Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Shipwire: Add Company tag to rates request

  • Loading branch information...
commit 3e5b41101f7d70fd00eef99d479e1f9d143835ae 1 parent 6cb087d
Tom Burns authored
View
1  lib/active_shipping/shipping/carriers/shipwire.rb
@@ -82,6 +82,7 @@ def add_address(xml, destination)
xml.tag! 'Address1', destination.address1
xml.tag! 'Address2', destination.address2 unless destination.address2.blank?
xml.tag! 'Address3', destination.address3 unless destination.address3.blank?
+ xml.tag! 'Company', destination.company unless destination.company.blank?
xml.tag! 'City', destination.city
xml.tag! 'State', destination.state unless destination.state.blank?
xml.tag! 'Country', destination.country_code
View
1  test/test_helper.rb
@@ -115,6 +115,7 @@ module TestFixtures
:country => 'US',
:city => 'Tampa',
:state => 'FL',
+ :company => 'Tampa Company',
:address1 => '7926 Woodvale Circle',
:zip => '33615',
:address_type => 'commercial'), # means that UPS will default to commercial if it doesn't know
View
15 test/unit/carriers/shipwire_test.rb
@@ -184,4 +184,19 @@ def test_rate_request_without_delivery_estimate
assert_equal [], response.rates[0].delivery_range
assert_nil response.rates[0].delivery_date
end
+
+ def test_rate_request_includes_company_if_provided
+ company = CGI.escape("<Company>Tampa Company</Company>")
+ @carrier.expects(:ssl_post).with(anything, includes(company)).returns(xml_fixture('shipwire/rates_response'))
+
+ response = @carrier.find_rates(
+ @locations[:ottawa],
+ @locations[:real_home_as_commercial],
+ @packages.values_at(:book, :wii),
+ :order_id => '#1000',
+ :items => @items
+ )
+
+ assert response.success?
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.