mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
New Accounts methods in Dispatcher service
This commit is contained in:
committed by
Dan Christian Bogos
parent
84a639d063
commit
5ec505d760
@@ -288,4 +288,7 @@ type ActionSv1Interface interface {
|
||||
|
||||
type AccountSv1Interface interface {
|
||||
Ping(ign *utils.CGREvent, reply *string) error
|
||||
AccountProfilesForEvent(args *utils.ArgsAccountsForEvent, aps *[]*utils.AccountProfile) error
|
||||
MaxAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error
|
||||
DebitAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error
|
||||
}
|
||||
|
||||
@@ -125,6 +125,6 @@ func TestAccountSv1Interface(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestActionSv1Interface(t *testing.T) {
|
||||
_ = AccountSv1Interface(NewDispatcherActionSv1(nil))
|
||||
_ = AccountSv1Interface(NewActionSv1(nil))
|
||||
_ = ActionSv1Interface(NewDispatcherActionSv1(nil))
|
||||
_ = ActionSv1Interface(NewActionSv1(nil))
|
||||
}
|
||||
|
||||
@@ -1366,6 +1366,18 @@ func (dR *DispatcherAccountSv1) Ping(args *utils.CGREvent, reply *string) error
|
||||
return dR.dR.AccountSv1Ping(args, reply)
|
||||
}
|
||||
|
||||
func (dR *DispatcherAccountSv1) AccountProfilesForEvent(args *utils.ArgsAccountsForEvent, aps *[]*utils.AccountProfile) error {
|
||||
return dR.dR.AccountProfilesForEvent(args, aps)
|
||||
}
|
||||
|
||||
func (dR *DispatcherAccountSv1) MaxAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error {
|
||||
return dR.dR.MaxAbstracts(args, eEc)
|
||||
}
|
||||
|
||||
func (dR *DispatcherAccountSv1) DebitAbstracts(args *utils.ArgsAccountsForEvent, eEc *utils.ExtEventCharges) error {
|
||||
return dR.dR.DebitAbstracts(args, eEc)
|
||||
}
|
||||
|
||||
func (rS *DispatcherSv1) Ping(ign *utils.CGREvent, reply *string) error {
|
||||
*reply = utils.Pong
|
||||
return nil
|
||||
|
||||
@@ -31,5 +31,47 @@ func (dS *DispatcherService) AccountSv1Ping(args *utils.CGREvent, rpl *string) (
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(args, utils.AccountS, utils.AccountSv1Ping, args, rpl)
|
||||
return dS.Dispatch(args, utils.MetaAccounts, utils.AccountSv1Ping, args, rpl)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) AccountProfilesForEvent(args *utils.ArgsAccountsForEvent, reply *[]*utils.AccountProfile) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
|
||||
tnt = args.CGREvent.Tenant
|
||||
}
|
||||
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
|
||||
if err = dS.authorize(utils.AccountSv1AccountProfilesForEvent, tnt,
|
||||
utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1AccountProfilesForEvent, args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) MaxAbstracts(args *utils.ArgsAccountsForEvent, reply *utils.ExtEventCharges) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
|
||||
tnt = args.CGREvent.Tenant
|
||||
}
|
||||
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
|
||||
if err = dS.authorize(utils.AccountSv1MaxAbstracts, tnt,
|
||||
utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1MaxAbstracts, args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) DebitAbstracts(args *utils.ArgsAccountsForEvent, reply *utils.ExtEventCharges) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args.CGREvent != nil && args.CGREvent.Tenant != utils.EmptyString {
|
||||
tnt = args.CGREvent.Tenant
|
||||
}
|
||||
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
|
||||
if err = dS.authorize(utils.AccountSv1DebitAbstracts, tnt,
|
||||
utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), args.CGREvent.Time); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(args.CGREvent, utils.MetaAccounts, utils.AccountSv1DebitAbstracts, args, reply)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user