Jump to content

order getting added with validateOrder - Total paid amount does not match cart total error


Admag

Recommended Posts

When I was trying to add order using validateOrder method 

$this->module->validateOrder(

                            (int) $cartId,

                            Configuration::get('PS_OS_PAYMENT'),

                            (float) $this->context->cart->getOrderTotal(true, Cart::BOTH),

                            $this->GetPaymentMethod($paymentDetails),

                            null,

                            null,

                            (int) $this->context->currency->id,

                            false,

                            $customer->secure_key

                    );

as mentioned above but most of the time wrong status was getting added in PrestaShop.

when validating in the ValidateOrder method of PrestaShop it goes breaks at the below condition

 

PaymentModule.php

amount_paid will be 3rd parameter which we passing to method    (float) $this->context->cart->getOrderTotal(true, Cart::BOTH)

 $cart_total_paid = (float) Tools::ps_round(

            (float) $this->context->cart->getOrderTotal(true, Cart::BOTH),

            Context::getContext()->getComputingPrecision()

        );

 $comp_precision = Context::getContext()->getComputingPrecision();

        if ($order_status->logable && (number_format($cart_total_paid, $comp_precision) !== number_format($amount_paid, $comp_precision))) {

            PrestaShopLogger::addLog('PaymentModule::validateOrder - Total paid amount does not match cart total', 3, null, 'Cart', (int) $id_cart, true);

            $id_order_state = Configuration::get('PS_OS_ERROR');

        }

 

as mentioned above both values were fetched dynamically by Prestashop itself it goes failed and the order got added with "Payment with error" status.

Thanks in advanced

Link to comment
Share on other sites

  • 4 weeks later...

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...