zero cost fix (♥ DigiDaz)

This commit is contained in:
Radu Ioan Fericean
2014-04-07 12:11:09 +03:00
parent 2e6ee328c9
commit 6dd22fa847

View File

@@ -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