test(payment): verify independent provider attempt settlement
parent
b938890936
commit
05b0c8343f
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
$assert = static function (bool $condition, string $message): void {
|
||||
if (!$condition) {
|
||||
throw new RuntimeException($message);
|
||||
}
|
||||
};
|
||||
|
||||
$routes = file_get_contents($root . '/config/routes.php');
|
||||
$cloudSchema = file_get_contents($root . '/sql/cloud.sql');
|
||||
$quoteMigration = file_get_contents($root . '/sql/payment_checkout_quotes.sql');
|
||||
$quoteService = file_get_contents(
|
||||
$root . '/app/Services/Payment/PaymentCheckoutQuotes.php'
|
||||
);
|
||||
$paytaroService = file_get_contents(
|
||||
$root . '/app/Services/Payment/PaytaroPaymentService.php'
|
||||
);
|
||||
$yipayService = file_get_contents(
|
||||
$root . '/app/Services/Payment/YipayPaymentService.php'
|
||||
);
|
||||
$paytaroConfig = file_get_contents(
|
||||
$root . '/app/Services/Payment/PaytaroConfig.php'
|
||||
);
|
||||
$yipayConfig = file_get_contents(
|
||||
$root . '/app/Services/Payment/YipayConfig.php'
|
||||
);
|
||||
$invoiceRuntime = file_get_contents(
|
||||
$root . '/public/cloud/invoice-detail-runtime.js'
|
||||
);
|
||||
|
||||
$assert(!file_exists($root . '/app/Services/Payment/PaymentClosureService.php')
|
||||
&& !str_contains($routes, '/payment-reconciliation/close')
|
||||
&& !str_contains($cloudSchema, 'provider_closed_')
|
||||
&& !str_contains($quoteMigration, 'provider_closed_'),
|
||||
'A local administrator closure path can still terminate provider orders.');
|
||||
|
||||
$assert(str_contains($paytaroService,
|
||||
"PaymentCheckoutQuotes::prepare('paytaro', \$amount, \$now, null)")
|
||||
&& str_contains($yipayService,
|
||||
"PaymentCheckoutQuotes::prepare('yipay_' . \$method, \$amount, \$now, null)")
|
||||
&& !str_contains($paytaroConfig, 'quote_minutes')
|
||||
&& !str_contains($yipayConfig, 'quote_minutes')
|
||||
&& !str_contains($quoteService, 'provider_closed'),
|
||||
'A CNY provider still uses a local checkout deadline or closure result.');
|
||||
|
||||
$assert(!str_contains($invoiceRuntime, 'onlinePaymentFallbackExpiresAt')
|
||||
&& str_contains($invoiceRuntime,
|
||||
'state.onlinePaymentExpiresAt = paymentExpiresAt ?? 0;')
|
||||
&& str_contains($invoiceRuntime,
|
||||
'clearInvoicePaymentKey(invoice.id, method.id);')
|
||||
&& str_contains($invoiceRuntime,
|
||||
'const idempotencyKey = pendingInvoicePaymentKey(invoice.id, method.id);'),
|
||||
'The browser no longer separates explicit payment attempts from transport retries.');
|
||||
|
||||
echo "Provider attempt lifetime and retry contract passed.\n";
|
||||
Loading…
Reference in New Issue