Exemple #1
0
 public function testGetInfoBlock()
 {
     $block = new Mage_Payment_Helper_Data();
     $paymentInfo = new Mage_Payment_Model_Info();
     $paymentInfo->setMethod('checkmo');
     $result = $block->getInfoBlock($paymentInfo);
     $this->assertInstanceOf('Mage_Payment_Block_Info_Checkmo', $result);
 }
Exemple #2
0
 /**
  * @return array
  */
 public function paymentMethodDataProvider()
 {
     $helper = new Mage_Payment_Helper_Data();
     $result = array();
     foreach ($helper->getPaymentMethods() as $code => $method) {
         $result[] = array($code, $method['model']);
     }
     return $result;
 }
Exemple #3
0
 /**
  * Retrieve all payment methods
  *
  * @param mixed $store
  * @return array
  */
 public function getPaymentMethods($store = null)
 {
     $_methods = parent::getPaymentMethods($store);
     if (isset($_methods['sagepaysuite'])) {
         unset($_methods['sagepaysuite']);
     }
     return $_methods;
 }
 /**
  * Check if we should render based on quote validation.
  *
  * @return bool
  */
 protected function _shouldRenderQuote()
 {
     $quote = $this->_getQuote();
     // validate minimum quote amount and validate quote for zero grandtotal
     if (null !== $quote && $this->_hasZeroGrandTotal($quote)) {
         return false;
     }
     // check payment method availability
     $methodInstance = $this->_paymentHelper->getMethodInstance($this->_paymentMethodCode);
     if (!$methodInstance || !$methodInstance->isAvailable($quote)) {
         return false;
     }
     return true;
 }
Exemple #5
0
 /**
  * Retrieve available payment methods for store, filtered according to the payment filter configuration.
  * This is only used in magento < 1.4. In newer versions the helper isn't rewritten.
  *
  * @param Mage_Core_Model_Store $store
  * @param Mage_Sales_Model_Quote $quote
  * @return array
  */
 public function getStoreMethods($store = null, $quote = null)
 {
     $methods = parent::getStoreMethods($store, $quote);
     if (!Mage::app()->getStore()->isAdmin()) {
         $tmp = array();
         foreach ($methods as $method) {
             if (in_array($method->getCode(), Mage::helper('payfilter')->getForbiddenPaymentMethodsForCart())) {
                 continue;
             }
             if (!in_array($method->getCode(), Mage::helper('payfilter')->getAllowedPaymentMethodsForCurrentGroup())) {
                 continue;
             }
             $tmp[] = $method;
         }
         $methods = $tmp;
     }
     return $methods;
 }