Documentation
¶
Overview ¶
Rule engine for credit card
Author Bogdan Peta ¶
Rule engine for Payment ¶
Author Bogdan Peta ¶
This is the interface with grule-rule-engine.
Represents the core of every rule engine derived from VolanteRuleEngine ¶
Author Bogdan Peta ¶
This is the rule engine root package that will hold multiple rule engines defined by various business rules
Implements the Factory design pattern ¶
Conventions:
1. Every rule engine will live in a file with name of the rule engine in this package and in this directory.
2. Every rule engine will implement the interface VolanteRuleEngine.
3. Every rule engine will load its rules from the directory: $PATH_TO/volgre/rules/<rule_engine_name>/<version>.grl
Author Bogdan Peta
Index ¶
- Constants
- Variables
- type CreditCard
- type CreditCardRuleEngine
- func (ccre *CreditCardRuleEngine) Dump(fn func(interface{}) ([]byte, error)) (rez []byte)
- func (ccre *CreditCardRuleEngine) Init(rule_path string) interface{}
- func (ccre *CreditCardRuleEngine) Load(fn func(interface{}))
- func (ccre *CreditCardRuleEngine) Refresh()
- func (ccre *CreditCardRuleEngine) Run(data string) string
- func (ccre *CreditCardRuleEngine) Version() string
- type Payment
- type PaymentRuleEngine
- func (ccre *PaymentRuleEngine) Dump(fn func(interface{}) ([]byte, error)) (rez []byte)
- func (ccre *PaymentRuleEngine) Init(rule_path string) interface{}
- func (ccre *PaymentRuleEngine) Load(fn func(interface{}))
- func (ccre *PaymentRuleEngine) Refresh()
- func (ccre *PaymentRuleEngine) Run(status string) string
- func (ccre *PaymentRuleEngine) Version() string
- type RuleEngine
- type ValidationResult
- type VolanteRuleEngine
Constants ¶
View Source
const ( CreditCardRuleEngineT = 1 PaymentRuleEngineT = 2 NotExistentRuleEngine = 3 )
Variables ¶
View Source
var LoadedRuleEngines map[string]VolanteRuleEngine = map[string]VolanteRuleEngine{}
Here will be pre-loaded the registered rules engines Singleton design pattern
View Source
var RegisteredRuleEngines map[string]int = map[string]int{ "credit_card": CreditCardRuleEngineT, "payment": PaymentRuleEngineT, }
registered rules engines TODO: load them from a config file
Functions ¶
This section is empty.
Types ¶
type CreditCard ¶
type CreditCard struct { Tenant interface{} `json:"tenant"` MessageContent interface{} `json:"messageContent"` MessageType string `json:"messageType"` Result ValidationResult `json:"volgre:validationResults"` Rule_engine_execution_time string `json:"volgre:rule_engine_execution_time"` }
func (*CreditCard) ValidateCardNumber ¶
func (cc *CreditCard) ValidateCardNumber() bool
Rules data structure
func (*CreditCard) ValidateExpMonth ¶
func (cc *CreditCard) ValidateExpMonth() bool
func (*CreditCard) ValidateExpYear ¶
func (cc *CreditCard) ValidateExpYear() bool
func (*CreditCard) ValidateHolderName ¶
func (cc *CreditCard) ValidateHolderName() bool
func (*CreditCard) ValidateSecurityCode ¶
func (cc *CreditCard) ValidateSecurityCode() bool
type CreditCardRuleEngine ¶
type CreditCardRuleEngine struct {
// contains filtered or unexported fields
}
func (*CreditCardRuleEngine) Dump ¶
func (ccre *CreditCardRuleEngine) Dump(fn func(interface{}) ([]byte, error)) (rez []byte)
func (*CreditCardRuleEngine) Init ¶
func (ccre *CreditCardRuleEngine) Init(rule_path string) interface{}
func (*CreditCardRuleEngine) Load ¶
func (ccre *CreditCardRuleEngine) Load(fn func(interface{}))
func (*CreditCardRuleEngine) Refresh ¶
func (ccre *CreditCardRuleEngine) Refresh()
func (*CreditCardRuleEngine) Run ¶
func (ccre *CreditCardRuleEngine) Run(data string) string
func (*CreditCardRuleEngine) Version ¶
func (ccre *CreditCardRuleEngine) Version() string
type Payment ¶
type Payment struct {
Status string `json:"messageType"`
}
func (*Payment) CreateAuditLog ¶
type PaymentRuleEngine ¶
type PaymentRuleEngine struct { Data *Payment // contains filtered or unexported fields }
func (*PaymentRuleEngine) Dump ¶
func (ccre *PaymentRuleEngine) Dump(fn func(interface{}) ([]byte, error)) (rez []byte)
func (*PaymentRuleEngine) Init ¶
func (ccre *PaymentRuleEngine) Init(rule_path string) interface{}
func (*PaymentRuleEngine) Load ¶
func (ccre *PaymentRuleEngine) Load(fn func(interface{}))
func (*PaymentRuleEngine) Refresh ¶
func (ccre *PaymentRuleEngine) Refresh()
func (*PaymentRuleEngine) Run ¶
func (ccre *PaymentRuleEngine) Run(status string) string
func (*PaymentRuleEngine) Version ¶
func (ccre *PaymentRuleEngine) Version() string
type RuleEngine ¶
type RuleEngine struct {
// contains filtered or unexported fields
}
type ValidationResult ¶
type VolanteRuleEngine ¶
type VolanteRuleEngine interface { Init(rule_path string) interface{} Load(f func(interface{})) Dump(f func(interface{}) ([]byte, error)) []byte Run(data string) string Refresh() Version() string }
func GetRuleEngine ¶
func GetRuleEngine(m int) (VolanteRuleEngine, error)
Click to show internal directories.
Click to hide internal directories.