lib/active_merchant/billing/gateways/d_local.rb in activemerchant-1.124.0 vs lib/active_merchant/billing/gateways/d_local.rb in activemerchant-1.125.0
- old
+ new
@@ -24,10 +24,11 @@
end
def authorize(money, payment, options = {})
post = {}
add_auth_purchase_params(post, money, payment, 'authorize', options)
+ post[:card][:verify] = true if options[:verify].to_s == 'true'
commit('authorize', post, options)
end
def capture(money, authorization, options = {})
@@ -50,14 +51,11 @@
post[:authorization_id] = authorization
commit('void', post, options)
end
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
+ authorize(0, credit_card, options.merge(verify: 'true'))
end
def supports_scrubbing?
true
end
@@ -189,11 +187,11 @@
# Since we aren't handling async notifications of eventual success,
# we count 100 as a success.
def success_from(action, response)
return false unless response['status_code']
- %w[100 200 400 600].include? response['status_code'].to_s
+ %w[100 200 400 600 700].include? response['status_code'].to_s
end
def message_from(action, response)
response['status_detail'] || response['message']
end
@@ -233,9 +231,10 @@
headers = {
'Content-Type' => 'application/json',
'X-Date' => timestamp,
'X-Login' => @options[:login],
'X-Trans-Key' => @options[:trans_key],
+ 'X-Version' => '2.1',
'Authorization' => signature(post, timestamp)
}
headers.merge('X-Idempotency-Key' => options[:idempotency_key]) if options[:idempotency_key]
headers
end