/** * Check and prepare payment method model * * @return bool */ protected function _canUseMethod($method) { if (!$method || !$method->canUseCheckout()) { return false; } return parent::_canUseMethod($method); }
/** * Check payment method model * * @return bool */ protected function _canUseMethod($method) { if (!$method->canUseInternal()) { return false; } return parent::_canUseMethod($method); }
/** * Prepare children blocks */ protected function _prepareLayout() { if ($headBlock = $this->getLayout()->getBlock('head')) { $headBlock->setTitle(Mage::helper('checkout')->__('Billing Information - %s', $headBlock->getDefaultTitle())); } return parent::_prepareLayout(); }
/** * Check and prepare payment method model * * @return bool */ protected function _canUseMethod($method) { if (!$method->canUseForMultishipping()) { return false; } return parent::_canUseMethod($method); }
/** * Check payment method model * * @param Mage_Payment_Model_Method_Abstract|null * @return bool */ protected function _canUseMethod($method) { if ($method) { if ($method->getCode() == 'free') { return false; } } return $method && $method->canUseCheckout() && parent::_canUseMethod($method); }
/** * Check and prepare payment method model * * @param mixed $method * @return bool */ protected function _canUseMethod($method) { if (!$method instanceof Mage_Payment_Model_Method_Abstract || !$method->canUseCheckout() || !$method->isAvailable($this->getQuote())) { return false; } return parent::_canUseMethod($method); }
/** * Check payment method model * * @param Mage_Payment_Model_Method_Abstract|null * @return bool */ protected function _canUseMethod($method) { return $method && $method->canUseCheckout() && parent::_canUseMethod($method); }
/** * Check payment method model * * @param Mage_Payment_Model_Method_Abstract|null $method * @return bool */ protected function _canUseMethod($method) { return $method && $method->canUseForMultishipping() && parent::_canUseMethod($method); }
/** * Check payment method model * * @param Mage_Payment_Model_Method_Abstract|null $method * @return bool */ protected function _canUseMethod($method) { return $method && $method->canUseInternal() && parent::_canUseMethod($method); }
public function testAddCCForZeroAmountCheckout() { $block = new Mage_Payment_Block_Form_Container(); $method = new Varien_Object(); $method->setCode('ops_ideal'); $block->setData('methods', array($method)); $quote = Mage::getModel('sales/quote'); $block->setQuote($quote); $featureModelMock = $this->getModelMock('ops/payment_features_zeroAmountAuth', array('isCCAndZeroAmountAuthAllowed')); $featureModelMock->expects($this->any())->method('isCCAndZeroAmountAuthAllowed')->will($this->returnValue(true)); $this->replaceByMock('model', 'ops/payment_features_zeroAmountAuth', $featureModelMock); $this->_helper->addCCForZeroAmountCheckout($block); $methods = $block->getMethods(); $this->assertTrue($methods[1] instanceof Netresearch_OPS_Model_Payment_Cc); $this->assertFalse($methods[0] instanceof Netresearch_OPS_Model_Payment_Cc); }
/** * call method that defined from block helper * * @param string $method * @param array $args * @return mixed */ public function __call($method, $args) { $helper = $this->getBlockHelper(); if (method_exists($helper, $method)) { return call_user_func_array(array($helper, $method), $args); // return call_user_method_array($method, $helper, $args); } return parent::__call($method, $args); }
/** * Check and prepare payment method model * * @param mixed $method * @return bool */ protected function _canUseMethod($method) { if (!$method || !$method->canUseCheckout() || !$method->canUseForMultishipping() || !$method->isAvailable($this->getQuote())) { return false; } return parent::_canUseMethod($method); }
public function __construct() { parent::__construct(); $this->setTemplate('sales/order/create/billing/method/form.phtml'); }
/** * add ops_cc payment to checkout methods if quote total is zero and zero amount checkout is activated * * @param Mage_Payment_Block_Form_Container $block * * @return $this */ public function addCCForZeroAmountCheckout(Mage_Payment_Block_Form_Container $block) { $methods = $block->getMethods(); if (false === $this->checkIfCCisInCheckoutMethods($methods)) { $ccPayment = Mage::getModel('ops/payment_cc'); if ($ccPayment->getFeatureModel()->isCCAndZeroAmountAuthAllowed($ccPayment, $block->getQuote())) { $ccPayment->setInfoInstance($block->getQuote()->getPayment()); $methods[] = $ccPayment; $block->setData('methods', $methods); } } return $this; }
public function testAddCcPaymentMethod() { $observer = Mage::getModel('ops/observer'); $event = new Varien_Event_Observer(); $block = new Mage_Payment_Block_Form_Container(); $quote = Mage::getModel('sales/quote'); $block->setQuote($quote); $eventData = new Varien_Event(); $event->setEvent($eventData); $event->getEvent()->setData('block', $block); $versionHelperMock = $this->getHelperMock('ops/version', array('canUseApplicableForQuote')); $versionHelperMock->expects($this->any())->method('canUseApplicableForQuote')->will($this->returnvalue(false)); $this->replaceByMock('helper', 'ops/version', $versionHelperMock); $paymentHelperMock = $this->getHelperMock('ops/payment', array('addCCForZeroAmountCheckout')); $paymentHelperMock->expects($this->once())->method('addCCForZeroAmountCheckout')->will($this->returnValue($paymentHelperMock)); $this->replaceByMock('helper', 'ops/payment', $paymentHelperMock); $observer->addCcPaymentMethod($event); }
/** * Check and prepare payment method model * * @param Mage_Payment_Model_Method_Abstract $method * @return bool */ protected function _canUseMethod($method) { return $method instanceof Mage_Payment_Model_Method_Abstract && $method->canUseCheckout() && $method->isAvailable($this->getQuote()) && parent::_canUseMethod($method); }