lib/active_merchant/billing/gateways/openpay.rb in activemerchant-1.103.0 vs lib/active_merchant/billing/gateways/openpay.rb in activemerchant-1.104.0
- old
+ new
@@ -73,11 +73,11 @@
post[:name] = options[:name]
post[:email] = options[:email]
MultiResponse.run(:first) do |r|
r.process { commit(:post, 'customers', post, options) }
- if(r.success? && !r.params['id'].blank?)
+ if r.success? && !r.params['id'].blank?
customer_id = r.params['id']
r.process { commit(:post, "customers/#{customer_id}/cards", card, options) }
end
end
end
@@ -149,10 +149,11 @@
post
end
def add_address(card, options)
return unless card.kind_of?(Hash)
+
if address = (options[:billing_address] || options[:address])
card[:address] = {
line1: address[:address1],
line2: address[:address2],
line3: address[:company],
@@ -173,9 +174,10 @@
}
end
def parse(body)
return {} unless body
+
JSON.parse(body)
end
def commit(method, resource, parameters, options = {})
response = http_request(method, resource, parameters, options)