當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。