-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathresponse.go
More file actions
325 lines (316 loc) · 14.3 KB
/
response.go
File metadata and controls
325 lines (316 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
package emailage
// Response is the overall payload returned from
// the Classic API
type Response struct {
Query *Query `json:"query"`
ResponseStatus *ResponseStatus `json:"responseStatus,omitempty"`
}
// Query holds the relevant data for the given request
type Query struct {
Email string `json:"email,omitempty"`
IpAddress string `json:"ipaddress,omitempty"`
QueryType string `json:"queryType,omitempty"`
Count int64 `json:"count,omitempty"`
Created string `json:"created,omitempty"`
Lang string `json:"lang,omitempty"`
ResponseLanguage string `json:"response_language,omitempty"`
Custom1 string `json:"custom1,omitempty"`
Custom2 string `json:"custom2,omitempty"`
Custom3 string `json:"custom3,omitempty"`
Custom4 string `json:"custom4,omitempty"`
Custom5 string `json:"custom5,omitempty"`
Custom6 string `json:"custom6,omitempty"`
Custom7 string `json:"custom7,omitempty"`
TrackingID string `json:"trackingId,omitempty"`
TransAmount string `json:"transAmount,omitempty"`
TransCurrency string `json:"transCurrency,omitempty"`
ResponseCount int64 `json:"responseCount,omitempty"`
PhoneCountryCode string `json:"phoneCountryCode,omitempty"`
Results []Result `json:"results,omitempty"`
}
// ResponseStatus contains the status for the given request
type ResponseStatus struct {
Status string `json:"status,omitempty"`
ErrorCode string `json:"errorCode,omitempty"`
Description string `json:"description,omitempty"`
}
// SMLink contains links to social media
type SMLink struct {
Source string `json:"source,omitempty"`
Link string `json:"link,omitempty"`
}
// Result represents a result given back from the Classic API
type Result struct {
CardCategory string `json:"cardCategory"`
CardType string `json:"cardType"`
CityPostalMatch string `json:"citypostalmatch"`
Company string `json:"company"`
CorrelationID string `json:"correlationId"`
Country string `json:"country"`
Custom1 string `json:"custom1,omitempty"`
Custom2 string `json:"custom2,omitempty"`
Custom3 string `json:"custom3,omitempty"`
Custom4 string `json:"custom4,omitempty"`
Custom5 string `json:"custom5,omitempty"`
Custom6 string `json:"custom6,omitempty"`
Custom7 string `json:"custom7,omitempty"`
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"`
IPAddress string `json:"ipaddress"`
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"`
IPPostalConf string `json:"ip_postalconf"`
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"`
IPRiskReason string `json:"ip_riskreason"`
IPRiskReasonID string `json:"ip_riskreasonid"`
IPRiskScore string `json:"ip_riskscore"`
IPShipCountryMatch string `json:"ipShipCountryMatch""`
IPShipDistanceMil string `json:"ipShipDistanceMil"`
IPShipDistanceKm string `json:"ipShipDistanceKm"`
IPTimezone string `json:"iptimezone"`
IPUserType string `json:"ip_usertype"`
IssuerBank string `json:"issuerBank"`
IssuerBrand string `json:"issuerBrand"`
IssuerCountry string `json:"issuerCountry"`
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"`
PhoneCarrierType string `json:"phonecarriertype"`
PhoneOwnerMatch string `json:"phoneownermatch"`
PhoneOwnerType string `json:"phoneownertype"`
PhoneStatus string `json:"phone_status"`
ShipCityPostalMatch string `json:"shipcitypostalmatch"`
DeviceIDRiskLevel string `json:"deviceIdRiskLevel"`
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"`
TrackingID string `json:"trackingId"`
TransAmount string `json:"transAmount"`
TransCurrency string `json:"transCurrency"`
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"`
}
// FraudCodeLookup provides code to fraud message lookup
func FraudCodeLookup(code int) string {
switch code {
case 1:
return "Card Not Present Fraud"
case 2:
return "Customer Dispute (Chargeback)"
case 3:
return "First Party Fraud"
case 4:
return "First Payment Default"
case 5:
return "Identify Theft (Fraud Application)"
case 6:
return "Identify Theft (Account Take Over)"
case 7:
return "Suspected Fraud (Not Confirmed)"
case 8:
return "Synthetic ID"
case 9:
return "Other"
default:
return ""
}
}
// PhoneOwnerMatchLookup provides a lookup translation
// from a received response
func PhoneOwnerMatchLookup(s string) string {
switch s {
case "Y":
return "Full Match"
case "P":
return "Partial Match"
case "N":
return "No Match"
case "U":
return "Owner Unknown"
default:
return ""
}
}
// RiskLevelLookup takes a level integer and
// converts it to a string representation
func RiskLevelLookup(level int) string {
switch level {
case 1:
return "Very High"
case 2:
return "High"
case 3:
return "Moderate"
case 4:
return "Low"
case 5:
return "Very Low"
case 6:
return "Review"
default:
return ""
}
}
// RiskReasonLookup provides the code to reason mapping for IP risk
func RiskReasonLookup(reason int) string {
switch reason {
case 301:
return "Moderate Risk"
case 307:
return "Risk Country"
case 308:
return "Anonymous Proxy"
case 309:
return "Risk Proxy"
case 310:
return "IP Not Found"
case 311:
return "Moderate By Proxy Reputation And Country Code"
case 312:
return "Invalid IP Syntax"
case 313:
return "TOR Network IP"
case 321:
return "Low Risk IP for Company"
case 322:
return "Low Risk IP Geolocation for Company"
case 323:
return "Low Risk IP for Industry"
case 324:
return "Low Risk IP Geolocation for Industry"
case 325:
return "Low Risk IP for Network"
case 326:
return "Low Risk IP Geolocation for Network"
case 327:
return "Very Low Risk IP for Company"
case 328:
return "Very Low Risk IP Geolocation for Company"
case 329:
return "Very Low Risk IP for Industry"
case 330:
return "Very Low Risk IP Geolocation for Industry"
case 331:
return "Very Low Risk IP for Network"
case 332:
return "Very Low Risk IP Geolocation for Network"
case 333:
return "High Risk IP for Company"
case 334:
return "High Risk IP Geolocation for Company"
case 335:
return "High Risk IP for Industry"
case 336:
return "High Risk IP Geolocation for Industry"
case 337:
return "High Risk IP for Network"
case 338:
return "High Risk IP Geolocation for Network"
case 339:
return "Very High Risk IP for Company"
case 340:
return "Very High Risk IP Geolocation for Company"
case 341:
return "Very High Risk IP for Industry"
case 342:
return "Very High Risk IP Geolocation for Industry"
case 343:
return "Very High Risk IP for Network"
case 344:
return "Very High Risk IP Geolocation for Network"
default:
return ""
}
}