diff --git a/lib/hushed/documents/request/hash_converter.rb b/lib/hushed/documents/request/hash_converter.rb index ba99b37..ab18a62 100644 --- a/lib/hushed/documents/request/hash_converter.rb +++ b/lib/hushed/documents/request/hash_converter.rb @@ -19,7 +19,7 @@ def ship_to_hash 'Address1' => ship_address.address1, 'Address2' => ship_address.address2, 'City' => ship_address.city, - 'State' => ship_address.state.name, + 'State' => state(ship_address), 'PostalCode' => ship_address.zipcode, 'Country' => ship_address.country.name } @@ -32,7 +32,7 @@ def bill_to_hash 'Address1' => bill_address.address1, 'Address2' => bill_address.address2, 'City' => bill_address.city, - 'State' => bill_address.state.name, + 'State' => state(bill_address), 'PostalCode' => bill_address.zipcode, 'Country' => bill_address.country.name } @@ -42,6 +42,10 @@ def bill_to_hash def normalize_sku(sku) sku.chomp("-SET") end + + def state(address) + address.state ? address.state.name : address.state_name + end end end end