lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/quickbooks.rb in activemerchant-1.80.0

- old
+ new

@@ -8,11 +8,11 @@ self.default_currency = 'USD' self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners] self.homepage_url = 'http://payments.intuit.com' self.display_name = 'QuickBooks Payments' - ENDPOINT = "/quickbooks/v4/payments/charges" + ENDPOINT = '/quickbooks/v4/payments/charges' OAUTH_ENDPOINTS = { site: 'https://oauth.intuit.com', request_token_path: '/oauth/v1/get_request_token', authorize_url: 'https://appcenter.intuit.com/Connect/Begin', access_token_path: '/oauth/v1/get_access_token' @@ -58,20 +58,20 @@ def purchase(money, payment, options = {}) post = {} add_amount(post, money, options) add_charge_data(post, payment, options) - post[:capture] = "true" + post[:capture] = 'true' commit(ENDPOINT, post) end def authorize(money, payment, options = {}) post = {} add_amount(post, money, options) add_charge_data(post, payment, options) - post[:capture] = "false" + post[:capture] = 'false' commit(ENDPOINT, post) end def capture(money, authorization, options = {}) @@ -143,11 +143,11 @@ end def add_creditcard(post, creditcard, options = {}) card = {} card[:number] = creditcard.number - card[:expMonth] = "%02d" % creditcard.month + card[:expMonth] = '%02d' % creditcard.month card[:expYear] = creditcard.year card[:cvc] = creditcard.verification_value if creditcard.verification_value? card[:name] = creditcard.name if creditcard.name card[:commercialCardCode] = options[:card_code] if options[:card_code] @@ -216,11 +216,11 @@ # Following the guidelines from http://nouncer.com/oauth/authentication.html oauth_parameters = { oauth_nonce: generate_unique_id, oauth_timestamp: Time.now.to_i.to_s, oauth_signature_method: 'HMAC-SHA1', - oauth_version: "1.0", + oauth_version: '1.0', oauth_consumer_key: @options[:consumer_key], oauth_token: @options[:access_token] } # prepare components for signature @@ -235,13 +235,13 @@ oauth_parameters = Hash[oauth_parameters.sort_by {|k, _| k}] oauth_headers = ["OAuth realm=\"#{@options[:realm]}\""] oauth_headers += oauth_parameters.map {|k, v| "#{k}=\"#{v}\""} { - "Content-type" => "application/json", - "Request-Id" => generate_unique_id, - "Authorization" => oauth_headers.join(', ') + 'Content-type' => 'application/json', + 'Request-Id' => generate_unique_id, + 'Authorization' => oauth_headers.join(', ') } end def cvv_code_from(response) if response['errors'].present? @@ -256,14 +256,14 @@ !['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"]] : "" + response['errors'].present? ? STANDARD_ERROR_CODE_MAPPING[response['errors'].first['code']] : '' end def authorization_from(response) response['id'] end