diff --git a/adyen.go b/adyen.go index 86c0eef..f102b73 100644 --- a/adyen.go +++ b/adyen.go @@ -17,10 +17,10 @@ const ( DefaultClientTimeout = time.Second * 10 // PaymentAPIVersion - API version of current payment API - PaymentAPIVersion = "v30" + PaymentAPIVersion = "v52" // RecurringAPIVersion - API version of current recurring API - RecurringAPIVersion = "v25" + RecurringAPIVersion = "v49" // PaymentService is used to identify the standard payment workflow. PaymentService = "Payment" @@ -29,7 +29,7 @@ const ( RecurringService = "Recurring" // CheckoutAPIVersion - API version of current checkout API - CheckoutAPIVersion = "v32" + CheckoutAPIVersion = "v52" ) // Adyen - base structure with configuration options diff --git a/avs.go b/avs.go new file mode 100644 index 0000000..cf6e802 --- /dev/null +++ b/avs.go @@ -0,0 +1,37 @@ +package adyen + +// AVSResponse is a type definition for all possible responses from Adyen's AVS system +// +// https://docs.adyen.com/risk-management/avs-checks +type AVSResponse string + +// AVSResponse hard-coded for easy comparison checking later +const ( + AVSResponse0 AVSResponse = "0 Unknown" + AVSResponse1 AVSResponse = "1 Address matches, postal code doesn't" + AVSResponse2 AVSResponse = "2 Neither postal code nor address match" + AVSResponse3 AVSResponse = "3 AVS unavailable" + AVSResponse4 AVSResponse = "4 AVS not supported for this card type" + AVSResponse5 AVSResponse = "5 No AVS data provided" + AVSResponse6 AVSResponse = "6 Postal code matches, but the address does not match" + AVSResponse7 AVSResponse = "7 Both postal code and address match" + AVSResponse8 AVSResponse = "8 Address not checked, postal code unknown" + AVSResponse9 AVSResponse = "9 Address matches, postal code unknown" + AVSResponse10 AVSResponse = "10 Address doesn't match, postal code unknown" + AVSResponse11 AVSResponse = "11 Postal code not checked, address unknown" + AVSResponse12 AVSResponse = "12 Address matches, postal code not checked" + AVSResponse13 AVSResponse = "13 Address doesn't match, postal code not checked" + AVSResponse14 AVSResponse = "14 Postal code matches, address unknown" + AVSResponse15 AVSResponse = "15 Postal code matches, address not checked" + AVSResponse16 AVSResponse = "16 Postal code doesn't match, address unknown" + AVSResponse17 AVSResponse = "17 Postal code doesn't match, address not checked." + AVSResponse18 AVSResponse = "18 Neither postal code nor address were checked" + AVSResponse19 AVSResponse = "19 Name and postal code matches" + AVSResponse20 AVSResponse = "20 Name, address and postal code matches" + AVSResponse21 AVSResponse = "21 Name and address matches" + AVSResponse22 AVSResponse = "22 Name matches" + AVSResponse23 AVSResponse = "23 Postal code matches, name doesn't match" + AVSResponse24 AVSResponse = "24 Both postal code and address matches, name doesn't match" + AVSResponse25 AVSResponse = "25 Address matches, name doesn't match" + AVSResponse26 AVSResponse = "26 Neither postal code, address nor name matches" +) diff --git a/cvv.go b/cvv.go new file mode 100644 index 0000000..bd487f1 --- /dev/null +++ b/cvv.go @@ -0,0 +1,16 @@ +package adyen + +// CVCResult represents the Adyen translation of CVC codes from issuer +// https://docs.adyen.com/development-resources/test-cards/cvc-cvv-result-testing +type CVCResult string + +// Constants represented by numerical code they are assigned +const ( + CVCResult0 CVCResult = "0 Unknown" + CVCResult1 CVCResult = "1 Matches" + CVCResult2 CVCResult = "2 Doesn't Match" + CVCResult3 CVCResult = "3 Not Checked" + CVCResult4 CVCResult = "4 No CVC/CVV provided, but was required" + CVCResult5 CVCResult = "5 Issuer not certified for CVC/CVV" + CVCResult6 CVCResult = "6 No CVC/CVV provided" +) diff --git a/notification.go b/notification.go index 49506c8..b1371b5 100644 --- a/notification.go +++ b/notification.go @@ -30,6 +30,13 @@ type NotificationRequestItemData struct { AuthorisedAmountValue string `json:"authorisedAmountValue,omitempty"` AuthorisedAmountCurrency string `json:"authorisedAmountCurrency,omitempty"` HmacSignature string `json:"hmacSignature,omitempty"` + NOFReasonCode string `json:"nofReasonCode,omitempty"` + NOFSchemeCode string `json:"nofSchemeCode,omitempty"` + RFIReasonCode string `json:"rfiReasonCode,omitempty"` + RFISchemeCode string `json:"rfiSchemeCode,omitempty"` + ChargebackReasonCode string `json:"chargebackReasonCode,omitempty"` + ChargebackSchemeCode string `json:"chargebackSchemeCode,omitempty"` + ARN string `json:"arn,omitempty"` } `json:"additionalData,omitempty"` Amount Amount `json:"amount"` PspReference string `json:"pspReference"` diff --git a/payment.go b/payment.go index 769d92d..87b6702 100644 --- a/payment.go +++ b/payment.go @@ -93,6 +93,10 @@ type AdditionalData struct { FundingSource string `json:"fundingSource,omitempty"` CustomRoutingFlag string `json:"customRoutingFlag,omitempty"` RequestedTestAcquirerResponseCode int `json:"RequestedTestAcquirerResponseCode,omitempty"` //Used for trigger error from adyen + CVCResult CVCResult `json:"cvcResult,omitempty"` + CVCResultRaw string `json:"cvcResultRaw,omitempty"` + AVSResult AVSResponse `json:"avsResult,omitempty"` + AVSResultRaw string `json:"avsResultRaw,omitempty"` } // BrowserInfo hold information on the user browser