pullingshots / Shipment

Perl interface into various shipping web service API's - FedEx, UPS, Purolator, Temando, Canada Post
https://metacpan.org/pod/Shipment
19 stars 19 forks source link

Shipment::UPS - No reliable rate comparison mechanism #27

Closed mjaquilina closed 8 years ago

mjaquilina commented 9 years ago

Shipment::UPS only provides one mechanism for unified rate comparison, _build_services(), but this method provides inaccurate rate quotes and does not reflect options specified for the package, including declared value and other value-add services.

This unreliability is presently expected and documented in the POD, but requires a work-around (multiple Rate calls) to retrieve accurate rate quotes. This causes pain and sadness.

I have a patch to introduce more accuracy to this method, but I wanted to raise this as a ticket first to ensure that there isn't some underlying reason for the vagueness of the method.

SysPete commented 9 years ago

@mjaquilina any chance of a PR or if you prefer just add the patch as a comment to this ticket?

mjaquilina commented 9 years ago

@SysPete The ultimate solution is a bit more complex than my original patch. In testing, I noticed that parts of Shipment::UPS rely on _build_services() to get a service list in cases where details (recipient location, weight) aren't present.

So, _build_services() probably needs to remain as-is. That's OK. It's an internal method and the POD even refers to its inaccuracy.

That said, I think the long-term solution is to add a new, public method that builds a combined rate quote for all services available from a vendor. It could even fall back on _build_services() and individual rate() calls on those services, so it didn't need to be implemented for every vendor at once. I may get to that patch at some point, but it seems unlikely for this month.

pullingshots commented 8 years ago

I believe this has been resolved with commit aaf59bf56d4

If there are still inconsistencies with _build_services not matching rates, please re-open this issue!