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

- old
+ new

@@ -10,24 +10,24 @@ self.homepage_url = 'http://www.ebanx.com/' self.display_name = 'Ebanx' CARD_BRAND = { - visa: "visa", - master: "master_card", - american_express: "amex", - discover: "discover", - diners_club: "diners" + visa: 'visa', + master: 'master_card', + american_express: 'amex', + discover: 'discover', + diners_club: 'diners' } URL_MAP = { - purchase: "direct", - authorize: "direct", - capture: "capture", - refund: "refund", - void: "cancel", - store: "token" + purchase: 'direct', + authorize: 'direct', + capture: 'capture', + refund: 'refund', + void: 'cancel', + store: 'token' } HTTP_METHOD = { purchase: :post, authorize: :post, @@ -129,20 +129,20 @@ def add_integration_key(post) post[:integration_key] = @options[:integration_key].to_s end def add_operation(post) - post[:operation] = "request" + post[:operation] = 'request' end def add_authorization(post, authorization) post[:hash] = authorization end def add_customer_data(post, payment, options) post[:payment][:name] = customer_name(payment, options) - post[:payment][:email] = options[:email] || "unspecified@example.com" + post[:payment][:email] = options[:email] || 'unspecified@example.com' post[:payment][:document] = options[:document] post[:payment][:birth_date] = options[:birth_date] if options[:birth_date] end def add_customer_responsible_person(post, payment, options) @@ -155,11 +155,11 @@ end end def add_address(post, options) if address = options[:billing_address] || options[:address] - post[:payment][:address] = address[:address1].split[1..-1].join(" ") if address[:address1] + post[:payment][:address] = address[:address1].split[1..-1].join(' ') if address[:address1] post[:payment][:street_number] = address[:address1].split.first if address[:address1] post[:payment][:city] = address[:city] post[:payment][:state] = address[:state] post[:payment][:zipcode] = address[:zip] post[:payment][:country] = address[:country].downcase @@ -174,11 +174,11 @@ post[:payment][:instalments] = options[:instalments] || 1 end def add_card_or_token(post, payment) if payment.is_a?(String) - payment, brand = payment.split("|") + payment, brand = payment.split('|') end post[:payment][:payment_type_code] = payment.is_a?(String) ? brand : CARD_BRAND[payment.brand.to_sym] post[:payment][:creditcard] = payment_details(payment) end @@ -220,32 +220,32 @@ ) end def success_from(action, response) if [:purchase, :capture, :refund].include?(action) - response.try(:[], "payment").try(:[], "status") == "CO" + response.try(:[], 'payment').try(:[], 'status') == 'CO' elsif action == :authorize - response.try(:[], "payment").try(:[], "status") == "PE" + response.try(:[], 'payment').try(:[], 'status') == 'PE' elsif action == :void - response.try(:[], "payment").try(:[], "status") == "CA" + response.try(:[], 'payment').try(:[], 'status') == 'CA' elsif action == :store - response.try(:[], "status") == "SUCCESS" + response.try(:[], 'status') == 'SUCCESS' else false end end def message_from(response) - return response["status_message"] if response["status"] == "ERROR" - response.try(:[], "payment").try(:[], "transaction_status").try(:[], "description") + return response['status_message'] if response['status'] == 'ERROR' + response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'description') end def authorization_from(action, parameters, response) if action == :store "#{response.try(:[], "token")}|#{CARD_BRAND[parameters[:payment_type_code].to_sym]}" else - response.try(:[], "payment").try(:[], "hash") + response.try(:[], 'payment').try(:[], 'hash') end end def post_data(action, parameters = {}) return nil if requires_http_get(action) @@ -265,17 +265,17 @@ def convert_to_url_form_encoded(parameters) parameters.map do |key, value| next if value != false && value.blank? "#{key}=#{value}" - end.compact.join("&") + end.compact.join('&') end def error_code_from(response, success) unless success - return response["status_code"] if response["status"] == "ERROR" - response.try(:[], "payment").try(:[], "transaction_status").try(:[], "code") + return response['status_code'] if response['status'] == 'ERROR' + response.try(:[], 'payment').try(:[], 'transaction_status').try(:[], 'code') end end def customer_country(options) if country = options[:country] || (options[:billing_address][:country] if options[:billing_address]) @@ -284,10 +284,10 @@ end def customer_name(payment, options) address_name = options[:billing_address][:name] if options[:billing_address] && options[:billing_address][:name] if payment.is_a?(String) - address_name || "Not Provided" + address_name || 'Not Provided' else payment.name end end end