postnl / postnl-magento2

This is the official Magento 2 extension for the logistics company PostNL. Add shipping options and parcelshops to your checkout. Create labels with track and trace functionality from the backend.
59 stars 60 forks source link

[BUG] Missing required parameters: delivery_date #133

Closed vshatylo closed 4 years ago

vshatylo commented 5 years ago

Hello, We from time to time face with problem: customers place order with chosen pick-up point but in back office new shipping address is not added. In order grid we see that shipment type 'Post Office' was selected
We checked access logs and found that customer received 500 error after choosing shipment type. Error message " Missing required parameters: delivery_date"

To Reproduce we can simulate error but it's not case for our customer. looks like delivery_date value was empty in response API of POSTNL. We don't log all requests because it produces huge log file of requests.

same error could be reproduced

  1. add product to cart
  2. add to checkout and fill shipping address
  3. open new tab with separate product
  4. add product in newly opened browser tab
  5. chose post office location on checkout

In developer console save request is failed

Expected result Shipping address contains info of selected location

Actual result New shipping address is not added

Workaround none

Please complete the following information

tig-jeffreybranderhorst commented 5 years ago

Hi @vshatylo,

The PostNL version you are using is a bit outdated, could you upgrade the PostNL versions to the newest version and test again? The newest version is 1.8.1 at this moment.

Have a nice day, Jeffrey

vshatylo commented 5 years ago

Hello, I've tested on 1.8.1 and problem still reproduced.

tig-jaspersmits commented 5 years ago

Hi @vshatylo ,

We will test this and get back to you as soon as possible.

Kind regards, Jasper

tig-jaspersmits commented 5 years ago

Hi @vshatylo ,

We've added this to the backlog.

Kind regards, Jasper

tig-jaspersmits commented 4 years ago

Hi @vshatylo ,

We've been able to reproduce the problem. We will work on a fix and release it in an upcoming version. You can follow our release notes here: https://confluence.tig.nl/x/3YSC

Kind regards, Jasper

TimQSO commented 4 years ago

@tig-jaspersmits Was this fix included in the 1.9.0 release? Because we are experiencing these errors in our logs with version 1.9.0 too:

