lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.114.0 vs lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.116.0
- old
+ new
@@ -92,11 +92,11 @@
APPLE_PAY_DATA_DESCRIPTOR = 'COMMON.APPLE.INAPP.PAYMENT'
PAYMENT_METHOD_NOT_SUPPORTED_ERROR = '155'
INELIGIBLE_FOR_ISSUING_CREDIT_ERROR = '54'
- def initialize(options={})
+ def initialize(options = {})
requires!(options, :login, :password)
super
end
def purchase(amount, payment, options = {})
@@ -109,11 +109,11 @@
add_auth_purchase(xml, 'authCaptureTransaction', amount, payment, options)
end
end
end
- def authorize(amount, payment, options={})
+ def authorize(amount, payment, options = {})
if payment.is_a?(String)
commit(:cim_authorize, options) do |xml|
add_cim_auth_purchase(xml, 'profileTransAuthOnly', amount, payment, options)
end
else
@@ -121,19 +121,19 @@
add_auth_purchase(xml, 'authOnlyTransaction', amount, payment, options)
end
end
end
- def capture(amount, authorization, options={})
+ def capture(amount, authorization, options = {})
if auth_was_for_cim?(authorization)
cim_capture(amount, authorization, options)
else
normal_capture(amount, authorization, options)
end
end
- def refund(amount, authorization, options={})
+ def refund(amount, authorization, options = {})
response =
if auth_was_for_cim?(authorization)
cim_refund(amount, authorization, options)
else
normal_refund(amount, authorization, options)
@@ -147,19 +147,19 @@
else
response
end
end
- def void(authorization, options={})
+ def void(authorization, options = {})
if auth_was_for_cim?(authorization)
cim_void(authorization, options)
else
normal_void(authorization, options)
end
end
- def credit(amount, payment, options={})
+ def credit(amount, payment, options = {})
raise ArgumentError, 'Reference credits are not supported. Please supply the original credit card or use the #refund method.' if payment.is_a?(String)
commit(:credit) do |xml|
add_order_id(xml, options)
xml.transactionRequest do
@@ -566,13 +566,15 @@
xml.customerIP(options[:ip]) unless empty?(options[:ip])
xml.cardholderAuthentication do
three_d_secure = options.fetch(:three_d_secure, {})
xml.authenticationIndicator(
- options[:authentication_indicator] || three_d_secure[:eci])
+ options[:authentication_indicator] || three_d_secure[:eci]
+ )
xml.cardholderAuthenticationValue(
- options[:cardholder_authentication_value] || three_d_secure[:cavv])
+ options[:cardholder_authentication_value] || three_d_secure[:cavv]
+ )
end
end
def add_billing_address(xml, payment_source, options)
address = options[:billing_address] || options[:address] || {}
@@ -593,11 +595,11 @@
xml.phoneNumber(truncate(address[:phone], 25)) unless empty?(address[:phone])
xml.faxNumber(truncate(address[:fax], 25)) unless empty?(address[:fax])
end
end
- def add_shipping_address(xml, options, root_node='shipTo')
+ def add_shipping_address(xml, options, root_node = 'shipTo')
address = options[:shipping_address] || options[:address]
return unless address
xml.send(root_node) do
first_name, last_name =
@@ -617,11 +619,11 @@
xml.zip(truncate(address[:zip], 20))
xml.country(truncate(address[:country], 60))
end
end
- def add_ship_from_address(xml, options, root_node='shipFrom')
+ def add_ship_from_address(xml, options, root_node = 'shipFrom')
address = options[:ship_from_address]
return unless address
xml.send(root_node) do
xml.zip(truncate(address[:zip], 20)) unless empty?(address[:zip])
@@ -840,10 +842,10 @@
def parse_normal(action, body)
doc = Nokogiri::XML(body)
doc.remove_namespaces!
- response = {action: action}
+ response = { action: action }
response[:response_code] = if (element = doc.at_xpath('//transactionResponse/responseCode'))
empty?(element.content) ? nil : element.content.to_i
end