2026-06-22 20:33:22 +03:00
|
|
|
<?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 () {
|
2026-06-23 04:15:48 +03:00
|
|
|
$ok = new WebhookVerifyResult('pay_123', 'succeeded', '500.00', 'RUB', 'card');
|
|
|
|
|
$pending = new WebhookVerifyResult('pay_9', 'pending', '500.00', 'RUB', null);
|
2026-06-22 20:33:22 +03:00
|
|
|
|
|
|
|
|
expect($ok->isSucceeded())->toBeTrue()
|
2026-06-23 04:15:48 +03:00
|
|
|
->and($pending->isSucceeded())->toBeFalse()
|
|
|
|
|
->and($ok->currency)->toBe('RUB');
|
2026-06-22 20:33:22 +03:00
|
|
|
});
|