fix: batch deduction lua script

This commit is contained in:
John Yeo
2025-11-17 23:10:58 +00:00
parent 449c5b830e
commit 448ffc50ee

View File

@@ -555,9 +555,7 @@ local function deductFromMainBalance(cusFeature, amount, adjustGrantedBalance)
local remaining = amount
-- POSITIVE AMOUNT (DEDUCTION): current_balance → overage
local isPaidAllocated = cusFeature.feature and cusFeature.feature.type == "metered" and cusFeature.feature.consumable == false and cusFeature.overage_allowed == true
if remaining > 0 or isPaidAllocated then
if remaining > 0 then
-- Pass 1: Deduct from current_balance
local currentBalanceResult = deductFromCurrentBalance(cusFeature, remaining, adjustGrantedBalance)
remaining = currentBalanceResult.remaining