-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add history, numbers, reports and numbers actions
- Loading branch information
Showing
13 changed files
with
376 additions
and
2 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,24 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Actions; | ||
|
||
use Ossycodes\Nigeriabulksms\Common\HttpClient; | ||
use Ossycodes\Nigeriabulksms\Objects\HistoryResponse; | ||
use Ossycodes\Nigeriabulksms\Objects\History as HistoryObject; | ||
|
||
/** | ||
* Class History | ||
*/ | ||
class History extends Base | ||
{ | ||
public function __construct(HttpClient $httpClient) | ||
{ | ||
$this->object = new HistoryObject(); | ||
|
||
$this->setActionName('history'); | ||
|
||
$this->setResponseObject(new HistoryResponse()); | ||
|
||
parent::__construct($httpClient); | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Actions; | ||
|
||
use Ossycodes\Nigeriabulksms\Common\HttpClient; | ||
use Ossycodes\Nigeriabulksms\Objects\NumbersResponse; | ||
use Ossycodes\Nigeriabulksms\Objects\Numbers as NumbersObject; | ||
|
||
/** | ||
* Class Numbers | ||
*/ | ||
class Numbers extends Base | ||
{ | ||
public function __construct(HttpClient $httpClient) | ||
{ | ||
$this->object = new NumbersObject(); | ||
|
||
$this->setActionName('numbers'); | ||
|
||
$this->setResponseObject(new NumbersResponse()); | ||
|
||
parent::__construct($httpClient); | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Actions; | ||
|
||
use Ossycodes\Nigeriabulksms\Common\HttpClient; | ||
use Ossycodes\Nigeriabulksms\Objects\ReportsResponse; | ||
use Ossycodes\Nigeriabulksms\Objects\Reports as ReportsObject; | ||
|
||
/** | ||
* Class Reports | ||
*/ | ||
class Reports extends Base | ||
{ | ||
public function __construct(HttpClient $httpClient) | ||
{ | ||
$this->object = new ReportsObject(); | ||
|
||
$this->setActionName('reports'); | ||
|
||
$this->setResponseObject(new ReportsResponse()); | ||
|
||
parent::__construct($httpClient); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
require_once(__DIR__ . '/../autoload.php'); | ||
|
||
$config = \Ossycodes\Nigeriabulksms\Configuration::getDefaultConfiguration() | ||
->setUsername('YOUR_USERNAME') | ||
->setPassword('YOUR_PASSWORD') | ||
->setTimeout(10) //optional defaults to 10 | ||
->setConnectionTimeout(2); //optional defaults to 2 | ||
|
||
$client = new \Ossycodes\Nigeriabulksms\Client($config); | ||
|
||
try { | ||
$history = $client->history->read(); | ||
var_dump($history); | ||
} catch (\Ossycodes\Nigeriabulksms\Exceptions\AuthenticateException $e) { | ||
// That means that your username and/or password is incorrect | ||
echo 'wrong login'; | ||
} | ||
catch (\Ossycodes\Nigeriabulksms\Exceptions\BalanceException $e) { | ||
// That means that your balance is insufficient | ||
echo 'insufficient balance'; | ||
} | ||
catch (\Exception $e) { | ||
var_dump($e->getMessage()); | ||
} |
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,34 @@ | ||
<?php | ||
|
||
require_once(__DIR__ . '/../autoload.php'); | ||
|
||
$config = \Ossycodes\Nigeriabulksms\Configuration::getDefaultConfiguration() | ||
->setUsername('YOUR_USERNAME') | ||
->setPassword('YOUR_PASSWORD') | ||
->setTimeout(10) //optional defaults to 10 | ||
->setConnectionTimeout(2); //optional defaults to 2 | ||
|
||
$client = new \Ossycodes\Nigeriabulksms\Client($config); | ||
|
||
try { | ||
$numbers = $client->numbers->getList(); | ||
var_dump($numbers); | ||
|
||
//iterate through each payment item | ||
foreach($client->numbers->getList()->getItems() as $number) { | ||
dump($payment->amount); | ||
dump($payment->reference); | ||
dump($payment->date); | ||
} | ||
|
||
} catch (\Ossycodes\Nigeriabulksms\Exceptions\AuthenticateException $e) { | ||
// That means that your username and/or password is incorrect | ||
echo 'wrong login'; | ||
} | ||
catch (\Ossycodes\Nigeriabulksms\Exceptions\BalanceException $e) { | ||
// That means that your balance is insufficient | ||
echo 'insufficient balance'; | ||
} | ||
catch (\Exception $e) { | ||
var_dump($e->getMessage()); | ||
} |
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,39 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Objects; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Class History | ||
*/ | ||
class History extends Base | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $username; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $mobile; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $sender; | ||
|
||
|
||
public function loadFromStdclass(stdClass $object): self | ||
{ | ||
parent::loadFromStdclass($object); | ||
|
||
return $this; | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Objects; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Class HistoryResponse | ||
*/ | ||
class HistoryResponse extends Base | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $username; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $mobile; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $sender; | ||
|
||
public function loadFromStdclass(stdClass $object): self | ||
{ | ||
parent::loadFromStdclass($object); | ||
|
||
return $this; | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Objects; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Class Numbers | ||
*/ | ||
class Numbers extends Base | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $mobile; | ||
|
||
public function loadFromStdclass(stdClass $object): self | ||
{ | ||
parent::loadFromStdclass($object); | ||
|
||
return $this; | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Objects; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Class NumbersResponse | ||
*/ | ||
class NumbersResponse extends Base | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $mobile; | ||
|
||
public function loadFromStdclass(stdClass $object): self | ||
{ | ||
parent::loadFromStdclass($object); | ||
|
||
return $this; | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
namespace Ossycodes\Nigeriabulksms\Objects; | ||
|
||
use stdClass; | ||
|
||
/** | ||
* Class Reports | ||
*/ | ||
class Reports extends Base | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $amount; | ||
|
||
/** | ||
* @var null|string | ||
*/ | ||
public $reference; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
public $date; | ||
|
||
public function loadFromStdclass(stdClass $object): self | ||
{ | ||
parent::loadFromStdclass($object); | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.