lib/active_merchant/billing/gateways/d_local.rb in activemerchant-1.103.0 vs lib/active_merchant/billing/gateways/d_local.rb in activemerchant-1.104.0

- old
+ new

@@ -87,10 +87,11 @@ post[:currency] = (options[:currency] || currency(money)) end def add_country(post, card, options) return unless address = options[:billing_address] || options[:address] + post[:country] = lookup_country_code(address[:country]) end def lookup_country_code(country) Country.find(country).code(:alpha2).value @@ -109,10 +110,11 @@ post[:payer][:address] = add_address(post, card, options) end def add_address(post, card, options) return unless address = options[:billing_address] || options[:address] + address_object = {} address_object[:state] = address[:state] if address[:state] address_object[:city] = address[:city] if address[:city] address_object[:zip_code] = address[:zip_code] if address[:zip_code] address_object[:street] = address[:street] if address[:street] @@ -127,10 +129,12 @@ post[:card][:expiration_year] = card.year post[:card][:number] = card.number post[:card][:cvv] = card.verification_value post[:card][:descriptor] = options[:dynamic_descriptor] if options[:dynamic_descriptor] post[:card][:capture] = (action == 'purchase') + post[:card][:installments] = options[:installments] if options[:installments] + post[:card][:installments_id] = options[:installments_id] if options[:installments_id] end def parse(body) JSON.parse(body) end @@ -161,10 +165,11 @@ # A refund may not be immediate, and return a status_code of 100, "Pending". # 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'] + ['100', '200', '400', '600'].include? response['status_code'].to_s end def message_from(action, response) response['status_detail'] || response['message'] @@ -174,9 +179,10 @@ response['id'] end def error_code_from(action, response) return if success_from(action, response) + code = response['status_code'] || response['code'] code&.to_s end def url(action, parameters, options={})