-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Payout
support for merchants (#1)
* Merchant Pay out * Merchant Pay out * Refactor the PayoutResponse and PayoutRequest * Refactor Transaction Type * Refactor Transaction Type * Payout response * Refactor transaction type * Add test Payout * Add test Payout --------- Co-authored-by: Bernard Ngandu <[email protected]>
- Loading branch information
1 parent
ff21017
commit 1c5c744
Showing
7 changed files
with
152 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,17 @@ | ||
<?php | ||
|
||
namespace Devscast\Flexpay\Data; | ||
|
||
enum TransactionType: int | ||
{ | ||
/** | ||
* 0 : pour les transactions mobile money | ||
*/ | ||
case MOBILE = 0; | ||
|
||
/** | ||
* 1 : pour les transactions bancaires | ||
*/ | ||
case CARD = 1; | ||
|
||
} |
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Devscast\Flexpay\Request; | ||
|
||
use Devscast\Flexpay\Data\Currency; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class PayoutRequest extends Request | ||
{ | ||
public function __construct( | ||
float $amount, | ||
string $reference, | ||
Currency $currency, | ||
string $callbackUrl, | ||
public string $phone, | ||
public int $type = 1, | ||
) { | ||
|
||
Assert::length($this->phone, 12, 'The phone number should be 12 characters long, eg: 243123456789'); | ||
|
||
parent::__construct($amount, $reference, $currency, $callbackUrl); | ||
} | ||
|
||
public function getPayload(): array | ||
{ | ||
return [ | ||
'authorization' => $this->authorization, | ||
'type' => $this->type, | ||
'reference' => $this->reference, | ||
'phone' => $this->phone, | ||
'amount' => $this->amount, | ||
'currency' => $this->currency->value, | ||
'callbackUrl' => $this->callbackUrl, | ||
]; | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Devscast\Flexpay\Response; | ||
|
||
use Devscast\Flexpay\Data\Status; | ||
|
||
final class PayoutResponse extends FlexpayResponse | ||
{ | ||
public function __construct( | ||
public Status $code, | ||
public string $message = '', | ||
public ?string $orderNumber = null, | ||
) { | ||
} | ||
} |
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