refactor: dto, requests, connector

This commit is contained in:
2026-01-19 10:46:57 +03:00
parent b2786d8606
commit 78e1e82331
32 changed files with 894 additions and 42 deletions

View File

@@ -0,0 +1,31 @@
<?php
use Apoloz\AlfaBank\Sbp\SbpConnector;
use Apoloz\AlfaBank\Core\AlfaConfig;
test('can parse payment notification webhook', function () {
$config = new AlfaConfig(
baseUrl: 'https://test.com',
certificatePath: __DIR__ . '/../../test_key.pem',
privateKeyPath: __DIR__ . '/../../test_key.pem'
);
$connector = new SbpConnector($config, 'alias');
$payload = [
'command' => 'qrc/notification',
'qrcId' => 'QR123',
'trxId' => 'TRX123',
'status' => 'ACWP',
'amount' => '1000',
'timestamp' => '2025-01-01T10:00:00Z',
'payerId' => '7900',
'payrrn' => 'RR123',
'TermNo' => 'T123'
];
$dto = $connector->parsePaymentNotification($payload);
expect($dto->qrcId)->toBe('QR123')
->and($dto->amount)->toBe('1000')
->and($dto->status)->toBe('ACWP');
});