forked from apoloz/alfa-bank-sdk
refactor: dto, requests, connector
This commit is contained in:
@@ -35,3 +35,37 @@ test('can check reversal data', function () {
|
||||
expect($response->status())->toBe(200)
|
||||
->and($response->dto()->messageID)->toBe('guid-123');
|
||||
});
|
||||
|
||||
test('can get reversal history', function () {
|
||||
$mockClient = new \Saloon\Http\Faking\MockClient([
|
||||
\Apoloz\AlfaBank\Sbp\Requests\Reversal\GetQrcReversalHistoryRequest::class => \Saloon\Http\Faking\MockResponse::make([
|
||||
'ErrorCode' => 0,
|
||||
'message' => 'OK',
|
||||
'refunds' => [
|
||||
[
|
||||
'TermNo' => '90080567',
|
||||
'amount' => '10000',
|
||||
'originalQrcId' => 'QR-123',
|
||||
'originalTrxId' => 'TRX-123',
|
||||
'payerId' => '7900',
|
||||
'status' => 'ACWP'
|
||||
]
|
||||
]
|
||||
], 200),
|
||||
]);
|
||||
|
||||
$config = new \Apoloz\AlfaBank\Core\AlfaConfig(
|
||||
baseUrl: 'https://test.com',
|
||||
certificatePath: __DIR__ . '/../../test_key.pem',
|
||||
privateKeyPath: __DIR__ . '/../../test_key.pem'
|
||||
);
|
||||
$connector = new \Apoloz\AlfaBank\Sbp\SbpConnector($config, 'alias');
|
||||
$connector->withMockClient($mockClient);
|
||||
|
||||
$response = $connector->send(new \Apoloz\AlfaBank\Sbp\Requests\Reversal\GetQrcReversalHistoryRequest('payrrn-1', 'term-1'));
|
||||
$dto = $response->dto();
|
||||
|
||||
expect($dto->ErrorCode)->toBe(0)
|
||||
->and($dto->refunds->count())->toBe(1)
|
||||
->and($dto->refunds->first()->status)->toBe('ACWP');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user