Exemplo n.º 1
0
 /**
  * @param Mage_Payment_Model_Method_Abstract $method
  * @return string
  */
 public function getMethodTitle(Mage_Payment_Model_Method_Abstract $method)
 {
     if ($paymentTitle = Mage::helper('msp')->getPaymentTitle($method)) {
         return $paymentTitle;
     }
     return parent::getMethodTitle($method);
 }
Exemplo n.º 2
0
 /**
  * Check and prepare payment method model
  *
  * @return bool
  */
 protected function _canUseMethod($method)
 {
     if (!$method || !$method->canUseCheckout()) {
         return false;
     }
     return parent::_canUseMethod($method);
 }
Exemplo n.º 3
0
 protected function _toHtml()
 {
     if (Mage::helper('fieldsmanager')->getStoredDatafor('enable') && !Mage::getStoreConfig('quickcheckout/general/active')) {
         $this->setTemplate("fieldsmanager/checkout/onepage/payment/methods.phtml");
     }
     return parent::_toHtml();
 }
Exemplo n.º 4
0
 /**
  * @return array
  */
 public function getMethods()
 {
     if ($this->methods !== null) {
         return $this->methods;
     }
     //
     $this->methods = parent::getMethods();
     $allowedMethods = $this->getAllowedMethods();
     // All Methods are allowed
     if ($allowedMethods === true) {
         return $this->methods;
     }
     $result = array();
     foreach ($this->methods as $method) {
         /**
          * @var $method Mage_Payment_Model_Method_Abstract
          */
         $methodAvailable = $allowedMethods->getData($method->getCode());
         if ($methodAvailable == 1) {
             $result[] = $method;
         }
     }
     // Overwrite Methods with the above created result array
     $this->methods = $result;
     return $this->methods;
 }
Exemplo n.º 5
0
 protected function _toHtml()
 {
     $this->setTemplate('customerreward/checkout/payment/methods.phtml');
     if ($this->getRequest()->getModuleName() == 'onestepcheckout') {
         $this->setTemplate('customerreward/checkout/payment/onestep.phtml');
     }
     return parent::_toHtml();
 }
Exemplo n.º 6
0
 protected function _canUseMethod($method)
 {
     $allowedMethods = explode(',', Mage::getStoreConfig('occ/configuration/payment_methods'));
     if (!in_array($method->getCode(), $allowedMethods)) {
         return false;
     }
     return parent::_canUseMethod($method);
 }
Exemplo n.º 7
0
 protected function _canUseMethod($method)
 {
     $methods_to_check = explode(',', Mage::getStoreConfig('byjuno/risk/payment', Mage::app()->getStore()));
     if (in_array($method->getCode(), $methods_to_check) === true) {
         if (Mage::getStoreConfig('byjuno/risk/status' . $this->getQuote()->getByjunoStatus(), Mage::app()->getStore()) == 0) {
             return false;
         }
     }
     return parent::_canUseMethod($method);
 }
 /**
  * Check and prepare payment method model
  *
  * @return bool
  */
 protected function _canUseMethod($method)
 {
     if (!$method || !$method->canUseCheckout()) {
         return false;
     }
     if ($this->availableMethods != null && !in_array($method->getCode(), $this->availableMethods)) {
         return false;
     }
     return parent::_canUseMethod($method);
 }
Exemplo n.º 9
0
 /**
  * Override template file for different checkouts
  * @return string
  */
 public function getTemplate()
 {
     if (Mage::getStoreConfig('payment/iways_paypalplus_payment/active')) {
         if (Mage::helper('iways_paypalplus')->isFirecheckout()) {
             return self::DEFAULT_TEMPLATE;
         }
         if (Mage::helper('iways_paypalplus')->isMagestoreOsc()) {
             return self::MAGESTORE_TEMPLATE;
         }
     }
     return parent::getTemplate();
 }
Exemplo n.º 10
0
 protected function _toHtml()
 {
     foreach ($this->getQuote()->getAllItems() as $item) {
         if ($item->getIsRecurring()) {
             return parent::_toHtml();
         }
     }
     $magentoVersionTag = AW_Points_Helper_Data::MAGENTO_VERSION_14;
     if (Mage::helper('points')->magentoLess14()) {
         $magentoVersionTag = AW_Points_Helper_Data::MAGENTO_VERSION_13;
     }
     $this->setTemplate('aw_points/checkout/onepage/payment/' . $magentoVersionTag . '/methods.phtml');
     return parent::_toHtml();
 }
