예제 #1
0
 /**
  * Return from PayPal and dispatch customer to order review page
  */
 public function returnAction()
 {
     $new_mage = $this->isNewMagento();
     if ($new_mage) {
         // for newer magentos
         if ($this->getRequest()->getParam('retry_authorization') == 'true' && is_array($this->_getCheckoutSession()->getPaypalTransactionData())) {
             $this->_forward('placeOrder');
             return;
         }
         try {
             $this->_getCheckoutSession()->unsPaypalTransactionData();
             $this->_checkout = $this->_initCheckout();
             $this->_checkout->returnFromPaypal($this->_initToken());
             if ($this->_checkout->canSkipOrderReviewStep()) {
                 $this->_forward('placeOrder');
             } else {
                 Mage::getSingleton('core/session')->unsPplRedirect();
                 $this->_redirect('paypal/express/review', array('_secure' => true));
             }
             return;
         } catch (Mage_Core_Exception $e) {
             Mage::getSingleton('checkout/session')->addError($e->getMessage());
         } catch (Exception $e) {
             Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
             Mage::logException($e);
         }
         $this->_redirect('checkout/cart');
     } else {
         // for older magentos
         try {
             $this->_initCheckout();
             $this->_checkout->returnFromPaypal($this->_initToken());
             Mage::getSingleton('core/session')->unsPplRedirect();
             echo "<script>parent.parent.location.href='" . Mage::getUrl('paypal/express/review', array('_secure' => true)) . "'</script>";
             return;
         } catch (Mage_Core_Exception $e) {
             Mage::getSingleton('checkout/session')->addError($e->getMessage());
         } catch (Exception $e) {
             Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
             Mage::logException($e);
         }
         echo "<script>parent.parent.location.href='" . Mage::getUrl('checkout/cart', array('_secure' => true)) . "'</script>";
     }
 }
예제 #2
0
 /**
  * Return from PayPal and dispatch customer to order review page
  */
 public function returnAction()
 {
     if ($this->getRequest()->getParam('retry_authorization') == 'true' && is_array($this->_getCheckoutSession()->getPaypalTransactionData())) {
         $this->_forward('placeOrder');
         return;
     }
     try {
         $this->_getCheckoutSession()->unsPaypalTransactionData();
         $this->_checkout = $this->_initCheckout();
         $this->_checkout->returnFromPaypal($this->_initToken());
         if ($this->_checkout->canSkipOrderReviewStep()) {
             $this->_forward('placeOrder');
         } else {
             $this->_redirect('*/*/review');
         }
         return;
     } catch (Mage_Core_Exception $e) {
         Mage::getSingleton('checkout/session')->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
         Mage::logException($e);
     }
     $this->_redirect('checkout/cart');
 }