forked from apoloz/alfa-bank-sdk
32 lines
892 B
PHP
32 lines
892 B
PHP
<?php
|
|
|
|
use Apoloz\AlfaBank\Core\AlfaConfig;
|
|
use Apoloz\AlfaBank\Sbp\SbpConnector;
|
|
|
|
test('can parse payment notification webhook', function (): void {
|
|
$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');
|
|
});
|