{"0":"Er ontbreken vereiste parameters: delivery_date","1":"<pre>#1 TIG\\PostNL\\Controller\\DeliveryOptions\\Save->saveDeliveryOption

tig-jaspersmits commented 4 years ago

Hi @GuiltyNL ,

Not yet. We did some tests but no fix has been implemented in the new release yet. This would probably be the next release. With what version of Magento are you experiencing this problem? 2.3.3, 2.3.4? Or another version?

Kind regards, Jasper TIG

TimQSO commented 4 years ago

@tig-jaspersmits We are currently running 2.3.3

tig-jaspersmits commented 4 years ago

@GuiltyNL , thanks. We'll do another test with that.

tig-support commented 4 years ago

Note from Jen: Automatically assigned Jasper Smits to this issue as no one was assigned.

woutk88 commented 4 years ago

We're also experiencing this issue with Magento 2.3.4, ~Buckaroo~ PostNL 1.9.0.

In the checkout the xhr POST request /postnl/deliveryoptions/save/ returns a status 500 error: "There has been an error processing your request".

{
   "0":"Er ontbreken vereiste parameters: delivery_date",
   "1":"
      #1 TIG\PostNL\Controller\DeliveryOptions\Save->saveDeliveryOption() called at [vendor/tig/postnl-magento2/Controller/DeliveryOptions/Save.php:99]
      #2 TIG\PostNL\Controller\DeliveryOptions\Save->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
      #3 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
      #4 TIG\PostNL\Controller\DeliveryOptions\Save\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
      #5 TIG\PostNL\Controller\DeliveryOptions\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-customer-segment/Model/App/Action/ContextPlugin.php:81]
      #6 Magento\CustomerSegment\Model\App\Action\ContextPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
      #7 TIG\PostNL\Controller\DeliveryOptions\Save\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #8 TIG\PostNL\Controller\DeliveryOptions\Save\Interceptor->___callPlugins() called at [generated/code/TIG/PostNL/Controller/DeliveryOptions/Save/Interceptor.php:26]
      #9 TIG\PostNL\Controller\DeliveryOptions\Save\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:159]
      #10 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:98]
      #11 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
      #12 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
      #13 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
      #14 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
      #15 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:73]
      #16 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
      #17 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
      #18 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
      #19 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
      #20 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
      #21 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:40]
   ",
   "url":"/postnl/deliveryoptions/save/",
   "script_name":"/index.php",
   "report_id":"64b6b533d72df0f1832b0f479275beba3832f717cf877d2acdbe733891308c2f"
}
tig-jaspersmits commented 4 years ago

Hi @woutk88 ,

My colleague did some tests but was unable to reproduce this problem. This was tested on 2.2.11, 2.3.3 and 2.3.4. Are you running any other 3rd party extensions by any chance? And regarding Buckaroo, that's managed by Buckaroo themselves, we no longer handle the support for that extension.

Kind regards, Jasper

martijnrmediact commented 4 years ago

@woutk88 At MediaCT we are using PostNL for a couple of webshops and we are facing the same issue. If we have pickuppoints enabled and try to make a payment the following error occurs in the logs: [2020-03-06 09:58:08] report.ERROR: Er ontbreken vereiste parameters: delivery_date [] []

In a shop where we are using Klarna and PostNL this error causes the order to be cancelled and the customer is redirect to the cart which is a bigger problem right now.

Could you please add this higher on the roadmap to investigate?

bossalinie commented 4 years ago

@tig-jaspersmits @woutk88 We are facing the same issues. We have the latest Commerce 2.3.4 installed with latest PostNL version. We found this issue: Er ontbreken vereiste parameters: delivery_date [] []

TimQSO commented 4 years ago

We have about 40 to 80 errors like above in our logs per day.

martijnrmediact commented 4 years ago

@GuiltyNL we were able to track what the customer sees and in a lot of cases the customer was redirected to the cart when the error occurred.

TimQSO commented 4 years ago

Does the cart stay in tact? So are they able to retry without issues @martijnrmediact ? And does the error only occur when the customer wants to select a pickup point?

martijnrmediact commented 4 years ago

@GuiltyNL what we see is that the cart stays in tact and they can retry and in most causes they can finish placing the order.

bossalinie commented 4 years ago

@martijnrmediact We can reproduce the problem and we can confirm that the cart stays in tact and they can retry. @tig-support hopefully you can priorize this problem.

tig-jaspersmits commented 4 years ago

Hi,

Thanks for your replies. I'll take another look. I'll give you an update when I have more information.

Kind regards, Jasper

TimQSO commented 4 years ago

We have 500 server errors logged at the same time, it is related:

213.127.49.XX - - [08/Mar/2020:12:04:32 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 469 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Mobile Safari/537.36"
213.127.49.XX - - [08/Mar/2020:12:04:32 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 469 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Linux; Android 9; SM-G950F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Mobile Safari/537.36"
217.103.80.XXX - - [08/Mar/2020:18:23:26 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 468 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
217.103.80.XXX - - [08/Mar/2020:18:23:26 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 468 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
77.248.103.XX - - [08/Mar/2020:20:27:27 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 468 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-A505FN) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
77.248.103.XX - - [08/Mar/2020:20:27:27 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 470 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Linux; Android 9; SAMSUNG SM-A505FN) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
81.247.178.XXX - - [08/Mar/2020:23:23:27 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 468 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
81.247.178.XXX - - [08/Mar/2020:23:23:27 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 469 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36"
94.110.148.XXX - - [09/Mar/2020:00:23:41 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 467 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0"
94.110.148.XXX - - [09/Mar/2020:00:23:41 +0100] "POST /nl/postnl/deliveryoptions/save/ HTTP/2.0" 500 468 "https://www.domain.com/nl/checkout/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0"

Unfortunately, my FPM error log does not seem to catch the error itself, sorry.

tig-jaspersmits commented 4 years ago

Thanks @GuiltyNL , I expect a response from my colleague on this issue soon. Will remind him to give a response.

Kind regards, Jasper

tig-dennisvanderhammen commented 4 years ago

Hi everybody,

I'm currently in the process of investigating this issue. I am able to reproduce the error, but only whenever I insert an invalid postcode and house number combination (1234AB, 37). This shouldn't apply to pickup locations, so I feel like you guys are looking at a different issue.

While I do agree that having a 500 error thrown is never a good thing, I will look into that. But I would love to hear if you guys are seeing the same error but with a presumingly valid postcode.

tig-dennisvanderhammen commented 4 years ago

TL;DR: Fix at last line of message.

As a followup on my message of yesterday:

We have made some changes in the past to how the delivery_date works. In the past we would take the next day as delivery_date, but this caused some confusion for merchants and customers, so we removed this and now a null is passed.

It seems that this error is caused when no delivery options could be found (usually due to an error). When this happens, we'll show "at the first opportunity". An obvious reason would be an invalid zipcode, but this might be caused by other things as well.

It seems that this fallback option still expected a delivery_date to be filled. When trying to select "at the first opportunity" the save function (mentioned by @GuiltyNL and @woutk88) would throw an exception when the delivery_date was not present.

In some cases Magento somehow decides to move the customer back to the cart, whether the Exception is a major issue or not.

We will have this fixed in the upcoming release, but for people who cannot wait and want to create a fork or patch their environment:

TIG/PostNL/Helper/DeliveryOptions/OrderParams.php line 52, change the 'fallback' value from true to false.

martijnrmediact commented 4 years ago

@tig-dennisvanderhammen thanx, can you give us a indication on the release with the full fix/solution, is it the next week or next month. We would like to decide on creating a temporary patch or to plan the upgrade.

tig-dennisvanderhammen commented 4 years ago

Hi @martijnrmediact,

We're currently in testing procedures. While I can't make any hard promises, if no issues are to be found, we can probably push a release somewhere at the end of this month.

TimQSO commented 4 years ago

I tried the patch / workaround, but I'm not sure if it has any effect. I keep getting the errors and the 500 server responses.

tig-dennisvanderhammen commented 4 years ago

@GuiltyNL, there might be something different going wrong in your case. In your case you could try setting the pickup and delivery values on 'false' as well, but I feel like this might have unintended consequences with the selected delivery dates.

What you could do is set some debug pointers in the following function: \TIG\PostNL\Controller\DeliveryOptions\Save::execute Maybe you can email the params to yourself and see what exactly gets through these params.

Important for us is a way to reproduce an issue, so that we can find a proper solution.

tig-dennisvanderhammen commented 4 years ago

@GuiltyNL,

After your comment I did some extra investigating. It seems that there are still some edge cases when the type is pickup. I currently have a pull request open in our private Github repository. We'll have this included in the release as well.

TimQSO commented 4 years ago

Ok, thanks!

tig-dennisvanderhammen commented 4 years ago

Hi everybody,

We just released version 1.9.5 which contains some improvements in the save functions and timeframe functions. This issue should also be fixed in the latest release. Thank you for pointing this out!