當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Data::getMethodInstance方法代碼示例

本文整理匯總了PHP中Magento\Payment\Helper\Data::getMethodInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Data::getMethodInstance方法的具體用法?PHP Data::getMethodInstance怎麽用?PHP Data::getMethodInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Payment\Helper\Data的用法示例。


在下文中一共展示了Data::getMethodInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * @param PaymentHelper $paymentHelper
  */
 public function __construct(PaymentHelper $paymentHelper)
 {
     $this->paymentHelper = $paymentHelper;
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
     }
 }
開發者ID:adragus-inviqa,項目名稱:adyen-magento2,代碼行數:10,代碼來源:AdyenHppConfigProvider.php

示例2: __construct

 /**
  * @param PaymentHelper $paymentHelper
  * @param UrlInterface $urlBuilder
  */
 public function __construct(PaymentHelper $paymentHelper, UrlInterface $urlBuilder)
 {
     $this->paymentHelper = $paymentHelper;
     $this->urlBuilder = $urlBuilder;
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
     }
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:IframeConfigProvider.php

示例3: getPaymentMethodInstance

 /**
  * Retrieve payment method instance
  *
  * @return \Magento\Payment\Model\MethodInterface
  */
 public function getPaymentMethodInstance()
 {
     if ($this->_paymentMethodInstance === null) {
         $this->_paymentMethodInstance = $this->_paymentData->getMethodInstance($this->getMethodCode());
         $this->_paymentMethodInstance->setStore($this->getStoreId());
     }
     return $this->_paymentMethodInstance;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:13,代碼來源:AbstractAgreement.php

示例4: toOptionArray

 /**
  * Return option array
  *
  * @return array
  */
 public function toOptionArray()
 {
     $result = array();
     foreach ($this->paymentHelper->getPaymentMethods() as $code => $data) {
         if ($this->specification->isSatisfiedBy($code)) {
             $result[$code] = isset($data['title']) ? $data['title'] : $this->paymentHelper->getMethodInstance($code)->getTitle();
         }
     }
     return $result;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:15,代碼來源:PaymentMethodsList.php

示例5: __construct

 /**
  * @param \Wirecard\CheckoutPage\Helper\Data $helper
  * @param \Magento\Payment\Helper\Data $paymentHelper
  * @param \Magento\Framework\Escaper $escaper
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  *
  */
 public function __construct(\Wirecard\CheckoutPage\Helper\Data $helper, \Magento\Payment\Helper\Data $paymentHelper, \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Asset\Repository $assetRepo)
 {
     $this->_dataHelper = $helper;
     $this->paymentHelper = $paymentHelper;
     $this->escaper = $escaper;
     $this->assetRepo = $assetRepo;
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
     }
 }
開發者ID:wirecard,項目名稱:magento2-wcp,代碼行數:17,代碼來源:ConfigProvider.php

示例6: __construct

 /**
  * @param ConfigFactory $configFactory
  * @param ResolverInterface $localeResolver
  * @param CurrentCustomer $currentCustomer
  * @param PaypalHelper $paypalHelper
  * @param PaymentHelper $paymentHelper
  */
 public function __construct(ConfigFactory $configFactory, ResolverInterface $localeResolver, CurrentCustomer $currentCustomer, PaypalHelper $paypalHelper, PaymentHelper $paymentHelper)
 {
     $this->localeResolver = $localeResolver;
     $this->config = $configFactory->create();
     $this->currentCustomer = $currentCustomer;
     $this->paypalHelper = $paypalHelper;
     $this->paymentHelper = $paymentHelper;
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
     }
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:18,代碼來源:ExpressConfigProvider.php

示例7: isMethodQuoteAvailable

 /**
  * Сhecks payment method and quote availability
  *
  * @param string $paymentCode
  * @param bool $isInCatalog
  * @return bool
  */
 public function isMethodQuoteAvailable($paymentCode, $isInCatalog)
 {
     $quote = $isInCatalog ? null : $this->_checkoutSession->getQuote();
     // check payment method availability
     /** @var \Magento\Payment\Model\Method\AbstractMethod $methodInstance */
     $methodInstance = $this->_paymentData->getMethodInstance($paymentCode);
     if (!$methodInstance->isAvailable($quote)) {
         return false;
     }
     return true;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:18,代碼來源:CheckoutValidator.php

示例8: prepareDataSource

 /**
  * Prepare Data Source
  *
  * @param array $dataSource
  * @return void
  */
 public function prepareDataSource(array &$dataSource)
 {
     if (isset($dataSource['data']['items'])) {
         foreach ($dataSource['data']['items'] as &$item) {
             try {
                 $item[$this->getData('name')] = $this->paymentHelper->getMethodInstance($item[$this->getData('name')])->getTitle();
             } catch (\UnexpectedValueException $exception) {
                 //Displaying payment code (with no changes) if payment method is not available in system
             }
         }
     }
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:18,代碼來源:PaymentMethod.php

示例9: getConfig

 /**
  * @inheritdoc
  */
 public function getConfig()
 {
     /**
      * @var $payment Payupl
      */
     $config = [];
     $payment = $this->paymentHelper->getMethodInstance(Payupl::CODE);
     if ($payment->isAvailable()) {
         $redirectUrl = $payment->getCheckoutRedirectUrl();
         $quote = $this->checkoutSession->getQuote();
         $config = ['payment' => ['orbaPayupl' => ['redirectUrl' => $redirectUrl, 'paytypes' => $this->paytypeHelper->getAllForQuote($quote)]]];
     }
     return $config;
 }
開發者ID:tozwierz,項目名稱:magento2_payupl,代碼行數:17,代碼來源:ConfigProvider.php

示例10: __construct

 /**
  * @param ConfigFactory $configFactory
  * @param ResolverInterface $localeResolver
  * @param CurrentCustomer $currentCustomer
  * @param PayfastHelper $paymentHelper
  * @param PaymentHelper $paymentHelper
  */
 public function __construct(\Psr\Log\LoggerInterface $logger, ConfigFactory $configFactory, ResolverInterface $localeResolver, CurrentCustomer $currentCustomer, PayfastHelper $payfastHelper, PaymentHelper $paymentHelper)
 {
     $this->_logger = $logger;
     $pre = __METHOD__ . ' : ';
     $this->_logger->debug($pre . 'bof');
     $this->localeResolver = $localeResolver;
     $this->config = $configFactory->create();
     $this->currentCustomer = $currentCustomer;
     $this->payfastHelper = $payfastHelper;
     $this->paymentHelper = $paymentHelper;
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $this->paymentHelper->getMethodInstance($code);
     }
     $this->_logger->debug($pre . 'eof and this  methods has : ', $this->methods);
 }
開發者ID:PayFast,項目名稱:mod-magento_2,代碼行數:22,代碼來源:PayfastConfigProvider.php

示例11: getManager

 /**
  * Return payment method instance
  *
  * @return ManagerInterface
  */
 protected function getManager()
 {
     if (!$this->_manager) {
         $this->_manager = $this->_managerFactory->create(array('paymentMethod' => $this->_paymentData->getMethodInstance($this->getMethodCode())));
     }
     return $this->_manager;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:12,代碼來源:RecurringPayment.php

示例12: __construct

 /**
  * @param CcConfig $ccConfig
  * @param PaymentHelper $paymentHelper
  * @param array $methodCodes
  */
 public function __construct(CcConfig $ccConfig, PaymentHelper $paymentHelper, array $methodCodes = [])
 {
     $this->ccConfig = $ccConfig;
     foreach ($methodCodes as $code) {
         $this->methods[$code] = $paymentHelper->getMethodInstance($code);
     }
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:CcGenericConfigProvider.php

示例13: getMethodInstance

 /**
  * Retrieve payment method model object
  *
  * @return \Magento\Payment\Model\MethodInterface
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function getMethodInstance()
 {
     if (!$this->hasMethodInstance()) {
         if (!$this->getMethod()) {
             throw new \Magento\Framework\Exception\LocalizedException(__('The payment method you requested is not available.'));
         }
         try {
             $instance = $this->_paymentData->getMethodInstance($this->getMethod());
         } catch (\UnexpectedValueException $e) {
             $instance = $this->_paymentData->getMethodInstance(Method\Substitution::CODE);
         }
         $instance->setInfoInstance($this);
         $this->setMethodInstance($instance);
     }
     return $this->_getData('method_instance');
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:22,代碼來源:Info.php

示例14: __construct

 /**
  * @param Repository $assetRepo
  * @param RequestInterface $request
  * @param UrlInterface $urlBuilder
  * @param LoggerInterface $logger
  * @param PaymentHelper $paymentHelper
  * @param string $methodCode
  */
 public function __construct(Repository $assetRepo, RequestInterface $request, UrlInterface $urlBuilder, LoggerInterface $logger, PaymentHelper $paymentHelper, $methodCode)
 {
     $this->assetRepo = $assetRepo;
     $this->request = $request;
     $this->urlBuilder = $urlBuilder;
     $this->logger = $logger;
     $this->methodCode = $methodCode;
     $this->method = $paymentHelper->getMethodInstance($methodCode);
 }
開發者ID:kid17,項目名稱:magento2,代碼行數:17,代碼來源:IframeConfigProvider.php

示例15: __construct

 /**
  * @param PaymentHelper $paymentHelper
  * @param Escaper $escaper
  */
 public function __construct(PaymentHelper $paymentHelper, \Magento\Framework\View\Element\Context $context, \Smart2Pay\GlobalPay\Model\ConfiguredMethodsFactory $configuredMethodsFactory)
 {
     $this->_configuredMethodFactory = $configuredMethodsFactory;
     //$this->escaper = $escaper;
     $this->_request = $context->getRequest();
     $this->_assetRepo = $context->getAssetRepository();
     foreach ($this->methodCodes as $code) {
         $this->methods[$code] = $paymentHelper->getMethodInstance($code);
     }
 }
開發者ID:smart2pay,項目名稱:magento20,代碼行數:14,代碼來源:ConfigProvider.php


注:本文中的Magento\Payment\Helper\Data::getMethodInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。