forked from apoloz/alfa-bank-sdk
refactor: dto, requests, connector
This commit is contained in:
31
tests/Feature/Sbp/WebhookTest.php
Normal file
31
tests/Feature/Sbp/WebhookTest.php
Normal 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');
|
||||
});
|
||||
Reference in New Issue
Block a user