<?php
use Magento\Vault\Model\Ui\TokenUiComponentProviderInterface;

/**
 * TNW_Stripe extension
 * NOTICE OF LICENSE
 *
 * This source file is subject to the OSL 3.0 License
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/osl-3.0.php
 *
 * @category  TNW
 * @package   TNW_Stripe
 * @copyright Copyright (c) 2017-2018
 * @license   Open Software License (OSL 3.0)
 */

/** @var \Magento\Framework\View\Element\Template $block */
$details = $block->getData(TokenUiComponentProviderInterface::COMPONENT_DETAILS);
$icon = $block->getData('icons')[$details['type']];
$id = $block->escapeHtml($block->getData('id'));
?>
<div data-mage-init='{
        "TNW_Stripe/js/vault": {
            "container": "payment_<?= /* @noEscape */ $id; ?>",
            "publishableKey" : "<?= $block->getData('publishableKey')?>",
            "publicHash": "<?= $block->escapeHtml($block->getData(TokenUiComponentProviderInterface::COMPONENT_PUBLIC_HASH)); ?>",
            "code": "<?= $block->escapeHtml($block->getData('code')); ?>",
            "createUrl": "<?= $block->getUrl('tnw_stripe/paymentintent/create'); ?>"
        }
    }' id="payment_<?= /* @noEscape */ $id;?>" class="admin__field">
  <div class="admin__field-control control">
    <input type="radio" id="token_switcher_<?= /* @noEscape */ $id; ?>" name="payment[token_switcher]"/>
    <img src="<?= $block->escapeUrl($icon['url']); ?>"
         width="<?= $block->escapeHtml($icon['width']); ?>"
         height="<?= $block->escapeHtml($icon['height']); ?>"
         class="payment-icon" >
    <span><?= $block->escapeHtml(__('ending'));?></span>
    <span><?= $block->escapeHtml($details['maskedCC']); ?></span>
    (<span><?= $block->escapeHtml(__('expires'));?></span>:
    <span><?= $block->escapeHtml($details['expirationDate']); ?></span>)
  </div>
</div>
