Open Codencode opened 1 month ago
Questions | Answers |
---|---|
Description? | As the remaining quantity in stock is not checked when paying with PayPal or other forms that require a gateway payment, it is possible to complete the order and pay for an out-of-stock product even if this is not permitted. |
Type? | bug fix |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | Fixes #325 |
How to test? | 1 - Create a cart with an available item. 2 - Proceed to checkout until the payment selection. 3 - Before confirming the order, modify the product quantity in the admin, making it unavailable. 4 - Confirm the order with PayPal. 5 - The system should refresh the page and redirect to the cart. |
Thank you @Codencode for your PR. We will read it and try to merge it ASAP.
Hi @clotairer,
my solution checks if the cart/product is actually available just before creating the order, and it does this in the createOrder
function.
If the cart/item is not available, the order ID is obviously not returned, and this generates an error/exception that is handled by the onError
function, where I refresh the page. This way, the system redirects to the cart, showing that the product is no longer available.
Perhaps it could be managed differently, but this is the solution I came up with.
Thanks.
Hi, It looks like we already fix your issue here https://github.com/202ecommerce/paypal/pull/350
Could you confirm to us your module is up to date ?
Hi, It looks like we already fix your issue here #350
Could you confirm to us your module is up to date ?
Yes, the module is updated to the latest version 6.4.2.
I think fix #350 solves a different case. The problem I encountered occurs when you are on a product page or in the cart and in the meantime the product has become unavailable. My change, before starting the order creation process on PayPal, performs the availability check and if unavailable blocks the order.