feat(pay): capability gates for transfer and withdraw
AND feature flags with user_caps balance_transfer / points_transfer / balance_withdraw on REST and user-center buttons.
This commit is contained in:
1 parent
9b98080daf
commit
c45a0ecef5
4 files changed
+21
No files matched your search
@@ -21,10 +21,17 @@ $wallet_fmt = class_exists('AKSRT_Balance')
|
||||
$recharge = class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'get_payment_recharge_settings')
|
||||
? AKSRT_Settings::get_payment_recharge_settings()
|
||||
: [];
|
||||
$uid = (int) ($user_id ?? get_current_user_id());
|
||||
$transfer_on = !empty($recharge['transfer']['enabled']);
|
||||
if ($transfer_on && class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('balance_transfer', $uid)) {
|
||||
$transfer_on = false;
|
||||
}
|
||||
$exchange_on = !empty($recharge['exchange']['enabled']);
|
||||
$all_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_all() : [];
|
||||
$withdraw_on = !empty($all_settings['pay_balance_withdraw_s']);
|
||||
if ($withdraw_on && class_exists('AKSRT_Settings_Capabilities') && !AKSRT_Settings_Capabilities::user_can('balance_withdraw', $uid)) {
|
||||
$withdraw_on = false;
|
||||
}
|
||||
$withdraw_min = max(1, (float) ($all_settings['pay_balance_withdraw_lowest_money'] ?? $all_settings['pay_rebate_withdraw_lowest_money'] ?? 50));
|
||||
$withdraw_pending_hold = 0.0;
|
||||
$withdraw_history = [];
|
||||
|
||||
Reference in new issue
Block a user