diff --git a/engine/libtest.go b/engine/libtest.go index b858ee8fe..c05edea28 100644 --- a/engine/libtest.go +++ b/engine/libtest.go @@ -295,6 +295,10 @@ cgrates.org,ONE_TIME_ACT,,,,,,,SET_BALANCE_TEST_DATA,,false,0s,*set_balance,,~*b cgrates.org,ONE_TIME_ACT,,,,,,,TOPUP_TEST_DATA,,false,0s,*topup,,~*balance.TestDataBalance.Value,1024 cgrates.org,ONE_TIME_ACT,,,,,,,SET_BALANCE_TEST_VOICE,,false,0s,*set_balance,,~*balance.TestVoiceBalance.Type,*voice cgrates.org,ONE_TIME_ACT,,,,,,,TOPUP_TEST_VOICE,,false,0s,*topup,,~*balance.TestVoiceBalance.Value,15m15s +` + + AccountProfileCSVContent = ` +#Tenant,ID,FilterIDs,ActivationInterval,Weight,BalanceID,BalanceFilterIDs,BalanceWeight,BalanceBlocker,BalanceType,BalanceOpts,BalanceValue ` ) diff --git a/engine/loader_csv_test.go b/engine/loader_csv_test.go index 8b084cde1..f747d603d 100644 --- a/engine/loader_csv_test.go +++ b/engine/loader_csv_test.go @@ -42,7 +42,7 @@ func init() { ActionsCSVContent, ActionPlansCSVContent, ActionTriggersCSVContent, AccountActionsCSVContent, ResourcesCSVContent, StatsCSVContent, ThresholdsCSVContent, FiltersCSVContent, RoutesCSVContent, AttributesCSVContent, ChargersCSVContent, DispatcherCSVContent, - DispatcherHostCSVContent, RateProfileCSVContent, ActionProfileCSVContent), testTPID, "", nil, nil, false) + DispatcherHostCSVContent, RateProfileCSVContent, ActionProfileCSVContent, AccountProfileCSVContent), testTPID, "", nil, nil, false) if err != nil { log.Print("error when creating TpReader:", err) } diff --git a/engine/storage_csv.go b/engine/storage_csv.go index d50a2e36f..0bb06e650 100644 --- a/engine/storage_csv.go +++ b/engine/storage_csv.go @@ -67,6 +67,7 @@ type CSVStorage struct { dispatcherHostsFn []string rateProfilesFn []string actionProfilesFn []string + accountProfilesFn []string } // NewCSVStorage creates a CSV storege that takes the data from the paths specified @@ -76,7 +77,7 @@ func NewCSVStorage(sep rune, actionsFn, actiontimingsFn, actiontriggersFn, accountactionsFn, resProfilesFn, statsFn, thresholdsFn, filterFn, routeProfilesFn, attributeProfilesFn, chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn, - rateProfilesFn, actionProfilesFn []string) *CSVStorage { + rateProfilesFn, actionProfilesFn, accountProfilesFn []string) *CSVStorage { return &CSVStorage{ sep: sep, generator: NewCsvFile, @@ -102,6 +103,7 @@ func NewCSVStorage(sep rune, dispatcherHostsFn: dispatcherHostsFn, rateProfilesFn: rateProfilesFn, actionProfilesFn: actionProfilesFn, + accountProfilesFn: accountProfilesFn, } } @@ -133,6 +135,7 @@ func NewFileCSVStorage(sep rune, dataPath string) *CSVStorage { dispatcherhostsPaths := appendName(allFoldersPath, utils.DispatcherHostsCsv) rateProfilesFn := appendName(allFoldersPath, utils.RateProfilesCsv) actionProfilesFn := appendName(allFoldersPath, utils.ActionProfilesCsv) + accountProfilesFn := appendName(allFoldersPath, utils.AccountProfilesCsv) return NewCSVStorage(sep, destinationsPaths, timingsPaths, @@ -156,6 +159,7 @@ func NewFileCSVStorage(sep rune, dataPath string) *CSVStorage { dispatcherhostsPaths, rateProfilesFn, actionProfilesFn, + accountProfilesFn, ) } @@ -166,7 +170,7 @@ func NewStringCSVStorage(sep rune, actionsFn, actiontimingsFn, actiontriggersFn, accountactionsFn, resProfilesFn, statsFn, thresholdsFn, filterFn, routeProfilesFn, attributeProfilesFn, chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn, - rateProfilesFn, actionProfilesFn string) *CSVStorage { + rateProfilesFn, actionProfilesFn, accountProfilesFn string) *CSVStorage { c := NewCSVStorage(sep, []string{destinationsFn}, []string{timingsFn}, []string{ratesFn}, []string{destinationratesFn}, []string{destinationratetimingsFn}, []string{ratingprofilesFn}, []string{sharedgroupsFn}, []string{actionsFn}, @@ -174,7 +178,7 @@ func NewStringCSVStorage(sep rune, []string{resProfilesFn}, []string{statsFn}, []string{thresholdsFn}, []string{filterFn}, []string{routeProfilesFn}, []string{attributeProfilesFn}, []string{chargerProfilesFn}, []string{dispatcherProfilesFn}, []string{dispatcherHostsFn}, []string{rateProfilesFn}, - []string{actionProfilesFn}) + []string{actionProfilesFn}, []string{accountProfilesFn}) c.generator = NewCsvString return c } @@ -217,7 +221,8 @@ func NewGoogleCSVStorage(sep rune, spreadsheetID string) (*CSVStorage, error) { getIfExist(utils.DispatcherProfiles), getIfExist(utils.DispatcherHosts), getIfExist(utils.RateProfiles), - getIfExist(utils.ActionProfiles)) + getIfExist(utils.ActionProfiles), + getIfExist(utils.AccountProfilesString)) c.generator = func() csvReaderCloser { return &csvGoogle{ spreadsheetID: spreadsheetID, @@ -251,6 +256,7 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage { var dispatcherhostsPaths []string var rateProfilesPaths []string var actionProfilesPaths []string + var accountProfilesPaths []string for _, baseURL := range strings.Split(dataPath, utils.INFIELD_SEP) { if !strings.HasSuffix(baseURL, utils.CSVSuffix) { @@ -276,6 +282,7 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage { dispatcherhostsPaths = append(dispatcherhostsPaths, joinURL(baseURL, utils.DispatcherHostsCsv)) rateProfilesPaths = append(rateProfilesPaths, joinURL(baseURL, utils.RateProfilesCsv)) actionProfilesPaths = append(actionProfilesPaths, joinURL(baseURL, utils.ActionProfilesCsv)) + accountProfilesPaths = append(accountProfilesPaths, joinURL(baseURL, utils.AccountProfilesCsv)) continue } switch { @@ -323,6 +330,9 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage { rateProfilesPaths = append(rateProfilesPaths, baseURL) case strings.HasSuffix(baseURL, utils.ActionProfilesCsv): actionProfilesPaths = append(actionProfilesPaths, baseURL) + case strings.HasSuffix(baseURL, utils.AccountProfilesCsv): + accountProfilesPaths = append(accountProfilesPaths, baseURL) + } } @@ -349,6 +359,7 @@ func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage { dispatcherhostsPaths, rateProfilesPaths, actionProfilesPaths, + accountProfilesPaths, ) c.generator = func() csvReaderCloser { return &csvURL{} @@ -687,6 +698,18 @@ func (csvs *CSVStorage) GetTPActionProfiles(tpid, tenant, id string) ([]*utils.T return tpDPPs.AsTPActionProfile(), nil } +func (csvs *CSVStorage) GetTPAccountProfiles(tpid, tenant, id string) ([]*utils.TPAccountProfile, error) { + var tpDPPs AccountProfileMdls + if err := csvs.proccesData(AccountProfileMdl{}, csvs.accountProfilesFn, func(tp interface{}) { + dpp := tp.(AccountProfileMdl) + dpp.Tpid = tpid + tpDPPs = append(tpDPPs, &dpp) + }); err != nil { + return nil, err + } + return tpDPPs.AsTPAccountProfile(), nil +} + func (csvs *CSVStorage) GetTpIds(colName string) ([]string, error) { return nil, utils.ErrNotImplemented } diff --git a/engine/storage_interface.go b/engine/storage_interface.go index 1e8d0bceb..4b6eeb099 100644 --- a/engine/storage_interface.go +++ b/engine/storage_interface.go @@ -192,6 +192,7 @@ type LoadReader interface { GetTPDispatcherHosts(string, string, string) ([]*utils.TPDispatcherHost, error) GetTPRateProfiles(string, string, string) ([]*utils.TPRateProfile, error) GetTPActionProfiles(string, string, string) ([]*utils.TPActionProfile, error) + GetTPAccountProfiles(string, string, string) ([]*utils.TPAccountProfile, error) } type LoadWriter interface { @@ -218,6 +219,7 @@ type LoadWriter interface { SetTPDispatcherHosts([]*utils.TPDispatcherHost) error SetTPRateProfiles([]*utils.TPRateProfile) error SetTPActionProfiles([]*utils.TPActionProfile) error + SetTPAccountProfiles([]*utils.TPAccountProfile) error } // NewMarshaler returns the marshaler type selected by mrshlerStr diff --git a/engine/storage_internal_stordb.go b/engine/storage_internal_stordb.go index 96434e901..c3701a8ee 100644 --- a/engine/storage_internal_stordb.go +++ b/engine/storage_internal_stordb.go @@ -607,6 +607,28 @@ func (iDB *InternalDB) GetTPActionProfiles(tpid, tenant, id string) (tpPrfs []*u return } +func (iDB *InternalDB) GetTPAccountProfiles(tpid, tenant, id string) (tpPrfs []*utils.TPAccountProfile, err error) { + key := tpid + if tenant != utils.EmptyString { + key += utils.CONCATENATED_KEY_SEP + tenant + } + if id != utils.EmptyString { + key += utils.CONCATENATED_KEY_SEP + id + } + ids := Cache.GetItemIDs(utils.CacheTBLTPAccountProfiles, key) + for _, id := range ids { + x, ok := Cache.Get(utils.CacheTBLTPAccountProfiles, id) + if !ok || x == nil { + return nil, utils.ErrNotFound + } + tpPrfs = append(tpPrfs, x.(*utils.TPAccountProfile)) + } + if len(tpPrfs) == 0 { + return nil, utils.ErrNotFound + } + return +} + //implement LoadWriter interface func (iDB *InternalDB) RemTpData(table, tpid string, args map[string]string) (err error) { if table == utils.EmptyString { @@ -880,6 +902,17 @@ func (iDB *InternalDB) SetTPActionProfiles(tpPrfs []*utils.TPActionProfile) (err return } +func (iDB *InternalDB) SetTPAccountProfiles(tpPrfs []*utils.TPAccountProfile) (err error) { + if len(tpPrfs) == 0 { + return nil + } + for _, tpPrf := range tpPrfs { + Cache.SetWithoutReplicate(utils.CacheTBLTPAccountProfiles, utils.ConcatenatedKey(tpPrf.TPid, tpPrf.Tenant, tpPrf.ID), tpPrf, nil, + cacheCommit(utils.NonTransactional), utils.NonTransactional) + } + return +} + //implement CdrStorage interface func (iDB *InternalDB) SetCDR(cdr *CDR, allowUpdate bool) (err error) { if cdr.OrderID == 0 { diff --git a/engine/storage_mongo_stordb.go b/engine/storage_mongo_stordb.go index a483aa479..81d9c4fa4 100644 --- a/engine/storage_mongo_stordb.go +++ b/engine/storage_mongo_stordb.go @@ -1608,6 +1608,36 @@ func (ms *MongoStorage) GetTPActionProfiles(tpid, tenant, id string) ([]*utils.T return results, err } +func (ms *MongoStorage) GetTPAccountProfiles(tpid, tenant, id string) ([]*utils.TPAccountProfile, error) { + filter := bson.M{"tpid": tpid} + if id != "" { + filter["id"] = id + } + if tenant != "" { + filter["tenant"] = tenant + } + var results []*utils.TPAccountProfile + err := ms.query(func(sctx mongo.SessionContext) (err error) { + cur, err := ms.getCol(utils.TBLTPAccountProfiles).Find(sctx, filter) + if err != nil { + return err + } + for cur.Next(sctx) { + var tp utils.TPAccountProfile + err := cur.Decode(&tp) + if err != nil { + return err + } + results = append(results, &tp) + } + if len(results) == 0 { + return utils.ErrNotFound + } + return cur.Close(sctx) + }) + return results, err +} + func (ms *MongoStorage) SetTPActionProfiles(tpAps []*utils.TPActionProfile) (err error) { if len(tpAps) == 0 { return @@ -1626,6 +1656,24 @@ func (ms *MongoStorage) SetTPActionProfiles(tpAps []*utils.TPActionProfile) (err }) } +func (ms *MongoStorage) SetTPAccountProfiles(tpAps []*utils.TPAccountProfile) (err error) { + if len(tpAps) == 0 { + return + } + return ms.query(func(sctx mongo.SessionContext) (err error) { + for _, tp := range tpAps { + _, err = ms.getCol(utils.TBLTPAccountProfiles).UpdateOne(sctx, bson.M{"tpid": tp.TPid, "id": tp.ID}, + bson.M{"$set": tp}, + options.Update().SetUpsert(true), + ) + if err != nil { + return err + } + } + return nil + }) +} + func (ms *MongoStorage) GetVersions(itm string) (vrs Versions, err error) { fop := options.FindOne() if itm != "" { diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 4c3058702..4ab8f1b19 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -769,6 +769,28 @@ func (self *SQLStorage) SetTPActionProfiles(tpAps []*utils.TPActionProfile) erro return nil } +func (self *SQLStorage) SetTPAccountProfiles(tpAps []*utils.TPAccountProfile) error { + if len(tpAps) == 0 { + return nil + } + tx := self.db.Begin() + for _, tpAp := range tpAps { + // Remove previous + if err := tx.Where(&AccountProfileMdl{Tpid: tpAp.TPid, Tenant: tpAp.Tenant, ID: tpAp.ID}).Delete(AccountProfileMdl{}).Error; err != nil { + tx.Rollback() + return err + } + for _, mst := range APItoModelTPAccountProfile(tpAp) { + if err := tx.Save(&mst).Error; err != nil { + tx.Rollback() + return err + } + } + } + tx.Commit() + return nil +} + func (self *SQLStorage) SetSMCost(smc *SMCost) error { if smc.CostDetails == nil { return nil @@ -1630,6 +1652,25 @@ func (self *SQLStorage) GetTPActionProfiles(tpid, tenant, id string) ([]*utils.T return arls, nil } +func (self *SQLStorage) GetTPAccountProfiles(tpid, tenant, id string) ([]*utils.TPAccountProfile, error) { + var dpps AccountProfileMdls + q := self.db.Where("tpid = ?", tpid) + if len(id) != 0 { + q = q.Where("id = ?", id) + } + if len(tenant) != 0 { + q = q.Where("tenant = ?", tenant) + } + if err := q.Find(&dpps).Error; err != nil { + return nil, err + } + arls := dpps.AsTPAccountProfile() + if len(arls) == 0 { + return arls, utils.ErrNotFound + } + return arls, nil +} + // GetVersions returns slice of all versions or a specific version if tag is specified func (self *SQLStorage) GetVersions(itm string) (vrs Versions, err error) { q := self.db.Model(&TBLVersion{}) diff --git a/engine/tpexporter.go b/engine/tpexporter.go index 3b336bf17..e0ed0206c 100644 --- a/engine/tpexporter.go +++ b/engine/tpexporter.go @@ -334,7 +334,7 @@ func (self *TPExporter) Run() error { storDataActionProfiles, err := self.storDb.GetTPActionProfiles(self.tpID, "", "") if err != nil && err.Error() != utils.ErrNotFound.Error() { - utils.Logger.Warning(fmt.Sprintf("<%s> error: %s, when getting %s from stordb for export", utils.ApierS, err, utils.TpRateProfiles)) + utils.Logger.Warning(fmt.Sprintf("<%s> error: %s, when getting %s from stordb for export", utils.ApierS, err, utils.TpActionProfiles)) withError = true } for _, sd := range storDataActionProfiles { @@ -344,6 +344,18 @@ func (self *TPExporter) Run() error { } } + storDataAccountProfiles, err := self.storDb.GetTPAccountProfiles(self.tpID, "", "") + if err != nil && err.Error() != utils.ErrNotFound.Error() { + utils.Logger.Warning(fmt.Sprintf("<%s> error: %s, when getting %s from stordb for export", utils.ApierS, err, utils.TpAccountProfiles)) + withError = true + } + for _, sd := range storDataAccountProfiles { + sdModels := APItoModelTPAccountProfile(sd) + for _, sdModel := range sdModels { + toExportMap[utils.AccountProfilesCsv] = append(toExportMap[utils.AccountProfilesCsv], sdModel) + } + } + if len(toExportMap) == 0 { // if we don't have anything to export we return not found error return utils.ErrNotFound } diff --git a/engine/tpimporter_csv.go b/engine/tpimporter_csv.go index 71575ea2f..53c8e0aba 100644 --- a/engine/tpimporter_csv.go +++ b/engine/tpimporter_csv.go @@ -61,6 +61,8 @@ var fileHandlers = map[string]func(*TPCSVImporter, string) error{ utils.DispatcherProfilesCsv: (*TPCSVImporter).importDispatcherProfiles, utils.DispatcherHostsCsv: (*TPCSVImporter).importDispatcherHosts, utils.RateProfilesCsv: (*TPCSVImporter).importRateProfiles, + utils.ActionProfilesCsv: (*TPCSVImporter).importActionProfiles, + utils.AccountProfilesCsv: (*TPCSVImporter).importAccountProfiles, } func (self *TPCSVImporter) Run() error { @@ -369,3 +371,25 @@ func (self *TPCSVImporter) importRateProfiles(fn string) error { } return self.StorDb.SetTPRateProfiles(rpps) } + +func (self *TPCSVImporter) importActionProfiles(fn string) error { + if self.Verbose { + log.Printf("Processing file: <%s> ", fn) + } + rpps, err := self.csvr.GetTPActionProfiles(self.TPid, "", "") + if err != nil { + return err + } + return self.StorDb.SetTPActionProfiles(rpps) +} + +func (self *TPCSVImporter) importAccountProfiles(fn string) error { + if self.Verbose { + log.Printf("Processing file: <%s> ", fn) + } + rpps, err := self.csvr.GetTPAccountProfiles(self.TPid, "", "") + if err != nil { + return err + } + return self.StorDb.SetTPAccountProfiles(rpps) +} diff --git a/general_tests/acntacts_test.go b/general_tests/acntacts_test.go index a8ea761a0..526cc1e9a 100644 --- a/general_tests/acntacts_test.go +++ b/general_tests/acntacts_test.go @@ -58,7 +58,7 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,,,false,false,10` csvr, err := engine.NewTpReader(dbAcntActs.DataDB(), engine.NewStringCSVStorage(utils.CSV_SEP, destinations, timings, rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions, - resLimits, stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) + resLimits, stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) if err != nil { t.Error(err) } diff --git a/general_tests/auth_test.go b/general_tests/auth_test.go index b95d81767..ec0c8e6fb 100644 --- a/general_tests/auth_test.go +++ b/general_tests/auth_test.go @@ -60,7 +60,7 @@ func TestAuthLoadCsvError(t *testing.T) { chargerProfiles := `` csvr, err := engine.NewTpReader(dbAuth.DataDB(), engine.NewStringCSVStorage(utils.CSV_SEP, destinations, timings, rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions, - resLimits, stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) + resLimits, stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) if err != nil { t.Error(err) } @@ -94,7 +94,7 @@ cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_ANY,` chargerProfiles := `` csvr, err := engine.NewTpReader(dbAuth.DataDB(), engine.NewStringCSVStorage(utils.CSV_SEP, destinations, timings, rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions, - resLimits, stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) + resLimits, stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) if err != nil { t.Error(err) } diff --git a/general_tests/costs1_test.go b/general_tests/costs1_test.go index 0a62ed97c..9dd100b0b 100644 --- a/general_tests/costs1_test.go +++ b/general_tests/costs1_test.go @@ -59,7 +59,7 @@ cgrates.org,sms,*any,2012-01-01T00:00:00Z,RP_SMS1,` utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, - utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString), + utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString), utils.EmptyString, utils.EmptyString, nil, nil, false) if err != nil { t.Error(err) diff --git a/general_tests/datachrg1_test.go b/general_tests/datachrg1_test.go index 084a9dd0c..f88e24de0 100644 --- a/general_tests/datachrg1_test.go +++ b/general_tests/datachrg1_test.go @@ -47,7 +47,7 @@ RP_DATA1,DR_DATA_2,TM2,10` utils.EmptyString, timings, rates, destinationRates, ratingPlans, ratingProfiles, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, - utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString), + utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString), utils.EmptyString, utils.EmptyString, nil, nil, false) if err != nil { t.Error(err) diff --git a/general_tests/ddazmbl1_test.go b/general_tests/ddazmbl1_test.go index e3be91e53..69d01b896 100644 --- a/general_tests/ddazmbl1_test.go +++ b/general_tests/ddazmbl1_test.go @@ -68,7 +68,7 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10` destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions, resLimits, stats, thresholds, filters, suppliers, - attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) + attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) if err != nil { t.Error(err) } diff --git a/general_tests/ddazmbl2_test.go b/general_tests/ddazmbl2_test.go index 235b0b099..eec6f246d 100644 --- a/general_tests/ddazmbl2_test.go +++ b/general_tests/ddazmbl2_test.go @@ -66,7 +66,7 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10` csvr, err := engine.NewTpReader(dataDB2.DataDB(), engine.NewStringCSVStorage(utils.CSV_SEP, destinations, timings, rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions, resLimits, - stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) + stats, thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) if err != nil { t.Error(err) } diff --git a/general_tests/ddazmbl3_test.go b/general_tests/ddazmbl3_test.go index 926538e74..0b8412f8b 100644 --- a/general_tests/ddazmbl3_test.go +++ b/general_tests/ddazmbl3_test.go @@ -64,7 +64,7 @@ cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,` csvr, err := engine.NewTpReader(dataDB3.DataDB(), engine.NewStringCSVStorage(utils.CSV_SEP, destinations, timings, rates, destinationRates, ratingPlans, ratingProfiles, sharedGroups, actions, actionPlans, actionTriggers, accountActions, resLimits, stats, - thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) + thresholds, filters, suppliers, attrProfiles, chargerProfiles, ``, "", utils.EmptyString, utils.EmptyString, utils.EmptyString), "", "", nil, nil, false) if err != nil { t.Error(err) } diff --git a/general_tests/smschrg1_test.go b/general_tests/smschrg1_test.go index c14e78e58..be8b6f567 100644 --- a/general_tests/smschrg1_test.go +++ b/general_tests/smschrg1_test.go @@ -47,7 +47,7 @@ func TestSMSLoadCsvTpSmsChrg1(t *testing.T) { utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, - utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString), utils.EmptyString, + utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString, utils.EmptyString), utils.EmptyString, utils.EmptyString, nil, nil, false) if err != nil { t.Error(err) diff --git a/utils/consts.go b/utils/consts.go index 7e59790fe..b545a5926 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -563,6 +563,7 @@ const ( DispatcherHosts = "DispatcherHosts" RateProfiles = "RateProfiles" ActionProfiles = "ActionProfiles" + AccountProfilesString = "AccountProfiles" MetaEveryMinute = "*every_minute" MetaHourly = "*hourly" ID = "ID" @@ -1143,6 +1144,7 @@ const ( TpDispatcherHosts = "TpDispatcherHosts" TpRateProfiles = "TpRateProfiles" TpActionProfiles = "TpActionProfiles" + TpAccountProfiles = "TpAccountProfiles" ) // Dispatcher Const @@ -1840,6 +1842,7 @@ const ( DispatcherHostsCsv = "DispatcherHosts.csv" RateProfilesCsv = "RateProfiles.csv" ActionProfilesCsv = "ActionProfiles.csv" + AccountProfilesCsv = "AccountProfiles.csv" ) // Table Name