/** * Verify security token * * @param string token * @return bool */ public function verifyToken($token, $tId = false) { if (empty($tId)) { if (empty($this->tInfo)) { throw new \Exception(Lang::txt(COM_CART_NO_TRANSACTION_FOUND)); } $tId = $this->tInfo->tId; } return parent::verifySecurityToken($token, $tId); }
/** * This is a redirect page where the customer ends up after payment is complete * * @return void */ public function completeTask() { // Get payment provider $params = Component::params(Request::getVar('option')); $paymentGatewayProivder = $params->get('paymentProvider'); // Get the transaction ID variable name to pull from URL require_once dirname(dirname(__DIR__)) . DS . 'lib' . DS . 'payment' . DS . 'PaymentDispatcher.php'; $verificationVar = \PaymentDispatcher::getTransactionIdVerificationVarName($paymentGatewayProivder); if ($verificationVar) { // Check the GET values passed $customVar = Request::getVar($verificationVar, ''); $tId = false; if (strstr($customVar, '-')) { $customData = explode('-', $customVar); $token = $customData[0]; $tId = $customData[1]; } else { $token = $customVar; } // Verify token if (!$token || !Cart::verifySecurityToken($token, $tId)) { die('Error processing your order. Failed to verify security token.'); } } // Get transaction info $tInfo = Cart::getTransactionFacts($tId); //print_r($tId); die; //print_r($tInfo);die; if (empty($tInfo->info->tStatus) || $tInfo->info->tiCustomerStatus != 'unconfirmed' || $tInfo->info->tStatus != 'completed') { die('Error processing your order...'); App::redirect(Route::url('index.php?option=' . $this->_option)); } // Transaction ok // Reset the lookup to prevent displaying the page multiple times //$cart->updateTransactionCustomerStatus('confirmed', $tId); // Display message $this->view->transactionInfo = $tInfo->info; $this->view->display(); }