allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s

This commit is contained in:
2026-03-30 14:54:57 +07:00
parent 66aed7c4e8
commit b5e3a778ce
21316 changed files with 2777892 additions and 13 deletions

27
vendor/melipayamak/php/src/BaseSms.php vendored Normal file
View File

@@ -0,0 +1,27 @@
<?php
namespace Melipayamak;
abstract class BaseSms
{
const PATH = '';
protected $username;
protected $password;
public function __construct($username,$password)
{
$this->username = $username;
$this->password = $password;
}
protected function getPath($path,$method)
{
return sprintf($path, $method);
}
}

299
vendor/melipayamak/php/src/Branch.php vendored Normal file
View File

@@ -0,0 +1,299 @@
<?php
namespace Melipayamak;
class Branch
{
protected $username;
protected $password;
protected $client;
const PATH = 'http://api.payamak-panel.com/post/Actions.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->client = new \SoapClient(self::PATH);
}
public function get($owner)
{
$result = $this->client->GetBranchs([
'username' => $this->username,
'password' => $this->password,
'owner'=>$owner
]
)->GetBranchsResult;
return $result;
}
public function remove($branchId)
{
$result = $this->client->RemoveBranch([
'username' => $this->username,
'password' => $this->password,
'branchId'=>$branchId
]
)->RemoveBranchResult;
return $result;
}
public function add($branchName,$owner)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branchName' => $branchName,
'owner'=>$owner
];
$result = $this->client->AddBranch($data
)->AddBranchResult;
return $result;
}
public function addNumber($mobileNumbers,$branchId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branchId'=> $branchId,
'mobileNumbers'=>$mobileNumbers
];
$result = $this->client->AddNumber($data
)->AddNumberResult;
return $result;
}
public function sendBulk($from,$title,$message,$branch,$DateToSend,$requestCount,$bulkType,$rowFrom,$rangeFrom,$rangeTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from'=> $from,
'title' => $title,
'message' => $message,
'branch'=> $branch,
'DateToSend'=>$DateToSend,
'requestCount'=>$requestCount,
'bulkType'=> $bulkType,
'rowFrom'=> $rowFrom,
'rangeFrom'=>$rangeFrom,
'rangeTo'=>$rangeTo,
];
$result = $this->client->AddBulk($data
)->AddBulkResult;
return $result;
}
public function sendBulk2($from,$title,$message,$branch,$DateToSend,$requestCount,$bulkType,$rowFrom,$rangeFrom,$rangeTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from'=> $from,
'title' => $title,
'message' => $message,
'branch'=> $branch,
'DateToSend'=>$DateToSend,
'requestCount'=>$requestCount,
'bulkType'=> $bulkType,
'rowFrom'=> $rowFrom,
'rangeFrom'=>$rangeFrom,
'rangeTo'=>$rangeTo,
];
$result = $this->client->AddBulk2($data
)->AddBulk2Result;
return $result;
}
public function getBulkCount($branch,$rangeFrom,$rangeTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branch'=> $branch,
'rangeFrom'=>$rangeFrom,
'rangeTo'=>$rangeTo,
];
$result = $this->client->GetBulkCount($data
)->GetBulkCountResult;
return $result;
}
public function getBulkReceptions($bulkId,$fromRows)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'bulkId'=> $bulkId,
'fromRows'=>$fromRows,
];
$result = $this->client->GetBulkReceptions($data
)->GetBulkReceptionsResult;
return $result;
}
public function getBulkStatus($bulkId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'bulkId'=> $bulkId,
];
$result = $this->client->GetBulkStatus($data
)->GetBulkStatusResult;
return $result;
}
public function getTodaySent()
{
$data = [
'username' => $this->username,
'password' => $this->password,
];
$result = $this->client->GetTodaySent($data
)->GetTodaySentResult;
return $result;
}
public function getTotalSent()
{
$data = [
'username' => $this->username,
'password' => $this->password,
];
$result = $this->client->GetTotalSent($data
)->GetTotalSentResult;
return $result;
}
public function removeBulk($id)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'bulkId'=> $id
];
$result = $this->client->RemoveBulk($data
)->GetTotalSentResult;
return $result;
}
public function sendMultipleSms($to,$from,$text,$isflash,$udh)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'to'=> $to,
'from'=> $from,
'text' => $text,
'isflash' => $isflash,
'udh'=> $udh
];
$result;
if(is_array($from)){
$result = $this->client->SendMultipleSMS2($data);
}
else{
$result = $this->client->SendMultipleSMS($data);
}
return $result;
}
public function updateBulkDelivery($bulkId)
{
$data=[
'bulkId'=> $bulkId,
'username' => $this->username,
'password' => $this->password,
];
$result = $this->client->UpdateBulkDelivery($data)->UpdateBulkDeliveryResult;
return $result;
}
}

View File

