Description:
We encountered a major issue in the Cardlink Magento 2 module regarding inventory management when a product is purchased with limited stock. If a customer selects Cardlink as the payment method, an order is not created until payment confirmation is received. This leads to a race condition where other customers can purchase the last item, resulting in stock inconsistencies and ultimately preventing the order from being created in Magento after payment has been completed.
Steps to Reproduce:
Set up a product with a stock quantity of 1 in Magento.
Have Customer A add the product to their cart and proceed to checkout.
Customer A selects Cardlink as the payment method and does not complete the payment process (without creating an order yet in Magento).
Before the payment confirmation returns from Cardlink, Customer B quickly buys the same product.
When Customer A's payment confirmation returns, Magento attempts to create the order but fails due to stock unavailability.
Actual Behavior:
Magento throws an exception when attempting to create the order post-payment due to the lack of available stock, despite the payment having already been completed. This results in a major issue as the customer has already paid, but the order cannot be fulfilled. Here’s the exception message:
1 exception(s):
Exception #0 (Magento\Framework\Validator\Exception): Κάποια από τα προϊόντα έχουν εξαντληθεί.
Impact:
This is a critical bug since it leads to paid orders that cannot be processed and requires immediate attention to ensure payment and stock handling are synchronized.
Description: We encountered a major issue in the Cardlink Magento 2 module regarding inventory management when a product is purchased with limited stock. If a customer selects Cardlink as the payment method, an order is not created until payment confirmation is received. This leads to a race condition where other customers can purchase the last item, resulting in stock inconsistencies and ultimately preventing the order from being created in Magento after payment has been completed.
Steps to Reproduce:
Actual Behavior: Magento throws an exception when attempting to create the order post-payment due to the lack of available stock, despite the payment having already been completed. This results in a major issue as the customer has already paid, but the order cannot be fulfilled. Here’s the exception message:
Impact: This is a critical bug since it leads to paid orders that cannot be processed and requires immediate attention to ensure payment and stock handling are synchronized.