feat(pay): 统一收银台四种模式(站内二维码/当前页跳转/表单提交/JSAPI)
- PaymentOrchestrator 统一返回 mode + code_url/payment_url/form_html/jsapi_params
- 支付宝:当面付二维码 / 电脑网站支付 / H5;微信:Native / H5 / JSAPI(WechatOpenid 静默授权)
- 易支付:PC mapi 二维码,移动端自动提交表单
- 删除旧键 alipay_payment_type / wechat_payment_type / epay_device 与 redirect/qr_content 字段
- 新增 pay-cashier.js,移除 window.open,订单状态接口改为 /pay/order/{n}
- 拆分 credits.js(affiliate / withdraw-history)至 1000 行以内
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b340b77d5a
commit
1df2822f01
28 files changed
+1255
-836
No files matched your search
@@ -544,21 +544,18 @@ trait PayOrders {
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($payment_result['redirect'])) {
|
||||
$cashier = \AKSRT\Payment\PaymentOrchestrator::cashier_payload($payment_result);
|
||||
if ($cashier !== []) {
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => [
|
||||
'redirect' => true,
|
||||
'payment_url' => (string) ($payment_result['payment_url'] ?? ''),
|
||||
'qr_content' => (string) ($payment_result['qr_content'] ?? ''),
|
||||
'data' => array_merge($cashier, [
|
||||
'order_number' => $order_number,
|
||||
'amount' => $amount_decimal,
|
||||
'pay_modo' => '0',
|
||||
'message' => $payment_result['message'],
|
||||
'reload' => false,
|
||||
'poll' => true,
|
||||
'replayed' => false,
|
||||
],
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ trait PayRest {
|
||||
],
|
||||
]);
|
||||
|
||||
register_rest_route('aksrt/v1', '/pay/content/order/(?P<order_number>[A-Za-z0-9_-]+)', [
|
||||
register_rest_route('aksrt/v1', '/pay/order/(?P<order_number>[A-Za-z0-9_-]+)', [
|
||||
'methods' => 'GET',
|
||||
'callback' => [$this, 'rest_order_status'],
|
||||
'permission_callback' => [$this, 'check_rest_nonce'],
|
||||
@@ -164,7 +164,7 @@ trait PayRest {
|
||||
|
||||
|
||||
/**
|
||||
* GET /pay/content/order/{order_number}
|
||||
* GET /pay/order/{order_number} (all order types; guests limited to content orders)
|
||||
*/
|
||||
public function rest_order_status(\WP_REST_Request $request) {
|
||||
$uid = get_current_user_id();
|
||||
|
||||
@@ -488,20 +488,17 @@ trait VipServicePurchase {
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($payment_result['redirect'])) {
|
||||
$cashier = \AKSRT\Payment\PaymentOrchestrator::cashier_payload($payment_result);
|
||||
if ($cashier !== []) {
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => [
|
||||
'redirect' => true,
|
||||
'payment_url' => (string) ($payment_result['payment_url'] ?? ''),
|
||||
'qr_content' => (string) ($payment_result['qr_content'] ?? ''),
|
||||
'data' => array_merge($cashier, [
|
||||
'order_number' => $order_number,
|
||||
'amount' => $amount_decimal,
|
||||
'message' => $payment_result['message'],
|
||||
'reload' => false,
|
||||
'poll' => true,
|
||||
'replayed' => false,
|
||||
],
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user