Files
portal/app/tests/Unit/Billing/GatewayDtoTest.php
T
Дмитрий 3b142f9375
Accessibility (Pa11y live) / a11y (push) Has been cancelled
SAST — Semgrep / Semgrep SAST scan (push) Has been cancelled
fix(billing-security): хардненинг webhook ЮKassa + чистка admin-auth комментариев
Webhook (PaymentWebhookController): строгий матч gatewayPaymentId===paymentId
(confused-deputy), проверка валюты RUB (WebhookVerifyResult.currency), IP-allowlist
services.yookassa.webhook_ip_allowlist (fail-open при пустом). web.php: убраны
устаревшие «MVP без auth» комментарии — saas-admin зона fail-closed (nginx-basic
+ M-1 REMOTE_USER allowlist, проверено на проде). +3 теста, 11/11 зелёные.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 04:15:48 +03:00

23 lines
881 B
PHP

<?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');
});