@@ -0,0 +1,328 @@
<?php
namespace Melipayamak;
class BranchAsync
{
protected $username;
protected $password;
protected $queue;
const PATH = 'http://api.payamak-panel.com/post/Actions.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->queue = array();
}
public function execute(){
$method = '';
$requestIds = [];
$parseResultFn = function ($method, $res) {
if (isset($res->{$method . 'Result'})) {
return $res->{$method . 'Result'};
}
return $res;
};
$options = [
'connection_timeout' => 40,
'trace' => true,
'exceptions' => true,
'soap_version' => SOAP_1_1,
'cache_wsdl' => WSDL_CACHE_BOTH,
'encoding' => 'UTF-8',
'resFn' => $parseResultFn,
];
$client = new \Soap\ParallelSoapClient(self::PATH, $options);
$client->setMulti(true);
$responses = [];
foreach ($this->queue as $key => $value) {
# code...
if(!is_array($value))
$method = $value;
else $requestIds[] = $client->{$method}($value);
}
$responses = $client->run();
foreach ($responses as $id => $response) {
if ($response instanceof SoapFault) {
/** handle the exception here */
print 'SoapFault: ' . $response->faultcode . ' - ' . $response->getMessage() . "\n";
} else {
if (!is_string($response)) {
$response = json_encode($response, JSON_UNESCAPED_SLASHES);
}
print 'Response is : ' . $response . "\n";
}
}
//clean queue
$this->queue = array();
}
public function get($owner)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'owner'=>$owner
];
array_push($this->queue, 'GetBranchs');
array_push($this->queue, $data);
}
public function remove($branchId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branchId'=>$branchId
];
array_push($this->queue, 'RemoveBranch');
array_push($this->queue, $data);
}
public function add($branchName,$owner)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branchName' => $branchName,
'owner'=>$owner
];
array_push($this->queue, 'AddBranch');
array_push($this->queue, $data);
}
public function addNumber($mobileNumbers,$branchId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branchId'=> $branchId,
'mobileNumbers'=>$mobileNumbers
];
array_push($this->queue, 'AddNumber');
array_push($this->queue, $data);
}
public function sendBulk($from,$title,$message,$branch,$DateToSend,$requestCount,$bulkType,$rowFrom,$rangeFrom,$rangeTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from'=> $from,
'title' => $title,
'message' => $message,
'branch'=> $branch,
'DateToSend'=>$DateToSend,
'requestCount'=>$requestCount,
'bulkType'=> $bulkType,
'rowFrom'=> $rowFrom,
'rangeFrom'=>$rangeFrom,
'rangeTo'=>$rangeTo,
];
array_push($this->queue, 'AddBulk');
array_push($this->queue, $data);
}
public function sendBulk2($from,$title,$message,$branch,$DateToSend,$requestCount,$bulkType,$rowFrom,$rangeFrom,$rangeTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from'=> $from,
'title' => $title,
'message' => $message,
'branch'=> $branch,
'DateToSend'=>$DateToSend,
'requestCount'=>$requestCount,
'bulkType'=> $bulkType,
'rowFrom'=> $rowFrom,
'rangeFrom'=>$rangeFrom,
'rangeTo'=>$rangeTo,
];
array_push($this->queue, 'AddBulk2');
array_push($this->queue, $data);
}
public function getBulkCount($branch,$rangeFrom,$rangeTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'branch'=> $branch,
'rangeFrom'=>$rangeFrom,
'rangeTo'=>$rangeTo,
];
array_push($this->queue, 'GetBulkCount');
array_push($this->queue, $data);
}
public function getBulkReceptions($bulkId,$fromRows)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'bulkId'=> $bulkId,
'fromRows'=>$fromRows,
];
array_push($this->queue, 'GetBulkReceptions');
array_push($this->queue, $data);
}
public function getBulkStatus($bulkId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'bulkId'=> $bulkId,
];
array_push($this->queue, 'GetBulkStatus');
array_push($this->queue, $data);
}
public function getTodaySent()
{
$data = [
'username' => $this->username,
'password' => $this->password,
];
array_push($this->queue, 'GetTodaySent');
array_push($this->queue, $data);
}
public function getTotalSent()
{
$data = [
'username' => $this->username,
'password' => $this->password,
];
array_push($this->queue, 'GetTotalSent');
array_push($this->queue, $data);
}
public function removeBulk($id)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'bulkId'=> $id
];
array_push($this->queue, 'RemoveBulk');
array_push($this->queue, $data);
}
public function sendMultipleSms($to,$from,$text,$isflash,$udh)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'to'=> $to,
'from'=> $from,
'text' => $text,
'isflash' => $isflash,
'udh'=> $udh
];
if(is_array($from))
array_push($this->queue, 'SendMultipleSMS2');
else array_push($this->queue, 'SendMultipleSMS');
array_push($this->queue, $data);
}
public function updateBulkDelivery($bulkId)
{
$data=[
'bulkId'=> $bulkId,
'username' => $this->username,
'password' => $this->password,
];
array_push($this->queue, 'UpdateBulkDelivery');
array_push($this->queue, $data);
}
}

147
vendor/melipayamak/php/src/Contacts.php vendored Normal file
View File

@@ -0,0 +1,147 @@
<?php
namespace Melipayamak;
class Contacts
{
protected $username;
protected $password;
protected $client;
const PATH = 'http://api.payamak-panel.com/post/contacts.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->client = new \SoapClient(self::PATH);
}
public function addGroup($groupName,$Descriptions,$showToChilds)
{
$result = $this->client->AddGroup([
'username'=> $this->username,
'password' => $this->password,
'groupName'=> $groupName,
'Descriptions'=> $Descriptions,
'showToChilds'=> $showToChilds
])->AddGroupResult;
return $result;
}
public function add($options)
{
$result = $this->client->AddContact($options+[
'username'=> $this->username,
'password' => $this->password
])->AddContactResult;
return $result;
}
public function checkMobileExist($mobileNumber)
{
$result = $this->client->CheckMobileExistInContact([
'username'=> $this->username,
'password' => $this->password,
'mobileNumber'=> $mobileNumber
])->CheckMobileExistInContactResult;
return $result;
}
public function get($groupId,$keyword,$from,$count)
{
$result = $this->client->GetContacts([
'username'=> $this->username,
'password' => $this->password,
'groupId'=> $groupId,
'keyword'=> $keyword,
'from'=> $from,
'count'=> $count
])->GetContactsResult;
return $result;
}
public function getGroups()
{
$result = $this->client->GetGroups([
'username'=> $this->username,
'password' => $this->password
])->GetGroupsResult;
return $result;
}
public function change($options)
{
$result = $this->client->ChangeContact($options+[
'username'=> $this->username,
'password' => $this->password
])->ChangeContactResult;
return $result;
}
public function remove($mobilenumber)
{
$result = $this->client->RemoveContact([
'username'=> $this->username,
'password' => $this->password,
'mobilenumber'=> $mobilenumber
])->RemoveContactResult;
return $result;
}
public function getEvents($contactId)
{
$result = $this->client->GetContactEvents([
'username'=> $this->username,
'password' => $this->password,
'contactId'=> $contactId
])->GetContactEventsResult;
return $result;
}
}

View File

