Skip to content

Commit

Permalink
Merge pull request #4 from mdhedayet/mdhedayet
Browse files Browse the repository at this point in the history
AjuraTech provider is added to master branch.
Thanks dost for your contributions.
  • Loading branch information
arif98741 authored Oct 7, 2021
2 parents d1952e7 + 03b747c commit 801325d
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ array:6 [▼
* OnnoRokomSMS
* SSLSms
* Tense
* AjuraTech

We are continuously working in this open source library for adding more Bangladeshi sms gateway. If you feel something is missing then make a issue regarding that.
If you want to contribute in this library, then you are highly welcome to do that....
Expand Down
7 changes: 7 additions & 0 deletions src/Config/sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Xenon\LaravelBDSms\Provider\Sms4BD;
use Xenon\LaravelBDSms\Provider\Ssl;
use Xenon\LaravelBDSms\Provider\Tense;
use Xenon\LaravelBDSms\Provider\AjuraTech;

return [
'default_provider' => env('SMS_DEFAULT_PROVIDER', Ssl::class),
Expand Down Expand Up @@ -121,5 +122,11 @@
'campaign' => env('SMS_TENSE_CAMPAIGN', ''),
'masking' => env('SMS_TENSE_MASKING', ''),
],
AjuraTech::class => [
'apikey'=>env('SMS_AjuraTechReveSms_API_KEY', ''),
'secretkey'=>env('SMS_AjuraTechReveSms_API_SECRET_KEY', ''),
'callerID'=>env('SMS_AjuraTechReveSms_CALLER_ID', ''),
],
]
];

80 changes: 80 additions & 0 deletions src/Provider/AjuraTech.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php
/*
* Last Modified: 6/29/21, 12:06 AM
* Copyright (c) 2021
* -created by Ariful Islam
* -All Rights Preserved By
* -If you have any query then knock me at
* [email protected]
* See my profile @ https://github.com/arif98741
*/

namespace Xenon\LaravelBDSms\Provider;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Xenon\LaravelBDSms\Handler\ParameterException;
use Xenon\LaravelBDSms\Sender;

class AjuraTech extends AbstractProvider
{
/**
* GreenWeb constructor.
* @param Sender $sender
*/
public function __construct(Sender $sender)
{
$this->senderObject = $sender;
}

/**
* Send Request To Api and Send Message
* @throws GuzzleException
*/
public function sendRequest()
{
$number = $this->senderObject->getMobile();
$text = $this->senderObject->getMessage();
$config = $this->senderObject->getConfig();

$client = new Client([
'base_uri' => 'https://smpp.ajuratech.com:7790/sendtext?json',
'timeout' => 10.0,
'verify' => false
]);

$response = $client->request('GET', '', [
'query' => [

'apikey'=> $config['apikey'],
'secretkey'=> $config['secretkey'],
'callerID'=> $config['callerID'],
'toUser' => $number,
'messageContent' => $text,
]
]);
$body = $response->getBody();
$smsResult = $body->getContents();

$data['number'] = $number;
$data['message'] = $text;
$report = $this->generateReport($smsResult, $data);
return $report->getContent();
}

/**
* @throws ParameterException
*/
public function errorException()
{
if (!array_key_exists('apikey', $this->senderObject->getConfig())) {
throw new ParameterException('apikey is absent in configuration');
}
if (!array_key_exists('secretkey', $this->senderObject->getConfig())) {
throw new ParameterException('secretkey is absent in configuration');
}
if (!array_key_exists('callerID', $this->senderObject->getConfig())) {
throw new ParameterException('callerID is absent in configuration');
}
}
}

0 comments on commit 801325d

Please sign in to comment.