当前位置: 首页>>代码示例>>PHP>>正文


PHP Data::getStoreMethods方法代码示例

本文整理汇总了PHP中Magento\Payment\Helper\Data::getStoreMethods方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::getStoreMethods方法的具体用法?PHP Data::getStoreMethods怎么用?PHP Data::getStoreMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Payment\Helper\Data的用法示例。


在下文中一共展示了Data::getStoreMethods方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getBillingAgreementMethods

 /**
  * Retrieve available billing agreement methods
  *
  * @param null|string|bool|int|\Magento\Store\Model\Store $store
  * @param \Magento\Quote\Model\Quote|null $quote
  * @return MethodInterface[]
  */
 public function getBillingAgreementMethods($store = null, $quote = null)
 {
     $result = [];
     foreach ($this->_paymentData->getStoreMethods($store, $quote) as $method) {
         if ($method instanceof MethodInterface) {
             $result[] = $method;
         }
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:Data.php

示例2: getAvailableMethods

 /**
  * @param \Magento\Quote\Api\Data\CartInterface $quote
  * @return \Magento\Payment\Model\MethodInterface[]
  * @api
  */
 public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     $store = $quote ? $quote->getStoreId() : null;
     $methods = [];
     foreach ($this->paymentHelper->getStoreMethods($store, $quote) as $method) {
         if ($this->_canUseMethod($method, $quote)) {
             $method->setInfoInstance($quote->getPayment());
             $methods[] = $method;
         }
     }
     return $methods;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:17,代码来源:MethodList.php

示例3: getAvailableMethods

 /**
  * @param \Magento\Sales\Model\Quote $quote
  * @return \Magento\Payment\Model\MethodInterface[]
  */
 public function getAvailableMethods(\Magento\Sales\Model\Quote $quote = null)
 {
     $store = $quote ? $quote->getStoreId() : null;
     $methods = array();
     $specification = $this->methodSpecificationFactory->create(array(AbstractMethod::CHECK_ZERO_TOTAL));
     foreach ($this->paymentHelper->getStoreMethods($store, $quote) as $method) {
         if ($this->_canUseMethod($method, $quote) && $specification->isApplicable($method, $quote)) {
             $method->setInfoInstance($quote->getPayment());
             $methods[] = $method;
         }
     }
     return $methods;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:MethodList.php

示例4: getBillingAgreementMethods

 /**
  * Retrieve available billing agreement methods
  *
  * @param null|string|bool|int|\Magento\Store\Model\Store $store
  * @param \Magento\Quote\Model\Quote|null $quote
  *
  * @return MethodInterface[]
  */
 public function getBillingAgreementMethods($store = null, $quote = null)
 {
     $pre = __METHOD__ . " : ";
     $this->_logger->debug($pre . 'bof');
     $result = [];
     foreach ($this->_paymentData->getStoreMethods($store, $quote) as $method) {
         if ($method instanceof MethodInterface) {
             $result[] = $method;
         }
     }
     $this->_logger->debug($pre . 'eof | result : ', $result);
     return $result;
 }
开发者ID:PayFast,项目名称:mod-magento_2,代码行数:21,代码来源:Data.php

示例5: testSortMethods

 /**
  * @param array $methodA
  * @param array $methodB
  *
  * @dataProvider getSortMethodsDataProvider
  */
 public function testSortMethods(array $methodA, array $methodB)
 {
     $this->initialConfig->expects($this->once())->method('getData')->will($this->returnValue([\Magento\Payment\Helper\Data::XML_PATH_PAYMENT_METHODS => [$methodA['code'] => $methodA['data'], $methodB['code'] => $methodB['data'], 'empty' => []]]));
     $this->scopeConfig->expects(new MethodInvokedAtIndex(0))->method('getValue')->with(sprintf('%s/%s/model', Data::XML_PATH_PAYMENT_METHODS, $methodA['code']))->will($this->returnValue('Magento\\Payment\\Model\\Method\\AbstractMethod'));
     $this->scopeConfig->expects(new MethodInvokedAtIndex(1))->method('getValue')->with(sprintf('%s/%s/model', Data::XML_PATH_PAYMENT_METHODS, $methodB['code']))->will($this->returnValue('Magento\\Payment\\Model\\Method\\AbstractMethod'));
     $this->scopeConfig->expects(new MethodInvokedAtIndex(2))->method('getValue')->with(sprintf('%s/%s/model', Data::XML_PATH_PAYMENT_METHODS, 'empty'))->will($this->returnValue(null));
     $methodInstanceMockA = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
     $methodInstanceMockA->expects($this->any())->method('isAvailable')->will($this->returnValue(true));
     $methodInstanceMockA->expects($this->any())->method('getConfigData')->with('sort_order', null)->will($this->returnValue($methodA['data']['sort_order']));
     $methodInstanceMockB = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
     $methodInstanceMockB->expects($this->any())->method('isAvailable')->will($this->returnValue(true));
     $methodInstanceMockB->expects($this->any())->method('getConfigData')->with('sort_order', null)->will($this->returnValue($methodB['data']['sort_order']));
     $this->methodFactory->expects($this->at(0))->method('create')->will($this->returnValue($methodInstanceMockA));
     $this->methodFactory->expects($this->at(1))->method('create')->will($this->returnValue($methodInstanceMockB));
     $sortedMethods = $this->helper->getStoreMethods();
     $this->assertTrue(array_shift($sortedMethods)->getConfigData('sort_order') < array_shift($sortedMethods)->getConfigData('sort_order'));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:DataTest.php

示例6: getBillingAgreementMethods

 /**
  * Retrieve available billing agreement methods
  *
  * @param null|string|bool|int|\Magento\Store\Model\Store $store
  * @param \Magento\Sales\Model\Quote|null $quote
  * @return MethodInterface[]
  */
 public function getBillingAgreementMethods($store = null, $quote = null)
 {
     $result = array();
     foreach ($this->_paymentData->getStoreMethods($store, $quote) as $method) {
         if ($this->canManageBillingAgreements($method)) {
             $result[] = $method;
         }
     }
     return $result;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Data.php

示例7: getAvailableMethods

 /**
  * @param \Magento\Quote\Api\Data\CartInterface $quote
  * @return \Magento\Payment\Model\MethodInterface[]
  * @api
  */
 public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     $store = $quote ? $quote->getStoreId() : null;
     $methods = [];
     $isFreeAdded = false;
     foreach ($this->paymentHelper->getStoreMethods($store, $quote) as $method) {
         if ($this->_canUseMethod($method, $quote)) {
             $method->setInfoInstance($quote->getPayment());
             $methods[] = $method;
             if ($method->getCode() == Free::PAYMENT_METHOD_FREE_CODE) {
                 $isFreeAdded = true;
             }
         }
     }
     if (!$isFreeAdded) {
         /** @var \Magento\Payment\Model\Method\Free $freeMethod */
         $freeMethod = $this->paymentHelper->getMethodInstance(Free::PAYMENT_METHOD_FREE_CODE);
         if ($freeMethod->isAvailableInConfig()) {
             $freeMethod->setInfoInstance($quote->getPayment());
             $methods[] = $freeMethod;
         }
     }
     return $methods;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:29,代码来源:MethodList.php

示例8: getMethods

 /**
  * Retrieve available payment methods
  *
  * @return array
  */
 public function getMethods()
 {
     $methods = $this->getData('methods');
     if ($methods === null) {
         $quote = $this->getQuote();
         $store = $quote ? $quote->getStoreId() : null;
         $methods = [];
         $specification = $this->methodSpecificationFactory->create([AbstractMethod::CHECK_ZERO_TOTAL]);
         foreach ($this->_paymentHelper->getStoreMethods($store, $quote) as $method) {
             if ($this->_canUseMethod($method) && $specification->isApplicable($method, $this->getQuote())) {
                 $this->_assignMethod($method);
                 $methods[] = $method;
             }
         }
         $this->setData('methods', $methods);
     }
     return $methods;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:23,代码来源:Container.php


注:本文中的Magento\Payment\Helper\Data::getStoreMethods方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。