@@ -0,0 +1,217 @@
<?php
namespace Melipayamak;
class ContactsAsync
{
protected $username;
protected $password;
protected $queue;
const PATH = 'http://api.payamak-panel.com/post/contacts.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->queue = array();
}
public function execute(){
$method = '';
$requestIds = [];
$parseResultFn = function ($method, $res) {
if (isset($res->{$method . 'Result'})) {
return $res->{$method . 'Result'};
}
return $res;
};
$options = [
'connection_timeout' => 40,
'trace' => true,
'exceptions' => true,
'soap_version' => SOAP_1_1,
'cache_wsdl' => WSDL_CACHE_BOTH,
'encoding' => 'UTF-8',
'resFn' => $parseResultFn,
];
$client = new \Soap\ParallelSoapClient(self::PATH, $options);
$client->setMulti(true);
$responses = [];
foreach ($this->queue as $key => $value) {
# code...
if(!is_array($value))
$method = $value;
else $requestIds[] = $client->{$method}($value);
}
$responses = $client->run();
foreach ($responses as $id => $response) {
if ($response instanceof SoapFault) {
/** handle the exception here */
print 'SoapFault: ' . $response->faultcode . ' - ' . $response->getMessage() . "\n";
} else {
if (!is_string($response)) {
$response = json_encode($response, JSON_UNESCAPED_SLASHES);
}
print 'Response is : ' . $response . "\n";
}
}
//clean queue
$this->queue = array();
}
public function addGroup($groupName,$Descriptions,$showToChilds)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'groupName'=> $groupName,
'Descriptions'=> $Descriptions,
'showToChilds'=> $showToChilds
];
array_push($this->queue, 'AddGroup');
array_push($this->queue, $data);
}
public function add($options)
{
$data = $options + [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'AddContact');
array_push($this->queue, $data);
}
public function checkMobileExist($mobileNumber)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'mobileNumber'=> $mobileNumber
];
array_push($this->queue, 'CheckMobileExistInContact');
array_push($this->queue, $data);
}
public function get($groupId,$keyword,$from,$count)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'groupId' => $groupId,
'keyword' => $keyword,
'from' => $from,
'count' => $count
];
array_push($this->queue, 'GetContacts');
array_push($this->queue, $data);
}
public function getGroups()
{
$data = [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'GetGroups');
array_push($this->queue, $data);
}
public function change($options)
{
$data = $options + [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'ChangeContact');
array_push($this->queue, $data);
}
public function remove($mobilenumber)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'mobilenumber'=> $mobilenumber
];
array_push($this->queue, 'RemoveContact');
array_push($this->queue, $data);
}
public function getEvents($contactId)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'contactId'=> $contactId
];
array_push($this->queue, 'GetContactEvents');
array_push($this->queue, $data);
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace Melipayamak;
class MelipayamakApi
{
protected $username;
protected $password;
private $namespace = '\Melipayamak\\';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
$this->username = $username;
$this->password = $password;
}
public function __call($name,$arguments)
{
$method = 'rest';
$class = $this->namespace.ucfirst($name);
$type = '';
if($name == 'sms') {
if(isset($arguments[0])) {
if($arguments[0] == 'soap')
$method = 'soap';
else if($arguments[0] == 'async')
$type = 'async';
}
if(isset($arguments[1])){
if($arguments[1] == 'async')
$type = 'async';
}
$class .= ucfirst($method);
$class .= ucfirst($type);
}
else if(isset($arguments[0])) {
$class .= ucfirst('async');
}
if(class_exists($class))
return new $class($this->username,$this->password);
}
}

182
vendor/melipayamak/php/src/SmsRest.php vendored Normal file
View File

@@ -0,0 +1,182 @@
<?php
namespace Melipayamak;
class SmsRest extends BaseSms
{
const PATH = "https://rest.payamak-panel.com/api/SendSMS/%s";
protected $username;
protected $password;
public function __construct($username,$password)
{
parent::__construct($username,$password);
}
protected function execute($url, $data = null)
{
$fields_string = "";
if (!is_null($data)) {
$fields_string = http_build_query($data);
}
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $fields_string);
$response = curl_exec($handle);
$code = curl_getinfo($handle, CURLINFO_HTTP_CODE);
$curl_errno = curl_errno($handle);
$curl_error = curl_error($handle);
if ($curl_errno) {
throw new \Exception($curl_error);
}
curl_close($handle);
return $response;
}
public function send($to,$from,$text,$isFlash=false)
{
$url = $this->getPath(self::PATH,'SendSMS');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password,
'To' => $to,
'From' => $from,
'Text' => $text,
'IsFlash' => $isFlash
];
return $this->execute($url,$data);
}
public function sendByBaseNumber($text,$to,$bodyId)
{
$url = $this->getPath(self::PATH,'BaseServiceNumber');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password,
'text' => $text,
'to' => $to,
'bodyId' => $bodyId
];
return $this->execute($url,$data);
}
public function isDelivered($id)
{
$url = $this->getPath(self::PATH,'GetDeliveries2');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password,
'recId' => $id
];
return $this->execute($url,$data);
}
public function getMessages($location,$index,$count,$from='')
{
$url = $this->getPath(self::PATH,'GetMessages');
$options = [
'UserName'=> $this->username,
'PassWord'=> $this->password,
'location'=> $location,
'index'=> $index,
'count' => $count,
'from' => $from
];
return $this->execute($url,$options);
}
public function getCredit()
{
$url = $this->getPath(self::PATH,'GetCredit');
$data=[
'UserName' => $this->username,
'PassWord' => $this->password
];
return $this->execute($url,$data);
}
public function getBasePrice()
{
$url = $this->getPath(self::PATH,'GetBasePrice');
$data=[
'UserName' => $this->username,
'PassWord' => $this->password
];
return $this->execute($url,$data);
}
public function getNumbers()
{
$url = $this->getPath(self::PATH,'GetUserNumbers');
$data=[
'UserName' => $this->username,
'PassWord' => $this->password
];
return $this->execute($url,$data);
}
}

View File

@@ -0,0 +1,170 @@
<?php
namespace Melipayamak;
//Async Version
class SmsRestAsync extends BaseSms
{
const PATH = "https://rest.payamak-panel.com/api/SendSMS/%s";
protected $username;
protected $password;
protected $queue;
public function __construct($username,$password)
{
parent::__construct($username,$password);
$this->queue = array();
}
public function execute()
{
$mh = curl_multi_init();
$handlers = array();
foreach ($this->queue as $key => $value) {
# code...
if(!is_array($value)){
//create handler
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $value);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, http_build_query($this->queue[$key + 1]));
curl_multi_add_handle($mh, $handle);
array_push($handlers, $handle);
}
}
$responses = array();
do {
$status = curl_multi_exec($mh, $active);
if ($active) {
// Wait a short time for more activity
curl_multi_select($mh);
}
} while ($active && $status == CURLM_OK);
//close the handles
foreach ($handlers as $key => $value) {
$html = curl_multi_getcontent($value); // get the content
array_push($responses, $html);
curl_multi_remove_handle($mh, $value);
}
curl_multi_close($mh);
return $responses;
}
public function send($to,$from,$text,$isFlash=false)
{
$url = $this->getPath(self::PATH,'SendSMS');
$data = [
'Username' => $this->username,
'Password' => $this->password,
'To' => $to,
'From' => $from,
'Text' => $text,
'isFlash' => $isFlash
];
array_push($this->queue, $url);
array_push($this->queue, $data);
}
public function isDelivered($id)
{
$url = $this->getPath(self::PATH,'GetDeliveries2');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password,
'recId' => $id
];
array_push($this->queue, $url);
array_push($this->queue, $data);
}
public function getMessages($location,$index,$count,$from='')
{
$url = $this->getPath(self::PATH,'GetMessages');
$data = [
'UserName'=> $this->username,
'PassWord'=> $this->password,
'Location'=> $location,
'Index'=> $index,
'Count' => $count,
'From' => $from
];
array_push($this->queue, $url);
array_push($this->queue, $data);
}
public function getCredit()
{
$url = $this->getPath(self::PATH,'GetCredit');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password
];
array_push($this->queue, $url);
array_push($this->queue, $data);
}
public function getBasePrice()
{
$url = $this->getPath(self::PATH,'GetBasePrice');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password
];
array_push($this->queue, $url);
array_push($this->queue, $data);
}
public function getNumbers()
{
$url = $this->getPath(self::PATH,'GetUserNumbers');
$data = [
'UserName' => $this->username,
'PassWord' => $this->password
];
array_push($this->queue, $url);
array_push($this->queue, $data);
}
}

