In a site I am building that uses Authorize.net Direct Post as the payment method, I am running into an issue where the cart will not be inactivated after successful order completion. In Mage_Authorizenet_Model_Directpost, I was able to confirm that the quote is being inactivated on line 574 as part of the order authorization step.
Mage::getModel('sales/quote')
->load($order->getQuoteId())
->setIsActive(false)
->save();
However, in directpost.js, when Authorize.net loads the IFrame and the returnQuote function is called, it redirects to Mage_Authorizenet_Directpost_PaymentController's returnQuoteAction which calls the _returnCustomerQuote function.
if ($order->getId()) {
$quote = Mage::getModel('sales/quote')
->load($order->getQuoteId());
if ($quote->getId()) {
$quote->setIsActive(1)
->setReservedOrderId(NULL)
->save();
$this->_getCheckout()->replaceQuote($quote);
}
$this->_getDirectPostSession()->removeCheckoutOrderIncrementId($incrementId);
$this->_getDirectPostSession()->unsetData('quote_id');
if ($cancelOrder) {
$order->registerCancellation($errorMsg)->save();
}
}
Notice that the quote is being set as active again. I don't know why they do this unless the order is canceled. I'm thinking that maybe I'm missing something in the logic here. We have done some onepage checkout customization and some customization on the actual order submission, but I don't see anything that would affect this. Is Magento expecting that the quote will get disabled later down the call chain? Its hard for me to debug this since I can't step through the code given that Authorize.net Direct Post won't relay a response back to my local.
Thanks for any help that can be offered.