lib/active_merchant/billing/gateways/d_local.rb in activemerchant-1.123.0 vs lib/active_merchant/billing/gateways/d_local.rb in activemerchant-1.124.0
- old
+ new
@@ -2,11 +2,11 @@
module Billing #:nodoc:
class DLocalGateway < Gateway
self.test_url = 'https://sandbox.dlocal.com'
self.live_url = 'https://api.dlocal.com'
- self.supported_countries = %w[AR BR CL CO MX PE UY TR]
+ self.supported_countries = %w[AR BD BO BR CL CM CN CO CR DO EC EG GH IN ID KE MY MX MA NG PA PY PE PH SN ZA TR UY VN]
self.default_currency = 'USD'
self.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro naranja cabal elo alia carnet]
self.homepage_url = 'https://dlocal.com/'
self.display_name = 'dLocal'
@@ -76,19 +76,24 @@
post[:payment_method_id] = 'CARD'
post[:payment_method_flow] = 'DIRECT'
add_country(post, card, options)
add_payer(post, card, options)
add_card(post, card, action, options)
+ add_additional_data(post, options)
post[:order_id] = options[:order_id] || generate_unique_id
post[:description] = options[:description] if options[:description]
end
def add_invoice(post, money, options)
post[:amount] = amount(money)
post[:currency] = (options[:currency] || currency(money))
end
+ def add_additional_data(post, options)
+ post[:additional_risk_data] = options[:additional_data]
+ end
+
def add_country(post, card, options)
return unless address = options[:billing_address] || options[:address]
post[:country] = lookup_country_code(address[:country])
end
@@ -107,9 +112,11 @@
post[:payer][:birth_date] = options[:birth_date] if options[:birth_date]
post[:payer][:phone] = address[:phone] if address && address[:phone]
post[:payer][:document] = options[:document] if options[:document]
post[:payer][:document2] = options[:document2] if options[:document2]
post[:payer][:user_reference] = options[:user_reference] if options[:user_reference]
+ post[:payer][:event_uuid] = options[:device_id] if options[:device_id]
+ post[:payer][:onboarding_ip_address] = options[:ip] if options[:ip]
post[:payer][:address] = add_address(post, card, options)
end
def add_address(post, card, options)
return unless address = options[:billing_address] || options[:address]