lib/active_merchant/billing/gateways/blue_snap.rb in activemerchant-1.97.0 vs lib/active_merchant/billing/gateways/blue_snap.rb in activemerchant-1.98.0

- old
+ new

@@ -6,11 +6,11 @@ self.test_url = 'https://sandbox.bluesnap.com/services/2' self.live_url = 'https://ws.bluesnap.com/services/2' self.supported_countries = %w(US CA GB AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE AR BO BR BZ CL CO CR DO EC GF GP GT HN HT MF MQ MX NI PA PE PR PY SV UY VE) self.default_currency = 'USD' - self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro, :naranja] + self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro, :naranja, :cabal] self.homepage_url = 'https://home.bluesnap.com/' self.display_name = 'BlueSnap' TRANSACTIONS = { @@ -221,10 +221,11 @@ def add_order(doc, options) doc.send('merchant-transaction-id', truncate(options[:order_id], 50)) if options[:order_id] doc.send('soft-descriptor', options[:soft_descriptor]) if options[:soft_descriptor] add_description(doc, options[:description]) if options[:description] + add_3ds(doc, options[:three_d_secure]) if options[:three_d_secure] add_level_3_data(doc, options) end def add_address(doc, options) address = options[:billing_address] @@ -233,9 +234,25 @@ doc.country(address[:country]) if address[:country] doc.state(address[:state]) if address[:state] && STATE_CODE_COUNTRIES.include?(address[:country]) doc.address(address[:address]) if address[:address] doc.city(address[:city]) if address[:city] doc.zip(address[:zip]) if address[:zip] + end + + def add_3ds(doc, three_d_secure_options) + eci = three_d_secure_options[:eci] + cavv = three_d_secure_options[:cavv] + xid = three_d_secure_options[:xid] + ds_transaction_id = three_d_secure_options[:ds_transaction_id] + version = three_d_secure_options[:version] + + doc.send('three-d-secure') do + doc.eci(eci) if eci + doc.cavv(cavv) if cavv + doc.xid(xid) if xid + doc.send('three-d-secure-version', version) if version + doc.send('ds-transaction-id', ds_transaction_id) if ds_transaction_id + end end def add_level_3_data(doc, options) return unless options[:customer_reference_number] doc.send('level-3-data') do