Public Member Functions | |
getOrder () | |
getStandard () | |
redirectAction () | |
cancelAction () | |
successAction () | |
ipnAction () | |
Protected Member Functions | |
_expireAjax () | |
Protected Attributes | |
$_order |
Definition at line 35 of file StandardController.php.
_expireAjax | ( | ) | [protected] |
Definition at line 55 of file StandardController.php.
00056 { 00057 if (!Mage::getSingleton('checkout/session')->getQuote()->hasItems()) { 00058 $this->getResponse()->setHeader('HTTP/1.1','403 Session Expired'); 00059 exit; 00060 } 00061 }
cancelAction | ( | ) |
When a customer cancel payment from paypal.
Definition at line 88 of file StandardController.php.
00089 { 00090 $session = Mage::getSingleton('checkout/session'); 00091 $session->setQuoteId($session->getPaypalStandardQuoteId(true)); 00092 00093 // cancel order 00094 if ($session->getLastRealOrderId()) { 00095 $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId()); 00096 if ($order->getId()) { 00097 $order->cancel()->save(); 00098 } 00099 } 00100 00101 /*we are calling getPaypalStandardQuoteId with true parameter, the session object will reset the session if parameter is true. 00102 so we don't need to manually unset the session*/ 00103 //$session->unsPaypalStandardQuoteId(); 00104 00105 //need to save quote as active again if the user click on cacanl payment from paypal 00106 //Mage::getSingleton('checkout/session')->getQuote()->setIsActive(true)->save(); 00107 //and then redirect to checkout one page 00108 $this->_redirect('checkout/cart'); 00109 }
getOrder | ( | ) |
getStandard | ( | ) |
Get singleton with paypal strandard order transaction information
Definition at line 68 of file StandardController.php.
00069 { 00070 return Mage::getSingleton('paypal/standard'); 00071 }
ipnAction | ( | ) |
when paypal returns via ipn cannot have any output here validate IPN data if data is valid need to update the database that the user has
Definition at line 137 of file StandardController.php.
00138 { 00139 if (!$this->getRequest()->isPost()) { 00140 $this->_redirect(''); 00141 return; 00142 } 00143 00144 if($this->getStandard()->getDebug()){ 00145 $debug = Mage::getModel('paypal/api_debug') 00146 ->setApiEndpoint($this->getStandard()->getPaypalUrl()) 00147 ->setRequestBody(print_r($this->getRequest()->getPost(),1)) 00148 ->save(); 00149 } 00150 00151 $this->getStandard()->setIpnFormData($this->getRequest()->getPost()); 00152 $this->getStandard()->ipnPostSubmit(); 00153 }
redirectAction | ( | ) |
When a customer chooses Paypal on Checkout/Payment page
Definition at line 77 of file StandardController.php.
00078 { 00079 $session = Mage::getSingleton('checkout/session'); 00080 $session->setPaypalStandardQuoteId($session->getQuoteId()); 00081 $this->getResponse()->setBody($this->getLayout()->createBlock('paypal/standard_redirect')->toHtml()); 00082 $session->unsQuoteId(); 00083 }
successAction | ( | ) |
when paypal returns The order information at this point is in POST variables. However, you don't want to "process" the order until you get validation from the IPN.
set the quote as inactive after back from paypal
Definition at line 117 of file StandardController.php.
00118 { 00119 $session = Mage::getSingleton('checkout/session'); 00120 $session->setQuoteId($session->getPaypalStandardQuoteId(true)); 00121 /** 00122 * set the quote as inactive after back from paypal 00123 */ 00124 Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save(); 00125 00126 //Mage::getSingleton('checkout/session')->unsQuoteId(); 00127 00128 $this->_redirect('checkout/onepage/success', array('_secure'=>true)); 00129 }
$_order [protected] |
Order instance
Definition at line 41 of file StandardController.php.