lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.86.0 vs lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.87.0
- old
+ new
@@ -46,11 +46,11 @@
# System Error
'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 = ['PMT-1000', 'PMT-1001', 'PMT-1002', 'PMT-1003']
def initialize(options = {})
requires!(options, :consumer_key, :consumer_secret, :access_token, :token_secret, :realm)
@options = options
super
@@ -222,21 +222,21 @@
oauth_consumer_key: @options[:consumer_key],
oauth_token: @options[:access_token]
}
# prepare components for signature
- oauth_signature_base_string = [method.to_s.upcase, request_uri.to_s, oauth_parameters.to_param].map{|v| CGI.escape(v) }.join('&')
- oauth_signing_key = [@options[:consumer_secret], @options[:token_secret]].map{|v| CGI.escape(v)}.join('&')
+ oauth_signature_base_string = [method.to_s.upcase, request_uri.to_s, oauth_parameters.to_param].map { |v| CGI.escape(v) }.join('&')
+ oauth_signing_key = [@options[:consumer_secret], @options[:token_secret]].map { |v| CGI.escape(v) }.join('&')
hmac_signature = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), oauth_signing_key, oauth_signature_base_string)
# append signature to required OAuth parameters
oauth_parameters[:oauth_signature] = CGI.escape(Base64.encode64(hmac_signature).chomp.gsub(/\n/, ''))
# prepare Authorization header string
- oauth_parameters = Hash[oauth_parameters.sort_by {|k, _| k}]
+ oauth_parameters = Hash[oauth_parameters.sort_by { |k, _| k }]
oauth_headers = ["OAuth realm=\"#{@options[:realm]}\""]
- oauth_headers += oauth_parameters.map {|k, v| "#{k}=\"#{v}\""}
+ oauth_headers += oauth_parameters.map { |k, v| "#{k}=\"#{v}\"" }
{
'Content-type' => 'application/json',
'Request-Id' => generate_unique_id,
'Authorization' => oauth_headers.join(', ')
@@ -256,10 +256,10 @@
!['DECLINED', 'CANCELLED'].include?(response['status'])
end
def message_from(response)
- response['errors'].present? ? response['errors'].map {|error_hash| error_hash['message'] }.join(' ') : response['status']
+ response['errors'].present? ? response['errors'].map { |error_hash| error_hash['message'] }.join(' ') : response['status']
end
def errors_from(response)
response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : ''
end