當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mage::throwException方法代碼示例

本文整理匯總了PHP中mage::throwException方法的典型用法代碼示例。如果您正苦於以下問題:PHP mage::throwException方法的具體用法?PHP mage::throwException怎麽用?PHP mage::throwException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mage的用法示例。


在下文中一共展示了mage::throwException方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getCustomerTokenCard

 public function getCustomerTokenCard()
 {
     if (!is_null($this->_customer)) {
         if ($this->getCustomerToken()) {
             $call = 'customers/' . $this->getCustomerToken();
             $proto = Zend_Http_Client::GET;
             $result = $this->talkToGateway(array(), $call, $proto);
             if (property_exists($result, 'error')) {
                 $message = $this->buildError($result);
                 Mage::throwException($message);
             } else {
                 if (property_exists($result, 'response') && property_exists($result->response, 'token')) {
                     return $result->response->card;
                 } else {
                     mage::log($result);
                     mage::throwException('Invalid response from payment gateway. Please check logs for details.');
                 }
             }
         }
     }
     return false;
 }
開發者ID:evangao,項目名稱:misterwallpaper,代碼行數:22,代碼來源:Customer.php

示例2: onSalesModelOrderCreditmemoRefund

 public function onSalesModelOrderCreditmemoRefund($observer)
 {
     if ($observer->getCreditmemo()->getOrder()->getInstallmentTypeId()) {
         if (NGC_Installment_Model_Master::refundInstallmentPayment($observer)) {
             return mage::throwException('Unable to refund installment payments');
         }
     }
 }
開發者ID:par-orillonsoft,項目名稱:magento_work,代碼行數:8,代碼來源:Observer.php

示例3: getConnection

 private function getConnection()
 {
     require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
     Mage::app($this->_appCode, $this->_appType);
     try {
         $this->_db = Zend_Db::factory('Pdo_Mysql', array('host' => $this->_configXml->global->resources->default_setup->connection->host, 'username' => $this->_configXml->global->resources->default_setup->connection->username, 'password' => $this->_configXml->global->resources->default_setup->connection->password, 'dbname' => $this->_configXml->global->resources->default_setup->connection->dbname));
         $this->_db->getConnection();
     } catch (Zend_Db_Adapter_Exception $e) {
         mage::throwException($e);
         die($e->getMessage());
     } catch (Zend_Exception $e) {
         mage::throwException($e);
         die($e->getMessage());
     }
 }
開發者ID:viewsonic-corp,項目名稱:snapshot,代碼行數:15,代碼來源:snapshot.php

示例4: _sendRequest

 private function _sendRequest($path, $params)
 {
     $httpRequest = new Zend_Http_Client(ProxiBlue_ReCaptcha_Helper_Data::RECAPTCHA_API_SERVER . '/' . ProxiBlue_ReCaptcha_Helper_Data::RECAPTCHA_API_PATH . '/' . $path);
     $httpRequest->setParameterPost(array_merge(array('remoteip' => $_SERVER['REMOTE_ADDR']), $params));
     $response = $httpRequest->request('POST');
     if ($response->getStatus() != 200) {
         mage::throwException('Bad response from cpatcha gateway. we got ' . $response->getStatus());
     }
     return $response->getBody();
 }
開發者ID:proxiblue,項目名稱:recaptcha,代碼行數:10,代碼來源:Recaptcha.php

示例5: refund

 /**
  * Process a refund
  * 
  * @param Varien_Object $payment
  * @param double $amount
  * @return \ProxiBlue_PinPayments_Model_Gateway
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $this->setAmount($amount)->setPayment($payment);
     try {
         $result = $this->talkToGateway(array(), 'charges/' . $payment->getRefundTransactionId() . '/refunds');
         if (property_exists($result, 'error')) {
             $message = $this->buildError($result);
             Mage::throwException($message);
         } else {
             if (property_exists($result, 'response') && property_exists($result->response, 'success')) {
                 $payment->setStatus(self::STATUS_APPROVED)->setLastTransId($result->response->token)->setRefundTransactionId($result->response->token);
             } else {
                 mage::log($result);
                 mage::throwException('Invalid response from payment gateway. Please check logs for details.');
             }
         }
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
     }
     return $this;
 }
開發者ID:evangao,項目名稱:misterwallpaper,代碼行數:28,代碼來源:Gateway.php


注:本文中的mage::throwException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。