display_column_left = false; $this->display_column_right = false; parent::init(); } /** * @throws PrestaShopException * @throws \Payment\Exceptions\NotSupportedHashMethod * @throws \Payment\Exceptions\OrderIsNotAnArray */ public function initContent() { parent::initContent(); if(!isset($_POST['imoje_order_id'], $_POST['imoje_customer_id'], $_POST['imoje_address_invoice_id'], $_POST['imoje_address_delivery_id'], $_POST['twisto_data'] ) && empty($_POST['imoje_order_id']) && empty($_POST['imoje_customer_id']) && empty($_POST['imoje_address_invoice_id']) && empty($_POST['imoje_address_delivery_id']) && empty($_POST['twisto_data']) && \Payment\Twisto::isActive( json_decode(Configuration::get('IMOJE_PAYMENT_METHODS'), true), Configuration::get('IMOJE_TWISTO_ENABLED')) ) { Tools::redirect('/'); return; } global $cookie; $addressBilling = new Address((int) $_POST['imoje_address_invoice_id']); $addressDelivery = new Address((int) $_POST['imoje_address_delivery_id']); $customer = new Customer((int) $_POST['imoje_customer_id']); $orderId = Order::getOrderByCartId((int) $_POST['imoje_order_id']); $order = new Order($orderId); $currencyInfo = Currency::getCurrency($order->id_currency); $imoje = new iMoje(); $payment = new Payment( Configuration::get('IMOJE_SANDBOX') == 1 ? \Payment\Util::ENVIRONMENT_SANDBOX : \Payment\Util::ENVIRONMENT_PRODUCTION, Configuration::get('IMOJE_SERVICE_KEY'), Configuration::get('IMOJE_SERVICE_ID'), Configuration::get('IMOJE_MERCHANT_ID') ); $twistoData = Configuration::get('IMOJE_SANDBOX') ? \Payment\Twisto::getDataSandbox() : (isset($_POST['twisto_data']) ? $_POST['twisto_data'] : ''); $this->context->smarty->assign([ 'form' => $payment->buildOrderForm( \Payment\Util::prepareData( \Payment\Util::convertAmountToFractional($order->total_paid), $currencyInfo['iso_code'], $orderId, $customer->firstname, $customer->lastname, $customer->email, $addressDelivery->phone_mobile ? $addressBilling->phone_mobile : ($addressBilling->phone ?: ''), $this->context->link->getModuleLink('imoje', 'success'), $this->context->link->getModuleLink('imoje', 'failure'), $this->context->link->getModuleLink('imoje', 'confirmation'), $imoje->version . ';prestashop_' . _PS_VERSION_, $twistoData ), $this->module->l('Continue', 'payment') ), ]); $this->setTemplate(IMoje::buildTemplatePath('pay', 'front')); } }