mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
Adding a secondary account to the TestV1DebitAbstractsEventCharges
This commit is contained in:
@@ -1257,9 +1257,14 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
|
||||
cb1ID := "CB1"
|
||||
cb2ID := "CB2"
|
||||
// populate the Account
|
||||
acnt := &utils.Account{
|
||||
acnt1 := &utils.Account{
|
||||
Tenant: utils.CGRateSorg,
|
||||
ID: "TestV1DebitAbstractsEventCharges",
|
||||
ID: "TestV1DebitAbstractsEventCharges1",
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 10,
|
||||
},
|
||||
},
|
||||
Balances: map[string]*utils.Balance{
|
||||
ab1ID: &utils.Balance{ // cost: 0.4 connectFee plus 0.2 per minute, available 2 minutes, should remain 10s
|
||||
ID: ab1ID,
|
||||
@@ -1332,8 +1337,39 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
|
||||
Units: utils.NewDecimal(int64(60*time.Second), 0), // 1 Minute
|
||||
},
|
||||
cb2ID: &utils.Balance{ // absorb all costs, standard rating used when primary debitting
|
||||
ID: cb2ID,
|
||||
Type: utils.MetaConcrete,
|
||||
Units: utils.NewDecimal(125, 2),
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := dm.SetAccount(acnt1, true); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
ID: cb2ID,
|
||||
acnt2 := &utils.Account{
|
||||
Tenant: utils.CGRateSorg,
|
||||
ID: "TestV1DebitAbstractsEventCharges2",
|
||||
Balances: map[string]*utils.Balance{
|
||||
ab1ID: &utils.Balance{ // cost: 0.4 connectFee plus 0.2 per minute, available 2 minutes, should remain 10s
|
||||
ID: ab1ID,
|
||||
Type: utils.MetaAbstract,
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 40,
|
||||
},
|
||||
},
|
||||
CostIncrements: []*utils.CostIncrement{
|
||||
{
|
||||
Increment: utils.NewDecimal(int64(time.Minute), 0),
|
||||
FixedFee: utils.NewDecimal(4, 1), // 0.4
|
||||
RecurrentFee: utils.NewDecimal(2, 1)}, // 0.2 per minute
|
||||
},
|
||||
Units: utils.NewDecimal(int64(130*time.Second), 0), // 2 Minute 10s
|
||||
},
|
||||
cb1ID: &utils.Balance{ // absorb all costs, standard rating used when primary debiting
|
||||
|
||||
ID: cb1ID,
|
||||
Type: utils.MetaConcrete,
|
||||
Opts: map[string]interface{}{
|
||||
utils.MetaBalanceUnlimited: true,
|
||||
@@ -1342,7 +1378,7 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := dm.SetAccount(acnt, true); err != nil {
|
||||
if err := dm.SetAccount(acnt2, true); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -1350,9 +1386,11 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
|
||||
CGREvent: &utils.CGREvent{
|
||||
ID: "TestV1DebitAbstractsEventCharges",
|
||||
Tenant: utils.CGRateSorg,
|
||||
//APIOpts: map[string]interface{}{
|
||||
// utils.MetaUsage: "2m5s",
|
||||
//},
|
||||
Event: map[string]interface{}{
|
||||
utils.AccountField: "TestV1DebitAbstractsEventCharges",
|
||||
utils.Usage: "2m5s",
|
||||
utils.Usage: "2m5s",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user