Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
CustomerTokenManagement Class Reference

Public Member Functions

 __construct (PaymentTokenManagement $tokenManagement, Session $session)
 
 getCustomerSessionTokens ()
 

Detailed Description

Definition at line 11 of file CustomerTokenManagement.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( PaymentTokenManagement  $tokenManagement,
Session  $session 
)

CustomerTokenManagement constructor.

Parameters
PaymentTokenManagement$tokenManagement
Session$session

Definition at line 28 of file CustomerTokenManagement.php.

31  {
32  $this->tokenManagement = $tokenManagement;
33  $this->session = $session;
34  }

Member Function Documentation

◆ getCustomerSessionTokens()

getCustomerSessionTokens ( )

Returns list of payment tokens for current customer session

Returns
PaymentTokenInterface[]

Definition at line 41 of file CustomerTokenManagement.php.

42  {
43  $customerId = $this->session->getCustomerId();
44  if (!$customerId || $this->session->isLoggedIn() === false) {
45  return [];
46  }
47 
48  return $this->tokenManagement->getVisibleAvailableTokens($customerId);
49  }

The documentation for this class was generated from the following file: