Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStateByDDD ¶
GetStateByDDD Method that receives a phone number in string type and returns only the DDD.
func GetStateMap ¶
GetStateMap Method opens a json file containing the DDD and state mapping and returns it.
func PointCounter ¶
func PointCounter(behaviorList []SuspiciousBehavior) int
PointCounter Method that receives a slice of SuspiciousBehavior and returns an Int value as result.
Types ¶
type Customer ¶
type Customer struct { ID string `json:"id" validate:"required"` Name string `json:"name" validate:"required"` BirthDate string `json:"birth_date" validate:"required"` State string `json:"state" validate:"required"` Phone string `json:"phone" validate:"required"` }
Customer It's an application structure for data storage and information processing.
type DDD ¶
DDD It's an application structure which has the DDD information for each Brazilian state.
type SuspiciousBehavior ¶
type SuspiciousBehavior struct { Description string `json:"description"` Value int `json:"value,string"` }
SuspiciousBehavior It's an application structure that represents suspicious behavior. It has a Description and a Value.
func DetectSB ¶
func DetectSB(transaction Transaction) []SuspiciousBehavior
DetectSB Method for detecting suspicious behavior, receives a Transaction and returns a slice of SuspiciousBehavior.
type Transaction ¶
type Transaction struct { ID string `json:"id" validate:"required"` Value float64 `json:"value" validate:"required"` PaidAt string `json:"paid_at" validate:"required"` IPLocation string `json:"ip_location" validate:"required"` CardHoldName string `json:"card_hold_name" validate:"required"` Customer Customer `json:"customer" validate:"required"` }
Transaction It's an application structure for data storage and information processing.
func (Transaction) Validate ¶
func (transaction Transaction) Validate() bool
Validate It's a Transaction's function that validates its own data.
type TransactionResult ¶
TransactionResult It's an application structure that represents the result of the fraud check. ID means the transaction identifier and Score means a score from 0 to 100 of risk, being 0 (with no evidence of fraud) and 100 (with maximum risk of fraud).
func CheckFraud ¶
func CheckFraud(transactions []Transaction) []TransactionResult
CheckFraud Fraud check method that receives a slice of Transaction and returns a slice of TransactionResult