-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
17 changed files
with
348 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* Define the model used my gateway | ||
*/ | ||
'model' => \App\Models\User::class, | ||
|
||
/** | ||
* The default gateway | ||
*/ | ||
'default' => 'orange_ci', | ||
|
||
/** | ||
* List of available gateway | ||
*/ | ||
'gateways' => [ | ||
'orange_ci' => [ | ||
'client_key' => '', | ||
'merchant_key' => '' | ||
], | ||
|
||
'mtn_ci' => [ | ||
'client_key' => '', | ||
'merchant_key' => '' | ||
], | ||
|
||
'moov_ci' => [ | ||
'client_key' => '', | ||
'merchant_key' => '' | ||
] | ||
] | ||
]; |
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,40 @@ | ||
<?php | ||
|
||
namespace Bow\Payment; | ||
|
||
use Bow\Payment\Common\PaymentManagerContract; | ||
use BowcasherOrangeMoneyService; | ||
|
||
class Bowcasher | ||
{ | ||
/** | ||
* Instance of | ||
* | ||
* @var PaymentManagerContract | ||
*/ | ||
private static $instance; | ||
|
||
/** | ||
* Make configuration | ||
* | ||
* @return PaymentManagerContract | ||
*/ | ||
public static function configure($config) | ||
{ | ||
static::$instance = new BowcasherOrangeMoneyService($config['gateways']['orange_ci']); | ||
} | ||
|
||
/** | ||
* __callStatic | ||
* | ||
* @param string $name | ||
* @param array $arguments | ||
* @return mixed | ||
*/ | ||
public static function __callStatic($name, $arguments) | ||
{ | ||
if (method_exists(static::$instance, $name)) { | ||
return call_user_func_array([static::$instance, $name], $arguments); | ||
} | ||
} | ||
} |
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,61 @@ | ||
<?php | ||
|
||
namespace Bow\Payment\Common; | ||
|
||
abstract class PaymentManagerContract | ||
{ | ||
const PRODUCTION = 'production'; | ||
const DEVELOPMENT = 'development'; | ||
|
||
/** | ||
* Define the payment mode | ||
* | ||
* @var string | ||
*/ | ||
protected $environment = PaymentManagerContract::DEVELOPMENT; | ||
|
||
/** | ||
* Make pay | ||
* | ||
* @return mixed | ||
*/ | ||
abstract public function pay(...$args); | ||
|
||
/** | ||
* Verify payment | ||
* | ||
* @return void | ||
*/ | ||
abstract public function verify(); | ||
|
||
/** | ||
* Switch to production mode | ||
* | ||
* @return string | ||
*/ | ||
public function switchToProduction() | ||
{ | ||
$this->environment = PaymentManagerContract::PRODUCTION; | ||
} | ||
|
||
/** | ||
* Switch to development mode | ||
* | ||
* @return string | ||
*/ | ||
public function switchToDevelopment() | ||
{ | ||
$this->environment = PaymentManagerContract::DEVELOPMENT; | ||
} | ||
|
||
/** | ||
* Get the payment environment | ||
* | ||
* @param string $environment | ||
* @return string | ||
*/ | ||
public function getEnvironment() | ||
{ | ||
return $this->environment; | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
|
||
namespace Bow\Payment\Common; | ||
|
||
use Bow\Payment\Common\PaymentToken; | ||
|
||
interface TokenGeneratorContract | ||
{ | ||
/** | ||
* Get payment token | ||
* | ||
* @return PaymentToken | ||
*/ | ||
public function getToken(); | ||
|
||
/** | ||
* Set the get token url | ||
* | ||
* @deprecated | ||
* @param string $url | ||
* @return mixed | ||
*/ | ||
public function setUrl(string $url); | ||
|
||
/** | ||
* Set the get token url | ||
* | ||
* @param string $url | ||
* @return mixed | ||
*/ | ||
public function setTokenGeneratorEndpoint(string $url); | ||
|
||
/** | ||
* Set credentials | ||
* | ||
* @param mixed $credentials | ||
* @return mixed | ||
*/ | ||
public function setCredentials($credentials); | ||
} |
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,48 @@ | ||
<?php | ||
|
||
namespace Bow\Payment\Common; | ||
|
||
interface TransactionStatusContract | ||
{ | ||
/** | ||
* Get the notification token | ||
* | ||
* @return string | ||
*/ | ||
public function getNotificationToken(); | ||
|
||
/** | ||
* Define if transaction fail | ||
* | ||
* @return bool | ||
*/ | ||
public function fail(); | ||
|
||
/** | ||
* Define if transaction initiated | ||
* | ||
* @return bool | ||
*/ | ||
public function initiated(); | ||
|
||
/** | ||
* Define if transaction expired | ||
* | ||
* @return bool | ||
*/ | ||
public function expired(); | ||
|
||
/** | ||
* Define if transaction success | ||
* | ||
* @return bool | ||
*/ | ||
public function success(); | ||
|
||
/** | ||
* Define if transaction pending | ||
* | ||
* @return bool | ||
*/ | ||
public function pending(); | ||
} |
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
Oops, something went wrong.