Add action type *dynamic_action_plan_accounts and tests for it

This commit is contained in:
arberkatellari
2025-06-03 15:24:57 +02:00
committed by Dan Christian Bogos
parent 2d94ca89bb
commit 801631196d
18 changed files with 733 additions and 147 deletions

View File

@@ -1170,57 +1170,58 @@ const (
// Actions
const (
MetaLog = "*log"
MetaResetTriggers = "*reset_triggers"
MetaSetRecurrent = "*set_recurrent"
MetaUnsetRecurrent = "*unset_recurrent"
MetaAllowNegative = "*allow_negative"
MetaDenyNegative = "*deny_negative"
MetaResetAccount = "*reset_account"
MetaRemoveAccount = "*remove_account"
MetaRemoveBalance = "*remove_balance"
MetaTopUpReset = "*topup_reset"
MetaTopUp = "*topup"
MetaDebitReset = "*debit_reset"
MetaDebit = "*debit"
MetaTransferBalance = "*transfer_balance"
MetaResetCounters = "*reset_counters"
MetaEnableAccount = "*enable_account"
MetaDisableAccount = "*disable_account"
HttpPostAsync = "*http_post_async"
MetaMailAsync = "*mail_async"
MetaUnlimited = "*unlimited"
CDRLog = "*cdrlog"
MetaSetDDestinations = "*set_ddestinations"
MetaTransferMonetaryDefault = "*transfer_monetary_default"
MetaCgrRpc = "*cgr_rpc"
MetaAlterSessions = "*alter_sessions"
MetaForceDisconnectSessions = "*force_disconnect_sessions"
TopUpZeroNegative = "*topup_zero_negative"
SetExpiry = "*set_expiry"
MetaPublishAccount = "*publish_account"
MetaRemoveSessionCosts = "*remove_session_costs"
MetaRemoveExpired = "*remove_expired"
MetaPostEvent = "*post_event"
MetaCDRAccount = "*reset_account_cdr"
MetaResetThreshold = "*reset_threshold"
MetaResetStatQueue = "*reset_stat_queue"
MetaRemoteSetAccount = "*remote_set_account"
MetaDynamicThreshold = "*dynamic_threshold"
MetaDynamicStats = "*dynamic_stats"
MetaDynamicAttribute = "*dynamic_attribute"
MetaDynamicActionPlan = "*dynamic_action_plan"
MetaDynamicAction = "*dynamic_action"
MetaDynamicDestination = "*dynamic_destination"
MetaDynamicFilter = "*dynamic_filter"
MetaDynamicRoute = "*dynamic_route"
MetaDynamicRanking = "*dynamic_ranking"
ActionID = "ActionID"
ActionType = "ActionType"
ActionValue = "ActionValue"
BalanceValue = "BalanceValue"
BalanceUnits = "BalanceUnits"
ExtraParameters = "ExtraParameters"
MetaLog = "*log"
MetaResetTriggers = "*reset_triggers"
MetaSetRecurrent = "*set_recurrent"
MetaUnsetRecurrent = "*unset_recurrent"
MetaAllowNegative = "*allow_negative"
MetaDenyNegative = "*deny_negative"
MetaResetAccount = "*reset_account"
MetaRemoveAccount = "*remove_account"
MetaRemoveBalance = "*remove_balance"
MetaTopUpReset = "*topup_reset"
MetaTopUp = "*topup"
MetaDebitReset = "*debit_reset"
MetaDebit = "*debit"
MetaTransferBalance = "*transfer_balance"
MetaResetCounters = "*reset_counters"
MetaEnableAccount = "*enable_account"
MetaDisableAccount = "*disable_account"
HttpPostAsync = "*http_post_async"
MetaMailAsync = "*mail_async"
MetaUnlimited = "*unlimited"
CDRLog = "*cdrlog"
MetaSetDDestinations = "*set_ddestinations"
MetaTransferMonetaryDefault = "*transfer_monetary_default"
MetaCgrRpc = "*cgr_rpc"
MetaAlterSessions = "*alter_sessions"
MetaForceDisconnectSessions = "*force_disconnect_sessions"
TopUpZeroNegative = "*topup_zero_negative"
SetExpiry = "*set_expiry"
MetaPublishAccount = "*publish_account"
MetaRemoveSessionCosts = "*remove_session_costs"
MetaRemoveExpired = "*remove_expired"
MetaPostEvent = "*post_event"
MetaCDRAccount = "*reset_account_cdr"
MetaResetThreshold = "*reset_threshold"
MetaResetStatQueue = "*reset_stat_queue"
MetaRemoteSetAccount = "*remote_set_account"
MetaDynamicThreshold = "*dynamic_threshold"
MetaDynamicStats = "*dynamic_stats"
MetaDynamicAttribute = "*dynamic_attribute"
MetaDynamicActionPlan = "*dynamic_action_plan"
MetaDynamicActionPlanAccounts = "*dynamic_action_plan_accounts"
MetaDynamicAction = "*dynamic_action"
MetaDynamicDestination = "*dynamic_destination"
MetaDynamicFilter = "*dynamic_filter"
MetaDynamicRoute = "*dynamic_route"
MetaDynamicRanking = "*dynamic_ranking"
ActionID = "ActionID"
ActionType = "ActionType"
ActionValue = "ActionValue"
BalanceValue = "BalanceValue"
BalanceUnits = "BalanceUnits"
ExtraParameters = "ExtraParameters"
MetaAddBalance = "*add_balance"
MetaSetBalance = "*set_balance"
@@ -1612,6 +1613,7 @@ const (
APIerSv1GetTPActionIds = "APIerSv1.GetTPActionIds"
APIerSv1RemoveTPActions = "APIerSv1.RemoveTPActions"
APIerSv1SetActionPlan = "APIerSv1.SetActionPlan"
APIerSv1SetActionPlanAccounts = "APIerSv1.SetActionPlanAccounts"
APIerSv1ExecuteAction = "APIerSv1.ExecuteAction"
APIerSv1SetTPRatingProfile = "APIerSv1.SetTPRatingProfile"
APIerSv1GetTPRatingProfile = "APIerSv1.GetTPRatingProfile"

View File

@@ -46,9 +46,16 @@ func ProcessFieldPath(fldPath, sep string, dP DataProvider) (newPath string, err
newPath = fldPath[:startIdx]
for path := range strings.SplitSeq(fldPath[startIdx+1:endIdx], sep) { // proccess the found path
var val string
if val, err = DPDynamicString(path, dP); err != nil {
newPath = EmptyString
return
if strings.HasPrefix(path, MetaNow) || strings.HasPrefix(path, MetaTenant) {
if val, err = dP.FieldAsString(SplitPath(path, NestingSep[0], -1)); err != nil {
newPath = EmptyString
return
}
} else {
if val, err = DPDynamicString(path, dP); err != nil {
newPath = EmptyString
return
}
}
newPath += val
}