diff --git a/src/Request/PayoutRequest.php b/src/Request/PayoutRequest.php index 86198a0..a8165e2 100644 --- a/src/Request/PayoutRequest.php +++ b/src/Request/PayoutRequest.php @@ -4,9 +4,7 @@ namespace Devscast\Flexpay\Request; -use Devscast\Flexpay\Credential; use Devscast\Flexpay\Data\Currency; -use Devscast\Flexpay\Data\TransactionType; use Webmozart\Assert\Assert; final class PayoutRequest extends Request @@ -16,12 +14,11 @@ public function __construct( string $reference, Currency $currency, string $callbackUrl, - public Credential $credentials, - public string $telephone, - public TransactionType $type, + public string $phone, + public int $type = 1, ) { - Assert::length($this->telephone, 12, 'The phone number should be 12 characters long, eg: 243123456789'); + Assert::length($this->phone, 12, 'The phone number should be 12 characters long, eg: 243123456789'); parent::__construct($amount, $reference, $currency, $callbackUrl); } @@ -29,11 +26,10 @@ public function __construct( public function getPayload(): array { return [ - 'authorization' => sprintf('Bearer %s', $this->credentials->token), - 'merchant' => $this->merchant, - 'type' => $this->type->value, + 'authorization' => $this->authorization, + 'type' => $this->type, 'reference' => $this->reference, - 'phone' => $this->telephone, + 'phone' => $this->phone, 'amount' => $this->amount, 'currency' => $this->currency->value, 'callbackUrl' => $this->callbackUrl, diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 16233fc..60b5a85 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -76,9 +76,8 @@ public function testPayout(): void reference: 'ref', currency: Currency::USD, callbackUrl: 'http://localhost:8000/callback', - credentials: '', - telephone: '243123456789', - type: TransactionType::CARD + phone: '243123456789', + type: 1 ); $response = $flexpay->payout($request);