From ab0475963beb6a4d4e81fb1592e57c1a7a70c0bc Mon Sep 17 00:00:00 2001 From: porosnicuadrian Date: Wed, 26 Jan 2022 18:11:10 +0200 Subject: [PATCH] Improved unitFctor in refundCharges --- accounts/accounts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/accounts.go b/accounts/accounts.go index 5e6cd2613..d17185692 100644 --- a/accounts/accounts.go +++ b/accounts/accounts.go @@ -269,7 +269,7 @@ func (aS *AccountS) refundCharges(ctx *context.Context, tnt string, ecs *utils.E for _, chrg := range ecs.Charges { acntChrg := ecs.Accounting[chrg.ChargingID] var uf *utils.UnitFactor - if _, has := ecs.UnitFactors[acntChrg.UnitFactorID]; has { + if acntChrg.UnitFactorID != utils.EmptyString { uf = ecs.UnitFactors[acntChrg.UnitFactorID] } if acntChrg.BalanceID != utils.MetaTransAbstract { // *transabstracts is not a real balance, hence the exception @@ -282,7 +282,7 @@ func (aS *AccountS) refundCharges(ctx *context.Context, tnt string, ecs *utils.E for _, chrgID := range acntChrg.JoinedChargeIDs { // refund extra charges extraChrg := ecs.Accounting[chrgID] var joinedChargeUf *utils.UnitFactor - if _, has := ecs.UnitFactors[extraChrg.UnitFactorID]; has { + if extraChrg.UnitFactorID != utils.EmptyString { joinedChargeUf = ecs.UnitFactors[extraChrg.UnitFactorID] } refundUnitsOnAccount(