lib/active_merchant/billing/gateways/mastercard.rb in activemerchant-1.114.0 vs lib/active_merchant/billing/gateways/mastercard.rb in activemerchant-1.116.0
- old
+ new
@@ -1,14 +1,14 @@
module ActiveMerchant
module Billing
module MastercardGateway
- def initialize(options={})
+ def initialize(options = {})
requires!(options, :userid, :password)
super
end
- def purchase(amount, payment_method, options={})
+ def purchase(amount, payment_method, options = {})
if options[:pay_mode]
post = new_post
add_invoice(post, amount, options)
add_reference(post, *new_authorization)
add_payment_method(post, payment_method)
@@ -22,48 +22,48 @@
r.process { capture(amount, r.authorization, options) }
end
end
end
- def authorize(amount, payment_method, options={})
+ def authorize(amount, payment_method, options = {})
post = new_post
add_invoice(post, amount, options)
add_reference(post, *new_authorization)
add_payment_method(post, payment_method)
add_customer_data(post, payment_method, options)
add_3dsecure_id(post, options)
commit('authorize', post)
end
- def capture(amount, authorization, options={})
+ def capture(amount, authorization, options = {})
post = new_post
add_invoice(post, amount, options, :transaction)
add_reference(post, *next_authorization(authorization))
add_customer_data(post, nil, options)
add_3dsecure_id(post, options)
commit('capture', post)
end
- def refund(amount, authorization, options={})
+ def refund(amount, authorization, options = {})
post = new_post
add_invoice(post, amount, options, :transaction)
add_reference(post, *next_authorization(authorization))
add_customer_data(post, nil, options)
commit('refund', post)
end
- def void(authorization, options={})
+ def void(authorization, options = {})
post = new_post
add_reference(post, *next_authorization(authorization), :targetTransactionId)
commit('void', post)
end
- def verify(credit_card, options={})
+ def verify(credit_card, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
@@ -107,16 +107,16 @@
shipping: {},
transaction: {}
}
end
- def add_invoice(post, amount, options, node=:order)
+ def add_invoice(post, amount, options, node = :order)
post[node][:amount] = amount(amount)
post[node][:currency] = (options[:currency] || currency(amount))
end
- def add_reference(post, orderid, transactionid, transaction_reference, reference_key=:reference)
+ def add_reference(post, orderid, transactionid, transaction_reference, reference_key = :reference)
post[:orderid] = orderid
post[:transactionid] = transactionid
post[:transaction][reference_key] = transaction_reference if transaction_reference
end
@@ -174,10 +174,10 @@
end
def add_3dsecure_id(post, options)
return unless options[:threed_secure_id]
- post.merge!({'3DSecureId' => options[:threed_secure_id]})
+ post.merge!({ '3DSecureId' => options[:threed_secure_id] })
end
def country_code(country)
if country
country = ActiveMerchant::Country.find(country)