Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add 'Company' field to shipwire request #11

Merged
merged 1 commit into from

3 participants

@boourns
Admin

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

Please review @jduff and @Soleone

@Soleone
Collaborator

Looks good to me :+1:

Just double checking with Shipwire support that it's okay to send an empty Company XML element in case it hasn't been provided to us.

@jduff
Admin

As long as company can be blank, :shipit:

@Soleone
Collaborator

Shipwire responded and said:

We'll ignore if it's empty, so it's fine always to provide it, for rating and fulfillment requests.

:shipit:

@boourns boourns merged commit 9c09d49 into from
@kevinhughes27 kevinhughes27 deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. @boourns
This page is out of date. Refresh to see the latest.
View
12 lib/active_fulfillment/fulfillment/services/shipwire.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?
View
7 test/unit/services/shipwire_test.rb
@@ -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>"
Something went wrong with that request. Please try again.