mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 23:58:44 +05:00
Add dryrun for CDRsV2ProcessEvent
This commit is contained in:
committed by
Dan Christian Bogos
parent
8781b968ac
commit
681cd3c58a
@@ -137,6 +137,7 @@ type CallDescriptor struct {
|
||||
DenyNegativeAccount bool // prevent account going on negative during debit
|
||||
account *Account
|
||||
testCallcost *CallCost // testing purpose only!
|
||||
DryRun bool
|
||||
}
|
||||
|
||||
// AsCGREvent converts the CallDescriptor into CGREvent
|
||||
@@ -769,7 +770,7 @@ func (cd *CallDescriptor) Debit(fltrS *FilterS) (cc *CallCost, err error) {
|
||||
}
|
||||
}
|
||||
return guardian.Guardian.Guard(func() (err error) {
|
||||
cc, err = cd.debit(account, false, !cd.DenyNegativeAccount, fltrS)
|
||||
cc, err = cd.debit(account, cd.DryRun, !cd.DenyNegativeAccount, fltrS)
|
||||
if err == nil {
|
||||
cc.AccountSummary = cd.AccountSummary(initialAcnt)
|
||||
}
|
||||
|
||||
@@ -202,6 +202,11 @@ func (rs *Responder) Debit(ctx *context.Context, arg *CallDescriptorWithAPIOpts,
|
||||
err = utils.ErrMaxUsageExceeded
|
||||
return
|
||||
}
|
||||
if ralsDryRun, exists := arg.APIOpts[utils.MetaRALsDryRun]; exists {
|
||||
if arg.DryRun, err = utils.IfaceAsBool(ralsDryRun); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
var r *CallCost
|
||||
if r, err = arg.Debit(rs.FilterS); err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user