-
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
Vincent Mosoti
committed
Feb 3, 2019
1 parent
13f0467
commit 1d7aff5
Showing
2 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
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,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; | ||
} | ||
} |