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


PHP SessionManagerInterface::getCustomerId方法代码示例

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


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

示例1: getConfig

 /**
  * Retrieve assoc array of checkout configuration
  *
  * @return array
  */
 public function getConfig()
 {
     $vaultPayments = [];
     $customerId = $this->session->getCustomerId();
     if (!$customerId) {
         return $vaultPayments;
     }
     $storeId = $this->storeManager->getStore()->getId();
     if (!$this->vaultPayment->isActive($storeId)) {
         return $vaultPayments;
     }
     $vaultProviderCode = $this->vaultPayment->getProviderCode($storeId);
     $componentProvider = $this->getComponentProvider($vaultProviderCode);
     if (null === $componentProvider) {
         return $vaultPayments;
     }
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::CUSTOMER_ID)->setValue($customerId)->create();
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::IS_VISIBLE)->setValue(1)->create();
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::PAYMENT_METHOD_CODE)->setValue($vaultProviderCode)->create();
     $searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)->create();
     foreach ($this->paymentTokenRepository->getList($searchCriteria)->getItems() as $index => $token) {
         $component = $componentProvider->getComponentForToken($token);
         $vaultPayments[VaultPaymentInterface::CODE . '_item_' . $index] = ['config' => $component->getConfig(), 'component' => $component->getName()];
     }
     return ['payment' => [VaultPaymentInterface::CODE => $vaultPayments]];
 }
开发者ID:uibar,项目名称:lavinia2,代码行数:31,代码来源:TokensConfigProvider.php

示例2: getConfig

 /**
  * Retrieve assoc array of checkout configuration
  *
  * @return array
  */
 public function getConfig()
 {
     $availableMethods = [];
     $vaultPayments = $this->getVaultPaymentMethodList();
     $customerId = $this->session->getCustomerId();
     $storeId = $this->storeManager->getStore()->getId();
     foreach ($vaultPayments as $method) {
         $availableMethods[$method->getCode()] = ['is_enabled' => $customerId !== null && $method->isActive($storeId)];
     }
     return [self::$vaultCode => $availableMethods];
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:VaultConfigProvider.php

示例3: execute

 /**
  * @inheritdoc
  */
 public function execute()
 {
     $response = $this->resultFactory->create(ResultFactory::TYPE_JSON);
     try {
         $publicHash = $this->getRequest()->getParam('public_hash');
         $customerId = $this->session->getCustomerId();
         $result = $this->command->execute(['public_hash' => $publicHash, 'customer_id' => $customerId])->get();
         $response->setData(['paymentMethodNonce' => $result['paymentMethodNonce']]);
     } catch (\Exception $e) {
         $this->logger->critical($e);
         return $this->processBadRequest($response);
     }
     return $response;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:17,代码来源:GetNonce.php

示例4: getTokensComponents

 /**
  * @param string $vaultPaymentCode
  * @return TokenUiComponentInterface[]
  */
 public function getTokensComponents($vaultPaymentCode)
 {
     $result = [];
     $customerId = $this->session->getCustomerId();
     if (!$customerId) {
         return $result;
     }
     $vaultPayment = $this->getVaultPayment($vaultPaymentCode);
     if ($vaultPayment === null) {
         return $result;
     }
     $vaultProviderCode = $vaultPayment->getProviderCode();
     $componentProvider = $this->getComponentProvider($vaultProviderCode);
     if ($componentProvider === null) {
         return $result;
     }
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::CUSTOMER_ID)->setValue($customerId)->create();
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::PAYMENT_METHOD_CODE)->setValue($vaultProviderCode)->create();
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::IS_ACTIVE)->setValue(1)->create();
     $filters[] = $this->filterBuilder->setField(PaymentTokenInterface::EXPIRES_AT)->setConditionType('gt')->setValue($this->dateTimeFactory->create('now', new \DateTimeZone('UTC'))->format('Y-m-d 00:00:00'))->create();
     $searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)->create();
     foreach ($this->paymentTokenRepository->getList($searchCriteria)->getItems() as $token) {
         $result[] = $componentProvider->getComponentForToken($token);
     }
     return $result;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:30,代码来源:TokensConfigProvider.php

示例5: getConfig

 /**
  * Retrieve assoc array of checkout configuration
  *
  * @return array
  */
 public function getConfig()
 {
     $storeId = $this->storeManager->getStore()->getId();
     $customerId = $this->session->getCustomerId();
     return [VaultPaymentInterface::CODE => ['vault_provider_code' => $this->vault->getProviderCode($storeId), 'is_enabled' => $customerId !== null && $this->vault->isActive($storeId)]];
 }
开发者ID:rafaelstz,项目名称:magento2,代码行数:11,代码来源:VaultConfigProvider.php


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