This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
cvv.go
36 lines (32 loc) · 1.86 KB
/
cvv.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
package sleet
// CVVResponse represents a possible CVV/CVN verification response.
type CVVResponse int
// Enum representing general CVV responses that we have
const (
CVVResponseUnknown CVVResponse = iota // Unknown CVV code returned by processor
CVVResponseNoResponse // No verification response was given
CVVResponseError // An error prevented verification (e.g. data validation check failed)
CVVResponseUnsupported // CVV verification is not supported
CVVResponseMatch // CVV matches
CVVResponseNoMatch // CVV doesn't match
CVVResponseNotProcessed // Verification didn't happen (e.g. auth already declined by bank before checking CVV)
CVVResponseRequiredButMissing // CVV should be present, but it was reported as not
CVVResponseSuspicious // The issuing bank determined this transaction to be suspicious
CVVResponseSkipped // Verification was not performed for this transaction
)
var cvvCodeToString = map[CVVResponse]string{
CVVResponseUnknown: "CVVResponseUnknown",
CVVResponseNoResponse: "CVVResponseNoResponse",
CVVResponseError: "CVVResponseError",
CVVResponseUnsupported: "CVVResponseUnsupported",
CVVResponseMatch: "CVVResponseMatch",
CVVResponseNoMatch: "CVVResponseNoMatch",
CVVResponseNotProcessed: "CVVResponseNotProcessed",
CVVResponseRequiredButMissing: "CVVResponseRequiredButMissing",
CVVResponseSuspicious: "CVVResponseSuspicious",
CVVResponseSkipped: "CVVResponseSkipped",
}
// String returns a string representation of a CVV response code
func (code CVVResponse) String() string {
return cvvCodeToString[code]
}