mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-20 14:48:43 +05:00
show error on not enough credit when debiting
This commit is contained in:
@@ -472,8 +472,8 @@ func (ub *UserBalance) debitCreditBalance(cc *CallCost, count bool) error {
|
||||
ts.SplitByIncrement(incrementIndex)
|
||||
cc.Timespans = cc.Timespans[:tsIndex+1]
|
||||
}
|
||||
//return errors.New("Not enough credit")
|
||||
return nil
|
||||
return errors.New("Not enough credit")
|
||||
//return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,8 +327,8 @@ func TestDebitCreditNoCredit(t *testing.T) {
|
||||
MINUTES + OUTBOUND: BalanceChain{b1},
|
||||
}}
|
||||
err := rifsBalance.debitCreditBalance(cc, false)
|
||||
if err != nil {
|
||||
t.Error("Error debiting balance: ", err)
|
||||
if err == nil {
|
||||
t.Error("Showing no enough credit error ")
|
||||
}
|
||||
if cc.Timespans[0].Increments[0].BalanceUuids[0] != "testb" ||
|
||||
cc.Timespans[0].Increments[0].Duration != time.Minute {
|
||||
@@ -556,8 +556,8 @@ func TestDebitCreditMoneyOnly(t *testing.T) {
|
||||
CREDIT + OUTBOUND: BalanceChain{&Balance{Uuid: "money", Value: 50}},
|
||||
}}
|
||||
err := rifsBalance.debitCreditBalance(cc, false)
|
||||
if err != nil {
|
||||
t.Error("Error debiting balance: ", err)
|
||||
if err == nil {
|
||||
t.Error("Missing noy enough credit error ")
|
||||
}
|
||||
|
||||
if cc.Timespans[0].Increments[0].BalanceUuids[0] != "money" ||
|
||||
|
||||
Reference in New Issue
Block a user