lib/active_merchant/billing/integrations/moneybookers/helper.rb in activemerchant-1.28.0 vs lib/active_merchant/billing/integrations/moneybookers/helper.rb in activemerchant-1.29.0

- old
+ new

@@ -24,19 +24,29 @@ mapping :notify_url, 'status_url' mapping :return_url, 'return_url' mapping :cancel_return_url, 'cancel_url' mapping :description, 'detail1_text' + + MAPPED_COUNTRY_CODES = { + 'SE' => 'SV', + 'DK' => 'DA' + } + + SUPPORTED_COUNTRY_CODES = [ + 'FI', 'DE', 'ES', 'FR', + 'IT','PL', 'GR', 'RO', + 'RU', 'TR', 'CN', 'CZ', 'NL' + ] def initialize(order, account, options = {}) super add_tracking_token add_default_parameters add_seller_details(options) end - private def add_tracking_token return if application_id.blank? || application_id == 'ActiveMerchant' @@ -49,9 +59,15 @@ end def add_seller_details(options) add_field('recipient_description', options[:account_name]) if options[:account_name] add_field('country', lookup_country_code(options[:country], :alpha3)) if options[:country] + add_field('language', locale_code(options[:country])) if options[:country] + end + + def locale_code(country_code) + return country_code if SUPPORTED_COUNTRY_CODES.include?(country_code) + MAPPED_COUNTRY_CODES[country_code] || 'EN' end end end end end