diff --git a/apier/v1/tpactions.go b/apier/v1/tpactions.go index 15ee69612..3c7569cd2 100644 --- a/apier/v1/tpactions.go +++ b/apier/v1/tpactions.go @@ -55,7 +55,7 @@ func (self *ApierV1) SetTPActions(attrs utils.TPActions, reply *string) error { Balance: &engine.Balance{ Value: act.Units, DestinationId: act.DestinationId, - RateSubject: act.RateSubject, + RateSubject: act.RatingSubject, Weight: act.BalanceWeight, }, Weight: act.Weight, diff --git a/config/config.go b/config/config.go index 3a2bea688..372dc262b 100644 --- a/config/config.go +++ b/config/config.go @@ -45,14 +45,14 @@ type CGRConfig struct { DataDBName string // The name of the database to connect to. DataDBUser string // The user to sign in as. DataDBPass string // The user's password. - DataDBEncoding string // The encoding used to store objects in string keys + DataDBEncoding string // The encoding used to store objects in string keys StorDBType string // Should reflect the database type used to store logs StorDBHost string // The host to connect to. Values that start with / are for UNIX domain sockets. StorDBPort string // The port to bind to. StorDBName string // The name of the database to connect to. StorDBUser string // The user to sign in as. StorDBPass string // The user's password. - DBDataEncoding string // The encoding used to store object data in strings: + DBDataEncoding string // The encoding used to store object data in strings: RPCEncoding string // RPC encoding used on APIs: . DefaultReqType string // Use this request type if not defined on top DefaultTOR string // set default type of record diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index 6f24eb81f..12e2c6e0d 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -46,7 +46,6 @@ CREATE TABLE `tp_rates` ( `group_interval_start` int(11) NOT NULL, `rounding_method` varchar(255) NOT NULL, `rounding_decimals` tinyint(4) NOT NULL, - `weight` decimal(5,2) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unique_tprate` (`tpid`,`tag`,`group_interval_start`), KEY `tpid` (`tpid`), diff --git a/data/tariffplans/fs_germany_prep1/Rates.csv b/data/tariffplans/fs_germany_prep1/Rates.csv index 803b91c3d..23615c56c 100644 --- a/data/tariffplans/fs_germany_prep1/Rates.csv +++ b/data/tariffplans/fs_germany_prep1/Rates.csv @@ -1,7 +1,7 @@ -#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals,Weight -LANDLINE_PEAK,0.02,0.02,60s,60s,0s,*up,4,10 -LANDLINE_PEAK,0.02,0.01,1s,1s,60s,*up,4,10 -MOBILE_PEAK,0.02,0.14,60s,60s,0s,*up,4,10 -LANDLINE_OFFPEAK,1,0,60s,60s,0s,*up,4,10 -MOBILE_OFFPEAK,0.02,0.1,60s,60s,0,*up,4,10 -RT_FS_USERS,0,0,60s,60s,0s,*up,0,10 +#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals +LANDLINE_PEAK,0.02,0.02,60s,60s,0s,*up,4 +LANDLINE_PEAK,0.02,0.01,1s,1s,60s,*up,4 +MOBILE_PEAK,0.02,0.14,60s,60s,0s,*up,4 +LANDLINE_OFFPEAK,1,0,60s,60s,0s,*up,4 +MOBILE_OFFPEAK,0.02,0.1,60s,60s,0,*up,4 +RT_FS_USERS,0,0,60s,60s,0s,*up,0 diff --git a/data/tariffplans/prepaid1centpsec/Rates.csv b/data/tariffplans/prepaid1centpsec/Rates.csv index a9edb8b24..d3c284a8f 100644 --- a/data/tariffplans/prepaid1centpsec/Rates.csv +++ b/data/tariffplans/prepaid1centpsec/Rates.csv @@ -1,2 +1,2 @@ -#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals,Weight -RT_FS_USERS,0,0,60s,60s,0s,*up,0,10 +#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart,RoundingMethod,RoundingDecimals +RT_FS_USERS,0,0,60s,60s,0s,*up,0 diff --git a/engine/storage_sql.go b/engine/storage_sql.go index a32fb4fb0..c8b635e57 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -196,14 +196,14 @@ func (self *SQLStorage) SetTPRates(tpid string, rts map[string][]*LoadRate) erro if len(rts) == 0 { return nil //Nothing to set } - qry := fmt.Sprintf("INSERT INTO %s (tpid, tag, connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals, weight) VALUES ", utils.TBL_TP_RATES) + qry := fmt.Sprintf("INSERT INTO %s (tpid, tag, connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals) VALUES ", utils.TBL_TP_RATES) i := 0 for rtId, rtRows := range rts { for _, rt := range rtRows { if i != 0 { //Consecutive values after the first will be prefixed with "," as separator qry += "," } - qry += fmt.Sprintf("('%s', '%s', %f, %f, %d, %d,%d,'%s', %d, %f)", + qry += fmt.Sprintf("('%s', '%s', %f, %f, %d, %d,%d,'%s', %d)", tpid, rtId, rt.ConnectFee, rt.Price, rt.RateUnit, rt.RateIncrement, rt.GroupIntervalStart, rt.RoundingMethod, rt.RoundingDecimals) i++ @@ -216,7 +216,7 @@ func (self *SQLStorage) SetTPRates(tpid string, rts map[string][]*LoadRate) erro } func (self *SQLStorage) GetTPRate(tpid, rtId string) (*utils.TPRate, error) { - rows, err := self.Db.Query(fmt.Sprintf("SELECT connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals, weight FROM %s WHERE tpid='%s' AND tag='%s'", utils.TBL_TP_RATES, tpid, rtId)) + rows, err := self.Db.Query(fmt.Sprintf("SELECT connect_fee, rate, rate_unit, rate_increment, group_interval_start, rounding_method, rounding_decimals FROM %s WHERE tpid='%s' AND tag='%s'", utils.TBL_TP_RATES, tpid, rtId)) if err != nil { return nil, err } @@ -225,11 +225,11 @@ func (self *SQLStorage) GetTPRate(tpid, rtId string) (*utils.TPRate, error) { i := 0 for rows.Next() { i++ //Keep here a reference so we know we got at least one prefix - var connectFee, rate, weight float64 + var connectFee, rate float64 var roundingDecimals int var rateUnit, rateIncrement, groupIntervalStart time.Duration var roundingMethod string - err = rows.Scan(&connectFee, &rate, &rateUnit, &rateIncrement, &groupIntervalStart, &roundingMethod, &roundingDecimals, &weight) + err = rows.Scan(&connectFee, &rate, &rateUnit, &rateIncrement, &groupIntervalStart, &roundingMethod, &roundingDecimals) if err != nil { return nil, err } diff --git a/utils/apitpdata.go b/utils/apitpdata.go index c9b616af6..6bddfe402 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -96,7 +96,7 @@ type Action struct { Units float64 // Number of units to add/deduct ExpiryTime string // Time when the units will expire DestinationId string // Destination profile id - RateSubject string // Reference a rate subject defined in RatingProfiles + RatingSubject string // Reference a rate subject defined in RatingProfiles BalanceWeight float64 // Balance weight ExtraParameters string Weight float64 // Action's weight diff --git a/utils/consts.go b/utils/consts.go index fa1800b8c..73588cc28 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -55,6 +55,6 @@ const ( ROUNDING_MIDDLE = "*middle" ROUNDING_DOWN = "*down" COMMENT_CHAR = '#' - JSON = "json" - MSGPACK = "msgpack" + JSON = "json" + MSGPACK = "msgpack" )