Files
alfa-bank-sdk/tests/Feature/SelfEmployed/TaxpayerStatusTest.php
Anatoliy Poloz b15d29f8e9 fix(formating)
2026-01-28 03:36:26 +03:00

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');
});