Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-vault
Model
Ui
VaultConfigProvider.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Vault\Model\Ui
;
7
8
use
Magento\Checkout\Model\ConfigProviderInterface
;
9
use
Magento\Framework\App\ObjectManager
;
10
use
Magento\Framework\Session\SessionManagerInterface
;
11
use
Magento\Store\Model\StoreManagerInterface
;
12
use
Magento\Vault\Api\PaymentMethodListInterface
;
13
20
class
VaultConfigProvider
implements
ConfigProviderInterface
21
{
22
const
IS_ACTIVE_CODE
=
'is_active_payment_token_enabler'
;
23
27
private
static
$vaultCode =
'vault'
;
28
32
private
$storeManager;
33
37
private
$session;
38
42
private
$vaultPaymentList;
43
49
public
function
__construct
(
50
StoreManagerInterface
$storeManager,
51
SessionManagerInterface
$session
52
) {
53
$this->storeManager =
$storeManager
;
54
$this->session =
$session
;
55
}
56
63
public
function
getConfig
()
64
{
65
$availableMethods = [];
66
$storeId
= $this->storeManager->getStore()->getId();
67
$vaultPayments = $this->getVaultPaymentList()->getActiveList(
$storeId
);
68
$customerId
= $this->session->getCustomerId();
69
70
foreach
($vaultPayments as
$method
) {
71
$availableMethods[
$method
->getCode()] = [
72
'is_enabled'
=>
$customerId
!==
null
&&
$method
->isActive(
$storeId
)
73
];
74
}
75
76
return
[
77
self::$vaultCode => $availableMethods
78
];
79
}
80
86
private
function
getVaultPaymentList()
87
{
88
if
($this->vaultPaymentList ===
null
) {
89
$this->vaultPaymentList =
ObjectManager::getInstance
()->get(PaymentMethodListInterface::class);
90
}
91
return
$this->vaultPaymentList;
92
}
93
}
$storeId
$storeId
Definition:
customer_review_with_rating.php:14
Magento\Framework\App\ObjectManager\getInstance
static getInstance()
Definition:
ObjectManager.php:33
$storeManager
$storeManager
Definition:
paypal_quote.php:14
$session
$session
Definition:
quote_with_configurable_product_last_variation.php:62
Magento\Framework\App\ObjectManager
Definition:
ConfigCache.php:8
Magento\Vault\Model\Ui\VaultConfigProvider
Definition:
VaultConfigProvider.php:20
Magento\Framework\Session\SessionManagerInterface
Definition:
SessionManagerInterface.php:16
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
Magento\Checkout\Model\ConfigProviderInterface
Definition:
ConfigProviderInterface.php:13
$customerId
$customerId
Definition:
quote_with_customer.php:16
Magento\Vault\Api\PaymentMethodListInterface
Definition:
PaymentMethodListInterface.php:16
Magento\Vault\Model\Ui\VaultConfigProvider\__construct
__construct(StoreManagerInterface $storeManager, SessionManagerInterface $session)
Definition:
VaultConfigProvider.php:49
Magento\Vault\Model\Ui
$method
$method
Definition:
info.phtml:13
Magento\Vault\Model\Ui\VaultConfigProvider\IS_ACTIVE_CODE
const IS_ACTIVE_CODE
Definition:
VaultConfigProvider.php:22
Magento\Vault\Model\Ui\VaultConfigProvider\getConfig
getConfig()
Definition:
VaultConfigProvider.php:63