diff --git a/accounts/absolutebalance.go b/accounts/absolutebalance.go index 5c02a3df2..257c937db 100644 --- a/accounts/absolutebalance.go +++ b/accounts/absolutebalance.go @@ -43,5 +43,9 @@ type abstractBalance struct { // debit implements the balanceOperator interface func (ab *abstractBalance) debit(cgrEv *utils.CGREventWithOpts, startTime time.Time, usage *decimal.Big) (ec *utils.EventCharges, err error) { + //var uF *utils.UsageFactor + if _, err = usageWithFactor(usage, ab.blnCfg, ab.fltrS, cgrEv); err != nil { + return + } return } diff --git a/utils/cgrevent.go b/utils/cgrevent.go index 614f50e4c..211325f82 100644 --- a/utils/cgrevent.go +++ b/utils/cgrevent.go @@ -150,6 +150,8 @@ type CGREvents struct { type CGREventWithOpts struct { Opts map[string]interface{} *CGREvent + + cache map[string]interface{} } // Clone return a copy of the CGREventWithOpts @@ -170,6 +172,34 @@ func (ev *CGREventWithOpts) Clone() (clned *CGREventWithOpts) { return } +// CacheInit will initialize the cache if not already done +func (ev *CGREventWithOpts) CacheInit() { + if ev.cache == nil { + ev.cache = make(map[string]interface{}) + } +} + +// CacheClear will reset the cache +func (ev *CGREventWithOpts) CacheClear() { + ev.cache = make(map[string]interface{}) +} + +// CacheGet will return a key from the cache +func (ev *CGREventWithOpts) CacheGet(key string) (itm interface{}, has bool) { + itm, has = ev.cache[key] + return +} + +// CacheSet will set data into the event's cache +func (ev *CGREventWithOpts) CacheSet(key string, val interface{}) { + ev.cache[key] = val +} + +// CacheRemove will remove data from cache +func (ev *CGREventWithOpts) CacheRemove(key string) { + delete(ev.cache, key) +} + // EventWithFlags is used where flags are needed to mark processing type EventWithFlags struct { Flags []string