-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,4 @@ http://firstpayamak.ir | |
http://fortytwo.com | ||
http://freepayamak.ir | ||
http://sms.hostiran.net | ||
http://melipayamak.ir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace Pamenary\LaravelSms\Gateways; | ||
|
||
/** | ||
* Created by PhpStorm. | ||
* User: Ali | ||
* Date: 12/23/2016 | ||
* Time: 12:51 PM | ||
*/ | ||
class MelipayamakGateway extends GatewayAbstract { | ||
|
||
/** | ||
* AdpdigitalGateway constructor. | ||
*/ | ||
public function __construct() { | ||
|
||
$this->webService = config('sms.gateway.melipayamak.webService'); | ||
$this->username = config('sms.gateway.melipayamak.username'); | ||
$this->password = config('sms.gateway.melipayamak.password'); | ||
$this->from = config('sms.gateway.melipayamak.from'); | ||
} | ||
|
||
|
||
/** | ||
* @param array $numbers | ||
* @param $text | ||
* @param bool $isflash | ||
* | ||
* @return mixed | ||
* @internal param $to | array | ||
*/ | ||
public function sendSMS( array $numbers, $text, $isflash = false ) { | ||
try { | ||
// Check credit for the gateway | ||
if ( ! $this->GetCredit() ) { | ||
return false; | ||
} | ||
$client = new \SoapClient( $this->webService ); | ||
$result = $client->SendSms( | ||
[ | ||
'username' => $this->username, | ||
'password' => $this->password, | ||
'from' => $this->from, | ||
'to' => $numbers, | ||
'text' => $text, | ||
'isflash' => $isflash, | ||
'udh' => '', | ||
'recId' => [ 0 ], | ||
'status' => 0x0, | ||
] | ||
); | ||
|
||
return $result->SendSmsResult; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getCredit() { | ||
try { | ||
$client = new \SoapClient( $this->webService ); | ||
|
||
return $client->GetCredit( [ | ||
"username" => $this->username, | ||
"password" => $this->password, | ||
] )->GetCreditResult; | ||
} catch( SoapFault $ex ) { | ||
echo $ex->faultstring; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters