当前位置: 首页>>代码示例>>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;未经允许,请勿转载。