Permalink
Browse files

Add 'Company' field to shipwire request instead of injecting it into …

…Address fields
  • Loading branch information...
Tom Burns
Tom Burns committed Jul 5, 2012
1 parent 2200cb8 commit d49c56e9a81f9c620cc7b16237790941e414ed35
Showing with 11 additions and 8 deletions.
  1. +4 −8 lib/active_fulfillment/fulfillment/services/shipwire.rb
  2. +7 −0 test/unit/services/shipwire_test.rb
@@ -142,14 +142,10 @@ def add_address(xml, address, options)
xml.tag! 'Full', address[:name]
end
- if address[:company].blank?
- xml.tag! 'Address1', address[:address1]
- xml.tag! 'Address2', address[:address2]
- else
- xml.tag! 'Address1', address[:company]
- xml.tag! 'Address2', address[:address1]
- xml.tag! 'Address3', address[:address2]
- end
+ xml.tag! 'Address1', address[:address1]
+ xml.tag! 'Address2', address[:address2]
+
+ xml.tag! 'Company', address[:company]
xml.tag! 'City', address[:city]
xml.tag! 'State', address[:state] unless address[:state].blank?
@@ -21,6 +21,7 @@ def setup
:state => 'NC',
:country => 'US',
:zip => '23456',
+ :company => 'MyCorp',
:email => 'buyer@jadedpallet.com'
}
@@ -150,6 +151,12 @@ def test_affiliate_id
assert_equal 'affiliate_id', affiliate_id.text
end
+ def test_company_name_in_request
+ xml = REXML::Document.new(@shipwire.send(:build_fulfillment_request, '123456', @address, @line_items, @options))
+ company_node = REXML::XPath.first(xml, "//Company")
+ assert_equal 'MyCorp', company_node.text
+ end
+
private
def successful_empty_tracking_response
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<TrackingUpdateResponse><Status>Test</Status><TotalOrders></TotalOrders><TotalShippedOrders></TotalShippedOrders><TotalProducts></TotalProducts><Bookmark></Bookmark></TrackingUpdateResponse>"

0 comments on commit d49c56e

Please sign in to comment.