chore(pay): close residual zibll edge contracts for content pay
Expand coupon scope to content categories, document points_deduction as runtime-off like zibll, reject card_pass on content cashier, and pass shop/content context into coupon validate.
This commit is contained in:
1 parent
dc28fafcc3
commit
2ead893923
6 files changed
+90
-24
No files matched your search
@@ -552,6 +552,13 @@ class AKSRT_Content_Pay {
|
||||
'payable' => round($payable, 2),
|
||||
'rebate_price' => round($rebate_price, 2),
|
||||
],
|
||||
// zibll: points_deduction runtime hard-off; card_pass not a content payment method.
|
||||
'points_deduction_allowed' => function_exists('aksrt_is_allow_points_deduction')
|
||||
? (bool) aksrt_is_allow_points_deduction('content')
|
||||
: false,
|
||||
'card_pass_allowed' => function_exists('aksrt_is_content_card_pass_pay_allowed')
|
||||
? (bool) aksrt_is_content_card_pass_pay_allowed($post)
|
||||
: false,
|
||||
'price_type' => $price_type,
|
||||
];
|
||||
}
|
||||
@@ -687,9 +694,16 @@ class AKSRT_Content_Pay {
|
||||
return new WP_Error('aksrt_wrong_modo', __('该内容仅支持积分支付。', 'aksrt'), ['status' => 400]);
|
||||
}
|
||||
|
||||
// Card pass cannot stack coupon (zibll).
|
||||
// Card pass cannot stack coupon (zibll). Content cashier does not sell via card_pass.
|
||||
$payment_method = sanitize_key($payment_method);
|
||||
if ($payment_method === 'card_pass') {
|
||||
if (!function_exists('aksrt_is_content_card_pass_pay_allowed') || !aksrt_is_content_card_pass_pay_allowed($post)) {
|
||||
return new WP_Error(
|
||||
'aksrt_card_pass_not_allowed',
|
||||
__('内容购买不支持卡密支付,请在用户中心使用卡密兑换余额/会员/积分。', 'aksrt'),
|
||||
['status' => 400]
|
||||
);
|
||||
}
|
||||
$coupon_code = '';
|
||||
}
|
||||
|
||||
@@ -1170,8 +1184,9 @@ class AKSRT_Content_Pay {
|
||||
}
|
||||
} else {
|
||||
$result = AKSRT_Coupon::get_instance()->validate($coupon_code, $pay, [
|
||||
'user_id' => max(0, $user_id),
|
||||
'user_id' => max(0, $user_id),
|
||||
'product_ids' => [(int) $post->ID],
|
||||
'context' => 'content',
|
||||
]);
|
||||
if (empty($result['valid'])) {
|
||||
$err = new WP_Error(
|
||||
|
||||
Reference in new issue
Block a user