if (_PS_VERSION_ < '1.5') {
                 $display = new BWDisplay();
             } else {
                 $display = new FrontController();
             }
             $ppec->getContext()->smarty->assign(array('message' => $ppec->l('Error occurred:'), 'logs' => $ppec->logs, 'use_mobile' => $ppec->getContext()->getMobileDevice()));
             $display->setTemplate(_PS_MODULE_DIR_ . 'paypal/views/templates/front/error.tpl');
         } else {
             $ppec->context->cookie->id_cart = (int) $ppec->context->cart->id;
         }
         $ppec->context->cart->updateQty((int) $product_quantity, (int) $id_product, (int) $id_product_attribute);
         $ppec->context->cart->update();
     }
     // Set details for a payment
     $ppec->setExpressCheckout();
     if ($ppec->hasSucceedRequest() && !empty($ppec->token)) {
         $ppec->redirectToAPI();
     } else {
         $ppec->displayPayPalAPIError($ppec->l('Error during the prepration of the express checkout payment'), $ppec->logs);
     }
 } elseif (!empty($ppec->token) && $ppec->token == Tools::getValue('token') && ($ppec->payer_id = Tools::getValue('PayerID'))) {
     // Get payment infos from paypal
     $ppec->getExpressCheckout();
     if ($ppec->hasSucceedRequest() && !empty($ppec->token)) {
         $address = null;
         $customer = null;
         // Create Customer if not exist with address etc
         if ($ppec->getContext()->cookie->logged) {
             if (!($id_customer = Paypal::getPayPalCustomerIdByEmail($ppec->result['EMAIL']))) {
                 PayPal::addPayPalCustomer($ppec->getContext()->customer->id, $ppec->result['EMAIL']);
             }