Skip to content

Commit

Permalink
add support for SMSKenya
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Mosoti committed Feb 3, 2019
1 parent 13f0467 commit 1d7aff5
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Config/sms.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
'user' => env('SYNQ_USER'),
'password' => env('SYNQ_PASSWORD'),
'source' => env('SYNQ_SOURCE')
],
'smskenya' => [
'api_key' => env('SMS_KENYA_API_KEY')
]
],

Expand All @@ -103,5 +106,6 @@
'tilil' => \CraftedSystems\LaravelSMS\Gateways\Tilil::class,
'aptus' => \CraftedSystems\LaravelSMS\Gateways\Aptus::class,
'synq' => \CraftedSystems\LaravelSMS\Gateways\Synq::class,
'smskenya' => \CraftedSystems\LaravelSMS\Gateways\SMSKenya::class,
]
];
81 changes: 81 additions & 0 deletions src/Gateways/SMSKenya.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**
* Created by PhpStorm.
* User: vincent
* Date: 12/14/17
* Time: 6:04 PM
*/

namespace CraftedSystems\LaravelSMS\Gateways;


use CraftedSystems\SMSKenya\SMSKenya as SMS_Kenya;
use CraftedSystems\LaravelSMS\Contracts\SMSContract;
use Illuminate\Http\Request;

class SMSKenya implements SMSContract
{
/**
* @var SMS_Kenya
*/
protected $class;


/**
* @param $settings
* @throws \Exception
*/
public function __construct($settings)
{
if (!class_exists('CraftedSystems\SMSKenya\SMSKenya')) {

throw new \Exception("Class 'CraftedSystems\SMSKenya\SMSKenya' does not exist");
}

$this->class = new SMS_Kenya($settings);
}

/**
* @param $recipient
* @param $message
* @param null $params
* @return mixed
* @throws \Exception
*/
public function send($recipient, $message, $params = null)
{
$response = $this->class->send($recipient, $message);

$data = [
'is_success' => $response->code === '200:OK',
'message_id' => ''
];

return (object)$data;
}

/**
* @return mixed
*/
public function getBalance()
{
return $this->class->getBalance();
}


/**
* @param Request $request
* @return mixed|object
*/
public function getDeliveryReports(Request $request)
{
$response = $this->class->getDeliveryReports($request);

$data = [
'status' => '',
'message_id' => ''
];

return (object)$data;
}
}

0 comments on commit 1d7aff5

Please sign in to comment.