diff --git a/data/storage/mysql/create_tariffplan_tables.sql b/data/storage/mysql/create_tariffplan_tables.sql index 546daf172..9557e7675 100644 --- a/data/storage/mysql/create_tariffplan_tables.sql +++ b/data/storage/mysql/create_tariffplan_tables.sql @@ -47,8 +47,6 @@ CREATE TABLE `tp_rates` ( `rate_unit` varchar(16) NOT NULL, `rate_increment` varchar(16) NOT NULL, `group_interval_start` varchar(16) NOT NULL, - `rounding_method` varchar(255) NOT NULL, - `rounding_decimals` tinyint(4) NOT NULL, PRIMARY KEY (`tbid`), UNIQUE KEY `unique_tprate` (`tpid`,`id`,`group_interval_start`), KEY `tpid` (`tpid`), @@ -66,6 +64,8 @@ CREATE TABLE `tp_destination_rates` ( `id` varchar(64) NOT NULL, `destinations_id` varchar(64) NOT NULL, `rates_id` varchar(64) NOT NULL, + `rounding_method` varchar(255) NOT NULL, + `rounding_decimals` tinyint(4) NOT NULL, PRIMARY KEY (`tbid`), KEY `tpid` (`tpid`), KEY `tpid_drid` (`tpid`,`id`), diff --git a/data/tariffplans/prepaid1centpsec/DestinationRates.csv b/data/tariffplans/prepaid1centpsec/DestinationRates.csv index bbfea15d5..3c841e62f 100644 --- a/data/tariffplans/prepaid1centpsec/DestinationRates.csv +++ b/data/tariffplans/prepaid1centpsec/DestinationRates.csv @@ -1,3 +1,3 @@ #Tag,DestinationsTag,RatesTag -DR_RETAIL,GERMANY,RT_1CENT -DR_RETAIL,GERMANY_MOBILE,RT_1CENT +DR_RETAIL,GERMANY,RT_1CENT,*up,2 +DR_RETAIL,GERMANY_MOBILE,RT_1CENT,*up,2 diff --git a/data/tariffplans/prepaid1centpsec/Rates.csv b/data/tariffplans/prepaid1centpsec/Rates.csv index 6602f6954..21aa20e17 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 -RT_1CENT,0,1,1s,1s,0s,*up,2 +RT_1CENT,0,1,1s,1s,0s diff --git a/engine/storage_sql.go b/engine/storage_sql.go index 67536a5b1..f1948085a 100644 --- a/engine/storage_sql.go +++ b/engine/storage_sql.go @@ -943,8 +943,9 @@ func (self *SQLStorage) GetTpDestinationRates(tpid, tag string) (map[string]*uti defer rows.Close() for rows.Next() { var id int - var tpid, tag, destinations_tag, rate_tag string - if err := rows.Scan(&id, &tpid, &tag, &destinations_tag, &rate_tag); err != nil { + var tpid, tag, destinations_tag, rate_tag, rounding_method string + var rounding_decimals int + if err := rows.Scan(&id, &tpid, &tag, &destinations_tag, &rate_tag, &rounding_method, &rounding_decimals); err != nil { return nil, err } @@ -953,8 +954,10 @@ func (self *SQLStorage) GetTpDestinationRates(tpid, tag string) (map[string]*uti DestinationRateId: tag, DestinationRates: []*utils.DestinationRate{ &utils.DestinationRate{ - DestinationId: destinations_tag, - RateId: rate_tag, + DestinationId: destinations_tag, + RateId: rate_tag, + RoundingMethod: rounding_method, + RoundingDecimals: rounding_decimals, }, }, }