640
vendor/melipayamak/php/src/SmsSoap.php vendored Normal file
View File

@@ -0,0 +1,640 @@
<?php
namespace Melipayamak;
class SmsSoap extends BaseSms
{
const PATH = "http://api.payamak-panel.com/post/%s.asmx?wsdl";
protected $username;
protected $password;
protected $sendUrl;
protected $receiveUrl;
protected $voiceUrl;
protected $scheduleUrl;
public function __construct($username,$password)
{
parent::__construct($username,$password);
ini_set("soap.wsdl_cache_enabled", "0");
$this->sendUrl = $this->getPath(self::PATH,'send');
$this->receiveUrl = $this->getPath(self::PATH,'receive');
$this->voiceUrl = $this->getPath(self::PATH,'Voice');
$this->scheduleUrl = $this->getPath(self::PATH,'Schedule');
}
public function getCredit()
{
$client = new \SoapClient($this->sendUrl);
$data =
[
'username' => $this->username,
'password' => $this->password
];
$result = $client->GetCredit($data)->GetCreditResult;
return $result;
}
public function sendByBaseNumber($text,$to,$bodyId)
{
$client = new \SoapClient($this->sendUrl);
$data =
[
'username' => $this->username,
'password' => $this->password,
'text'=> $text,
'to' => $to,
'bodyId' => $bodyId
];
$result;
if(is_array($text))
$result = $client->SendByBaseNumber($data)->SendByBaseNumberResult;
else
$result = $client->SendByBaseNumber2($data)->SendByBaseNumber2Result;
return $result;
}
public function isDelivered($id)
{
$client = new \SoapClient($this->sendUrl);
$data =
[
'username' => $this->username,
'password' => $this->password,
];
$result;
if(is_array($id)){
$data['recId'] = $id;
$result = $client->GetDeliveries3($data)->GetDeliveries3Result;
}
else{
$data['recId'] = $id;
$result = $client->GetDelivery2($data)->GetDelivery2Result;
}
return $result;
}
public function send($to,$from,$text,$isflash=false)
{
$client = new \SoapClient($this->sendUrl);
$data =
[
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'text'=> $text,
'isflash' => $isflash,
'to' => $to
];
$result;
if(is_array($to)){
$result = $client->SendSimpleSMS($data)->SendSimpleSMSResult;
}
else{
$result = $client->SendSimpleSMS2($data)->SendSimpleSMS2Result;
}
return $result;
}
public function send2($to,$from,$text,$isflash=false,$udh="")
{
$client = new \SoapClient($this->sendUrl);
$to = is_array($to) ? $to : array($to);
$recId = array();
$status = 0x0;
$result = $client->SendSms([
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'text'=> $text,
'isflash' => $isflash,
'to' => $to,
'udh' =>$udh,
'recId' => &$recId,
'status' => &$status
]
);
return $result;
}
public function sendWithDomain($to,$from,$text,$isflash,$domain)
{
//P roblem
$client = new \SoapClient($this->sendUrl);
$result = $client->SendWithDomain([
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'text'=> $text,
'isflash' => $isflash,
'to' => $to,
'domainName' => $domain
]
)->SendWithDomainResult;
return $result;
}
public function getMessages($location,$index,$count,$from='')
{
$client = new \SoapClient($this->sendUrl);
$result = $client->getMessages([
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from
]
)->getMessagesResult;
return $result;
}
public function getMessagesStr($location,$index,$count,$from='')
{
$client = new \SoapClient($this->receiveUrl);
$result = $client->GetMessageStr([
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from
]
)->GetMessageStrResult;
return $result;
}
public function getMessagesByDate($location,$index,$count,$from,$dateFrom,$dateTo)
{
$client = new \SoapClient($this->receiveUrl);
$result = $client->GetMessagesByDate([
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from,
'dateTo' => $dateTo,
'dateFrom' => $dateFrom
]
)->GetMessagesByDateResult;
return $result;
}
public function getMessagesReceptions($msgId,$fromRows)
{
$client = new \SoapClient($this->receiveUrl);
$result = $client->GetMessagesReceptions([
'username' => $this->username,
'password' => $this->password,
'msgId' => $msgId,
'fromRows' =>$fromRows
]
)->GetMessagesReceptionsResult;
return $result;
}
public function getUsersMessagesByDate($location,$index,$count,$from,$dateFrom,$dateTo)
{
$client = new \SoapClient($this->receiveUrl);
$result = $client->GetUsersMessagesByDate([
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from,
'dateTo' => $dateTo,
'dateFrom' => $dateFrom
]
)->GetUsersMessagesByDateResult;
return $result;
}
public function remove($msgIds)
{
$client = new \SoapClient($this->receiveUrl);
$result = $client->RemoveMessages2([
'username' => $this->username,
'password' => $this->password,
'msgIds' => $msgIds
]
)->RemoveMessages2Result;
return $result;
}
public function getPrice($irancell,$mtn,$from,$text)
{
$client = new \SoapClient($this->sendUrl);
$result = $client->GetSmsPrice([
'username' => $this->username,
'password' => $this->password,
'irancellCount' => $irancell,
'mtnCount'=> $mtn,
'text' => $text,
'from' => $from
]
)->GetSmsPriceResult;
return $result;
}
public function getInboxCount($isRead=false)
{
$client = new \SoapClient($this->sendUrl);
$result = $client->GetInboxCount([
'username' => $this->username,
'password' => $this->password,
'isRead' => $isRead,
]
)->GetInboxCountResult;
return $result;
}
public function sendWithSpeech($to,$from,$text,$speech)
{
$client = new \SoapClient($this->voiceUrl);
$result = $client->SendSMSWithSpeechText([
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'to' => $to,
'smsBody' => $text,
'speechBody' => $speech
]
)->SendSMSWithSpeechTextResult;
return $result;
}
public function sendWithSpeechSchduleDate($to,$from,$text,$speech,$scheduleDate)
{
$client = new \SoapClient($this->voiceUrl);
$result = $client->SendSMSWithSpeechTextBySchduleDate([
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'to' => $to,
'smsBody' => $text,
'speechBody' => $speech,
'scheduleDate'=> $scheduleDate
]
)->SendSMSWithSpeechTextBySchduleDateResult;
return $result;
}
public function getSendWithSpeech($recId)
{
$client = new \SoapClient($this->voiceUrl);
$result = $client->GetSendSMSWithSpeechTextStatus([
'username' => $this->username,
'password' => $this->password,
'recId'=>$recId
]
);
return $result;
}
public function getMultiDelivery($recId)
{
$client = new \SoapClient($this->sendUrl);
$result = $client->GetMultiDelivery2([
'username' => $this->username,
'password' => $this->password,
'recId' => $recId,
]
)->GetMultiDelivery2Result;
return $result;
}
public function sendMultipleSchedule($to,$from,$text,$isflash,$scheduleDateTime,$period)
{
$client = new \SoapClient($this->scheduleUrl);
$result = $client->AddMultipleSchedule([
'username' => $this->username,
'password' => $this->password,
'to' => $to,
'from'=>$from,
'text'=>$text,
'isflash'=>$isflash,
'scheduleDateTime'=>$scheduleDateTime,
'period' => $period
]
)->AddMultipleScheduleResult;
return $result;
}
public function sendSchedule($to,$from,$text,$isflash,$scheduleDateTime,$period)
{
$client = new \SoapClient($this->scheduleUrl);
$result = $client->AddSchedule([
'username' => $this->username,
'password' => $this->password,
'to' => $to,
'from'=>$from,
'text'=>$text,
'isflash'=>$isflash,
'scheduleDateTime'=>$scheduleDateTime,
'period' => $period
]
)->AddScheduleResult;
return $result;
}
public function getScheduleStatus($schId)
{
$client = new \SoapClient($this->scheduleUrl);
$result = $client->GetScheduleStatus([
'username' => $this->username,
'password' => $this->password,
'scheduleId'=>$schId
]
)->GetScheduleStatusResult;
return $result;
}
public function removeSchedule($schId)
{
$client = new \SoapClient($this->scheduleUrl);
$result = $client->RemoveSchedule([
'username' => $this->username,
'password' => $this->password,
'scheduleId'=>$schId
]
)->RemoveScheduleResult;
return $result;
}
public function addUsance($to,$from,$text,$isflash,$scheduleStartDateTime,$repeatAfterDays,$scheduleEndDateTime)
{
$client = new \SoapClient($this->scheduleUrl);
$result = $client->AddUsance([
'username' => $this->username,
'password' => $this->password,
'to' => $to,
'from'=>$from,
'text'=>$text,
'isflash'=>$isflash,
'scheduleStartDateTime'=>$scheduleStartDateTime,
'repeatAfterDays' => $repeatAfterDays,
'scheduleEndDateTime'=>$scheduleEndDateTime
]
)->AddUsanceResult;
return $result;
}
}

