display_column_left = false; $this->display_column_right = false; $this->display_footer = false; $this->display_header = false; parent::init(); } /** * Verify signature, json, create signature and change status if its okay * * @throws PrestaShopException * @throws Exception */ public function process() { if(($payloadDecoded = Util::checkRequestNotification(Configuration::get('IMOJE_SERVICE_KEY'), Configuration::get('IMOJE_SERVICE_ID'))) && ($payloadDecoded['transaction']['status'] === 'settled')) { $cartIdFromNotification = (int) $payloadDecoded['transaction']['orderId']; $cart = new Cart($cartIdFromNotification); if(!$cart->id) { header("HTTP/1.1 404 Not Found"); exit; } $orderId = Order::getOrderByCartId($cartIdFromNotification); if($orderId !== false) { header("HTTP/1.1 404 Not Found"); exit; } $currencyInfo = Currency::getCurrency($cart->id_currency); $cartTotal = $cart->getOrderTotal(); if(Util::checkRequestAmount( $payloadDecoded, Util::convertAmountToFractional($cartTotal), $currencyInfo["iso_code"])) { $customer = new Customer((int) $cart->id_customer); $cartId = (int) $cart->id; $imoje = new iMoje(); $imoje->validateOrder($cartId, _PS_OS_PAYMENT_, $cartTotal, $imoje->displayName, null, [], null, false, $customer->secure_key ); $history = new OrderHistory(); $history->id_order = intval($orderId); $history->addWithemail(true); header("HTTP/1.1 200 OK"); exit(); } } header("HTTP/1.1 404 Not Found"); exit; } }