lib/active_merchant/billing/gateways/adyen.rb in activemerchant-1.96.0 vs lib/active_merchant/billing/gateways/adyen.rb in activemerchant-1.97.0

- old
+ new

@@ -8,11 +8,11 @@ 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' self.currencies_without_fractions = %w(CVE DJF GNF IDR JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF) - self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover, :elo] + self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover, :elo, :naranja] self.money_format = :cents self.homepage_url = 'https://www.adyen.com/' self.display_name = 'Adyen' @@ -326,28 +326,16 @@ } end def add_3ds(post, options) if three_ds_2_options = options[:three_ds_2] - if browser_info = three_ds_2_options[:browser_info] - post[:browserInfo] = { - acceptHeader: browser_info[:accept_header], - colorDepth: browser_info[:depth], - javaEnabled: browser_info[:java], - language: browser_info[:language], - screenHeight: browser_info[:height], - screenWidth: browser_info[:width], - timeZoneOffset: browser_info[:timezone], - userAgent: browser_info[:user_agent] - } - - if device_channel = three_ds_2_options[:channel] - post[:threeDS2RequestData] = { - deviceChannel: device_channel, - notificationURL: three_ds_2_options[:notification_url] || 'https://example.com/notification' - } - end + device_channel = three_ds_2_options[:channel] + if device_channel == 'app' + post[:threeDS2RequestData] = { deviceChannel: device_channel } + else + add_browser_info(three_ds_2_options[:browser_info], post) + post[:threeDS2RequestData] = { deviceChannel: device_channel, notificationURL: three_ds_2_options[:notification_url] } end else return unless options[:execute_threed] || options[:threed_dynamic] post[:browserInfo] = { userAgent: options[:user_agent], acceptHeader: options[:accept_header] } post[:additionalData] = { executeThreeD: 'true' } if options[:execute_threed] @@ -454,9 +442,23 @@ JSON.generate(parameters) end def error_code_from(response) STANDARD_ERROR_CODE_MAPPING[response['errorCode']] + end + + def add_browser_info(browser_info, post) + return unless browser_info + post[:browserInfo] = { + acceptHeader: browser_info[:accept_header], + colorDepth: browser_info[:depth], + javaEnabled: browser_info[:java], + language: browser_info[:language], + screenHeight: browser_info[:height], + screenWidth: browser_info[:width], + timeZoneOffset: browser_info[:timezone], + userAgent: browser_info[:user_agent] + } end end end end