diff --git a/data/storage/mysql/create_costdetails_tables.sql b/data/storage/mysql/create_costdetails_tables.sql index 868027892..6b2ee5a42 100644 --- a/data/storage/mysql/create_costdetails_tables.sql +++ b/data/storage/mysql/create_costdetails_tables.sql @@ -12,8 +12,8 @@ CREATE TABLE `cost_details` ( `account` varchar(128) NOT NULL, `subject` varchar(128) NOT NULL, `destination` varchar(128) NOT NULL, - `cost` DECIMAL(5,4) NOT NULL, - `connect_fee` DECIMAL(5,4) NOT NULL, + `cost` double(20,4) NOT NULL, + `connect_fee` double(20,4) NOT NULL, `timespans` text, `source` varchar(64) NOT NULL, PRIMARY KEY (`id`), diff --git a/engine/action.go b/engine/action.go index cad58c4d6..d872eca42 100644 --- a/engine/action.go +++ b/engine/action.go @@ -119,6 +119,9 @@ func resetPrepaidAction(ub *UserBalance, a *Action) (err error) { } func topupResetAction(ub *UserBalance, a *Action) (err error) { + if ub.BalanceMap == nil { // Init the map since otherwise will get error if nil + ub.BalanceMap = make(map[string]BalanceChain, 0) + } ub.BalanceMap[a.BalanceId+a.Direction] = BalanceChain{&Balance{Value: 0}} // ToDo: can ub be empty here? genericMakeNegative(a) genericDebit(ub, a)