mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-25 09:08:45 +05:00
Rename from BalanceValue to BalanceUnits for AccountProfile
This commit is contained in:
committed by
Dan Christian Bogos
parent
6980a3f322
commit
1ff5adfa9d
@@ -1657,7 +1657,7 @@ func TestLoadAccountProfiles(t *testing.T) {
|
||||
Factor: 200,
|
||||
},
|
||||
},
|
||||
Value: 14,
|
||||
Units: 14,
|
||||
},
|
||||
&utils.TPAccountBalance{
|
||||
ID: "VoiceBalance",
|
||||
@@ -1667,7 +1667,7 @@ func TestLoadAccountProfiles(t *testing.T) {
|
||||
CostIncrement: []*utils.TPBalanceCostIncrement{},
|
||||
CostAttributes: []string{},
|
||||
UnitFactors: []*utils.TPBalanceUnitFactor{},
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{utils.META_NONE},
|
||||
|
||||
@@ -3507,7 +3507,7 @@ func (apm AccountProfileMdls) CSVHeader() (result []string) {
|
||||
return []string{"#" + utils.Tenant, utils.ID, utils.FilterIDs,
|
||||
utils.ActivationIntervalString, utils.Weight, utils.BalanceID,
|
||||
utils.BalanceFilterIDs, utils.BalanceWeight, utils.BalanceBlocker,
|
||||
utils.BalanceType, utils.BalanceOpts, utils.BalanceValue, utils.ThresholdIDs,
|
||||
utils.BalanceType, utils.BalanceOpts, utils.BalanceUnits, utils.ThresholdIDs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3611,7 +3611,7 @@ func (tps AccountProfileMdls) AsTPAccountProfile() (result []*utils.TPAccountPro
|
||||
CostIncrement: costIncrements,
|
||||
CostAttributes: costAttributes,
|
||||
UnitFactors: unitFactors,
|
||||
Value: tp.BalanceValue,
|
||||
Units: tp.BalanceUnits,
|
||||
})
|
||||
}
|
||||
actPrfMap[tenID] = aPrf
|
||||
@@ -3694,7 +3694,7 @@ func APItoModelTPAccountProfile(tPrf *utils.TPAccountProfile) (mdls AccountProfi
|
||||
}
|
||||
mdl.BalanceUnitFactors += unitFactor.AsString()
|
||||
}
|
||||
mdl.BalanceValue = balance.Value
|
||||
mdl.BalanceUnits = balance.Units
|
||||
mdls = append(mdls, mdl)
|
||||
i++
|
||||
}
|
||||
@@ -3726,7 +3726,7 @@ func APItoAccountProfile(tpAp *utils.TPAccountProfile, timezone string) (ap *uti
|
||||
Weight: bal.Weight,
|
||||
Blocker: bal.Blocker,
|
||||
Type: bal.Type,
|
||||
Value: bal.Value,
|
||||
Units: bal.Units,
|
||||
}
|
||||
if bal.Opts != utils.EmptyString {
|
||||
ap.Balances[i].Opts = make(map[string]interface{})
|
||||
@@ -3815,7 +3815,7 @@ func AccountProfileToAPI(ap *utils.AccountProfile) (tpAp *utils.TPAccountProfile
|
||||
Weight: bal.Weight,
|
||||
Blocker: bal.Blocker,
|
||||
Type: bal.Type,
|
||||
Value: bal.Value,
|
||||
Units: bal.Units,
|
||||
}
|
||||
|
||||
elems := make([]string, 0, len(bal.Opts))
|
||||
|
||||
@@ -6960,7 +6960,7 @@ func TestModelHelpersCSVLoadErrorBool(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourceMdlsCSVHeader(t *testing.T) {
|
||||
func TestAccountProfileMdlsCSVHeader(t *testing.T) {
|
||||
testStruct := AccountProfileMdls{{
|
||||
Tpid: "TEST_TPID",
|
||||
Tenant: "cgrates.org",
|
||||
@@ -6974,7 +6974,7 @@ func TestResourceMdlsCSVHeader(t *testing.T) {
|
||||
exp := []string{"#" + utils.Tenant, utils.ID, utils.FilterIDs,
|
||||
utils.ActivationIntervalString, utils.Weight, utils.BalanceID,
|
||||
utils.BalanceFilterIDs, utils.BalanceWeight, utils.BalanceBlocker,
|
||||
utils.BalanceType, utils.BalanceOpts, utils.BalanceValue, utils.ThresholdIDs}
|
||||
utils.BalanceType, utils.BalanceOpts, utils.BalanceUnits, utils.ThresholdIDs}
|
||||
result := testStruct.CSVHeader()
|
||||
if !reflect.DeepEqual(exp, result) {
|
||||
t.Errorf("Expecting: %+v,\nreceived: %+v", utils.ToJSON(exp), utils.ToJSON(result))
|
||||
@@ -6995,7 +6995,7 @@ func TestAccountProfileMdlsAsTPAccountProfile(t *testing.T) {
|
||||
BalanceWeight: 10,
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.VOICE,
|
||||
BalanceValue: 3600000000000,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1",
|
||||
},
|
||||
}
|
||||
@@ -7019,7 +7019,7 @@ func TestAccountProfileMdlsAsTPAccountProfile(t *testing.T) {
|
||||
CostIncrement: []*utils.TPBalanceCostIncrement{},
|
||||
CostAttributes: []string{},
|
||||
UnitFactors: []*utils.TPBalanceUnitFactor{},
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{"WARN_RES1"},
|
||||
@@ -7047,7 +7047,7 @@ func TestAccountProfileMdlsAsTPAccountProfileCase2(t *testing.T) {
|
||||
BalanceWeight: 10,
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.VOICE,
|
||||
BalanceValue: 3600000000000,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1",
|
||||
},
|
||||
}
|
||||
@@ -7070,7 +7070,7 @@ func TestAccountProfileMdlsAsTPAccountProfileCase2(t *testing.T) {
|
||||
CostIncrement: []*utils.TPBalanceCostIncrement{},
|
||||
CostAttributes: []string{},
|
||||
UnitFactors: []*utils.TPBalanceUnitFactor{},
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{"WARN_RES1"},
|
||||
@@ -7101,7 +7101,7 @@ func TestAPItoModelTPAccountProfile(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{"WARN_RES1"},
|
||||
@@ -7118,7 +7118,7 @@ func TestAPItoModelTPAccountProfile(t *testing.T) {
|
||||
BalanceWeight: 10,
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.VOICE,
|
||||
BalanceValue: 3600000000000,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1",
|
||||
}}
|
||||
result := APItoModelTPAccountProfile(testStruct)
|
||||
@@ -7165,7 +7165,7 @@ func TestAPItoModelTPAccountProfileCase2(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR1", "FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{"WARN_RES1", "WARN_RES2"},
|
||||
@@ -7182,7 +7182,7 @@ func TestAPItoModelTPAccountProfileCase2(t *testing.T) {
|
||||
BalanceWeight: 10,
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.VOICE,
|
||||
BalanceValue: 3600000000000,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1;WARN_RES2",
|
||||
}}
|
||||
sort.Strings(testStruct.FilterIDs)
|
||||
@@ -7210,7 +7210,7 @@ func TestApitoAccountProfileCase2(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
Opts: "key1:val1",
|
||||
},
|
||||
},
|
||||
@@ -7230,7 +7230,7 @@ func TestApitoAccountProfileCase2(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
Opts: map[string]interface{}{
|
||||
"key1": "val1",
|
||||
},
|
||||
@@ -7262,7 +7262,7 @@ func TestApitoAccountProfileCaseTimeError(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{"WARN_RES1"},
|
||||
@@ -7289,7 +7289,7 @@ func TestApitoAccountProfileCaseTimeError2(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
Opts: "22:22:4fs",
|
||||
},
|
||||
},
|
||||
@@ -7388,7 +7388,7 @@ func TestModelHelpersAccountProfileToAPI(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
Opts: map[string]interface{}{
|
||||
"key1": "val1",
|
||||
},
|
||||
@@ -7410,7 +7410,7 @@ func TestModelHelpersAccountProfileToAPI(t *testing.T) {
|
||||
FilterIDs: []string{"FLTR_RES_GR2"},
|
||||
Weight: 10,
|
||||
Type: utils.VOICE,
|
||||
Value: 3600000000000,
|
||||
Units: 3600000000000,
|
||||
Opts: "22:22:4fs",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -586,7 +586,7 @@ type AccountProfileMdl struct {
|
||||
BalanceCostIncrements string `index:"11" re:""`
|
||||
BalanceCostAttributes string `index:"12" re:""`
|
||||
BalanceUnitFactors string `index:"13" re:""`
|
||||
BalanceValue float64 `index:"14" re:"\d+\.?\d*"`
|
||||
BalanceUnits float64 `index:"14" re:"\d+\.?\d*"`
|
||||
ThresholdIDs string `index:"15" re:""`
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ func testStorDBitCRUDTPAccountProfiles(t *testing.T) {
|
||||
Factor: 200,
|
||||
},
|
||||
},
|
||||
Value: 14,
|
||||
Units: 14,
|
||||
},
|
||||
},
|
||||
ThresholdIDs: []string{utils.META_NONE},
|
||||
|
||||
Reference in New Issue
Block a user