Skip to content

Commit

Permalink
Merge pull request #84 from nirajjayantbolt/master
Browse files Browse the repository at this point in the history
Updating API versions
  • Loading branch information
zhutik authored May 8, 2020
2 parents 771fae8 + e7a5332 commit b6dc639
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 3 deletions.
6 changes: 3 additions & 3 deletions adyen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,7 +29,7 @@ const (
RecurringService = "Recurring"

// CheckoutAPIVersion - API version of current checkout API
CheckoutAPIVersion = "v32"
CheckoutAPIVersion = "v52"
)

// Adyen - base structure with configuration options
Expand Down
37 changes: 37 additions & 0 deletions avs.go
Original file line number Diff line number Diff line change
@@ -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"
)
16 changes: 16 additions & 0 deletions cvv.go
Original file line number Diff line number Diff line change
@@ -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"
)
7 changes: 7 additions & 0 deletions notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
4 changes: 4 additions & 0 deletions payment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b6dc639

Please sign in to comment.