forked from apoloz/alfa-bank-sdk
38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
|
use Apoloz\AlfaBank\Data\SelfEmployed\TaxpayerStatusRequestData;
|
|
use Apoloz\AlfaBank\Requests\SelfEmployed\GetTaxpayerStatusRequest;
|
|
use Saloon\Http\Faking\MockResponse;
|
|
|
|
test('can get self-employed status from FTS', function (): void {
|
|
$mockClient = new \Saloon\Http\Faking\MockClient([
|
|
GetTaxpayerStatusRequest::class => MockResponse::make([
|
|
'requestId' => '00000000-0000-0000-0000-000000000001',
|
|
'externalId' => '00000000-0000-0000-0000-000000000002',
|
|
'taxpayerStatusList' => [
|
|
[
|
|
'vatin' => '112233445566',
|
|
'status' => 'ACTIVE',
|
|
'message' => 'Is self-employed',
|
|
],
|
|
],
|
|
], 200, ['Content-Type' => 'application/json']),
|
|
]);
|
|
|
|
$config = createTestConfig();
|
|
$connector = new AlfaBankConnector($config);
|
|
$connector->withMockClient($mockClient);
|
|
|
|
$payload = new TaxpayerStatusRequestData(
|
|
externalId: '00000000-0000-0000-0000-000000000002',
|
|
selfemployedVatinList: ['112233445566']
|
|
);
|
|
|
|
$response = $connector->send(new GetTaxpayerStatusRequest($payload));
|
|
|
|
expect($response->status())->toBe(200)
|
|
->and($response->dto()->requestId)->toBe('00000000-0000-0000-0000-000000000001')
|
|
->and($response->dto()->taxpayerStatusList[0]['status'])->toBe('ACTIVE');
|
|
});
|