test(payment): verify independent provider attempt settlement

go
codex 47 minutes ago
parent b938890936
commit 05b0c8343f

@ -9,6 +9,13 @@
行情过期或买一价超出自动范围时,暂停相应渠道的新单。已发出的新版本订单按原报价处理。Wise 闭市时,报价会按相同规则失效。超级管理员可从「支付汇率与对账」填写应急汇率、理由与不超过三天的有效期。应急汇率应用于新单,失效后恢复仍有效的自动报价。人民币支付按分四舍五入,USDT 基础金额向上取整到六位小数,再分配匹配尾数。手续费、净到账和差额以商户原始流水核对。[Wise 汇率接口](https://docs.wise.com/api-reference/rate) · [Kraken Ticker](https://docs.kraken.com/api-reference/market-data/get-ticker-information)
## 账单与上游支付尝试
- 面板账单和上游支付订单不是同一对象。同一张未支付账单可以切换渠道,也可以再次选择同一渠道。
- 用户每次明确点击支付都会生成新的请求标识和独立上游订单;同一次 HTTP 或任务重试必须携带原请求标识,并复用原任务,不能重复下单。
- 第一个准确验签且金额、币种匹配的支付完成账单履约。之后到达的其他独立有效付款不会再次履约,而是按各自冻结汇率计入用户余额。
- 易支付和 Paytaro 不使用面板自定义二维码期限,也没有管理员本地关单入口。只有上游明确且被集成支持的期限或终态证据可以结束上游支付尝试。
## 部署已有面板
1. 备份业务库,从三个受影响渠道关闭新单入口。保留商户配置和 USDT 扫链,记录在途订单及原交易凭证。Stripe 和余额支付可以继续使用。

@ -686,7 +686,7 @@ namespace {
'payment_kind' => 'payurl', 'payment_value' => 'https://pay.example.test/order',
'created_at' => $now, 'updated_at' => $now,
]);
PaymentCheckoutQuotes::persist(PaymentCheckoutQuotes::prepare('paytaro', '12.50', $now, $now + 1800),
PaymentCheckoutQuotes::persist(PaymentCheckoutQuotes::prepare('paytaro', '12.50', $now, null),
'PT-GRACE-EXISTING', 1);
$gatewayResult = CloudInvoicePaymentService::create($gatewayGraceInvoice, User::find(1), [
'method' => 'paytaro', 'idempotency_key' => 'gateway-grace-payment-0001',

@ -94,7 +94,7 @@ foreach ([
'idempotency_key' => 'fx-concurrent-key-' . $provider, 'amount' => '72.00', 'status' => 'pending',
'created_at' => $now, 'updated_at' => $now,
]);
$quote = PaymentCheckoutQuotes::prepare($provider, '72.00', $now, $now + 900);
$quote = PaymentCheckoutQuotes::prepare($provider, '72.00', $now, null);
PaymentCheckoutQuotes::persist($quote, $orderNo, $userId);
$payload = [
'pid' => $merchant, 'trade_no' => $trade, 'out_trade_no' => $orderNo, 'type' => 'alipay',

@ -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…
Cancel
Save