lib/active_merchant/billing/gateways/redsys.rb in activemerchant-1.126.0 vs lib/active_merchant/billing/gateways/redsys.rb in activemerchant-1.129.0

- old
+ new

@@ -89,11 +89,11 @@ # The set of supported transactions for this gateway. # More operations are supported by the gateway itself, but # are not supported in this library. SUPPORTED_TRANSACTIONS = { - purchase: 'A', + purchase: '0', authorize: '1', capture: '2', refund: '3', cancel: '9' } @@ -264,13 +264,17 @@ commit data, options end def verify(creditcard, options = {}) - MultiResponse.run(:use_first_response) do |r| - r.process { authorize(100, creditcard, options) } - r.process(:ignore_result) { void(r.authorization, options) } + if options[:sca_exemption_behavior_override] == 'endpoint_and_ntid' + purchase(0, creditcard, options) + else + MultiResponse.run(:use_first_response) do |r| + r.process { authorize(100, creditcard, options) } + r.process(:ignore_result) { void(r.authorization, options) } + end end end def supports_scrubbing true @@ -683,10 +687,10 @@ def encrypt(key, order_id) block_length = 8 cipher = OpenSSL::Cipher.new('DES3') cipher.encrypt - cipher.key = Base64.strict_decode64(key) + cipher.key = Base64.urlsafe_decode64(key) # The OpenSSL default of an all-zeroes ("\\0") IV is used. cipher.padding = 0 order_id += "\0" until order_id.bytesize % block_length == 0 # Pad with zeros