-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report
Description
Preconditions
- Magento CE 2.1.1
- PHP 7.0.10
Steps to reproduce
- Login as an existing customer in the shop
- Add something to your cart and go to the checkout
- Somehow manage to have invalid data in your billing address
- Pick a payment method and click the "Place Order" button
Expected result
- A useful message telling you why your billing address isn't valid
Actual result
- An error message which isn't clear at all:
An error occurred on the server. Please try to place the order again.
Discussion
In the response of the ajax call to {store-code}/rest/nl/V1/carts/mine/payment-information I see this:
{
"message": "An error occurred on the server. Please try to place the order again.",
"trace": "
#0 /Volumes/Projects/magento2/some-project/vendor/magento/framework/Interception/Interceptor.php(146): Magento\\Checkout\\Model\\PaymentInformationManagement->savePaymentInformationAndPlaceOrder(35, Object(Magento\\Quote\\Model\\Quote\\Payment), Object(Magento\\Quote\\Model\\Quote\\Address))\n
#1 /Volumes/Projects/magento2/some-project/var/generation/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.php(26): Magento\\Checkout\\Model\\PaymentInformationManagement\\Interceptor->___callPlugins('savePaymentInfo...', Array, Array)\n
#2 [internal function]: Magento\\Checkout\\Model\\PaymentInformationManagement\\Interceptor->savePaymentInformationAndPlaceOrder(35, Object(Magento\\Quote\\Model\\Quote\\Payment), Object(Magento\\Quote\\Model\\Quote\\Address))\n
#3 /Volumes/Projects/magento2/some-project/vendor/magento/module-webapi/Controller/Rest.php(307): call_user_func_array(Array, Array)\n
#4 /Volumes/Projects/magento2/some-project/vendor/magento/module-webapi/Controller/Rest.php(216): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n
#5 /Volumes/Projects/magento2/some-project/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(37): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n
#6 /Volumes/Projects/magento2/some-project/vendor/magento/framework/App/Http.php(135): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n
#7 /Volumes/Projects/magento2/some-project/vendor/magento/framework/App/Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\n
#8 /Volumes/Projects/magento2/some-project/pub/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n
#9 {main}"
}The actual useful info about why your billing address is invalid gets inserted over here:
magento2/app/code/Magento/Quote/Model/QuoteValidator.php
Lines 59 to 64 in 2d368d0
| throw new \Magento\Framework\Exception\LocalizedException( | |
| __( | |
| 'Please check the billing address information. %1', | |
| implode(' ', $quote->getBillingAddress()->validate()) | |
| ) | |
| ); |
But then this LocalizedException gets encapsulated by a CouldNotSaveException exception in:
| throw new CouldNotSaveException( | |
| __('An error occurred on the server. Please try to place the order again.'), | |
| $e | |
| ); |
And then I stopped digging any further.
It would be great if instead of the generic An error occurred on the server. Please try to place the order again. message, a more detailed message could get displayed to the user why his/her billing address isn't valid.
Metadata
Metadata
Assignees
Labels
Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report