feat(payment): finish Zibll key contract and wire checkout gateways
Drop dual-read payment runtime fallbacks, align PHP schema to Vue keys, read gateway credentials only from aksrt_settings with enable toggles, expose configured adapters at checkout, fix credits pay signatures, and apply order expiry settings. Wire orphan order/card-pass/withdrawal schema pages; delete unused Payment* wrappers.
This commit is contained in:
1 parent
12c31ad82b
commit
c93b303453
16 files changed
+298
-228
No files matched your search
@@ -122,6 +122,12 @@ class AKSRT_Shop_Checkout_Service {
|
||||
'discount' => $data['discount'],
|
||||
];
|
||||
|
||||
$expiry_minutes = 30;
|
||||
if (class_exists('AKSRT_Settings')) {
|
||||
$order_settings = AKSRT_Settings::get_order_settings();
|
||||
$expiry_minutes = max(5, min(1440, (int) ($order_settings['expiry'] ?? 30)));
|
||||
}
|
||||
|
||||
$order_number = AKSRT_Order_Repository::get_instance()->create([
|
||||
'user_id' => $user_id,
|
||||
'product_type' => 'shop_product',
|
||||
@@ -130,7 +136,7 @@ class AKSRT_Shop_Checkout_Service {
|
||||
'currency' => 'CNY',
|
||||
'status' => AKSRT_Order::STATUS_PENDING,
|
||||
'payment_method' => $payment_method,
|
||||
'expires_at' => date('Y-m-d H:i:s', strtotime('+10 minutes')),
|
||||
'expires_at' => date('Y-m-d H:i:s', strtotime('+' . $expiry_minutes . ' minutes')),
|
||||
'note' => wp_json_encode($meta_payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||
]);
|
||||
|
||||
@@ -246,14 +252,20 @@ class AKSRT_Shop_Checkout_Service {
|
||||
return ['success' => false, 'message' => __('订单金额无效。', 'aksrt')];
|
||||
}
|
||||
|
||||
$balance = AKSRT_Credits::get_balance($user_id);
|
||||
$balance = AKSRT_Credits::balance($user_id);
|
||||
if ($balance < $amount) {
|
||||
return ['success' => false, 'message' => sprintf(__('积分不足,需要 %d 积分,当前余额 %d。', 'aksrt'), $amount, $balance)];
|
||||
}
|
||||
|
||||
$deducted = AKSRT_Credits::deduct($amount, $user_id, 'shop_points_pay', sprintf(__('积分购买订单 %s', 'aksrt'), $order_number));
|
||||
if (!$deducted) {
|
||||
return ['success' => false, 'message' => __('积分扣除失败。', 'aksrt')];
|
||||
$deducted = AKSRT_Credits::deduct(
|
||||
$user_id,
|
||||
$amount,
|
||||
'shop_points_pay',
|
||||
['order' => $order_number],
|
||||
sprintf(__('积分购买订单 %s', 'aksrt'), $order_number)
|
||||
);
|
||||
if (is_wp_error($deducted)) {
|
||||
return ['success' => false, 'message' => $deducted->get_error_message() ?: __('积分扣除失败。', 'aksrt')];
|
||||
}
|
||||
|
||||
$repo = AKSRT_Order_Repository::get_instance();
|
||||
|
||||
Reference in new issue
Block a user