本文整理汇总了PHP中Mage_Paypal_Model_Config::isMethodAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Paypal_Model_Config::isMethodAvailable方法的具体用法?PHP Mage_Paypal_Model_Config::isMethodAvailable怎么用?PHP Mage_Paypal_Model_Config::isMethodAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Paypal_Model_Config
的用法示例。
在下文中一共展示了Mage_Paypal_Model_Config::isMethodAvailable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getRecurringProfile
/**
* Load recurring profile
*
* @return Mage_Sales_Model_Recurring_Profile
* @throws Exception
*/
protected function _getRecurringProfile()
{
if (empty($this->_recurringProfile)) {
// get proper recurring profile
$internalReferenceId = $this->_request['rp_invoice_id'];
$this->_recurringProfile = Mage::getModel('sales/recurring_profile')->loadByInternalReferenceId($internalReferenceId);
if (!$this->_recurringProfile->getId()) {
throw new Exception(sprintf('Wrong recurring profile INTERNAL_REFERENCE_ID: "%s".', $internalReferenceId));
}
// re-initialize config with the method code and store id
$methodCode = $this->_recurringProfile->getMethodCode();
$this->_config = Mage::getModel('paypal/config', array($methodCode, $this->_recurringProfile->getStoreId()));
if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) {
throw new Exception(sprintf('Method "%s" is not available.', $methodCode));
}
}
return $this->_recurringProfile;
}
示例2: isMethodAvailable
/**
* Check whether method available for checkout or not
* Logic based on merchant country, methods dependence
*
* @param string $methodCode
* @return bool
*/
public function isMethodAvailable($methodCode = null)
{
$result = parent::isMethodAvailable($methodCode);
if (!$result) {
return false;
}
// Additionally check parent method
if ($methodCode === null) {
$methodCode = $this->getMethodCode();
}
switch ($methodCode) {
case self::METHOD_PAYPAL_DIRECT_CUSTOMERSTORED:
case self::METHOD_PAYPAL_DIRECT_ORDERSTORED:
if (!$this->isMethodActive(self::METHOD_WPP_DIRECT)) {
$result = false;
}
break;
case self::METHOD_PAYPAL_PAYFLOWADVANCED_CUSTOMERSTORED:
case self::METHOD_PAYPAL_PAYFLOWADVANCED_ORDERSTORED:
if (!$this->isMethodActive(self::METHOD_PAYFLOWADVANCED)) {
$result = false;
}
break;
case self::METHOD_PAYPAL_PAYFLOWLINK_CUSTOMERSTORED:
case self::METHOD_PAYPAL_PAYFLOWLINK_ORDERSTORED:
if (!$this->isMethodActive(self::METHOD_PAYFLOWLINK)) {
$result = false;
}
break;
case self::METHOD_PAYPAL_PAYFLOWPRO_CUSTOMERSTORED:
case self::METHOD_PAYPAL_PAYFLOWPRO_ORDERSTORED:
if (!$this->isMethodActive(self::METHOD_PAYFLOWPRO)) {
$result = false;
}
break;
}
return $result;
}