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:
38
tests/Feature/SelfEmployed/TaxpayerStatusTest.php
Normal file
38
tests/Feature/SelfEmployed/TaxpayerStatusTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Apoloz\AlfaBank\Core\AlfaBankConnector;
|
||||
use Apoloz\AlfaBank\Core\AlfaConfig;
|
||||
use Apoloz\AlfaBank\Requests\SelfEmployed\GetTaxpayerStatusRequest;
|
||||
use Apoloz\AlfaBank\Data\SelfEmployed\TaxpayerStatusRequestData;
|
||||
use Saloon\Http\Faking\MockResponse;
|
||||
|
||||
test('can get self-employed status from FTS', function () {
|
||||
$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');
|
||||
});
|
||||
Reference in New Issue
Block a user