Open elebruchec opened 1 week ago
Hello @elebruchec ,
I tried the following :
The order is confirmed, the price is correct. No cart rule is taken into account.
I'm using a native payment module.
Is there something I'm missing ?
Waiting for your feedback.
Ah sorry, that's my fault. I forgot that we have a non-native behavior regarding expiration validation. Natively, Prestashop does not remove expired vouchers after they have been added to the cart! So the 'how to reproduce' is not correct!
But, the issue also occurs if a cart rule becomes invalid after the payment form is displayed (for example, due to a change in the conditions). Actually, as soon as a cart rule needs to be removed in PaymentModule::validateOrder, it should happen.
Your issue is similar to : https://github.com/PrestaShop/PrestaShop/issues/26235
Could you confirm ?
Thanks!
Prerequisites
Describe the bug and add attachments
Hello,
This issue should only occur if the PSP does not go through Prestashop for validation before payment (i.e., payment within an iframe) but I'm not sure.
In
PaymentModuleCore::validateOrder
, if a cart rule expires, it is removed from the cart, but the order is still processed with a valid status, despite the difference in amount. The cart total is calculated before the cart rules are removed. It is then compared with the paid amount, which are incorrectly considered equal.Expected behavior
The cart rule should be removed from the cart, and the order should transition to the status
Configuration::get('PS_OS_ERROR');
. The cart total should be calculated after the cart rules are removed in order to compare the actual cart total with the paid amount.sSteps to reproduce
PrestaShop version(s) where the bug happened
8.1.7
PHP version(s) where the bug happened
8.1
If your bug is related to a module, specify its name and its version
Observed with sdevmonetico but may appears with other payment module
Your company or customer's name goes here (if applicable).
No response