From 6dd22fa847cfe032e62feced4358f6efa9b61e4e Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Mon, 7 Apr 2014 12:11:09 +0300 Subject: [PATCH] =?UTF-8?q?zero=20cost=20fix=20(=E2=99=A5=20DigiDaz)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/balances.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/balances.go b/engine/balances.go index ade1fbbc2..2f285c633 100644 --- a/engine/balances.go +++ b/engine/balances.go @@ -168,7 +168,7 @@ func (b *Balance) DebitMinutes(cc *CallCost, count bool, ub *Account, moneyBalan if seconds == 1 { amount = increment.Duration.Seconds() } - if b.Value >= amount { // balance has at least 60 seconds + if b.Value >= amount { newTs := ts inc := increment if seconds > 1 { // we need to recreate increments @@ -240,7 +240,7 @@ func (b *Balance) DebitMinutes(cc *CallCost, count bool, ub *Account, moneyBalan break } } - if moneyBal != nil && b.Value >= seconds { + if (cost == 0 || moneyBal != nil) && b.Value >= seconds { b.SubstractAmount(seconds) nInc.BalanceInfo.MinuteBalanceUuid = b.Uuid nInc.BalanceInfo.AccountId = ub.Id