perf(modal): unify cancellable frontend modal flows
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25ce1d8f43
commit
5375ad6429
36 files changed
+2623
-1806
No files matched your search
@@ -23,7 +23,7 @@ class PaymentOrchestrator {
|
||||
|
||||
/**
|
||||
* @param array<string,mixed> $order Order row plus subject/amount overrides.
|
||||
* @param array<string,mixed> $opts paid_note: string
|
||||
* @param array<string,mixed> $opts paid_note: string, order_context: array
|
||||
*
|
||||
* @return array{
|
||||
* success:bool,
|
||||
@@ -58,7 +58,16 @@ class PaymentOrchestrator {
|
||||
// A pending order remains bound to the gateway selected at creation.
|
||||
// Switching it would make a late callback from the previous gateway look
|
||||
// invalid after that provider may already have collected the money.
|
||||
// The caller may pass request-local create context so metadata such as
|
||||
// subject is not reconstructed or read a second time. The persisted row
|
||||
// remains authoritative for status, ownership, and payment method.
|
||||
$stored = $repo->get($order_number);
|
||||
if (is_array($opts['order_context'] ?? null)) {
|
||||
$context = $opts['order_context'];
|
||||
if ((string) ($context['order_number'] ?? '') === $order_number && is_array($stored)) {
|
||||
$stored = array_merge($context, $stored);
|
||||
}
|
||||
}
|
||||
$stored_status = sanitize_key((string) ($stored['status'] ?? ''));
|
||||
if (!in_array($stored_status, [Order::STATUS_CREATED, Order::STATUS_PENDING], true)) {
|
||||
return self::fail('aksrt_order_not_payable', __('当前订单状态不可支付。', 'aksrt'));
|
||||
|
||||
Reference in new issue
Block a user