/** * 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 include_once JPATH_COMPONENT . 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 || !CartModelCart::verifySecurityToken($token, $tId)) { die('Error processing your order. Failed to verify security token.'); } } // Get transaction info $tInfo = CartModelCart::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...'); //throw new Exception(Lang::txt('Error processing transaction.'), 404); $redirect_url = Route::url('index.php?option=' . 'com_cart'); App::redirect($redirect_url); } // 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(); }
/** * 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); }