lib/active_merchant/billing/gateways/realex.rb in activemerchant-1.18.0 vs lib/active_merchant/billing/gateways/realex.rb in activemerchant-1.18.1
- old
+ new
@@ -195,11 +195,11 @@
end
end
if shipping_address
xml.tag! 'address', 'type' => 'shipping' do
- xml.tag! 'code', avs_input_code( shipping_address )
+ xml.tag! 'code', format_shipping_zip_code(shipping_address[:zip])
xml.tag! 'country', shipping_address[:country]
end
end
end
end
@@ -243,9 +243,13 @@
end
end
def avs_input_code(address)
address.values_at(:zip, :address1).map{ |v| extract_digits(v) }.join('|')
+ end
+
+ def format_shipping_zip_code(zip)
+ zip.to_s.gsub(/\W/, '')
end
def extract_digits(string)
return "" if string.nil?
string.gsub(/[\D]/,'')
\ No newline at end of file