forked from apoloz/alfa-bank-sdk
refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
33
tests/Feature/SelfEmployed/PayoutTest.php
Normal file
33
tests/Feature/SelfEmployed/PayoutTest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
||||
use Apoloz\AlfaBank\Core\AlfaConfig;
|
||||
use Apoloz\AlfaBank\Requests\SelfEmployed\CreatePayoutRequest;
|
||||
use Apoloz\AlfaBank\Data\SelfEmployed\PayoutRequestData;
|
||||
use Saloon\Http\Faking\MockResponse;
|
||||
|
||||
test('can create a payout for self-employed', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
CreatePayoutRequest::class => MockResponse::make([
|
||||
'requestId' => 'payout-req-123',
|
||||
'state' => 'PROCESSED'
|
||||
], 200, ['Content-Type' => 'application/json']),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$payload = new PayoutRequestData(
|
||||
externalId: 'ext-id-456',
|
||||
company: ['vatin' => '7700000000'],
|
||||
requisite: [
|
||||
['amount' => 1000, 'vatin' => '112233445566']
|
||||
]
|
||||
);
|
||||
|
||||
$response = $connector->send(new CreatePayoutRequest($payload));
|
||||
|
||||
expect($response->status())->toBe(200)
|
||||
->and($response->json('requestId'))->toBe('payout-req-123');
|
||||
});
|
||||
Reference in New Issue
Block a user