[-] FO : #PSFV-755 - Fix bug with bad total paid real

This commit is contained in:
mDeflotte
2012-04-02 09:37:48 +00:00
parent abbdc64906
commit 7dee6f5a09
+7 -6
View File
@@ -189,12 +189,6 @@ abstract class PaymentModuleCore extends Module
$order->invoice_date = '0000-00-00 00:00:00'; $order->invoice_date = '0000-00-00 00:00:00';
$order->delivery_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 // Creating order
$result = $order->add(); $result = $order->add();
@@ -206,6 +200,13 @@ abstract class PaymentModuleCore extends Module
throw new PrestaShopException('Can\'t save Order Payment'); 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; $order_list[] = $order;
// Insert new Order detail list using cart for the current order // Insert new Order detail list using cart for the current order