Jump to content

[Urgent] probleme de validateOrder


Recommended Posts

Bonjour,

 

Depuis récemment, j'ai un gros problème sur mon module de paiement.

Le validateOrder ne fonctionne pas totalement (suivant les commandes il fonctionne ou non).

Dès que ma commande est validé (Configuration::get('PS_OS_PAYMENT')), mon validateOrder bloque totalement.

je ne peux même pas vérifier son retour (true/false) donc mon prestashop ne redirige pas ensuite vers "index.php?controller=order-confirmation&id_cart.....etc"

Par contre si je change le PS_OS en /ERROR/CANCELED/CHEQUE ça fonctionne impeccable.

De plus, même si le validateOrder bloque, en backend tout s'enregistre bien. (dans order history j'ai bien la commande de validé).

La je sèche complètement et j'ai besoin d'une réponse rapide si possible

 

Merci d'avance et voici mon code

class SMoneyConfirmationModuleFrontController extends ModuleFrontController
{
    public function postProcess()
    {
// check de l'erreur au retour de l'api
     $error = $this->context->cookie->test_error;

     if ($error != 0)
     {
        $message = $this->getPaymentErrorMessage($error);
        switch ($error)
        {
            case '1':
            $status = Configuration::get('PS_OS_ERROR');
            case '2':
            $status = Configuration::get('PS_OS_CANCELED');
            case '3':
            $status = Configuration::get('PS_OS_CANCELED');
            case '4':
            $status = Configuration::get('PS_OS_ERROR');
            case '5':
            $status = Configuration::get('PS_OS_ERROR');
            case '6':
            $status = Configuration::get('PS_OS_ERROR'); 
            default:
            $message = "Transaction failed";
            $status = Configuration::get('PS_OS_ERROR'); 
        }
    }
    else 
    {
        $status = Configuration::get('PS_OS_PAYMENT');
        $message = "";
    }

    $cart_id =  Context::getContext()->cart->id;
    $secure_key = Context::getContext()->customer->secure_key;


    $cart = new Cart((int)$cart_id);
    $customer = new Customer((int)$cart->id_customer);


    if (!Validate::isLoadedObject($customer))
        {
        Tools::redirect('index.php?controller=order&step=1');
        }

       /**
         * Converting cart into a valid order
         */

       $currency_id = (int)Context::getContext()->currency->id;

       $total = (float)($cart->getOrderTotal(true, Cart::BOTH));

       $this->module->validateOrder((int)$cart_id,  $status, $total, $this->module->displayName, null, null, (int)$currency_id, false, $secure_key);

       /**
        * If the order has been validated we try to retrieve it
        */

       $order_id = Order::getOrderByCartId((int)$cart->id);

       if ($order_id && ($secure_key == $customer->secure_key)) {
          /**
           * The order has been placed so we redirect the customer on the confirmation page.
           */
          Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart_id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$secure_key);
      } else {
           /**
            * An error occured and is shown on a new page.
            */
           $this->errors[] = $this->module->l('An error occured. Please contact the merchant to have more informations');
           return $this->setTemplate('error.tpl');
       }
   }

   public function getPaymentErrorMessage($errorCode)
   {
    $this->payment_errors = array(
        1 => 'Le commerçant doit contacter la banque du porteur',
        2 => 'Paiement refusé',
        3 => 'Paiement annulé par le client',
        4 => 'Porteur non enrôlé 3D-Secure',
        5 => 'Erreur authentification 3D-Secure',
        6 => 'Erreur technique SystemPay',
        710 => 'Error 710'
        );
    return $this->payment_errors[$errorCode];
}

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

Bonjour,

 

En checkant, ce sont les PDF qui bloquent.

Warning: include(C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\modules\prestashop/translations/en/pdf.php): failed toopen stream: No such fileor directory in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\modules\prestashop\classes\Translate.php on line 214

Warning: include(): Failed opening'C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\modules\prestashop/translations/en/pdf.php' for inclusion(include_path='.;C:\php\pear') in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\modules\prestashop\classes\Translate.php on line 214

 

Connaissez-vous comment régler ceci? merci

Edited by piloop35 (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...