Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find_by_package_id not recognizing FedEx #6

Closed
superjustin opened this issue Oct 22, 2013 · 9 comments
Closed

find_by_package_id not recognizing FedEx #6

superjustin opened this issue Oct 22, 2013 · 9 comments

Comments

@superjustin
Copy link

Trackerific::Services.find_by_package_id("123456789012")
=> []

USPS and UPS appear to be working fine:
irb(main):006:0> Trackerific::Services.find_by_package_id("1Z12345E0291980793")
=> [Trackerific::Services::UPS]
irb(main):007:0> Trackerific::Services.find_by_package_id("EJ958083578US")
=> [Trackerific::Services::USPS]

@zackshapiro
Copy link

I'm having this issue as well. My working theory that it's because I don't have FedEx credentials in my config like I do for UPS and USPS. Can anyone else confirm this?

Hopefully I'm wrong and this is just some bug in the gem. I'd like to be able to see whether a number is a FedEx number without a dev account with them.

@superjustin
Copy link
Author

Yes, you need to have the FedEx credentials.

@annaswims
Copy link

I have valid credentials and I see the same behavior.

Trackerific::Services.find_by_package_id('605578645398')
=> []

but Trackerific::Services::FedEx.track('605578645398') actually gets me a resopnse from Fedex (which errors out later)

@travishaynes
Copy link
Owner

Trackerific::Services.find_by_package_id uses regex to discover which services can handle the tracking ID. The FedEx matcher is currently /^[0-9]{15}$/. if you run that expression against the tracking ID you're using, it doesn't match:

'605578645398' =~ /^[0-9]{15}$/ # => nil

The reason is obviously because the regex specifies the tracking number has to be 15 digits long. We can solve that issue by adding some additional regex matchers to the FedEx service.

What are the errors that you're getting?

@annaswims
Copy link

It looks like the xml schema may have changed since it was last tested.

TypeError: no implicit conversion of Symbol into Integer
from /Users/annacarey/.rvm/gems/ruby-2.1.2/gems/trackerific-0.7.5/lib/trackerific/parsers/fedex.rb:41:in `[]'

@travishaynes
Copy link
Owner

Yeah, I just checked on the FedEx development resources website. They're in v9, and this gem uses v8. I'll update the WSDL and run the tests to see what's changed.

@travishaynes
Copy link
Owner

I pulled in the latest WSDL from FedEx, and updated the XML fixtures and was able to reproduce the error you're getting.

I may not have time to work on this for a while. If you'd like, I can push what I've done so far into a bug-fix branch so you can take a look and see if you can fix it yourself. It's just a matter of updating the FedEx parser to get it to work with v9 of the API.

@superjustin
Copy link
Author

Here's what I did back then to get it matching for FedEx:
79368d2

My error was related to it only matching 15 characters. The fix matches 12 and 15 characters.

@travishaynes
Copy link
Owner

Thanks, @superjustin. I'll add that expression to the service.

@annaswims, I'm going to commit the matchers so I can close this issue, and create a new one (issue #11) for updating to the latest FedEx API version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants