Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerTokenManagement.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Vault\Model;
7 
10 
12 {
16  private $tokenManagement;
17 
21  private $session;
22 
28  public function __construct(
29  PaymentTokenManagement $tokenManagement,
30  Session $session
31  ) {
32  $this->tokenManagement = $tokenManagement;
33  $this->session = $session;
34  }
35 
41  public function getCustomerSessionTokens()
42  {
43  $customerId = $this->session->getCustomerId();
44  if (!$customerId || $this->session->isLoggedIn() === false) {
45  return [];
46  }
47 
48  return $this->tokenManagement->getVisibleAvailableTokens($customerId);
49  }
50 }
__construct(PaymentTokenManagement $tokenManagement, Session $session)