verbb / postie

A Craft Commerce shipping calculator plugin.
Other
12 stars 18 forks source link

Why is Postie sending queries to DHL when viewing an order in the CP? #128

Open peteeveleigh opened 5 months ago

peteeveleigh commented 5 months ago

Question

When viewing a completed order in the CP it looks as if Postie is doing it's thing and sending a Payload to DHL. But why? The order is completed, paid for, and to all intents and purposes finished with. There's no benefit to fetching shipping rates again.

The reason I ask is that we are seeing an intermittent problem viewing orders in the CP where an internal server error is thrown. The logged error is relating to Postie.

Error: Call to a member function getBody() on null in /home/forge/www.domain.com/vendor/verbb/postie/src/providers/DHLExpress.php:207

Additional context

No response

engram-design commented 5 months ago

What version of Postie are you on? I can confirm this does happen, and I agree that it shouldn't, but it's a limitation of how Commerce's Vue-based order editor works. If people want to change the shipping method, using the dropdown won't work without a call to fetch available methods. What's frustrating is that the fetching of methods isn't even an Ajax request which we could check and allow for.

Looking into our options to improve this pretty detrimental performance hit.

As for the getBody() that line number doesn't match on my end, hence my version number question.

peteeveleigh commented 5 months ago

Hi Josh

Looks like we are on version dev-craft-4 Probably as a result of an earlier issue and we haven't switched to a mainstream release. I'll switch to a proper release and see what happens.

The extra oddity is that this has only started happening in the last week or so which makes me think the root cause may be something else. Or perhaps DHL were having some issues and not sending a response sometimes.

engram-design commented 5 months ago

I'm just assuming it's referring to this line https://github.com/verbb/postie/blob/70c9b78ee1ee84ee8977ddc03dde955c4f173b2b/src/providers/DHLExpress.php#L202 which seems odd to throw that error, but not impossible.

But I agree this needs to be improved somehow, I'm just not sure what without adding more complexity to things like providing an entirely different interface to set the shipping methods that works with Postie. This isn't going to be great for UX though...