Beispiel #1
0
 /**
  * Process PayPal API's processable errors
  *
  * @param Mage_Paypal_Model_Api_ProcessableException $exception
  * @throws Mage_Paypal_Model_Api_ProcessableException
  */
 protected function _processPaypalApiError($exception)
 {
     switch ($exception->getCode()) {
         case Mage_Paypal_Model_Api_ProcessableException::API_MAX_PAYMENT_ATTEMPTS_EXCEEDED:
         case Mage_Paypal_Model_Api_ProcessableException::API_TRANSACTION_EXPIRED:
             $this->getResponse()->setRedirect($this->_getQuote()->getPayment()->getCheckoutRedirectUrl());
             break;
         case Mage_Paypal_Model_Api_ProcessableException::API_DO_EXPRESS_CHECKOUT_FAIL:
             $this->_redirectSameToken();
             break;
         case Mage_Paypal_Model_Api_ProcessableException::API_UNABLE_TRANSACTION_COMPLETE:
             if ($this->_config->getPaymentAction() == Mage_Payment_Model_Method_Abstract::ACTION_ORDER) {
                 $paypalTransactionData = $this->_getCheckoutSession()->getPaypalTransactionData();
                 $this->getResponse()->setRedirect($this->_config->getExpressCheckoutOrderUrl($paypalTransactionData['transaction_id']));
             } else {
                 $this->_redirectSameToken();
             }
             break;
         default:
             $this->_redirectToCartAndShowError($exception->getUserMessage());
             break;
     }
 }