View File

@@ -0,0 +1,549 @@
<?php
namespace Melipayamak;
class SmsSoapAsync extends BaseSms
{
const PATH = "http://api.payamak-panel.com/post/%s.asmx?wsdl";
protected $username;
protected $password;
protected $sendUrl;
protected $receiveUrl;
protected $voiceUrl;
protected $scheduleUrl;
protected $queue;
public function __construct($username,$password)
{
parent::__construct($username,$password);
ini_set("soap.wsdl_cache_enabled", "0");
$this->sendUrl = $this->getPath(self::PATH,'send');
$this->receiveUrl = $this->getPath(self::PATH,'receive');
$this->voiceUrl = $this->getPath(self::PATH,'Voice');
$this->scheduleUrl = $this->getPath(self::PATH,'Schedule');
$this->queue = array();
}
public function execute(){
$endpoint = $this->queue[0];
$method = '';
$requestIds = [];
$parseResultFn = function ($method, $res) {
if (isset($res->{$method . 'Result'})) {
return $res->{$method . 'Result'};
}
return $res;
};
$options = [
'connection_timeout' => 40,
'trace' => true,
'exceptions' => true,
'soap_version' => SOAP_1_1,
'cache_wsdl' => WSDL_CACHE_BOTH,
'encoding' => 'UTF-8',
'resFn' => $parseResultFn,
];
$client = new \Soap\ParallelSoapClient($endpoint, $options);
$client->setMulti(true);
$responses = [];
foreach ($this->queue as $key => $value) {
# code...
if(!is_array($value)){
//$value is wsdl url && differs
if(strlen($value) > 33 && $endpoint != $value) {
//run prior tasks if we can change endpoint
// array_push($responses, $client->run());
//init new client
//unfortunately there's no way to change wsdl url during running, followings don't work!
// $client = new \Soap\ParallelSoapClient($value, $options);
// $client->__setLocation($value);
}
//$value is method name
else $method = $value;
}
else {
$requestIds[] = $client->{$method}($value);
}
}
$responses = $client->run();
// array_push($responses, $client->run());
//calling multiple endpoints causes $responses to be multidimensional array
// $results = $this->flatten($responses);
foreach ($responses as $id => $response) {
if ($response instanceof SoapFault) {
/** handle the exception here */
print 'SoapFault: ' . $response->faultcode . ' - ' . $response->getMessage() . "\n";
} else {
if (!is_string($response)) {
$response = json_encode($response, JSON_UNESCAPED_SLASHES);
}
print 'Response is : ' . $response . "\n";
}
}
//clean queue
$this->queue = array();
}
function flatten(array $array) {
$return = array();
array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; });
return $return;
}
public function getCredit()
{
$data = [
'username' => $this->username,
'password' => $this->password
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'getCredit');
array_push($this->queue, $data);
}
public function isDelivered($id)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'recId' => $id
];
array_push($this->queue, $this->sendUrl);
if(is_array($id))
array_push($this->queue, 'GetDeliveries3');
else array_push($this->queue, 'GetDelivery2');
array_push($this->queue, $data);
}
public function send($to,$from,$text,$isflash=false)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'text'=> $text,
'isflash' => $isflash,
'to' => $to
];
array_push($this->queue, $this->sendUrl);
if(is_array($to))
array_push($this->queue, 'SendSimpleSMS');
else array_push($this->queue, 'SendSimpleSMS2');
array_push($this->queue, $data);
}
public function send2($to,$from,$text,$isflash=false,$udh="")
{
$to = is_array($to) ? $to : array($to);
$recId = array();
$status = 0x0;
$data = [
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'text'=> $text,
'isflash' => $isflash,
'to' => $to,
'udh' =>$udh,
'recId' => &$recId,
'status' => &$status
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'SendSms');
array_push($this->queue, $data);
}
public function sendWithDomain($to,$from,$text,$isflash,$domain)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'text'=> $text,
'isflash' => $isflash,
'to' => $to,
'domainName' => $domain
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'SendWithDomain');
array_push($this->queue, $data);
}
public function getMessages($location,$index,$count,$from='')
{
$data = [
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'getMessages');
array_push($this->queue, $data);
}
public function getMessagesStr($location,$index,$count,$from='')
{
$data = [
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index' => $index,
'count' => $count,
'from' => $from
];
array_push($this->queue, $this->receiveUrl);
array_push($this->queue, 'GetMessageStr');
array_push($this->queue, $data);
}
public function getMessagesByDate($location,$index,$count,$from,$dateFrom,$dateTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from,
'dateTo' => $dateTo,
'dateFrom' => $dateFrom
];
array_push($this->queue, $this->receiveUrl);
array_push($this->queue, 'GetMessagesByDate');
array_push($this->queue, $data);
}
public function getMessagesReceptions($msgId,$fromRows)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'msgId' => $msgId,
'fromRows' =>$fromRows
];
array_push($this->queue, $this->receiveUrl);
array_push($this->queue, 'GetMessagesReceptions');
array_push($this->queue, $data);
}
public function getUsersMessagesByDate($location,$index,$count,$from,$dateFrom,$dateTo)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'location' => $location,
'index'=> $index,
'count' => $count,
'from' => $from,
'dateTo' => $dateTo,
'dateFrom' => $dateFrom
];
array_push($this->queue, $this->receiveUrl);
array_push($this->queue, 'GetUsersMessagesByDate');
array_push($this->queue, $data);
}
public function remove($msgIds)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'msgIds' => $msgIds
];
array_push($this->queue, $this->receiveUrl);
array_push($this->queue, 'RemoveMessages2');
array_push($this->queue, $data);
}
public function getPrice($irancell,$mtn,$from,$text)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'irancellCount' => $irancell,
'mtnCount'=> $mtn,
'text' => $text,
'from' => $from
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'GetSmsPrice');
array_push($this->queue, $data);
}
public function getInboxCount($isRead=false)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'isRead' => $isRead,
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'GetInboxCount');
array_push($this->queue, $data);
}
public function sendWithSpeech($to,$from,$text,$speech)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'to' => $to,
'smsBody' => $text,
'speechBody' => $speech
];
array_push($this->queue, $this->voiceUrl);
array_push($this->queue, 'SendSMSWithSpeechText');
array_push($this->queue, $data);
}
public function sendWithSpeechSchduleDate($to,$from,$text,$speech,$scheduleDate)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'from' => $from,
'to' => $to,
'smsBody' => $text,
'speechBody' => $speech,
'scheduleDate'=> $scheduleDate
];
array_push($this->queue, $this->voiceUrl);
array_push($this->queue, 'SendSMSWithSpeechTextBySchduleDate');
array_push($this->queue, $data);
}
public function getSendWithSpeech($recId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'recId'=>$recId
];
array_push($this->queue, $this->voiceUrl);
array_push($this->queue, 'GetSendSMSWithSpeechTextStatus');
array_push($this->queue, $data);
}
public function getMultiDelivery($recId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'recId' => $recId,
];
array_push($this->queue, $this->sendUrl);
array_push($this->queue, 'GetMultiDelivery2');
array_push($this->queue, $data);
}
public function sendMultipleSchedule($to,$from,$text,$isflash,$scheduleDateTime,$period)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'to' => $to,
'from'=>$from,
'text'=>$text,
'isflash'=>$isflash,
'scheduleDateTime'=>$scheduleDateTime,
'period' => $period
];
array_push($this->queue, $this->scheduleUrl);
array_push($this->queue, 'AddMultipleSchedule');
array_push($this->queue, $data);
}
public function sendSchedule($to,$from,$text,$isflash,$scheduleDateTime,$period)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'to' => $to,
'from' => $from,
'text' => $text,
'isflash' => $isflash,
'scheduleDateTime' => $scheduleDateTime,
'period' => $period
];
array_push($this->queue, $this->scheduleUrl);
array_push($this->queue, 'AddSchedule');
array_push($this->queue, $data);
}
public function getScheduleStatus($schId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'scheduleId'=>$schId
];
array_push($this->queue, $this->scheduleUrl);
array_push($this->queue, 'GetScheduleStatus');
array_push($this->queue, $data);
}
public function removeSchedule($schId)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'scheduleId'=>$schId
];
array_push($this->queue, $this->scheduleUrl);
array_push($this->queue, 'RemoveSchedule');
array_push($this->queue, $data);
}
public function addUsance($to,$from,$text,$isflash,$scheduleStartDateTime,$repeatAfterDays,$scheduleEndDateTime)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'to' => $to,
'from'=>$from,
'text'=>$text,
'isflash'=>$isflash,
'scheduleStartDateTime'=>$scheduleStartDateTime,
'repeatAfterDays' => $repeatAfterDays,
'scheduleEndDateTime'=>$scheduleEndDateTime
];
array_push($this->queue, $this->scheduleUrl);
array_push($this->queue, 'AddUsance');
array_push($this->queue, $data);
}
}

