lib/active_merchant/billing/gateways/blue_snap.rb in activemerchant-1.81.0 vs lib/active_merchant/billing/gateways/blue_snap.rb in activemerchant-1.82.0
- old
+ new
@@ -114,11 +114,11 @@
end
end
def verify_credentials
begin
- ssl_get("#{url}/nonexistent", headers)
+ ssl_get(url.to_s, headers)
rescue ResponseError => e
return false if e.response.code.to_i == 401
end
true
@@ -138,10 +138,11 @@
private
def add_auth_purchase(doc, money, payment_method, options)
doc.send('recurring-transaction', options[:recurring] ? 'RECURRING' : 'ECOMMERCE')
add_order(doc, options)
+ doc.send('storeCard', options[:store_card] || false)
add_amount(doc, money, options)
doc.send('transaction-fraud-info') do
doc.send('shopper-ip-address', options[:ip]) if options[:ip]
end
@@ -207,10 +208,11 @@
doc.send('transaction-id', authorization)
end
def parse(response)
return bad_authentication_response if response.code.to_i == 401
+ return forbidden_response(response.body) if response.code.to_i == 403
parsed = {}
doc = Nokogiri::XML(response.body)
doc.root.xpath('*').each do |node|
if (node.elements.empty?)
@@ -335,9 +337,13 @@
end
end
def bad_authentication_response
{ 'description' => 'Unable to authenticate. Please check your credentials.' }
+ end
+
+ def forbidden_response(body)
+ { 'description' => body }
end
end
end
end