debug debit

This commit is contained in:
Radu Ioan Fericean
2012-08-10 20:01:49 +03:00
parent e87ed4fcd3
commit c73cbd43e7
2 changed files with 2 additions and 3 deletions

View File

@@ -359,12 +359,13 @@ func (cd *CallDescriptor) GetMaxSessionTime() (seconds float64, err error) {
func (cd *CallDescriptor) Debit() (cc *CallCost, err error) {
cc, err = cd.GetCost()
if err != nil {
Logger.Err(fmt.Sprintf("error getting cost for key %v: %v", cd.GetKey(), err))
Logger.Err(fmt.Sprintf("error getting cost for key %v: %v", cd.GetUserBalanceKey(), err))
return
}
if userBalance, err := cd.getUserBalance(); err == nil && userBalance != nil {
defer storageGetter.SetUserBalance(userBalance)
if cc.Cost != 0 || cc.ConnectFee != 0 {
Logger.Debug(fmt.Sprintf("Debiting from %v, value: %v", cd.GetUserBalanceKey(), cc.Cost+cc.ConnectFee))
userBalance.debitBalance(CREDIT, cc.Cost+cc.ConnectFee, true)
}
for _, ts := range cc.Timespans {

View File

@@ -20,7 +20,6 @@ package timespans
import (
"errors"
"fmt"
"strconv"
"strings"
)
@@ -68,7 +67,6 @@ Returns user's available minutes for the specified destination
*/
func (ub *UserBalance) getSecondsForPrefix(prefix string) (seconds, credit float64, bucketList bucketsorter) {
credit = ub.BalanceMap[CREDIT+OUTBOUND]
Logger.Debug(fmt.Sprintf("Initial credit: %v from %+v", credit, ub.BalanceMap))
if len(ub.MinuteBuckets) == 0 {
// Logger.Debug("There are no minute buckets to check for user: ", ub.Id)
return