Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TokenUiComponentProvider.php
Go to the documentation of this file.
1 <?php
7 
11 use Magento\Vault\Model\Ui\TokenUiComponentInterfaceFactory;
13 
18 {
22  private $componentFactory;
23 
27  private $urlBuilder;
28 
33  public function __construct(
34  TokenUiComponentInterfaceFactory $componentFactory,
35  UrlInterface $urlBuilder
36  ) {
37  $this->componentFactory = $componentFactory;
38  $this->urlBuilder = $urlBuilder;
39  }
40 
47  {
48  $jsonDetails = json_decode($paymentToken->getTokenDetails() ?: '{}', true);
49  $component = $this->componentFactory->create(
50  [
51  'config' => [
53  'nonceUrl' => $this->getNonceRetrieveUrl(),
56  ],
57  'name' => 'Magento_Braintree/js/view/payment/method-renderer/vault'
58  ]
59  );
60 
61  return $component;
62  }
63 
68  private function getNonceRetrieveUrl()
69  {
70  return $this->urlBuilder->getUrl(ConfigProvider::CODE . '/payment/getnonce', ['_secure' => true]);
71  }
72 }
__construct(TokenUiComponentInterfaceFactory $componentFactory, UrlInterface $urlBuilder)
getComponentForToken(PaymentTokenInterface $paymentToken)