Skip to content

Commit

Permalink
Adyen: Constantize version to fix subdomains
Browse files Browse the repository at this point in the history
Closes activemerchant#3228

Remote:
60 tests, 187 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Unit (subdomain test run and verified independently):
37 tests, 179 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
curiousepic authored and whitby3001 committed Sep 3, 2019
1 parent 2dbf5ff commit 6c4d3b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Expand Up @@ -16,7 +16,8 @@
* WorldPay: Support Unknown Card Type [tanyajajodia] #3213
* Mundipagg: Make gateway_affiliation_id an option [curiousepic] #3219
* CyberSource: Adds Elo Card Type [tanyajajodia] #3220
* CyberSource: Support standalone credit for cards [curiousepic] 3225
* CyberSource: Support standalone credit for cards [curiousepic] #3225
* Adyen: Constantize version to fix subdomains [curiousepic] #3228

== Version 1.93.0 (April 18, 2019)
* Stripe: Do not consider a refund unsuccessful if only refunding the fee failed [jasonwebster] #3188
Expand Down
12 changes: 7 additions & 5 deletions lib/active_merchant/billing/gateways/adyen.rb
Expand Up @@ -4,8 +4,8 @@ class AdyenGateway < Gateway

# we recommend setting up merchant-specific endpoints.
# https://docs.adyen.com/developers/api-manual#apiendpoints
self.test_url = 'https://pal-test.adyen.com/pal/servlet/Payment/v40'
self.live_url = 'https://pal-live.adyen.com/pal/servlet/Payment/v40'
self.test_url = 'https://pal-test.adyen.com/pal/servlet/Payment/'
self.live_url = 'https://pal-live.adyen.com/pal/servlet/Payment/'

self.supported_countries = ['AT', 'AU', 'BE', 'BG', 'BR', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'HK', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SG', 'SK', 'SI', 'US']
self.default_currency = 'USD'
Expand All @@ -16,6 +16,8 @@ class AdyenGateway < Gateway
self.homepage_url = 'https://www.adyen.com/'
self.display_name = 'Adyen'

API_VERSION = 'v40'

STANDARD_ERROR_CODE_MAPPING = {
'101' => STANDARD_ERROR_CODE[:incorrect_number],
'103' => STANDARD_ERROR_CODE[:invalid_cvc],
Expand Down Expand Up @@ -375,11 +377,11 @@ def cvv_result_from(response)

def url
if test?
test_url
"#{test_url}#{API_VERSION}"
elsif @options[:subdomain]
"https://#{@options[:subdomain]}-pal-live.adyenpayments.com/pal/servlet/Payment/v18"
"https://#{@options[:subdomain]}-pal-live.adyenpayments.com/pal/servlet/Payment/#{API_VERSION}"
else
live_url
"#{live_url}#{API_VERSION}"
end
end

Expand Down

0 comments on commit 6c4d3b2

Please sign in to comment.