mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Removed BalanceBlocker field from Balance
This commit is contained in:
committed by
Dan Christian Bogos
parent
b1d63c55e6
commit
db53fa7df1
@@ -298,9 +298,9 @@ cgrates.org,ONE_TIME_ACT,,,,,,,TOPUP_TEST_VOICE,,false,0s,*topup,,~*balance.Test
|
||||
`
|
||||
|
||||
AccountProfileCSVContent = `
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Weights,Opts,BalanceID,BalanceFilterIDs,BalanceWeights,BalanceBlocker,BalanceType,BalanceUnits,BalanceUnitFactors,BalanceOpts,BalanceCostIncrements,BalanceAttributeIDs,BalanceRateProfileIDs,ThresholdIDs
|
||||
cgrates.org,1001,,,;20,,MonetaryBalance,,;10,,*monetary,14,fltr1&fltr2;100;fltr3;200,,fltr1&fltr2;1.3;2.3;3.3,attr1;attr2,,*none
|
||||
cgrates.org,1001,,,,,VoiceBalance,,;10,,*voice,3600000000000,,,,,,
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Weights,Opts,BalanceID,BalanceFilterIDs,BalanceWeights,BalanceType,BalanceUnits,BalanceUnitFactors,BalanceOpts,BalanceCostIncrements,BalanceAttributeIDs,BalanceRateProfileIDs,ThresholdIDs
|
||||
cgrates.org,1001,,,;20,,MonetaryBalance,,;10,*monetary,14,fltr1&fltr2;100;fltr3;200,,fltr1&fltr2;1.3;2.3;3.3,attr1;attr2,,*none
|
||||
cgrates.org,1001,,,,,VoiceBalance,,;10,*voice,3600000000000,,,,,,
|
||||
`
|
||||
)
|
||||
|
||||
|
||||
@@ -3463,7 +3463,6 @@ func (tps AccountProfileMdls) AsTPAccountProfile() (result []*utils.TPAccountPro
|
||||
aPrf.Balances[tp.BalanceID] = &utils.TPAccountBalance{
|
||||
ID: tp.BalanceID,
|
||||
Weights: tp.BalanceWeights,
|
||||
Blocker: tp.BalanceBlocker,
|
||||
Type: tp.BalanceType,
|
||||
Opts: tp.BalanceOpts,
|
||||
Units: tp.BalanceUnits,
|
||||
@@ -3571,7 +3570,6 @@ func APItoModelTPAccountProfile(tPrf *utils.TPAccountProfile) (mdls AccountProfi
|
||||
}
|
||||
mdl.BalanceFilterIDs += val
|
||||
}
|
||||
mdl.BalanceBlocker = balance.Blocker
|
||||
mdl.BalanceWeights = balance.Weights
|
||||
mdl.BalanceType = balance.Type
|
||||
mdl.BalanceOpts = balance.Opts
|
||||
@@ -3634,7 +3632,6 @@ func APItoAccountProfile(tpAp *utils.TPAccountProfile, timezone string) (ap *uti
|
||||
ap.Balances[id] = &utils.Balance{
|
||||
ID: bal.ID,
|
||||
FilterIDs: bal.FilterIDs,
|
||||
Blocker: bal.Blocker,
|
||||
Type: bal.Type,
|
||||
Units: utils.NewDecimalFromFloat64(bal.Units),
|
||||
}
|
||||
@@ -3728,7 +3725,6 @@ func AccountProfileToAPI(ap *utils.AccountProfile) (tpAp *utils.TPAccountProfile
|
||||
ID: bal.ID,
|
||||
FilterIDs: make([]string, len(bal.FilterIDs)),
|
||||
Weights: bal.Weights.String(";", "&"),
|
||||
Blocker: bal.Blocker,
|
||||
Type: bal.Type,
|
||||
CostIncrement: make([]*utils.TPBalanceCostIncrement, len(bal.CostIncrements)),
|
||||
AttributeIDs: make([]string, len(bal.AttributeIDs)),
|
||||
|
||||
@@ -6878,7 +6878,6 @@ func TestAccountProfileMdlsAsTPAccountProfile(t *testing.T) {
|
||||
BalanceID: "VoiceBalance",
|
||||
BalanceFilterIDs: "FLTR_RES_GR2",
|
||||
BalanceWeights: "10",
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.MetaVoice,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1",
|
||||
@@ -6927,7 +6926,6 @@ func TestAccountProfileMdlsAsTPAccountProfileCase2(t *testing.T) {
|
||||
BalanceID: "VoiceBalance",
|
||||
BalanceFilterIDs: "FLTR_RES_GR2",
|
||||
BalanceWeights: "10",
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.MetaVoice,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1",
|
||||
@@ -7032,7 +7030,6 @@ func TestAPItoModelTPAccountProfile(t *testing.T) {
|
||||
BalanceID: "VoiceBalance",
|
||||
BalanceFilterIDs: "FLTR_RES_GR2",
|
||||
BalanceWeights: "10",
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.MetaVoice,
|
||||
BalanceUnits: 3600000000000,
|
||||
ThresholdIDs: "WARN_RES1",
|
||||
@@ -7121,7 +7118,6 @@ func TestAPItoModelTPAccountProfileCase2(t *testing.T) {
|
||||
BalanceID: "VoiceBalance",
|
||||
BalanceFilterIDs: "FLTR_RES_GR1;FLTR_RES_GR2",
|
||||
BalanceWeights: "10",
|
||||
BalanceBlocker: false,
|
||||
BalanceType: utils.MetaVoice,
|
||||
BalanceCostIncrements: "*string:*~req.Account:100;1;20;5;*string:*~req.Destination:10;2;10;7",
|
||||
BalanceAttributeIDs: "20;30",
|
||||
|
||||
@@ -578,15 +578,14 @@ type AccountProfileMdl struct {
|
||||
BalanceID string `index:"6" re:""`
|
||||
BalanceFilterIDs string `index:"7" re:""`
|
||||
BalanceWeights string `index:"8" re:""`
|
||||
BalanceBlocker bool `index:"9" re:""`
|
||||
BalanceType string `index:"10" re:""`
|
||||
BalanceUnits float64 `index:"11" re:"\d+\.?\d*"`
|
||||
BalanceUnitFactors string `index:"12" re:""`
|
||||
BalanceOpts string `index:"13" re:""`
|
||||
BalanceCostIncrements string `index:"14" re:""`
|
||||
BalanceAttributeIDs string `index:"15" re:""`
|
||||
BalanceRateProfileIDs string `index:"16" re:""`
|
||||
ThresholdIDs string `index:"17" re:""`
|
||||
BalanceType string `index:"9" re:""`
|
||||
BalanceUnits float64 `index:"10" re:"\d+\.?\d*"`
|
||||
BalanceUnitFactors string `index:"11" re:""`
|
||||
BalanceOpts string `index:"12" re:""`
|
||||
BalanceCostIncrements string `index:"13" re:""`
|
||||
BalanceAttributeIDs string `index:"14" re:""`
|
||||
BalanceRateProfileIDs string `index:"15" re:""`
|
||||
ThresholdIDs string `index:"16" re:""`
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
|
||||
@@ -525,11 +525,19 @@ func testExpVerifyAccountProfiles(t *testing.T) {
|
||||
},
|
||||
ThresholdIDs: []string{"*none"},
|
||||
}
|
||||
sort.Strings(acctPrf.Balances["MonetaryBalance"].CostIncrements[0].FilterIDs)
|
||||
sort.Strings(acctPrf.Balances["MonetaryBalance"].UnitFactors[0].FilterIDs)
|
||||
sort.Strings(acctPrf.Balances["MonetaryBalance"].AttributeIDs)
|
||||
if err := expRpc.Call(utils.APIerSv1GetAccountProfile, &utils.TenantIDWithOpts{
|
||||
TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ACC_PRF_1"}}, &reply); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !reflect.DeepEqual(acctPrf, reply) {
|
||||
t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(acctPrf), utils.ToJSON(reply))
|
||||
} else {
|
||||
sort.Strings(acctPrf.Balances["MonetaryBalance"].CostIncrements[0].FilterIDs)
|
||||
sort.Strings(acctPrf.Balances["MonetaryBalance"].UnitFactors[0].FilterIDs)
|
||||
sort.Strings(acctPrf.Balances["MonetaryBalance"].AttributeIDs)
|
||||
if !reflect.DeepEqual(acctPrf, reply) {
|
||||
t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(acctPrf), utils.ToJSON(reply))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ type Balance struct {
|
||||
ID string // Balance identificator, unique within an Account
|
||||
FilterIDs []string
|
||||
Weights DynamicWeights
|
||||
Blocker bool
|
||||
Type string
|
||||
Opts map[string]interface{}
|
||||
CostIncrements []*CostIncrement
|
||||
@@ -191,7 +190,6 @@ func (aI *ActivationInterval) Clone() *ActivationInterval {
|
||||
func (bL *Balance) Clone() (blnc *Balance) {
|
||||
blnc = &Balance{
|
||||
ID: bL.ID,
|
||||
Blocker: bL.Blocker,
|
||||
Weights: bL.Weights.Clone(),
|
||||
Type: bL.Type,
|
||||
}
|
||||
@@ -376,7 +374,6 @@ type APIBalance struct {
|
||||
ID string // Balance identificator, unique within an Account
|
||||
FilterIDs []string
|
||||
Weights string
|
||||
Blocker bool
|
||||
Type string
|
||||
Opts map[string]interface{}
|
||||
CostIncrements []*APICostIncrement
|
||||
@@ -391,7 +388,6 @@ func (ext *APIBalance) AsBalance() (balance *Balance, err error) {
|
||||
balance = &Balance{
|
||||
ID: ext.ID,
|
||||
FilterIDs: ext.FilterIDs,
|
||||
Blocker: ext.Blocker,
|
||||
Type: ext.Type,
|
||||
Opts: ext.Opts,
|
||||
AttributeIDs: ext.AttributeIDs,
|
||||
|
||||
@@ -35,8 +35,7 @@ func TestCloneBalance(t *testing.T) {
|
||||
Weight: 1.1,
|
||||
},
|
||||
},
|
||||
Blocker: true,
|
||||
Type: "*abstract",
|
||||
Type: "*abstract",
|
||||
Opts: map[string]interface{}{
|
||||
"Destination": 10,
|
||||
},
|
||||
@@ -94,8 +93,7 @@ func TestCloneAccountProfile(t *testing.T) {
|
||||
Weight: 1.1,
|
||||
},
|
||||
},
|
||||
Blocker: true,
|
||||
Type: "*abstract",
|
||||
Type: "*abstract",
|
||||
Opts: map[string]interface{}{
|
||||
"Destination": 10,
|
||||
},
|
||||
@@ -151,7 +149,6 @@ func TestAccountProfileAsAccountProfile(t *testing.T) {
|
||||
ID: "VoiceBalance",
|
||||
FilterIDs: []string{"*string:~*req.Account:1001"},
|
||||
Weights: ";1.2",
|
||||
Blocker: true,
|
||||
Type: "*abstract",
|
||||
Opts: map[string]interface{}{
|
||||
"Destination": 10,
|
||||
@@ -174,8 +171,7 @@ func TestAccountProfileAsAccountProfile(t *testing.T) {
|
||||
Weight: 1.2,
|
||||
},
|
||||
},
|
||||
Blocker: true,
|
||||
Type: "*abstract",
|
||||
Type: "*abstract",
|
||||
Opts: map[string]interface{}{
|
||||
"Destination": 10,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user