mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
remove unused DryRun field from CallDescriptor
dryRun vars will also not be considered anymore in the balance blocker condition.
This commit is contained in:
committed by
Dan Christian Bogos
parent
d510b12d2a
commit
668f421842
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user