Public Member Functions | |
getPayment () | |
getSession () | |
payAction () | |
returnSuccessAction () | |
returnCancelAction () | |
notificationAction () |
Definition at line 34 of file AspController.php.
getPayment | ( | ) |
Get singleton with payment model AmazonPayments ASP
Definition at line 41 of file AspController.php.
00042 { 00043 return Mage::getSingleton('amazonpayments/payment_asp'); 00044 }
getSession | ( | ) |
Get singleton with model checkout session
Definition at line 51 of file AspController.php.
00052 { 00053 return Mage::getSingleton('checkout/session'); 00054 }
notificationAction | ( | ) |
Amazon Simple Pay service send notification
Definition at line 149 of file AspController.php.
00150 { 00151 $this->getPayment()->processNotification($this->getRequest()->getParams()); 00152 }
payAction | ( | ) |
When a customer press "Place Order" button on Checkout/Review page Redirect customer to Amazon Simple Pay payment interface
Definition at line 61 of file AspController.php.
00062 { 00063 $session = $this->getSession(); 00064 $quoteId = $session->getQuoteId(); 00065 $lastRealOrderId = $session->getLastRealOrderId(); 00066 if (is_null($quoteId) || is_null($lastRealOrderId)){ 00067 $this->_redirect('checkout/cart/'); 00068 } else { 00069 $session->setAmazonAspQuoteId($quoteId); 00070 $session->setAmazonAspLastRealOrderId($lastRealOrderId); 00071 00072 $order = Mage::getModel('sales/order'); 00073 $order->loadByIncrementId($lastRealOrderId); 00074 00075 $payment = $this->getPayment(); 00076 $payment->setOrder($order); 00077 $payment->processEventRedirect(); 00078 00079 Mage::register('amazonpayments_payment_asp', $payment); 00080 $this->loadLayout(); 00081 $this->renderLayout(); 00082 00083 $quote = $session->getQuote(); 00084 $quote->setIsActive(false); 00085 $quote->save(); 00086 00087 $session->setQuoteId(null); 00088 $session->setLastRealOrderId(null); 00089 } 00090 }
returnCancelAction | ( | ) |
Customer canceled payment and successfully returned from Amazon Simple Pay site Redirect customer to Shopping Cart page
Definition at line 126 of file AspController.php.
00127 { 00128 $session = $this->getSession(); 00129 $session->setQuoteId($session->getAmazonAspQuoteId(true)); 00130 00131 $order = Mage::getModel('sales/order'); 00132 $order->loadByIncrementId($session->getAmazonAspLastRealOrderId()); 00133 00134 if ($order->isEmpty()) { 00135 return false; 00136 } 00137 00138 $payment = $this->getPayment(); 00139 $payment->setOrder($order); 00140 $payment->processEventReturnCancel(); 00141 00142 $this->_redirect('checkout/cart/'); 00143 }
returnSuccessAction | ( | ) |
When a customer successfully returned from Amazon Simple Pay site Redirect customer to Checkout/Success page
Definition at line 97 of file AspController.php.
00098 { 00099 $session = $this->getSession(); 00100 00101 $orderId = $session->getAmazonAspLastRealOrderId(); 00102 $quoteId = $session->getAmazonAspQuoteId(true); 00103 00104 $order = Mage::getModel('sales/order'); 00105 $order->loadByIncrementId($orderId); 00106 00107 if ($order->isEmpty()) { return false; 00108 } 00109 00110 $payment = $this->getPayment(); 00111 $payment->setOrder($order); 00112 $payment->processEventReturnSuccess(); 00113 00114 $session->setQuoteId($quoteId); 00115 $session->getQuote()->setIsActive(false)->save(); 00116 $session->setLastRealOrderId($orderId); 00117 00118 $this->_redirect('checkout/onepage/success'); 00119 }