/** * Place order (for orders with zero balances) * * @return void */ public function placeTask() { // Get the current active transaction $cart = new CurrentCart(); $transaction = $cart->liftTransaction(); if (!$transaction) { App::redirect(Route::url('index.php?option=' . 'com_cart')); } // get security token (Parameter 0) $token = Request::getVar('p0'); if (!$token || !$cart->verifyToken($token)) { die('Error processing your order. Bad security token.'); } // Check if the order total is 0 if ($transaction->info->tiTotal != 0) { die('Cannot process transaction. Order total is not zero.'); } // Check if the transaction's status is pending if ($transaction->info->tStatus != 'pending') { die('Cannot process transaction. Transaction status is invalid.'); } //print_r($transaction); die; if ($this->completeOrder($transaction)) { // Get the transaction ID variable name to pull from URL $params = Component::params(Request::getVar('option')); // Get payment provider $paymentGatewayProivder = $params->get('paymentProvider'); require_once dirname(dirname(__DIR__)) . DS . 'lib' . DS . 'payment' . DS . 'PaymentDispatcher.php'; $verificationVar = \PaymentDispatcher::getTransactionIdVerificationVarName($paymentGatewayProivder); // redirect to thank you page $redirect_url = Route::url('index.php?option=' . 'com_cart') . '/order/complete/' . '?' . $verificationVar . '=' . $token . '-' . $transaction->info->tId; App::redirect($redirect_url); } }