lib/active_merchant/billing/gateways/paypal.rb in activemerchant-1.95.0 vs lib/active_merchant/billing/gateways/paypal.rb in activemerchant-1.96.0
- old
+ new
@@ -7,11 +7,11 @@
class PaypalGateway < Gateway
include PaypalCommonAPI
include PaypalRecurringApi
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
- self.supported_countries = ['US']
+ self.supported_countries = ['CA', 'NZ', 'GB', 'US']
self.homepage_url = 'https://www.paypal.com/us/webapps/mpp/paypal-payments-pro'
self.display_name = 'PayPal Payments Pro (US)'
def authorize(money, credit_card_or_referenced_id, options = {})
requires!(options, :ip)
@@ -88,15 +88,28 @@
end
xml.tag! 'n2:Payer', options[:email]
add_address(xml, 'n2:Address', address)
end
+
+ add_three_d_secure(xml, options) if options[:three_d_secure]
end
end
def add_descriptors(xml, options)
xml.tag! 'n2:SoftDescriptor', options[:soft_descriptor] unless options[:soft_descriptor].blank?
xml.tag! 'n2:SoftDescriptorCity', options[:soft_descriptor_city] unless options[:soft_descriptor_city].blank?
+ end
+
+ def add_three_d_secure(xml, options)
+ three_d_secure = options[:three_d_secure]
+ xml.tag! 'ThreeDSecureRequest' do
+ xml.tag! 'MpiVendor3ds', 'Y'
+ xml.tag! 'AuthStatus3ds', three_d_secure[:trans_status] unless three_d_secure[:trans_status].blank?
+ xml.tag! 'Cavv', three_d_secure[:cavv] unless three_d_secure[:cavv].blank?
+ xml.tag! 'Eci3ds', three_d_secure[:eci] unless three_d_secure[:eci].blank?
+ xml.tag! 'Xid', three_d_secure[:xid] unless three_d_secure[:xid].blank?
+ end
end
def credit_card_type(type)
case type
when 'visa' then 'Visa'