diff --git a/engine/account.go b/engine/account.go index 488f54fa8..97acaccf1 100644 --- a/engine/account.go +++ b/engine/account.go @@ -410,7 +410,7 @@ func (acc *Account) debitCreditBalance(cd *CallDescriptor, count bool, dryRun bo } } // check for blocker - if dryRun && balance.Blocker { + if balance.Blocker { return // don't go to next balances } } @@ -443,7 +443,7 @@ func (acc *Account) debitCreditBalance(cd *CallDescriptor, count bool, dryRun bo } } // check for blocker - if dryRun && balance.Blocker { + if balance.Blocker { return // don't go to next balances } } diff --git a/engine/calldesc.go b/engine/calldesc.go index 9f35974e6..3dd8c9be7 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -168,7 +168,6 @@ type CallDescriptor struct { RunID string ForceDuration bool // for Max debit if less than duration return err PerformRounding bool // flag for rating info rounding - DryRun bool DenyNegativeAccount bool // prevent account going on negative during debit account *Account testCallcost *CallCost // testing purpose only! @@ -804,7 +803,7 @@ func (cd *CallDescriptor) Debit() (cc *CallCost, err error) { } } _, err = guardian.Guardian.Guard(func() (iface any, err error) { - cc, err = cd.debit(account, cd.DryRun, !cd.DenyNegativeAccount) + cc, err = cd.debit(account, false, !cd.DenyNegativeAccount) if err == nil { cc.AccountSummary = cd.AccountSummary(initialAcnt) } @@ -869,7 +868,7 @@ func (cd *CallDescriptor) MaxDebit() (cc *CallCost, err error) { cd.TimeEnd = cd.TimeStart.Add(remainingDuration) cd.DurationIndex -= initialDuration - remainingDuration } - cc, err = cd.debit(account, cd.DryRun, !cd.DenyNegativeAccount) + cc, err = cd.debit(account, false, !cd.DenyNegativeAccount) if err == nil { cc.AccountSummary = cd.AccountSummary(initialAcnt) } @@ -1034,7 +1033,6 @@ func (cd *CallDescriptor) Clone() *CallDescriptor { ToR: cd.ToR, ForceDuration: cd.ForceDuration, PerformRounding: cd.PerformRounding, - DryRun: cd.DryRun, CgrID: cd.CgrID, RunID: cd.RunID, } diff --git a/engine/calldesc_test.go b/engine/calldesc_test.go index e5cd1264a..ed9a44aed 100644 --- a/engine/calldesc_test.go +++ b/engine/calldesc_test.go @@ -2464,11 +2464,10 @@ func TestCallDescFieldAsString(t *testing.T) { func TestCallDescString(t *testing.T) { cd := CallDescriptor{} - - rcv := cd.String() - - if rcv != `{"Category":"","Tenant":"","Subject":"","Account":"","Destination":"","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00Z","LoopIndex":0,"DurationIndex":0,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"","ExtraFields":null,"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"","RunID":"","ForceDuration":false,"PerformRounding":false,"DryRun":false,"DenyNegativeAccount":false}` { - t.Error(rcv) + want := `{"Category":"","Tenant":"","Subject":"","Account":"","Destination":"","TimeStart":"0001-01-01T00:00:00Z","TimeEnd":"0001-01-01T00:00:00Z","LoopIndex":0,"DurationIndex":0,"FallbackSubject":"","RatingInfos":null,"Increments":null,"ToR":"","ExtraFields":null,"MaxRate":0,"MaxRateUnit":0,"MaxCostSoFar":0,"CgrID":"","RunID":"","ForceDuration":false,"PerformRounding":false,"DenyNegativeAccount":false}` + got := cd.String() + if got != want { + t.Errorf("cd.String() = %s, want %s", got, want) } }