本文整理汇总了PHP中Mage_Payment_Model_Method_Abstract::validateRecurringProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Abstract::validateRecurringProfile方法的具体用法?PHP Mage_Payment_Model_Method_Abstract::validateRecurringProfile怎么用?PHP Mage_Payment_Model_Method_Abstract::validateRecurringProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Method_Abstract
的用法示例。
在下文中一共展示了Mage_Payment_Model_Method_Abstract::validateRecurringProfile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValid
/**
* Check whether the object data is valid
* Returns true if valid.
*
* @return bool
*/
public function isValid()
{
$this->_filterValues();
$this->_errors = array();
// start date, order ref ID, schedule description
if (!$this->getStartDatetime()) {
$this->_errors['start_datetime'][] = Mage::helper('payment')->__('Start date is undefined.');
} elseif (!Zend_Date::isDate($this->getStartDatetime(), Varien_Date::DATETIME_INTERNAL_FORMAT)) {
$this->_errors['start_datetime'][] = Mage::helper('payment')->__('Start date has invalid format.');
}
if (!$this->getScheduleDescription()) {
$this->_errors['schedule_description'][] = Mage::helper('payment')->__('Schedule description must be not empty.');
}
// period unit and frequency, trial period unit and trial frequency
if (!$this->getPeriodUnit() || !in_array($this->getPeriodUnit(), $this->getAllPeriodUnits(false), true)) {
$this->_errors['period_unit'][] = Mage::helper('payment')->__('Billing period unit is not defined or wrong.');
} elseif ($this->getPeriodFrequency()) {
$this->_validatePeriodFrequency('period_unit', 'period_frequency');
}
if ($this->getTrialPeriodUnit()) {
if (!in_array($this->getTrialPeriodUnit(), $this->getAllPeriodUnits(false), true)) {
$this->_errors['trial_period_unit'][] = Mage::helper('payment')->__('Trial billing period unit is wrong.');
} elseif ($this->getTrialPeriodFrequency()) {
$this->_validatePeriodFrequency('trial_period_unit', 'trial_period_frequency');
}
}
// billing and other amounts
if (!$this->getBillingAmount() || 0 >= $this->getBillingAmount()) {
$this->_errors['billing_amount'][] = Mage::helper('payment')->__('Wrong or empty billing amount specified.');
}
foreach (array('trial_billing_abount', 'shipping_amount', 'tax_amount', 'init_amount') as $key) {
if ($this->hasData($key) && 0 >= $this->getData($key)) {
$this->_errors[$key][] = Mage::helper('payment')->__('Wrong %s specified.', $this->getFieldLabel($key));
}
}
// currency code
if (!$this->getCurrencyCode()) {
$this->_errors['currency_code'][] = Mage::helper('payment')->__('Currency code is undefined.');
}
// payment method
if (!$this->_methodInstance || !$this->getMethodCode()) {
$this->_errors['method_code'][] = Mage::helper('payment')->__('Payment method code is undefined.');
}
if ($this->_methodInstance) {
try {
$this->_methodInstance->validateRecurringProfile($this);
} catch (Mage_Core_Exception $e) {
$this->_errors['payment_method'][] = $e->getMessage();
}
}
return empty($this->_errors);
}