-
Notifications
You must be signed in to change notification settings - Fork 547
Conversation
@@ -154,6 +154,11 @@ class USPS < Carrier | |||
"WS" => "Western Samoa" | |||
} | |||
|
|||
TRACKING_ODD_COUNTRY_NAMES = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine. The way we solved a similar problem in shopify is defining a name_alternates
array in the countries YAML file (https://github.com/Shopify/shopify/blob/master/db/data/countries.yml#L51), and then we roll that up into another key https://github.com/Shopify/shopify/blob/master/app/models/country_db.rb#L133). It's a bit more of a sustainable long term approach. Ok with this too though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's lots of other hashes like this in the same place so I thought I would do it a consistent way, and there should only be a few of them.
⛵ |
I received a list of the country names USPS uses from someone at USPS and reconciled the code so that it should handle any country they can throw at us. |
This is a great approach. Huge. Thanks for digging to find that country list. |
While running batch processing on tracking numbers I discovered a few bugs in active_shipping USPS tracking. This PR fixes two of them:
I'm definitely open to discussion on how I handled the lack of date. I imagine lots of code would assume that all events have a time, which is true for everything except this rare event type, which is why I still return a time rather than nil. I chose an arbitrary past date rather than the current date so that the sort by time would do the right thing and put this event in the past.
@kmcphillips @garethson