lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.108.0 vs lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.109.0
- old
+ new
@@ -4,11 +4,11 @@
self.test_url = 'https://sandbox.api.intuit.com'
self.live_url = 'https://api.intuit.com'
self.supported_countries = ['US']
self.default_currency = 'USD'
- self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners]
+ self.supported_cardtypes = %i[visa master american_express discover diners]
self.homepage_url = 'http://payments.intuit.com'
self.display_name = 'QuickBooks Payments'
BASE = '/quickbooks/v4/payments'
ENDPOINT = "#{BASE}/charges"
@@ -81,11 +81,11 @@
check_token_response(response, ENDPOINT, post, options)
end
def capture(money, authorization, options = {})
post = {}
- authorization, _ = split_authorization(authorization)
+ authorization, = split_authorization(authorization)
post[:amount] = localized_amount(money, currency(money))
add_context(post, options)
response = commit(capture_uri(authorization), post)
check_token_response(response, capture_uri(authorization), post, options)
@@ -93,11 +93,11 @@
def refund(money, authorization, options = {})
post = {}
post[:amount] = localized_amount(money, currency(money))
add_context(post, options)
- authorization, _ = split_authorization(authorization)
+ authorization, = split_authorization(authorization)
response = commit(refund_uri(authorization), post)
check_token_response(response, refund_uri(authorization), post, options)
end
@@ -237,11 +237,11 @@
end
def headers(method, uri)
return oauth_v2_headers if @options[:refresh_token]
- raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get" unless [:post, :get].include?(method)
+ raise ArgumentError, "Invalid HTTP method: #{method}. Valid methods are :post and :get" unless %i[post get].include?(method)
request_uri = URI.parse(uri)
# Following the guidelines from http://nouncer.com/oauth/authentication.html
oauth_parameters = {
@@ -321,18 +321,18 @@
end
def success?(response)
return FRAUD_WARNING_CODES.concat(['0']).include?(response['errors'].first['code']) if response['errors']
- !['DECLINED', 'CANCELLED'].include?(response['status']) && !['AuthenticationFailed', 'AuthorizationFailed'].include?(response['code'])
+ !%w[DECLINED CANCELLED].include?(response['status']) && !%w[AuthenticationFailed AuthorizationFailed].include?(response['code'])
end
def message_from(response)
response['errors'].present? ? response['errors'].map { |error_hash| error_hash['message'] }.join(' ') : response['status']
end
def errors_from(response)
- if ['AuthenticationFailed', 'AuthorizationFailed'].include?(response['code'])
+ if %w[AuthenticationFailed AuthorizationFailed].include?(response['code'])
response['code']
else
response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : ''
end
end