lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.133.0 vs lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.137.0

- old
+ new

@@ -40,14 +40,14 @@ # Transaction Declined 'PMT-5000' => STANDARD_ERROR_CODE[:card_declined], # Request was declined 'PMT-5001' => STANDARD_ERROR_CODE[:card_declined], # Merchant does not support given payment method # System Error - 'PMT-6000' => STANDARD_ERROR_CODE[:processing_error], # A temporary Issue prevented this request from being processed. + 'PMT-6000' => STANDARD_ERROR_CODE[:processing_error] # A temporary Issue prevented this request from being processed. } - FRAUD_WARNING_CODES = ['PMT-1000', 'PMT-1001', 'PMT-1002', 'PMT-1003'] + FRAUD_WARNING_CODES = %w(PMT-1000 PMT-1001 PMT-1002 PMT-1003) def initialize(options = {}) # Quickbooks is deprecating OAuth 1.0 on December 17, 2019. # OAuth 2.0 requires a client_id, client_secret, access_token, and refresh_token # To maintain backwards compatibility, check for the presence of a refresh_token (only specified for OAuth 2.0) @@ -126,12 +126,12 @@ gsub(%r((realm=\")\w+), '\1[FILTERED]'). gsub(%r((oauth_consumer_key=\")\w+), '\1[FILTERED]'). gsub(%r((oauth_nonce=\")\w+), '\1[FILTERED]'). gsub(%r((oauth_signature=\")[a-zA-Z%0-9]+), '\1[FILTERED]'). gsub(%r((oauth_token=\")\w+), '\1[FILTERED]'). - gsub(%r((number\D+)\d{16}), '\1[FILTERED]'). - gsub(%r((cvc\D+)\d{3}), '\1[FILTERED]'). + gsub(%r((number\\\":\\\")\d+), '\1[FILTERED]'). + gsub(%r((cvc\\\":\\\")\d+), '\1[FILTERED]'). gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]'). gsub(%r((access_token\\?":\\?")[\w\-\.]+)i, '\1[FILTERED]'). gsub(%r((refresh_token\\?":\\?")\w+), '\1[FILTERED]'). gsub(%r((refresh_token=)\w+), '\1[FILTERED]'). gsub(%r((Authorization: Bearer )[\w\-\.]+)i, '\1[FILTERED]\2') @@ -261,11 +261,11 @@ # append signature to required OAuth parameters oauth_parameters[:oauth_signature] = CGI.escape(Base64.encode64(hmac_signature).chomp.delete("\n")) # prepare Authorization header string - oauth_parameters = Hash[oauth_parameters.sort_by { |k, _| k }] + oauth_parameters = oauth_parameters.sort_by { |k, _| k }.to_h oauth_headers = ["OAuth realm=\"#{@options[:realm]}\""] oauth_headers += oauth_parameters.map { |k, v| "#{k}=\"#{v}\"" } { 'Content-type' => 'application/json', @@ -356,9 +356,10 @@ begin parse(response_error.response.body) rescue JSON::ParserError raise response_error end + response_error.response.body end def refund_uri(authorization) "#{ENDPOINT}/#{CGI.escape(authorization.to_s)}/refunds"