From 7dee6f5a091762638ef9227df7b32eb296d5f970 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Mon, 2 Apr 2012 09:37:48 +0000 Subject: [PATCH] [-] FO : #PSFV-755 - Fix bug with bad total paid real --- classes/PaymentModule.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 9099bbc60..ce2ebcee4 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -189,13 +189,7 @@ abstract class PaymentModuleCore extends Module $order->invoice_date = '0000-00-00 00:00:00'; $order->delivery_date = '0000-00-00 00:00:00'; - // Amount paid by customer is not the right one -> Status = payment error - // We don't use the following condition to avoid the float precision issues : http://www.php.net/manual/en/language.types.float.php - // if ($order->total_paid != $order->total_paid_real) - // We use number_format in order to compare two string - if (number_format($cart_total_paid, 2) != number_format($order->total_paid_real, 2)) - $id_order_state = Configuration::get('PS_OS_ERROR'); - + // Creating order $result = $order->add(); @@ -205,6 +199,13 @@ abstract class PaymentModuleCore extends Module if (!$order->addOrderPayment($amount_paid)) throw new PrestaShopException('Can\'t save Order Payment'); } + + // Amount paid by customer is not the right one -> Status = payment error + // We don't use the following condition to avoid the float precision issues : http://www.php.net/manual/en/language.types.float.php + // if ($order->total_paid != $order->total_paid_real) + // We use number_format in order to compare two string + if ($order_status->logable && number_format($cart_total_paid, 2) != number_format($order->total_paid_real, 2)) + $id_order_state = Configuration::get('PS_OS_ERROR'); $order_list[] = $order;