lib/active_merchant/billing/gateways/clearhaus.rb in activemerchant-1.86.0 vs lib/active_merchant/billing/gateways/clearhaus.rb in activemerchant-1.87.0
- old
+ new
@@ -52,20 +52,20 @@
def authorize(amount, payment, options={})
post = {}
add_invoice(post, amount, options)
action = if payment.respond_to?(:number)
- add_payment(post, payment)
- '/authorizations'
- elsif payment.kind_of?(String)
- "/cards/#{payment}/authorizations"
- else
- raise ArgumentError.new("Unknown payment type #{payment.inspect}")
+ add_payment(post, payment)
+ '/authorizations'
+ elsif payment.kind_of?(String)
+ "/cards/#{payment}/authorizations"
+ else
+ raise ArgumentError.new("Unknown payment type #{payment.inspect}")
end
post[:recurring] = options[:recurring] if options[:recurring]
- post[:threed_secure] = {pares: options[:pares]} if options[:pares]
+ post[:card][:pares] = options[:pares] if options[:pares]
commit(action, post)
end
def capture(amount, authorization, options={})
@@ -106,11 +106,11 @@
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )[\w=]+), '\1[FILTERED]').
gsub(%r((&?card(?:\[|%5B)csc(?:\]|%5D)=)[^&]*)i, '\1[FILTERED]').
- gsub(%r((&?card(?:\[|%5B)number(?:\]|%5D)=)[^&]*)i, '\1[FILTERED]')
+ gsub(%r((&?card(?:\[|%5B)pan(?:\]|%5D)=)[^&]*)i, '\1[FILTERED]')
end
private
def add_invoice(post, money, options)
@@ -124,24 +124,24 @@
post[:currency] = (options[:currency] || default_currency)
end
def add_payment(post, payment)
card = {}
- card[:number] = payment.number
+ card[:pan] = payment.number
card[:expire_month] = '%02d'% payment.month
card[:expire_year] = payment.year
if payment.verification_value?
- card[:csc] = payment.verification_value
+ card[:csc] = payment.verification_value
end
post[:card] = card if card.any?
end
def headers(api_key)
{
- 'Authorization' => 'Basic ' + Base64.strict_encode64("#{api_key}:"),
- 'User-Agent' => "Clearhaus ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
+ 'Authorization' => 'Basic ' + Base64.strict_encode64("#{api_key}:"),
+ 'User-Agent' => "Clearhaus ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
}
end
def parse(body)
JSON.parse(body) rescue body