mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 13:49:53 +05:00
Initial ChargerService.V1ProcessEvent
This commit is contained in:
@@ -224,13 +224,14 @@
|
||||
],
|
||||
|
||||
|
||||
"attributes": { // Attribute service
|
||||
"enabled": true, // starts Alias service: <true|false>.
|
||||
|
||||
"attributes": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
"chargers": { // Attribute service
|
||||
"enabled": true, // starts Alias service: <true|false>.
|
||||
"chargers": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
@@ -262,11 +263,6 @@
|
||||
},
|
||||
|
||||
|
||||
"aliases": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"suppliers_conns": [
|
||||
|
||||
@@ -25,6 +25,17 @@ import (
|
||||
"github.com/cgrates/rpcclient"
|
||||
)
|
||||
|
||||
// ChargerProfile is the config for one Charger
|
||||
type ChargerProfile struct {
|
||||
Tenant string
|
||||
ID string
|
||||
FilterIDs []string
|
||||
ActivationInterval *utils.ActivationInterval // Activation interval
|
||||
RunID string
|
||||
AttributeIDs []string // perform data aliasing based on these Attributes
|
||||
Weight float64
|
||||
}
|
||||
|
||||
func NewChargerService(dm *DataManager, filterS *FilterS,
|
||||
attrS rpcclient.RpcClientConnection,
|
||||
strgIdxFlds, prfxIdxFlds *[]string) (*ChargerService, error) {
|
||||
@@ -34,6 +45,7 @@ func NewChargerService(dm *DataManager, filterS *FilterS,
|
||||
prfxIdxFlds: prfxIdxFlds}, nil
|
||||
}
|
||||
|
||||
// ChargerService is performing charging
|
||||
type ChargerService struct {
|
||||
dm *DataManager
|
||||
filterS *FilterS
|
||||
@@ -57,12 +69,24 @@ func (cS *ChargerService) Shutdown() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
type ChargerProfile struct {
|
||||
Tenant string
|
||||
ID string
|
||||
FilterIDs []string
|
||||
ActivationInterval *utils.ActivationInterval // Activation interval
|
||||
RunID string
|
||||
AttributeIDs []string
|
||||
Weight float64
|
||||
func (cS *ChargerService) processEvent(cgrEv *utils.CGREvent) (cgrEvs []*utils.CGREvent, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// V1ProcessEvent will process the event received via API and return list of events forked
|
||||
func (cS *ChargerService) V1ProcessEvent(args *utils.CGREvent,
|
||||
reply *[]*utils.CGREvent) (err error) {
|
||||
if args.Event == nil {
|
||||
return utils.NewErrMandatoryIeMissing("Event")
|
||||
}
|
||||
rply, err := cS.processEvent(args)
|
||||
if err != nil {
|
||||
if err != utils.ErrNotFound {
|
||||
err = utils.NewErrServerError(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
*reply = rply
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user