-
Notifications
You must be signed in to change notification settings - Fork 44
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
Wrong HTTP status (1) on failure to create order #894
Comments
Hi there @mariuszsienkiewicz, Thank you for a detailed explanation of the issue. Best Regards, |
@justelis22 Could you please provide any updates on this topic? |
The improvement will be added to the next release 6.1.1. It is planned to be done in the next couple of weeks. The beta should be available next week. Best Regards, |
@mariuszsienkiewicz Hi there, Release 6.1.1 is out and the fix was included. I will be waiting for your feedback! Best Regards, |
Thank you for the provided fix @justelis22. The problem is that the customer still does not know what the issue is, now the only thing showed by the mollie module is: "Unknown exception in Mollie" Wouldn't it be better to implement more non-technical message for the customer? I know it should be implemented here: https://github.com/mollie/PrestaShop/blob/master/src/Service/ExceptionService.php Even just a generic message to alert the customer that they may have entered something incorrectly in the address? This error occurs even when the customer enters a single character in the family name - I know the probability of a family name consisting of a single letter is very low. I don't want to open a new issue so please open this one again - I think that there is still a problem that has to be in some way fixed. |
Thank you for the additional information. I'll create a task for our team to improve the error messages. We have the upcoming 6.2.0 and 6.2.1 releases already planned, so this most likely will be investigated a bit later on. Best Regards, |
We started to work on this improvement and a couple of questions were raised. We were unable to recreate the Unknown exception in Mollie but were able to get the default message with the steps you provided. Useful information would be:
Best Regards, |
What I have found?
I noticed unusual behavior when selecting Klarna Pay Later (and probably other payments): if there is an error in the data passed to the API (such as a too short family family name of the customer), NGINX will return 502 Bad Gateway error in the payment.php controller.
I found this line in error logs:
Reason
The
payment.php
controller utilizesMollieOrderCreationService
. When an error occurs in thecreateMollieOrder
method (such as: Error executing API call (422: Unprocessable Entity): The 'billingAddress.familyName' field should have more than 1 character.), it is handled byErrorHandler
'shandle
method:PrestaShop/src/Service/MollieOrderCreationService.php
Lines 67 to 69 in 1d60186
The
handle
method sets HTTP code relative to the code given in theException
:PrestaShop/src/Handler/ErrorHandler/ErrorHandler.php
Line 107 in 1d60186
For example,
OrderCreationException
will have$code
equal to1
:The issue arises because this HTTP code is later used by the PrestaShop controller without being altered to a proper HTTP code. As a result, we receive an HTTP code that is not in the RFC, so NGINX treats this situation as an error in the PHP code and returns a 502 Bad Gateway because the upstream provided an incorrect response code.
In the result our customers see error
502 Bad Gateway
instead of being informed that there was an error in data passed to Mollie API.The text was updated successfully, but these errors were encountered: