Description
Description
When a guest order is placed in Magento\Checkout\Model\GuestPaymentInformationManagement::savePaymentInformationAndPlaceOrder(), the following is executed: $salesConnection->beginTransaction(); $checkoutConnection->beginTransaction(), which creates a nested set of DB transactions (e.g. Magento\Framework\DB\Adapter\Pdo\Mysql::_transactionLevel exceeds 1).
Magento is built to handle nested DB transactions, but the way GuestPaymentInformationManagement is architected, it's almost guaranteeing a critical exception. When $this->savePaymentInformation() is executed, the _transactionLevel is already at 2, which means that any rollbacks triggered inside savePaymentInformation() will lead to a Magento\Framework\DB\Adapter\AdapterInterface::ERROR_ROLLBACK_INCOMPLETE_MESSAGE exception message thrown.
This is especially odd architecture when we compare it to synonymous class and method use for registered users: Magento\Checkout\Model\PaymentInformationManagement::savePaymentInformationAndPlaceOrder()
Preconditions (*)
- Magento 2.1.15
- PHP 7.0
Steps to reproduce (*)
- Configure any online payment method with sandbox credentials.
- Place a guest order with credit card details that trigger an error message from the payment processor.
Expected result (*)
- The customer is shown the "An error has occurred on the server.." message.
- The exception log is empty.
Actual result (*)
- The customer is shown the "An error has occurred on the server.." message.
- The exception log has a critical exception of "Rolled back transaction has not been completed correctly."