fix(orders): enforce configured expiry

Apply the configured order lifetime to all checkout flows and close unpaid orders once their expiry is reached.
This commit is contained in:
kate522 committed 2026-08-12 17:49:54 +08:00
1 parent 5752f80e62
commit 69dd3b66ab
8 files changed
+92 -12

No files matched your search

+14
View File
@@ -392,6 +392,20 @@ class PaymentRuntime {
];
}
/**
* Return the UTC expiry time for a newly created payable order.
*
* Keeping this in the payment runtime prevents individual checkout
* flows from drifting away from the admin "payment_order_expiry" setting.
*/
public static function get_order_expiry_at(?int $now = null): string {
$settings = self::get_order_settings();
$timestamp = $now ?? time();
$minutes = max(5, min(1440, (int) ($settings['expiry'] ?? 30)));
return gmdate('Y-m-d H:i:s', $timestamp + $minutes * MINUTE_IN_SECONDS);
}
/**
* @return array<string,mixed>
*/