mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fix for setBalance not checking actionTriggers on default balance
This commit is contained in:
@@ -140,7 +140,6 @@ func TestApierV2itSetAccountActionTriggers(t *testing.T) {
|
||||
GroupID: utils.StringPointer("MONITOR_MAX_BALANCE"),
|
||||
ThresholdType: utils.StringPointer(utils.TRIGGER_MAX_BALANCE),
|
||||
ThresholdValue: utils.Float64Pointer(50),
|
||||
BalanceID: utils.StringPointer(utils.META_DEFAULT),
|
||||
BalanceType: utils.StringPointer(utils.MONETARY),
|
||||
ActionsID: utils.StringPointer("DISABLE_ACCOUNT"),
|
||||
}
|
||||
@@ -186,8 +185,8 @@ func TestApierV2itFraudMitigation(t *testing.T) {
|
||||
t.Error(err)
|
||||
} else if len(acnt.BalanceMap) != 1 || acnt.BalanceMap[utils.MONETARY][0].Value != 60.0 {
|
||||
t.Errorf("Unexpected balance received: %+v", acnt.BalanceMap[utils.MONETARY][0])
|
||||
//} else if !acnt.Disabled {
|
||||
// t.Fatalf("Received account: %+v", acnt)
|
||||
} else if !acnt.Disabled {
|
||||
t.Fatalf("Received account: %+v", acnt)
|
||||
}
|
||||
attrSetAcnt := AttrSetAccount{
|
||||
Tenant: "cgrates.org",
|
||||
|
||||
@@ -127,6 +127,7 @@ func (acc *Account) setBalanceAction(a *Action) error {
|
||||
balance.ID = utils.META_DEFAULT
|
||||
if a.Balance.Value != nil {
|
||||
balance.Value = a.Balance.GetValue()
|
||||
balance.SetDirty() // Mark the balance as dirty since we have modified and it should be checked by action triggers
|
||||
}
|
||||
} else {
|
||||
a.Balance.ModifyBalance(balance)
|
||||
|
||||
Reference in New Issue
Block a user