135
vendor/melipayamak/php/src/Ticket.php vendored Normal file
View File

@@ -0,0 +1,135 @@
<?php
namespace Melipayamak;
class Ticket
{
protected $username;
protected $password;
protected $client;
const PATH = 'http://api.payamak-panel.com/post/Tickets.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->client = new \SoapClient(self::PATH);
}
public function add($title,$content,$aws=true)
{
$result = $this->client->AddTicket([
'username' => $this->username,
'password' => $this->password,
'title'=>$title,
'content' =>$content,
'alertWithSms'=> $aws
]
)->AddTicketResult;
return $result;
}
public function getReceived($ticketOwner,$ticketType,$keyword)
{
$result = $this->client->GetReceivedTickets([
'username' => $this->username,
'password' => $this->password,
'ticketOwner'=>$ticketOwner,
'ticketType' =>$ticketType,
'keyword'=> $keyword
]
)->GetReceivedTicketsResult;
return $result;
}
public function getReceivedCount($ticketType)
{
$result = $this->client->GetReceivedTicketsCount([
'username' => $this->username,
'password' => $this->password,
'ticketType' =>$ticketType,
]
)->GetReceivedTicketsCountResult;
return $result;
}
public function getSent($ticketOwner,$ticketType,$keyword)
{
$result = $this->client->GetSentTickets([
'username' => $this->username,
'password' => $this->password,
'ticketOwner'=>$ticketOwner,
'ticketType' =>$ticketType,
'keyword'=> $keyword
]
)->GetSentTicketsResult;
return $result;
}
public function getSentCount($ticketType)
{
$result = $this->client->GetSentTicketsCount([
'username' => $this->username,
'password' => $this->password,
'ticketType' =>$ticketType,
]
)->GetSentTicketsCountResult;
return $result;
}
public function response($ticketId,$type,$content,$alertWithSms=true)
{
$result = $this->client->ResponseTicket([
'username' => $this->username,
'password' => $this->password,
'ticketType' =>$ticketType,
'type'=> $type,
'content'=> $content,
'alertWithSms'=> $alertWithSms
]
)->ResponseTicketResult;
return $result;
}
}

