本文整理汇总了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;
}
示例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');
}
}
}
示例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());
}
}
示例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();
}
示例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;
}