emailage

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2020 License: MIT Imports: 13 Imported by: 0

README

Emailage

Version

The Emailage™ API is organized around REST (Representational State Transfer). The API was built to help companies integrate with our highly efficient fraud risk and scoring system. By calling our API endpoints and simply passing us an email and/or IP Address, companies will be provided with real-time risk scoring assessments based around machine learning and proprietary algorithms that evolve with new fraud trends.

The package no longer supports HMAC-SHA1, we recommend use of HMAC-SHA256, HMAC-SHA384, or HMAC-SHA512.

Getting Started

Requirements

git clone https://github.com/emailage/Emailage_Go.git 

This package can be imported with:

import github.com/emailage/emailage

Usage

Settings

Email Only Validation

params := map[string]string{
    "first_seen_days": 30,
    "phone": "8675309",
    "transorigin": "O",
}
res, err := client.EmailOnlyScore("nigerian.prince@legit.ru", params)
if err != nil {
    log.Fatalln(err)
}
fmt.Printf("Result: %+v\n", res.Query)

IP Only Validation

res, err := client.IPOnlyScore("192.168.0.1", nil)
if err != nil {
    log.Fatalln(err)
}
fmt.Printf("Result: %+v\n", res.Query)

Email and IP Validation

params := map[string]string{
    "billcity": "Phoenix",
    "responseCount": 10,
}
res, err := client.EmailAndIPScore("nigerian.prince@legit.ru", "192.168.0.1", params)
if err != nil {
    log.Fatalln(err)
}
fmt.Printf("Result: %+v\n", res.Query)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCodeLookup

func ErrorCodeLookup(code string) string

ErrorCodeLookup provies the ability to look up an error code returned from the API

func FraudCodeLookup

func FraudCodeLookup(code int) string

FraudCodeLookup provides code to fraud message lookup

func PhoneOwnerMatchLookup

func PhoneOwnerMatchLookup(s string) string

PhoneOwnerMatchLookup provides a lookup translation from a received response

func RiskLevelLookup

func RiskLevelLookup(level int) string

RiskLevelLookup takes a level integer and converts it to a string representation

func RiskReasonLookup

func RiskReasonLookup(reason int) string

RiskReasonLookup provides the code to reason mapping for IP risk

Types

type ClientOpts

type ClientOpts struct {
	Token       string
	AccountSID  string
	Endpoint    string
	Format      ResponseFormat
	Algorithm   auth.HMACSHA
	HTTPTimeout time.Duration
}

ClientOpts contains fields used by the client

type Emailage

type Emailage struct {
	HTTPClient http.Client
	// contains filtered or unexported fields
}

Emailage Configuration object for the emailage type

func New

func New(co *ClientOpts) (*Emailage, error)

New creates a new value of type pointer Emailage

func (*Emailage) EmailAndIPScore

func (e *Emailage) EmailAndIPScore(email, ip string, params map[string]string) (*Response, error)

EmailAndIPScore provides a risk score for the provided email/IP address combination. IP4 and IP6 addresses are supported.

func (*Emailage) EmailOnlyScore

func (e *Emailage) EmailOnlyScore(email string, params map[string]string) (*Response, error)

EmailOnlyScore provides a risk score for the provided email address.

func (*Emailage) IPAddressOnlyScore

func (e *Emailage) IPAddressOnlyScore(ip string, params map[string]string) (*Response, error)

IPAddressOnlyScore provides a risk score for the provided IP address.

type Query

type Query struct {
	Email         string   `json:"email,omitempty"`
	QueryType     string   `json:"queryType,omitempty"`
	Count         int64    `json:"count,omitempty"`
	Created       string   `json:"created,omitempty"`
	Lang          string   `json:"lang,omitempty"`
	ResponseCount int64    `json:"responseCount,omitempty"`
	Results       []Result `json:"results,omitempty"`
}

Query holds the relevant data for the given request

type Response

type Response struct {
	Query          *Query          `json:"query"`
	ResponseStatus *ResponseStatus `json:"responseStatus,omitempty"`
}

Response is the overall payload returned from the Classic API

type ResponseFormat

type ResponseFormat string

ResponseFormat that the server will return

const (
	// JSON Request JSON formatted data from the EmailRisk API
	JSON ResponseFormat = "json"
	// XML Request XML formatted data from the EmailRisk API
	XML ResponseFormat = "xml"
)

type ResponseStatus