View File

@@ -0,0 +1,192 @@
<?php
namespace Melipayamak;
class TicketAsync
{
protected $username;
protected $password;
protected $queue;
const PATH = 'http://api.payamak-panel.com/post/Tickets.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->queue = array();
}
public function execute(){
$method = '';
$requestIds = [];
$parseResultFn = function ($method, $res) {
if (isset($res->{$method . 'Result'})) {
return $res->{$method . 'Result'};
}
return $res;
};
$options = [
'connection_timeout' => 40,
'trace' => true,
'exceptions' => true,
'soap_version' => SOAP_1_1,
'cache_wsdl' => WSDL_CACHE_BOTH,
'encoding' => 'UTF-8',
'resFn' => $parseResultFn,
];
$client = new \Soap\ParallelSoapClient(self::PATH, $options);
$client->setMulti(true);
$responses = [];
foreach ($this->queue as $key => $value) {
# code...
if(!is_array($value))
$method = $value;
else $requestIds[] = $client->{$method}($value);
}
$responses = $client->run();
foreach ($responses as $id => $response) {
if ($response instanceof SoapFault) {
/** handle the exception here */
print 'SoapFault: ' . $response->faultcode . ' - ' . $response->getMessage() . "\n";
} else {
if (!is_string($response)) {
$response = json_encode($response, JSON_UNESCAPED_SLASHES);
}
print 'Response is : ' . $response . "\n";
}
}
//clean queue
$this->queue = array();
}
public function add($title,$content,$aws=true)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'title'=>$title,
'content' =>$content,
'alertWithSms'=> $aws
];
array_push($this->queue, 'AddTicket');
array_push($this->queue, $data);
}
public function getReceived($ticketOwner,$ticketType,$keyword)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'ticketOwner'=>$ticketOwner,
'ticketType' =>$ticketType,
'keyword'=> $keyword
];
array_push($this->queue, 'GetReceivedTickets');
array_push($this->queue, $data);
}
public function getReceivedCount($ticketType)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'ticketType' =>$ticketType,
];
array_push($this->queue, 'GetReceivedTicketsCount');
array_push($this->queue, $data);
}
public function getSent($ticketOwner,$ticketType,$keyword)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'ticketOwner'=>$ticketOwner,
'ticketType' =>$ticketType,
'keyword'=> $keyword
];
array_push($this->queue, 'GetSentTickets');
array_push($this->queue, $data);
}
public function getSentCount($ticketType)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'ticketType' =>$ticketType,
];
array_push($this->queue, 'GetSentTicketsCount');
array_push($this->queue, $data);
}
public function response($ticketId,$type,$content,$alertWithSms=true)
{
$data = [
'username' => $this->username,
'password' => $this->password,
'ticketType' =>$ticketType,
'type'=> $type,
'content'=> $content,
'alertWithSms'=> $alertWithSms
];
array_push($this->queue, 'ResponseTicket');
array_push($this->queue, $data);
}
}

276
vendor/melipayamak/php/src/Users.php vendored Normal file
View File

@@ -0,0 +1,276 @@
<?php
namespace Melipayamak;
class Users
{
protected $username;
protected $password;
protected $client;
const PATH = 'http://api.payamak-panel.com/post/users.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->client = new \SoapClient(self::PATH);
}
public function addPayment($options)
{
$result = $this->client->AddPayment($options+[
'username'=> $this->username,
'password' => $this->password
])->AddPaymentResult;
return $result;
}
public function add($options)
{
$result = $this->client->AddUser($options+[
'username'=> $this->username,
'password' => $this->password
])->AddUserResult;
return $result;
}
public function addComplete($options)
{
$result = $this->client->AddUserComplete($options+[
'username'=> $this->username,
'password' => $this->password
])->AddUserCompleteResult;
return $result;
}
public function addWithLocation($options)
{
$result = $this->client->AddUserWithLocation($options+[
'username'=> $this->username,
'password' => $this->password
])->AddUserWithLocationResult;
return $result;
}
public function authenticate()
{
$result = $this->client->AuthenticateUser([
'username'=> $this->username,
'password' => $this->password
])->AuthenticateUserResult;
return $result;
}
public function changeCredit($amount,$description,$targetUsername,$GetTax)
{
$result = $this->client->ChangeUserCredit([
'username'=> $this->username,
'password' => $this->password,
'amount'=> $amount,
'description' => $description,
'targetUsername' => $targetUsername,
'GetTax' => $GetTax
])->ChangeUserCreditResult;
return $result;
}
public function forgotPassword($mobileNumber,$emailAddress,$targetUsername)
{
$result = $this->client->ForgotPassword([
'username'=> $this->username,
'password' => $this->password,
'mobileNumber'=> $mobileNumber,
'emailAddress'=> $emailAddress,
'targetUsername'=> $targetUsername
])->ForgotPasswordResult;
return $result;
}
public function getBasePrice($targetUsername)
{
$result = $this->client->GetUserBasePrice([
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
])->GetUserBasePriceResult;
return $result;
}
public function remove($targetUsername)
{
$result = $this->client->RemoveUser([
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
])->RemoveUserResult;
return $result;
}
public function getCredit($targetUsername)
{
$result = $this->client->GetUserCredit([
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
])->GetUserCreditResult;
return $result;
}
public function getDetails($targetUsername)
{
$result = $this->client->GetUserDetails([
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
])->GetUserDetailsResult;
return $result;
}
public function getNumbers()
{
$result = $this->client->GetUserNumbers([
'username'=> $this->username,
'password' => $this->password
])->GetUserNumbersResult;
return $result;
}
public function getProvinces()
{
$result = $this->client->GetProvinces([
'username'=> $this->username,
'password' => $this->password
])->GetProvincesResult;
return $result;
}
public function getCities($provinceId)
{
$result = $this->client->GetCities([
'username'=> $this->username,
'password' => $this->password,
'provinceId'=> $provinceId
])->GetCitiesResult;
return $result;
}
public function getExpireDate()
{
$result = $this->client->GetExpireDate([
'username'=> $this->username,
'password' => $this->password
])->GetExpireDateResult;
return $result;
}
public function getTransactions($targetUsername,$creditType,$dateFrom,$dateTo,$keyword)
{
$result = $this->client->GetUserTransactions([
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername,
'keyword'=> $keyword,
'creditType'=> $creditType,
'dateFrom'=> $dateFrom,
'dateTo'=> $dateTo
])->GetUserTransactionsResult;
return $result;
}
public function get()
{
$result = $this->client->GetUsers([
'username'=> $this->username,
'password' => $this->password
])->GetUsersResult;
return $result;
}
public function hasFilter($text)
{
$result = $this->client->HasFilter([
'username'=> $this->username,
'password' => $this->password,
'text'=> $text
])->HasFilterResult;
return $result;
}
}

