Purolator 'rating' giving 'Product is Invalid' some of the time... #745
Replies: 3 comments 1 reply
-
Purolator force you to provide an I think it would maybe be good to add the extra step of calling thier API to get the products' avilibility, or defaultt to an other product then This is how they recomand to do it. Currently it has a default and it will be express, maybe express is no avilaible at all, (notice that it has a fule only if the recipient is us, so double check what is your destination. karrio/modules/connectors/purolator/karrio/providers/purolator/units.py Lines 205 to 223 in 845c6e0 |
Beta Was this translation helpful? Give feedback.
-
Thanks jacob that is helpful... so if that is the initializer I'm thinking my is_international is getting flagged as True before that gets init in the rates... but in the flow chart your showing I don't think we are ever calling to see which services are available (I think our account is flagged not to ship to the US as we have a much better contract with UPS for that...) but something else must be tripping up the is_international flag. I'm guessing too from what I saw, that the dashboard must have some fall over to 'try again' when it errors too. Time to debug! |
Beta Was this translation helpful? Give feedback.
-
Gah... idk. I thought I got to a point where I had a And then... no, that wasn't consistently failing anymore... wtf. So I added in some logging and a default: def shipping_services_initializer(
services: typing.List[str],
is_international: bool = False,
recipient_country: str = None,
) -> units.Services:
"""
Apply default values to the given services.
"""
logger.debug(f"Initial services: {services}")
logger.debug(f"is_international: {is_international}, recipient_country: {recipient_country}")
# When no specific service is requested, set a default.
if not any([svc in ShippingService for svc in services]): # type: ignore
if is_international is False:
services.append(ShippingService.purolator_express.name) # type: ignore
logger.debug("Appended default domestic service: purolator_express")
elif recipient_country == "US":
services.append(ShippingService.purolator_express_us.name) # type: ignore
logger.debug("Appended default US service: purolator_express_us")
else:
services.append(ShippingService.purolator_express_international.name) # type: ignore
logger.debug("Appended default international service: purolator_express_international")
# Ensure there is always at least one valid service
if not services:
services.append(ShippingService.purolator_express.name) # type: ignore
logger.debug("Appended fallback default service: purolator_express")
logger.debug(f"Final services: {services}")
return units.Services(services, ShippingService) but as soon as the logging was in, it worked all the time. wth!?! Then I noticed in the logs, the first time it would be:
but then afterward it would be
so if the initial one correctly 'picked' the purolator_express it seemed to then 'remember' it for all future calls, but I'm guessing there is some scenario where the first call in selects the 'invalid product' (the purolator_express_us) and then that becomes teh default until the API server is restarted. Does that seem to make sense? What would the 'fix' be for that do we think? |
Beta Was this translation helpful? Give feedback.
-
Has anyone seen this? Calling the v1/proxy/rates endpoint, expecting to get back a bunch of different rates from a few configured carriers at different service levels and... only on some (maybe one but multiple orders for the same customer haven't verified that yet either) addresses it is throwing this error for purolator.
"message":"karrio response messages","messages":[{"carrier_id":"purolator","carrier_name":"purolator","code":"1100491","details":{"AdditionalInformation":"Shipping Error"},"message":"Product is invalid."}]
When I look at the actual SOAP that is generated and going out, I believe the issue is with
v2:ServiceIDPurolatorExpressU.S.</v2:ServiceID>
instead of
v2:ServiceIDPurolatorExpress</v2:ServiceID>
but I can't see off the top why it might be using the one vs the other? Also I thought it did 'all'?
Might it be the use of
.first
inservice = units.Services(payload.services, provider_units.ShippingService).first
and it is just 'random' what order that 'list' is returned in or something? I'm not sure.If I do the same address via the dashboard it seems to work (thought it looked like maybe it didn't, and then it made a 2nd call and it did... it was hard to tell and I wasn't tailing logs at that point).
I had an idea maybe it is because of "QC" instead of "PQ" for the Province being Quebec but I haven't dug into that theory yet either...
From my end users stand point, as far as they see Purolator just isn't an option for these orders which I can see happening to some destinations but not downtown Montreal (which I confirmed doing it in the dashboard instead of just the api).
Cheers.
Beta Was this translation helpful? Give feedback.
All reactions