type ResponseStatus struct {
	Status      string `json:"status,omitempty"`
	ErrorCode   string `json:"errorCode,omitempty"`
	Description string `json:"description,omitempty"`
}

ResponseStatus contains the status for the given request

type Result

type Result struct {
	CardCategory                       string   `json:"cardCategory"`
	CardType                           string   `json:"cardType"`
	CityPostalMatch                    string   `json:"citypostalmatch"`
	Company                            string   `json:"company"`
	Count                              string   `json:"count"`
	Country                            string   `json:"country"`
	Created                            string   `json:"created"`
	CustomerIdentifierMatch            string   `json:"customeridentifiermatch"`
	CustPhoneInBillingLoc              string   `json:"custphoneInbillingloc"`
	DOB                                string   `json:"dob"`
	DomainAge                          string   `json:"domainAge"`
	DomainCategory                     string   `json:"domaincategory"`
	DomainCompany                      string   `json:"domaincompany"`
	DomainCorporate                    string   `json:"domaincorporate"`
	DomainCountryName                  string   `json:"domaincountryname"`
	DomainCreationDays                 string   `json:"domain_creation_days"`
	DomainExists                       string   `json:"domainExists"`
	DomainName                         string   `json:"domainname"`
	DomainRelevantInfo                 string   `json:"domainrelevantinfo"`
	DomainRelevantInfoID               string   `json:"domainrelevantinfoID"`
	DomainRiskCountry                  string   `json:"domainriskcountry"`
	DomainRiskLevel                    string   `json:"domainrisklevel"`
	DomainRisklevelID                  string   `json:"domainrisklevelID"`
	EAAdvice                           string   `json:"EAAdvice"`
	EAAdviceID                         string   `json:"EAAdviceID"`
	EAReason                           string   `json:"EAReason"`
	EAReasonID                         string   `json:"EAReasonID"`
	EARiskBand                         string   `json:"EARiskBand"`
	EARiskBandID                       string   `json:"EARiskBandID"`
	EAScore                            string   `json:"EAScore"`
	EAStatusID                         string   `json:"EAStatusID"`
	Email                              string   `json:"email"`
	EmailAge                           string   `json:"emailAge"`
	EmailCreationDays                  string   `json:"email_creation_days"`
	EmailExists                        string   `json:"emailExists"`
	EName                              string   `json:"eName"`
	FirstSeenDays                      string   `json:"first_seen_days"`
	FirstVerificationDate              string   `json:"firstVerificationDate"`
	FraudRisk                          string   `json:"fraudRisk"`
	FraudType                          string   `json:"fraud_type"`
	Gender                             string   `json:"gender"`
	ImageURL                           string   `json:"imageurl"`
	IPAccuracyRadius                   string   `json:"ipaccuracyradius"`
	IPAnonymousDetected                string   `json:"ip_anonymousdetected"`
	IPAsNum                            string   `json:"ipasnum"`
	IPCallingCode                      string   `json:"ip_callingcode"`
	IPCity                             string   `json:"ip_city"`
	IPCityConf                         string   `json:"ip_cityconf"`
	IPContinentCode                    string   `json:"ip_continentCode"`
	IPCorporateProxy                   string   `json:"ip_corporateProxy"`
	IPCountry                          string   `json:"ip_country"`
	IPCountryCode                      string   `json:"ip_countryCode"`
	IPCountryConf                      string   `json:"ip_countryconf"`
	IPCountryMatch                     string   `json:"ipcountrymatch"`
	IPDistanceKM                       string   `json:"ipdistancekm"`
	IPDistanceMil                      string   `json:"ipdistancemil"`
	IPDomain                           string   `json:"ipdomain"`
	IPISP                              string   `json:"ip_isp"`
	IPLatitude                         string   `json:"ip_latitude"`
	IPLongitude                        string   `json:"ip_longitude"`
	IPMap                              string   `json:"ip_map"`
	IPMetroCode                        string   `json:"ip_metroCode"`
	IPNetSpeedCell                     string   `json:"ip_netSpeedCell"`
	IPOrg                              string   `json:"ip_org"`
	IPPostalCode                       string   `json:"ip_postalcode"`
	IPProxyDescription                 string   `json:"ip_proxydescription"`
	IPProxyType                        string   `json:"ip_proxytype"`
	IPRegion                           string   `json:"ip_region"`
	IPRegionConf                       string   `json:"ip_regionconf"`
	IPReputation                       string   `json:"ip_reputation"`
	IPRiskCountry                      string   `json:"ipriskcountry"`
	IPRiskLevel                        string   `json:"ip_risklevel"`
	IPRiskLevelID                      string   `json:"ip_risklevelid"`
	IPRiskLevelReason                  string   `json:"ip_risklevelreason"`
	IPRiskLevelReasonID                string   `json:"ip_risklevelReasonid"`
	IPRiskScore                        string   `json:"ip_riskscore"`
	IPTimezone                         string   `json:"iptimezone"`
	IPUserType                         string   `json:"ip_usertype"`
	IssuerBank                         string   `json:"issuerBank"`
	IssuerBrand                        string   `json:"issuerBrand"`
	IssuerCountry                      string   `json:"issuerCountry"`
	Lang                               string   `json:"lang"`
	LastFlaggedOn                      string   `json:"lastflaggedon"`
	LastVerificationDate               string   `json:"lastVerificationDate"`
	Location                           string   `json:"location"`
	NameMatch                          string   `json:"namematch"`
	PhoneCarrierName                   string   `json:"phonecarriername"`
	PhoneCarrierNetworkCode            string   `json:"phonecarriernetworkcode"`
	PhoneOwner                         string   `json:"phoneowner"`
	PhoneOwnerCarrierType              string   `json:"phoneownercarriertype"`
	PhoneOwnerMatch                    string   `json:"phoneownermatch"`
	PhoneOwnerType                     string   `json:"phoneownertype"`
	PhoneStatus                        string   `json:"phone_status"`
	ShipCityPostalMatch                string   `json:"shipcitypostalmatch"`
	ShipForward                        string   `json:"shipforward"`
	SMFriends                          string   `json:"smfriends"`
	SMLinks                            []SMLink `json:"smlinks"`
	SourceIndustry                     string   `json:"source_industry"`
	Status                             string   `json:"status"`
	Title                              string   `json:"title"`
	TotalHits                          string   `json:"totalhits"`
	UniqueHits                         string   `json:"uniquehits"`
	UserdefinedRecordID                string   `json:"userdefinedrecordid"`
	OverallDigitalIdentityScore        string   `json:"overallDigitalIdentityScore"`
	EmailToIPConfidence                string   `json:"emailToIpConfidence"`
	EmailToPhoneConfidence             string   `json:"emailToPhoneConfidence"`
	EmailToBillAddressConfidence       string   `json:"emailToBillAddressConfidence"`
	EmailToShipAddressConfidence       string   `json:"emailToShipAddressConfidence"`
	EmailToFullNameConfidence          string   `json:"emailToFullNameConfidence"`
	EmailToLastNameConfidence          string   `json:"emailToLastNameConfidence"`
	IPToPhoneConfidence                string   `json:"ipToPhoneConfidence"`
	IPToBillAddressConfidence          string   `json:"ipToBillAddressConfidence"`
	IPToShipAddressConfidence          string   `json:"ipToShipAddressConfidence"`
	IPToFullNameConfidence             string   `json:"ipToFullNameConfidence"`
	IPToLastNameConfidence             string   `json:"ipToLastNameConfidence"`
	PhoneToBillAddressConfidence       string   `json:"phoneToBillAddressConfidence"`
	PhoneToShipAddressConfidence       string   `json:"phoneToShipAddressConfidence"`
	PhoneToFullNameConfidence          string   `json:"phoneToFullNameConfidence"`
	PhoneToLastNameConfidence          string   `json:"phoneToLastNameConfidence"`
	BillAddressToFullNameConfidence    string   `json:"billAddressToFullNameConfidence"`
	BillAddressToLastNameConfidence    string   `json:"billAddressToLastNameConfidence"`
	ShipAddressToBillAddressConfidence string   `json:"shipAddressToBillAddressConfidence"`
	ShipAddressToFullNameConfidence    string   `json:"shipAddressToFullNameConfidence"`
	ShipAddressToLastNameConfidence    string   `json:"shipAddressToLastNameConfidence"`
	StandardizedBillAddress            string   `json:"standardizedbillingaddress"`
	StandardizedShipAddress            string   `json:"standardizedshippingaddress"`
}

Result represents a result given back from the Classic API

type SMLink struct {
	Source string `json:"source,omitempty"`
	Link   string `json:"link,omitempty"`
}

SMLink contains links to social media

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL