forked from BoltApp/sleet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
avs.go
70 lines (60 loc) · 4.24 KB
/
avs.go
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
package sleet
// AVSResponse represents a possible Address Verification System response.
type AVSResponse int
// Consts representing the various AVSResponses we can get
// We keep this pretty general to translate into any of our PsPs we support
const (
AVSResponseUnknown AVSResponse = iota
AVSResponseError // The AVS is unavailable due to a system error.
AVSResponseUnsupported // The issuing bank does not support AVS.
AVSResponseSkipped // Verification was not performed for this transaction.
AVSResponseZip9MatchAddressMatch // 9-digit ZIP matches, street address matches.
AVSResponseZip9MatchAddressNoMatch // 9-digit ZIP matches, street address doesn't match.
AVSResponseZip5MatchAddressMatch // 5-digit ZIP matches, street address matches.
AVSResponseZip5MatchAddressNoMatch // 5-digit ZIP matches, street address doesn't match.
AVSresponseZipMatchAddressMatch // 5 or 9 digit ZIP matches, street address matches.
AVSResponseZipNoMatchAddressMatch // ZIP doesn't match, street address matches.
AVSResponseZipMatchAddressUnverified // ZIP matches, street address not verified.
AVSResponseZipUnverifiedAddressMatch // ZIP not verified, street address matches.
AVSResponseMatch // Generic "everything matches"
AVSResponseNoMatch // Generic "nothing matches"
AVSResponseNonUsZipMatchAddressMatch // (Non U.S. cards) ZIP matches, street address matches.
AVSResponseNonUsZipNoMatchAddressNoMatch // (Non U.S. cards) ZIP and street address don't match.
AVSResponseNonUsZipUnverifiedAddressMatch // (Non U.S. cards) ZIP unverified, street address matches.
AVSResponseNameNoMatch // Cardholder's name doesn't match.
AVSResponseNameNoMatchAddressMatch // Cardholder's name doesn't match, street address matches.
AVSResponseNameNoMatchZipMatch // Cardholder's name doesn't match but ZIP code matches
AVSResponseNameNoMatchZipMatchAddressMatch // Cardholder's name doesn't match but both zip/address do match
AVSResponseNameMatchZipMatchAddressNoMatch // Cardholder's name and ZIP match, street address doesn't match.
AVSResponseNameMatchZipNoMatchAddressMatch // Cardholder's name and street address match, ZIP doesn't match.
AVSResponseNameMatchZipNoMatchAddressNoMatch // Cardholder's name matches, ZIP and street address don't match.
AVSResponseNameMatchZipMatchAddressMatch // Cardholder's name, zip, and address all match
)
var avsCodeToString = map[AVSResponse]string{
AVSResponseUnknown: "AVSResponseUnknown",
AVSResponseError: "AVSResponseError",
AVSResponseUnsupported: "AVSResponseUnsupported",
AVSResponseSkipped: "AVSResponseSkipped",
AVSResponseZip9MatchAddressMatch: "AVSResponseZip9MatchAddressMatch",
AVSResponseZip9MatchAddressNoMatch: "AVSResponseZip9MatchAddressNoMatch",
AVSResponseZip5MatchAddressMatch: "AVSResponseZip5MatchAddressMatch",
AVSResponseZip5MatchAddressNoMatch: "AVSResponseZip5MatchAddressNoMatch",
AVSresponseZipMatchAddressMatch: "AVSresponseZipMatchAddressMatch",
AVSResponseZipNoMatchAddressMatch: "AVSResponseZipNoMatchAddressMatch",
AVSResponseZipMatchAddressUnverified: "AVSResponseZipMatchAddressUnverified",
AVSResponseZipUnverifiedAddressMatch: "AVSResponseZipUnverifiedAddressMatch",
AVSResponseMatch: "AVSResponseMatch",
AVSResponseNoMatch: "AVSResponseNoMatch",
AVSResponseNonUsZipMatchAddressMatch: "AVSResponseNonUsZipMatchAddressMatch",
AVSResponseNonUsZipNoMatchAddressNoMatch: "AVSResponseNonUsZipNoMatchAddressNoMatch",
AVSResponseNonUsZipUnverifiedAddressMatch: "AVSResponseNonUsZipUnverifiedAddressMatch",
AVSResponseNameNoMatch: "AVSResponseNameNoMatch",
AVSResponseNameNoMatchAddressMatch: "AVSResponseNameNoMatchAddressMatch",
AVSResponseNameMatchZipMatchAddressNoMatch: "AVSResponseNameMatchZipMatchAddressNoMatch",
AVSResponseNameMatchZipNoMatchAddressMatch: "AVSResponseNameMatchZipNoMatchAddressMatch",
AVSResponseNameMatchZipNoMatchAddressNoMatch: "AVSResponseNameMatchZipNoMatchAddressNoMatch",
}
// String returns a string representation of a AVS response code
func (code AVSResponse) String() string {
return avsCodeToString[code]
}