/** * Executes a request to the PaynetEasy server * to start the payment process. * * If the request is successful, redirects the * customer to the PaynetEasy payment form. * * If the request is made with an error, * displays an error message. */ public function display() { $payment_aggregate = new PaymentAggregate($this->module); $prestashop_cart = $this->context->cart; $return_url = $this->context->link->getModuleLink('payneteasy', 'finishsale', array('id_cart' => $prestashop_cart->id), true); try { $paynet_response = $payment_aggregate->startSale($prestashop_cart, $return_url); $this->savePaynetPayment($paynet_response, $prestashop_cart); } catch (Exception $ex) { $this->createOrderWithErrorPayment($prestashop_cart, $ex->getMessage()); return $this->displayTechnicalError($ex); } Tools::redirectLink($paynet_response->getRedirectUrl()); }