AccountS - TestV1DebitAbstractsEventCharges with Abstracts and Concretes matching, RateProfileCost with indexed Rates

This commit is contained in:
DanB
2021-05-10 16:43:26 +02:00
parent 983f74f8a8
commit 32c6b4a673
5 changed files with 15 additions and 10 deletions

View File

@@ -118,6 +118,8 @@ func (aB *abstractBalance) debitAbstracts(usage *decimal.Big,
aB.rateSConns, aB.blnCfg.RateProfileIDs,
costIcrm, dbted); err != nil {
return
} else if ecCost.Abstracts.Compare(utils.NewDecimal(0, 0)) == 0 { // no debit performed
return
}
}

View File

@@ -1428,9 +1428,8 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
cb2ID := "CB2"
// populate the Account
acnt1 := &utils.Account{
Tenant: utils.CGRateSorg,
ID: "TestV1DebitAbstractsEventCharges1",
FilterIDs: []string{"*string:*~req.Account:AnotherAccount"},
Tenant: utils.CGRateSorg,
ID: "TestV1DebitAbstractsEventCharges1",
Weights: utils.DynamicWeights{
{
Weight: 10,
@@ -1592,8 +1591,8 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
}
eEvChgs := &utils.ExtEventCharges{
Abstracts: utils.Float64Pointer(475000000000),
Concretes: utils.Float64Pointer(5.15),
Abstracts: utils.Float64Pointer(446000000000),
Concretes: utils.Float64Pointer(4.95),
Charges: []*utils.ChargeEntry{
{
ChargingID: "GENUUID1",
@@ -1743,7 +1742,6 @@ func TestV1DebitAbstractsEventCharges(t *testing.T) {
Tenant: utils.CGRateSorg,
APIOpts: map[string]interface{}{
utils.MetaUsage: "7m26s",
//utils.MetaUsage: "2m1s",
},
},
}

View File

@@ -92,6 +92,8 @@ func (cB *concreteBalance) debitAbstracts(aUnits *decimal.Big,
cB.rateSConns, cB.blnCfg.RateProfileIDs,
costIcrm, dbted); err != nil {
return
} else if ecCncrt.Abstracts.Compare(utils.NewDecimal(0, 0)) == 0 { // no debit performed
return
}
ec = utils.NewEventCharges()
ec.Abstracts = ecCncrt.Abstracts

View File

@@ -40,10 +40,11 @@ type EventCharges struct {
Charges []*ChargeEntry
Accounting map[string]*AccountCharge
UnitFactors map[string]*UnitFactor
Rating map[string]*RateSInterval
Accounts map[string]*Account
Accounting map[string]*AccountCharge
UnitFactors map[string]*UnitFactor
Rating map[string]*RateSInterval
IntervalRates map[string]*IntervalRate
Accounts map[string]*Account
}
// ChargeEntry is a reference towards Accounting or Rating ID (depending on request type)

View File

@@ -413,6 +413,7 @@ type RateSIncrement struct {
IncrementStart *Decimal
Rate *Rate
IntervalRateIndex int
RateID string
CompressFactor int64
Usage *Decimal
@@ -533,6 +534,7 @@ type RateProfileCost struct {
MaxCost float64
MaxCostStrategy string
RateSIntervals []*RateSInterval
Rates map[string]*IntervalRate
Altered []string
}