Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ignore values that aren't included in our expected addresses when bui…

…lding that part

of the query.
  • Loading branch information...
commit 471f4a56fa3de27506f310f4c261b4dc44c374ae 1 parent 2398001
@csaunders csaunders authored
View
2  lib/active_fulfillment/fulfillment/services/amazon_mws.rb
@@ -399,7 +399,7 @@ def build_tracking_request(order_id, options)
def build_address(address)
requires!(address, :name, :address1, :city, :state, :country, :zip)
- ary = address.map{ |key, value| [LOOKUPS[:destination_address][key], value] if value.present? }
+ ary = address.map{ |key, value| [LOOKUPS[:destination_address][key], value] if LOOKUPS[:destination_address].include?(key) && value.present? }
Hash[ary.compact]
end
View
7 test/unit/services/amazon_mws_test.rb
@@ -270,6 +270,13 @@ def test_building_address_skips_nil_values
end
end
+ def test_building_a_full_query_does_not_cause_query_to_fail
+ @address[:company] = "Powerthirst Inc."
+
+ constructed_address = @service.send(:build_address, @address)
+ assert !constructed_address[nil]
+ end
+
private
def build_mock_response(response, message, code = "200")
http_response = mock(:code => code, :message => message)
Please sign in to comment.
Something went wrong with that request. Please try again.