lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.85.0 vs lib/active_merchant/billing/gateways/authorize_net.rb in activemerchant-1.86.0
- old
+ new
@@ -255,10 +255,11 @@
add_po_number(xml, options)
add_customer_data(xml, payment, options)
add_market_type_device_type(xml, payment, options)
add_settings(xml, payment, options)
add_user_fields(xml, amount, options)
+ add_ship_from_address(xml, options)
end
end
def add_cim_auth_purchase(xml, transaction_type, amount, payment, options)
add_order_id(xml, options)
@@ -608,18 +609,29 @@
xml.zip(truncate(address[:zip], 20))
xml.country(truncate(address[:country], 60))
end
end
+ def add_ship_from_address(xml, options, root_node='shipFrom')
+ address = options[:ship_from_address]
+ return unless address
+
+ xml.send(root_node) do
+ xml.zip(truncate(address[:zip], 20)) unless empty?(address[:zip])
+ xml.country(truncate(address[:country], 60)) unless empty?(address[:country])
+ end
+ end
+
def add_order_id(xml, options)
xml.refId(truncate(options[:order_id], 20))
end
def add_invoice(xml, transaction_type, options)
xml.order do
xml.invoiceNumber(truncate(options[:order_id], 20))
xml.description(truncate(options[:description], 255))
xml.purchaseOrderNumber(options[:po_number]) if options[:po_number] && transaction_type.start_with?('profileTrans')
+ xml.summaryCommodityCode(truncate(options[:summary_commodity_code], 4)) if options[:summary_commodity_code] && !transaction_type.start_with?('profileTrans')
end
# Authorize.net API requires lineItems to be placed directly after order tag
if options[:line_items]
xml.lineItems do