Jump to content

Payment error status when using CoD (Cash on Delivery)


Recommended Posts

Hello! As I mentioned in the title, the buyer will always receive an email with the following status: Error in Payment.

I use Hungarian forint as default currency with 0 decimal places. If I set the decimal point to 2, it works fine. 
Can anyone suggest a solution to this? I would definitely like to use 0 decimal.

I have tried reinstalling, turning it off, nothing worked.

PrestaShop version: 1.7.8.5
Module version: v1.0.6

 

Link to comment
Share on other sites

In the validatedOrder function of the PaymentModule class, the amount paid (which is received, rounded to 0 decimal places) and the total shopping cart are compared again, and if the amounts are not equal, it goes to that status.

if ($order_status->logable && number_format($cart_total_paid, _PS_PRICE_COMPUTE_PRECISION_) != number_format($amount_paid, _PS_PRICE_COMPUTE_PRECISION_)) {
	$id_order_state = Configuration::get('PS_OS_ERROR');
}

As you can see, here the rounding is done by the variable "_PS_PRICE_COMPUTE_PRECISION_", and in the cash on delivery module, getOrderTotal() function, it is done by $computePrecision = Context::getContext()->getComputingPrecision();

Probably you should adjust the functions slightly so that the same value is used for rounding.

Edited by Ress (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...