I am building payment gateway extension and i am facing small issue to get the quote object after control return from payment Gateway.
Let me explain you in detail.
I am using below funtion to redirect to payment gateway.
public function getCheckoutRedirectUrl()
{
return Mage::getUrl('custom/index/start');
}
Above method works fine. I am redirecting to payment gateway and payment processed successful with success message and redirect back to our store with captured status on below controller action.
public function returnAction()
{
$quote = Mage::getSingleton('checkout/session')->getQuote();
$quote->collectTotals();
$payment = $quote->getPayment();
$service = Mage::getModel('sales/service_quote', $quote);
$service->submitAll();
$quote->save();
$order = $service->getOrder();
$this->getSession()->setLastQuoteId($quote->getId())
->setLastSuccessQuoteId($quote->getId())
->setLastOrderId($order->getId());
{
Mage_Sales_Model_Order::STATE_PENDING_PAYMENT:
break;
case Mage_Sales_Model_Order::STATE_PROCESSING:
case Mage_Sales_Model_Order::STATE_COMPLETE:
case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
$order->sendNewOrderEmail();
break;
}
$this->getResponse()->setRedirect(Mage::getUrl('checkout/onepage/success'));
return;
}
But in the above function i get the quote object as blank and due to that i am unable to place an order. This means that after returning from payment gateway it clears the checkout session.
How can i get the quote object and what is the problem ?
Please help