forked from apoloz/alfa-bank-sdk
fix(formating)
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Apoloz\AlfaBank\Webhooks\WebhookFactory;
|
||||
use Apoloz\AlfaBank\Data\Webhooks\Payloads\BaasWebhookData;
|
||||
use Apoloz\AlfaBank\Data\Webhooks\Payloads\SbpWebhookData;
|
||||
use Apoloz\AlfaBank\Webhooks\WebhookFactory;
|
||||
|
||||
test('can detect baas webhook', function () {
|
||||
test('can detect baas webhook', function (): void {
|
||||
$payload = [
|
||||
[
|
||||
'object' => 'ul_transaction_default',
|
||||
@@ -19,20 +19,20 @@ test('can detect baas webhook', function () {
|
||||
'documentDate' => '2022-01-12',
|
||||
'operationCode' => '01',
|
||||
'paymentPurpose' => 'Test',
|
||||
'uuid' => 'uuid-123'
|
||||
]
|
||||
]
|
||||
'uuid' => 'uuid-123',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
expect(WebhookFactory::isBaas($payload))->toBeTrue();
|
||||
|
||||
|
||||
$webhook = WebhookFactory::create($payload);
|
||||
expect($webhook)->toBeInstanceOf(BaasWebhookData::class)
|
||||
->and($webhook->object)->toBe('ul_transaction_default')
|
||||
->and($webhook->data->transactionId)->toBe('TX123');
|
||||
});
|
||||
|
||||
test('can detect sbp webhook', function () {
|
||||
test('can detect sbp webhook', function (): void {
|
||||
$payload = [
|
||||
[
|
||||
'object' => 'jp_sbp_incoming_payments',
|
||||
@@ -42,13 +42,13 @@ test('can detect sbp webhook', function () {
|
||||
'nspkTransactionId' => 'NSPK123',
|
||||
'amount' => 1000,
|
||||
'currency' => 'RUR',
|
||||
'timestamp' => '2024-11-26T09:09:32Z'
|
||||
]
|
||||
]
|
||||
'timestamp' => '2024-11-26T09:09:32Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
expect(WebhookFactory::isSbp($payload))->toBeTrue();
|
||||
|
||||
|
||||
$webhook = WebhookFactory::create($payload);
|
||||
expect($webhook)->toBeInstanceOf(SbpWebhookData::class)
|
||||
->and($webhook->object)->toBe('jp_sbp_incoming_payments')
|
||||
|
||||
Reference in New Issue
Block a user