Documentation ¶
Overview ¶
Rule engine for credit card
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)
- func (ccre *CreditCardRuleEngine) Load(fn func(interface{}))
- func (ccre *CreditCardRuleEngine) Refresh()
- func (ccre *CreditCardRuleEngine) Run()
- func (ccre *CreditCardRuleEngine) Version() string
- type RuleEngine
- type ValidationResult
- type VolanteRuleEngine
Constants ¶
View Source
const ( CreditCardRuleEngineT = 1 BankNotExistentRuleEngine = 2 )
Variables ¶
View Source
var LoadedRuleEngines map[string]VolanteRuleEngine = map[string]VolanteRuleEngine{}
Here will be pre-loadede the registered rules engines Singleton design pattern
View Source
var RegisteredRuleEngines map[string]int = map[string]int{ "credit_card": CreditCardRuleEngineT, }
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)
func (*CreditCardRuleEngine) Load ¶
func (ccre *CreditCardRuleEngine) Load(fn func(interface{}))
func (*CreditCardRuleEngine) Refresh ¶
func (ccre *CreditCardRuleEngine) Refresh()
func (*CreditCardRuleEngine) Run ¶
func (ccre *CreditCardRuleEngine) Run()
func (*CreditCardRuleEngine) Version ¶
func (ccre *CreditCardRuleEngine) Version() string
type RuleEngine ¶
type RuleEngine struct {
// contains filtered or unexported fields
}
type ValidationResult ¶
type VolanteRuleEngine ¶
type VolanteRuleEngine interface { Init(rule_path string) Load(f func(interface{})) Dump(f func(interface{}) ([]byte, error)) []byte Run() Refresh() Version() string }
func GetRuleEngine ¶
func GetRuleEngine(m int) (VolanteRuleEngine, error)
Click to show internal directories.
Click to hide internal directories.