Files
portal/app/tests/Unit/Billing/GatewayDtoTest.php
T

23 lines
881 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
use App\Services\Billing\Gateway\CreatePaymentResult;
use App\Services\Billing\Gateway\WebhookVerifyResult;
it('CreatePaymentResult хранит id платежа и url подтверждения', function () {
$r = new CreatePaymentResult('pay_123', 'https://yoomoney.ru/checkout/pay_123');
expect($r->gatewayPaymentId)->toBe('pay_123')
->and($r->confirmationUrl)->toBe('https://yoomoney.ru/checkout/pay_123');
});
it('WebhookVerifyResult различает успех и прочие статусы', function () {
$ok = new WebhookVerifyResult('pay_123', 'succeeded', '500.00', 'RUB', 'card');
$pending = new WebhookVerifyResult('pay_9', 'pending', '500.00', 'RUB', null);
expect($ok->isSucceeded())->toBeTrue()
->and($pending->isSucceeded())->toBeFalse()
->and($ok->currency)->toBe('RUB');
});