mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 06:38:45 +05:00
Fixes #1435
This commit is contained in:
committed by
Dan Christian Bogos
parent
e5b71bce0e
commit
53d5925bf5
@@ -532,6 +532,28 @@ func (ub *Account) debitCreditBalance(cd *CallDescriptor, count bool, dryRun boo
|
||||
cost := increment.Cost
|
||||
defaultBalance := ub.GetDefaultMoneyBalance()
|
||||
defaultBalance.SubstractValue(cost)
|
||||
//send default balance to thresholdS to be processed
|
||||
acntTnt := utils.NewTenantID(ub.ID)
|
||||
thEv := &ArgsProcessEvent{
|
||||
CGREvent: utils.CGREvent{
|
||||
Tenant: acntTnt.Tenant,
|
||||
ID: utils.GenUUID(),
|
||||
Event: map[string]interface{}{
|
||||
utils.EventType: utils.BalanceUpdate,
|
||||
utils.EventSource: utils.AccountService,
|
||||
utils.Account: acntTnt.ID,
|
||||
utils.BalanceID: defaultBalance.ID,
|
||||
utils.Units: defaultBalance.Value}}}
|
||||
if thresholdS != nil {
|
||||
var tIDs []string
|
||||
if err := thresholdS.Call(utils.ThresholdSv1ProcessEvent, thEv, &tIDs); err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<AccountS> error: %s processing balance event %+v with ThresholdS.",
|
||||
err.Error(), thEv))
|
||||
}
|
||||
}
|
||||
|
||||
increment.BalanceInfo.Monetary = &MonetaryInfo{
|
||||
UUID: defaultBalance.Uuid,
|
||||
ID: defaultBalance.ID,
|
||||
|
||||
Reference in New Issue
Block a user