View File

@@ -0,0 +1,353 @@
<?php
namespace Melipayamak;
class UsersAsync
{
protected $username;
protected $password;
protected $queue;
const PATH = 'http://api.payamak-panel.com/post/users.asmx?wsdl';
public function __construct($username,$password)
{
if (is_null($username)||is_null($password)) {
die('username/password is empty');
exit;
}
ini_set("soap.wsdl_cache_enabled", "0");
$this->username = $username;
$this->password = $password;
$this->queue = array();
}
public function execute(){
$method = '';
$requestIds = [];
$parseResultFn = function ($method, $res) {
if (isset($res->{$method . 'Result'})) {
return $res->{$method . 'Result'};
}
return $res;
};
$options = [
'connection_timeout' => 40,
'trace' => true,
'exceptions' => true,
'soap_version' => SOAP_1_1,
'cache_wsdl' => WSDL_CACHE_BOTH,
'encoding' => 'UTF-8',
'resFn' => $parseResultFn,
];
$client = new \Soap\ParallelSoapClient(self::PATH, $options);
$client->setMulti(true);
$responses = [];
foreach ($this->queue as $key => $value) {
# code...
if(!is_array($value))
$method = $value;
else $requestIds[] = $client->{$method}($value);
}
$responses = $client->run();
foreach ($responses as $id => $response) {
if ($response instanceof SoapFault) {
/** handle the exception here */
print 'SoapFault: ' . $response->faultcode . ' - ' . $response->getMessage() . "\n";
} else {
if (!is_string($response)) {
$response = json_encode($response, JSON_UNESCAPED_SLASHES);
}
print 'Response is : ' . $response . "\n";
}
}
//clean queue
$this->queue = array();
}
public function addPayment($options)
{
$data = $options + [
'username' => $this->username,
'password' => $this->password
];
array_push($this->queue, 'AddPayment');
array_push($this->queue, $data);
}
public function add($options)
{
$data = $options + [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'AddUser');
array_push($this->queue, $data);
}
public function addComplete($options)
{
$data = $options + [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'AddUserComplete');
array_push($this->queue, $data);
}
public function addWithLocation($options)
{
$data = $options + [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'AddUserWithLocation');
array_push($this->queue, $data);
}
public function authenticate()
{
$data = [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'AuthenticateUser');
array_push($this->queue, $data);
}
public function changeCredit($amount,$description,$targetUsername,$GetTax)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'amount'=> $amount,
'description' => $description,
'targetUsername' => $targetUsername,
'GetTax' => $GetTax
];
array_push($this->queue, 'ChangeUserCredit');
array_push($this->queue, $data);
}
public function forgotPassword($mobileNumber,$emailAddress,$targetUsername)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'mobileNumber'=> $mobileNumber,
'emailAddress'=> $emailAddress,
'targetUsername'=> $targetUsername
];
array_push($this->queue, 'ForgotPassword');
array_push($this->queue, $data);
}
public function getBasePrice($targetUsername)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
];
array_push($this->queue, 'GetUserBasePrice');
array_push($this->queue, $data);
}
public function remove($targetUsername)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
];
array_push($this->queue, 'RemoveUser');
array_push($this->queue, $data);
}
public function getCredit($targetUsername)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
];
array_push($this->queue, 'GetUserCredit');
array_push($this->queue, $data);
}
public function getDetails($targetUsername)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername
];
array_push($this->queue, 'GetUserDetails');
array_push($this->queue, $data);
}
public function getNumbers()
{
$data = [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'GetUserNumbers');
array_push($this->queue, $data);
}
public function getProvinces()
{
$data = [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'GetProvinces');
array_push($this->queue, $data);
}
public function getCities($provinceId)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'provinceId'=> $provinceId
];
array_push($this->queue, 'GetCities');
array_push($this->queue, $data);
}
public function getExpireDate()
{
$data = [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'GetExpireDate');
array_push($this->queue, $data);
}
public function getTransactions($targetUsername,$creditType,$dateFrom,$dateTo,$keyword)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'targetUsername'=> $targetUsername,
'keyword'=> $keyword,
'creditType'=> $creditType,
'dateFrom'=> $dateFrom,
'dateTo'=> $dateTo
];
array_push($this->queue, 'GetUserTransactions');
array_push($this->queue, $data);
}
public function get()
{
$data = [
'username'=> $this->username,
'password' => $this->password
];
array_push($this->queue, 'GetUsers');
array_push($this->queue, $data);
}
public function hasFilter($text)
{
$data = [
'username'=> $this->username,
'password' => $this->password,
'text'=> $text
];
array_push($this->queue, 'HasFilter');
array_push($this->queue, $data);
}
}