lib/active_merchant/billing/gateways/ebanx.rb in activemerchant-1.71.0 vs lib/active_merchant/billing/gateways/ebanx.rb in activemerchant-1.72.0

- old
+ new

@@ -46,11 +46,11 @@ add_operation(post) add_invoice(post, money, options) add_customer_data(post, payment, options) add_payment(post, payment) add_address(post, options) - + add_customer_responsible_person(post, payment, options) if post[:payment][:country] == 'BR' commit(:purchase, post) end def authorize(money, payment, options={}) post = { payment: {} } @@ -58,10 +58,11 @@ add_operation(post) add_invoice(post, money, options) add_customer_data(post, payment, options) add_payment(post, payment) add_address(post, options) + add_customer_responsible_person(post, payment, options) if post[:payment][:country] == 'BR' post[:payment][:creditcard][:auto_capture] = false commit(:authorize, post) end @@ -127,12 +128,20 @@ def add_customer_data(post, payment, options) post[:payment][:name] = payment.name post[:payment][:email] = options[:email] || "unspecified@example.com" post[:payment][:document] = options[:document] + post[:payment][:birth_date] = options[:birth_date] if options[:birth_date] end + def add_customer_responsible_person(post, payment, options) + post[:payment][:responsible] = {} + post[:payment][:responsible][:name] = payment.name + post[:payment][:responsible][:document] = options[:document] + post[:payment][:responsible][:birth_date] = options[:birth_date] if options[:birth_date] + end + def add_address(post, options) if address = options[:billing_address] || options[:address] post[:payment][:address] = address[:address1].split[1..-1].join(" ") if address[:address1] post[:payment][:street_number] = address[:address1].split.first if address[:address1] post[:payment][:city] = address[:city] @@ -145,9 +154,10 @@ def add_invoice(post, money, options) post[:payment][:amount_total] = amount(money) post[:payment][:currency_code] = (options[:currency] || currency(money)) post[:payment][:merchant_payment_code] = options[:order_id] + post[:payment][:instalments] = options[:instalments] || 1 end def add_payment(post, payment) post[:payment][:payment_type_code] = CARD_BRAND[payment.brand.to_sym] post[:payment][:creditcard] = {