Exemplo n.º 11
0
 /**
  * Retrieve availale payment methods
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return array
  */
 public function getPaymentMethods(Mage_Sales_Model_Quote $quote)
 {
     if (is_null($this->_paymentMethodsBlock)) {
         $this->_paymentMethodsBlock = Mage::getBlockSingleton('checkout/Onepage_Payment_Methods');
     }
     $methods = $this->_methods;
     if (empty($methods)) {
         $methodInstances = $this->_paymentMethodsBlock->setQuote($quote)->getMethods();
         foreach ($methodInstances as $methodItem) {
             $methods[] = $methodItem->getCode();
         }
         $this->_methods = $methods;
     }
     return $this->_methods;
 }
 /**
  * Retrieve availale payment methods
  *
  * @return array
  */
 public function getMethods()
 {
     // Get payment methods form scoring session.
     if (false == Mage::getModel('scoring/session')->hasSolvencyGroup()) {
         return parent::getMethods();
     }
     $methods = Mage::getModel('scoring/session')->getSolvencyValidationResultArray();
     $result = array();
     // Check allowed payment methods and retrieve availale payment methods.
     foreach (parent::getMethods() as $method) {
         // Hide payment methods, which are not allowed exists in scoring session.
         if (false == isset($methods['allowed_payment_methods']) || in_array($method->getCode(), $methods['allowed_payment_methods'])) {
             $result[] = $method;
         }
     }
     return $result;
 }
Exemplo n.º 13
0
 public function testGetMethodTitleAndMethodLabelAfterHtml()
 {
     $expectedTitle = 'Free Method';
     $expectedLabel = 'Label After Html';
     $method = Mage::getModel('Mage_Payment_Model_Method_Free');
     $block = $this->_block->getLayout()->createBlock('Mage_Core_Block_Text')->setMethodTitle($expectedTitle)->setMethodLabelAfterHtml($expectedLabel);
     $this->assertEquals('No Payment Information Required', $this->_block->getMethodTitle($method));
     $this->_block->setChild('payment.method.free', $block);
     $actualTitle = $this->_block->getMethodTitle($method);
     $actualLabel = $this->_block->getMethodLabelAfterHtml($method);
     $this->assertEquals($expectedTitle, $actualTitle);
     $this->assertEquals($expectedLabel, $actualLabel);
 }
Exemplo n.º 14
0
 /**
  * Retrieve available payment methods
  * The method is redefined to show only Zero Subtotal Checkout (free) payment
  * method when total value (it includes discount) is zero
  *
  * @return array
  */
 public function getMethods()
 {
     if (($methods = $this->getData('methods')) !== null) {
         return $methods;
     }
     $methods = parent::getMethods();
     if (!($methods && $this->getQuote()->getBaseGrandTotal() == 0)) {
         return $methods;
     }
     $_methods = array();
     foreach ($methods as $method) {
         if ($method->getCode() == 'free') {
             $_methods[] = $method;
             break;
         }
     }
     $this->setData('methods', $_methods);
     return $_methods;
 }
Exemplo n.º 15
0
 /**
  * Check and prepare payment method model
  * @return bool
  */
 protected function _canUseMethod($method)
 {
     //shipping method
     $sm = $this->getQuote()->getShippingAddress()->getShippingMethod();
     $sTemp = explode('_', $sm);
     //is it sheepla's method
     if ($sTemp[0] == 'sheepla') {
         //if so get check if $method is available with current shipping method
         //Mage::log($method);
         $cString = "sheepla/{$sTemp[1]}_{$sTemp[2]}";
         $conf = Mage::getStoreConfig($cString);
         //Mage::log($conf);
         if (strpos($conf['payment'], $method->getCode()) === false) {
             return false;
         }
     }
     if (!$method || !$method->canUseCheckout()) {
         return false;
     }
     return parent::_canUseMethod($method);
 }
Exemplo n.º 16
0
 public function _construct()
 {
     parent::_construct();
 }