MockResponse::make([ 'ErrorCode' => 0, 'message' => 'OK', 'qrcId' => 'test-id', 'messageID' => 'guid-123', 'payerBnkName' => 'Alfa', ], 200), ]); $config = new AlfaConfig( baseUrl: 'https://test.com', certificatePath: __DIR__ . '/../../test_key.pem', privateKeyPath: __DIR__ . '/../../test_key.pem' ); $connector = new SbpConnector($config, 'alias'); $connector->withMockClient($mockClient); $payload = new GetQrcReversalDataRequestData( termNo: 'term-1', qrcId: 'test-id' ); $response = $connector->send(new GetQrcReversalDataRequest($payload)); expect($response->status())->toBe(200) ->and($response->dto()->messageID)->toBe('guid-123'); }); test('can get reversal history', function (): void { $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'); });