Skip to content

Commit

Permalink
Merge pull request #84 from arif98741/dev
Browse files Browse the repository at this point in the history
Merge Latest Updates for Fine Tuning from Dev to Master
  • Loading branch information
arif98741 authored Jan 10, 2025
2 parents 97a0b45 + 20ed77d commit 92db450
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Config/sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
'api_token' => env('SMS_SSL_API_TOKEN', ''),
'sid' => env('SMS_SSL_SID', ''),
'csms_id' => env('SMS_SSL_CSMS_ID', ''),
'batch_csms_id ' => env('SMS_SSL_BATCH_CSMS_ID ', ''),
],
Tense::class => [
'user' => env('SMS_TENSE_USER', ''),
Expand Down
10 changes: 10 additions & 0 deletions src/Provider/BulkSmsBD.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function sendRequest()
$query ['senderid'] = $config['senderid'];
}

if (is_array($number)) {
$query['number'] = implode(',', $number);
}

$requestObject = new Request($this->apiEndpoint, $query, $queue, [], $queueName,$tries,$backoff);
$response = $requestObject->get();
if ($queue) {
Expand All @@ -78,5 +82,11 @@ public function errorException()
throw new ParameterException('api_key key is absent in configuration');
}

if (!array_key_exists('senderid', $this->senderObject->getConfig())) {
throw new ParameterException('senderid key is absent in configuration');
}



}
}
3 changes: 2 additions & 1 deletion src/Provider/Esms.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

class Esms extends AbstractProvider
{
private string $apiEndpoint = 'https://login.esms.com.bd/api/v3/sms/send';
/**
* DianaHost constructor.
* @param Sender $sender
Expand Down Expand Up @@ -52,7 +53,7 @@ public function sendRequest()
'Content-Type' => 'application/json'
];

$requestObject = new Request('https://login.esms.com.bd/api/v3/sms/send', $query, $queue, [], $queueName,$tries,$backoff);
$requestObject = new Request($this->apiEndPoint, $query, $queue, [], $queueName,$tries,$backoff);
$requestObject->setHeaders($headers)->setContentTypeJson(true);
$response = $requestObject->post();
if ($queue) {
Expand Down
11 changes: 10 additions & 1 deletion src/Provider/Ssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@ public function sendRequest()
$query = [
'api_token' => $config['api_token'],
'sid' => $config['sid'],
'csms_id' => $config['csms_id'],
'msisdn' => $mobile,
'csms_id' => $config['csms_id'],
'sms' => $text,
'batch_csms_id' => $config['batch_csms_id'] ?? null,
];

$requestObject = new Request($this->apiEndpoint . (is_array($mobile) ? '/bulk' : ''), $query, $queue, [], $queueName, $tries, $backoff);
$requestObject->setHeaders([
'Content-Type' => 'application/json',
])->setContentTypeJson(true);

$response = $requestObject->post();
if ($queue) {
return true;
Expand Down Expand Up @@ -79,5 +84,9 @@ public function errorException()
throw new RenderException('csms_id key is absent in configuration');
}

if (is_array($this->senderObject->getMobile()) && !array_key_exists('batch_csms_id', $this->senderObject->getConfig())) {
throw new RenderException('batch_csms_id key is absent in configuration. This is required if you send array of receivers');
}

}
}

0 comments on commit 92db450

Please sign in to comment.