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:
42
tests/Feature/Statement/StatementTest.php
Normal file
42
tests/Feature/Statement/StatementTest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
||||
use Apoloz\AlfaBank\Core\AlfaConfig;
|
||||
use Apoloz\AlfaBank\Requests\Statement\GetTransactionsRequest;
|
||||
use Saloon\Http\Faking\MockResponse;
|
||||
|
||||
test('can get transactions statement', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
GetTransactionsRequest::class => MockResponse::make([
|
||||
'pagination' => [
|
||||
'totalCount' => 1,
|
||||
'limit' => 10,
|
||||
'offset' => 0
|
||||
],
|
||||
'transactions' => [
|
||||
[
|
||||
'uuid' => 'uuid-123',
|
||||
'transactionId' => 'tx-123',
|
||||
'operationDate' => '2023-01-01',
|
||||
'number' => '1',
|
||||
'direction' => 'CREDIT',
|
||||
'amount' => ['amount' => 100.00, 'currencyName' => 'RUB'],
|
||||
'amountRub' => ['amount' => 100.00, 'currencyName' => 'RUB'],
|
||||
'paymentPurpose' => 'Test',
|
||||
'correspondingAccount' => '408...'
|
||||
]
|
||||
]
|
||||
], 200, ['Content-Type' => 'application/json']),
|
||||
]);
|
||||
|
||||
$config = createTestConfig();
|
||||
$connector = new AlfaBankConnector($config);
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$request = new GetTransactionsRequest('408...', '2023-01-01', '2023-01-02');
|
||||
$response = $connector->send($request);
|
||||
|
||||
expect($response->status())->toBe(200)
|
||||
->and($response->dto()->transactions[0]->transactionId)->toBe('tx-123')
|
||||
->and($response->dto()->transactions[0]->amount->amount)->toBe(100.00);
|
||||
});
|
||||
Reference in New Issue
Block a user