fix(payment): wire balance wallet end-to-end when pay_balance_s is on
Opening 余额功能 alone now enables cash-wallet pay (unless 余额支付 is explicitly off). Drop points-as-balance fallback, stop fake method injection, expose real wallet in cashiers, and honor auto_to_balance on recharge fulfill.
This commit is contained in:
@@ -189,16 +189,14 @@ class TopicPay {
|
||||
}
|
||||
$has_paid = $this->user_has_paid($uid, $topic_id);
|
||||
|
||||
$balance = 0;
|
||||
if ($uid > 0 && class_exists('\AKSRT\Credits\Credits')) {
|
||||
$balance = (int) \AKSRT\Credits\Credits::balance($uid);
|
||||
$wallet_balance = 0.0;
|
||||
if ($uid > 0 && class_exists('\AKSRT\Credits\Balance') && \AKSRT\Credits\Balance::enabled()) {
|
||||
$wallet_balance = (float) \AKSRT\Credits\Balance::balance($uid);
|
||||
}
|
||||
|
||||
$methods = function_exists('aksrt_list_cash_payment_methods')
|
||||
? aksrt_list_cash_payment_methods($uid > 0)
|
||||
: ($uid > 0
|
||||
? [['id' => 'balance', 'name' => __('站内余额', 'aksrt')]]
|
||||
: [['id' => 'alipay', 'name' => __('支付宝', 'aksrt')]]);
|
||||
: [];
|
||||
|
||||
$coupon_allowed = $this->is_coupon_allowed($topic_id);
|
||||
$coupon_error = '';
|
||||
@@ -259,8 +257,9 @@ class TopicPay {
|
||||
'need_vip' => false,
|
||||
'need_purchase' => !$has_paid && !$is_free,
|
||||
'logged_in' => $uid > 0,
|
||||
'balance' => $balance,
|
||||
'balance_enough' => true,
|
||||
'balance' => $wallet_balance,
|
||||
'wallet_balance' => $wallet_balance,
|
||||
'balance_enough' => $is_free || ($wallet_balance + 0.0001 >= (float) $payable),
|
||||
'payment_methods' => $methods,
|
||||
'login_url' => wp_login_url(get_permalink($post)),
|
||||
'vip_url' => home_url('/'),
|
||||
|
||||
Reference in New Issue
Block a user