mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
added tennant and other fields that compose account names
This commit is contained in:
@@ -72,6 +72,7 @@ func (self *Apier) SetDestination(attr *AttrDestination, reply *rater.Destinatio
|
||||
}
|
||||
|
||||
type AttrGetBalance struct {
|
||||
Tenant string
|
||||
Account string
|
||||
BalanceId string
|
||||
Direction string
|
||||
@@ -79,7 +80,8 @@ type AttrGetBalance struct {
|
||||
|
||||
// Get balance
|
||||
func (self *Apier) GetBalance(attr *AttrGetBalance, reply *float64) error {
|
||||
userBalance, err := self.StorDb.GetUserBalance(attr.Account)
|
||||
tag := fmt.Sprintf("%s:%s:%s", attr.Direction, attr.Tenant, attr.Account)
|
||||
userBalance, err := self.StorDb.GetUserBalance(tag)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -98,6 +100,7 @@ func (self *Apier) GetBalance(attr *AttrGetBalance, reply *float64) error {
|
||||
}
|
||||
|
||||
type AttrAddBalance struct {
|
||||
Tenant string
|
||||
Account string
|
||||
BalanceId string
|
||||
Direction string
|
||||
@@ -106,9 +109,10 @@ type AttrAddBalance struct {
|
||||
|
||||
func (self *Apier) AddBalance(attr *AttrAddBalance, reply *float64) error {
|
||||
// what storage instance do we use?
|
||||
tag := fmt.Sprintf("%s:%s:%s", attr.Direction, attr.Tenant, attr.Account)
|
||||
|
||||
at := &rater.ActionTiming{
|
||||
UserBalanceIds: []string{attr.Account},
|
||||
UserBalanceIds: []string{tag},
|
||||
}
|
||||
|
||||
if attr.Direction == "" {
|
||||
@@ -125,14 +129,17 @@ func (self *Apier) AddBalance(attr *AttrAddBalance, reply *float64) error {
|
||||
}
|
||||
|
||||
type AttrExecuteAction struct {
|
||||
Direction string
|
||||
Tenant string
|
||||
Account string
|
||||
BalanceId string
|
||||
ActionsId string
|
||||
}
|
||||
|
||||
func (self *Apier) ExecuteAction(attr *AttrExecuteAction, reply *float64) error {
|
||||
tag := fmt.Sprintf("%s:%s:%s", attr.Direction, attr.Tenant, attr.Account)
|
||||
at := &rater.ActionTiming{
|
||||
UserBalanceIds: []string{attr.Account},
|
||||
UserBalanceIds: []string{tag},
|
||||
ActionsId: attr.ActionsId,
|
||||
}
|
||||
|
||||
@@ -144,12 +151,21 @@ func (self *Apier) ExecuteAction(attr *AttrExecuteAction, reply *float64) error
|
||||
}
|
||||
|
||||
type AttrSetRatingProfile struct {
|
||||
Direction string
|
||||
Tenant string
|
||||
TOR string
|
||||
Subject string
|
||||
RatingProfileId string
|
||||
}
|
||||
|
||||
func (self *Apier) SetRatingProfile(attr *AttrSetRatingProfile, reply *float64) error {
|
||||
subject, err := self.StorDb.GetRatingProfile(attr.Subject)
|
||||
cd := &rater.CallDescriptor{
|
||||
Direction: attr.Direction,
|
||||
Tenant: attr.Tenant,
|
||||
TOR: attr.TOR,
|
||||
Subject: attr.Subject,
|
||||
}
|
||||
subject, err := self.StorDb.GetRatingProfile(cd.GetKey())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -342,10 +342,13 @@ Gets a specific balance of a user acoount.
|
||||
::
|
||||
|
||||
type AttrGetBalance struct {
|
||||
Account string
|
||||
BalanceId string
|
||||
Direction string
|
||||
}
|
||||
Tenant string
|
||||
Account string
|
||||
BalanceId string
|
||||
Direction string
|
||||
}
|
||||
|
||||
The Tenant is the network tenant of the account.
|
||||
|
||||
The Account is the id of the account for which the balance is desired.
|
||||
|
||||
@@ -366,12 +369,14 @@ Adds an amount to a specific balance of a user account.
|
||||
::
|
||||
|
||||
type AttrAddBalance struct {
|
||||
Account string
|
||||
BalanceId string
|
||||
Direction string
|
||||
Value float64
|
||||
}
|
||||
Tenant string
|
||||
Account string
|
||||
BalanceId string
|
||||
Direction string
|
||||
Value float64
|
||||
}
|
||||
|
||||
The Tenant is the network tenant of the account.
|
||||
|
||||
The Account is the id of the account for which the balance is set.
|
||||
|
||||
@@ -393,10 +398,12 @@ Executes specified action on a user account.
|
||||
::
|
||||
|
||||
type AttrExecuteAction struct {
|
||||
Account string
|
||||
BalanceId string
|
||||
ActionsId string
|
||||
}
|
||||
Direction string
|
||||
Tenant string
|
||||
Account string
|
||||
BalanceId string
|
||||
ActionsId string
|
||||
}
|
||||
|
||||
Example
|
||||
ExecuteAction(attr \*AttrExecuteAction, reply \*float64)
|
||||
@@ -415,9 +422,12 @@ Sets the rating profile for the specified subject.
|
||||
::
|
||||
|
||||
type AttrSetRatingProfile struct {
|
||||
Subject string
|
||||
RatingProfileId string
|
||||
}
|
||||
Direction string
|
||||
Tenant string
|
||||
TOR string
|
||||
Subject string
|
||||
RatingProfileId string
|
||||
}
|
||||
|
||||
Example
|
||||
SetRatingProfile(attr \*AttrSetRatingProfile, reply \*float64)
|
||||
|
||||
Reference in New Issue
Block a user