<?php
/**
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * Adyen Payment module (https://www.adyen.com/)
 *
 * Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
 * See LICENSE.txt for license details.
 *
 * Author: Adyen <magento@adyen.com>
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * @see \Magento\Payment\Block\Info
 */

?>
<?= $block->escapeHtml($block->getMethod()->getTitle()) ?>

<?php
$_info = $block->getInfo();
$_isDemoMode = $block->isDemoMode();
?>

<?php if ($_pspReference = $_info->getAdditionalInformation('pspReference')): ?>
    <div>
        <?= $block->escapeHtml(__('Adyen PSP Reference: ')); ?>
        <?php if ($_isDemoMode): ?>
            <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=<?= $block->escapeHtml(
                $_pspReference
            ); ?>&txType=Payment" target="_blank"><?= $block->escapeHtml($_pspReference); ?></a>
        <?php else: ?>
            <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=<?= $block->escapeHtml(
                $_pspReference
            ); ?>&txType=Payment" target="_blank"><?= $block->escapeHtml($_pspReference); ?></a>
        <?php endif; ?>
    </div>
<?php endif; ?>

<?php if ($_brandCode = $_info->getAdditionalInformation('brand_code')): ?>
    <div><?= $block->escapeHtml(__('Payment Method: %1', $_brandCode)); ?></div>
<?php endif; ?>

<?php if ($_info->getAdditionalInformation('social_security_number') != ""): ?>
    <div>
        <?= $block->escapeHtml(
            __('Social Security Number: %1', $_info->getAdditionalInformation('social_security_number'))
        ); ?>
    </div>
<?php endif; ?>

<?php if ($_info->getAdditionalInformation('boleto_type') != ""): ?>
    <div>
        <?= $block->escapeHtml(__('Boleto Type: %1', $_info->getAdditionalInformation('boleto_type'))); ?>
    </div>
<?php endif; ?>

<?php if ($_info->getAdditionalInformation('firstname') != ""): ?>
    <div>
        <?= $block->escapeHtml(__('Firstname: %1', $_info->getAdditionalInformation('firstname'))); ?>
    </div>
<?php endif; ?>

<?php if ($_info->getAdditionalInformation('lastname') != ""): ?>
    <div>
        <?= $block->escapeHtml(__('Lastname: %1', $_info->getAdditionalInformation('lastname'))); ?>
    </div>
<?php endif; ?>

<?php if (!empty($block->getPaymentActionData('expiresAt'))): ?>
    <div>
        <?= $block->escapeHtml(__('Expiration Date: %1', $block->getPaymentActionData('expiresAt'))); ?>
    </div>
<?php endif; ?>

<?php if ($_info->getAdditionalInformation('dueDate') != ""): ?>
    <div>
        <?= $block->escapeHtml(__('Due Date: %1', $_info->getAdditionalInformation('dueDate'))); ?>
    </div>
<?php endif; ?>

<?php if (!empty($block->getPaymentActionData('downloadUrl'))): ?>
    <div>
        <a target="_blank"
           href="<?= $block->escapeHtml($block->getPaymentActionData('downloadUrl')); ?>"><?= $block->escapeHtml(
               __('PDF Url')
            ); ?></a>
    </div>
<?php endif; ?>

<?php if ($_info->getAdditionalInformation('adyen_total_fraud_score') != ""): ?>
    <div>
        <?= $block->escapeHtml(
            __('Total fraud score: %1', $_info->getAdditionalInformation('adyen_total_fraud_score'))
        ); ?>
    </div>
<?php endif; ?>

<?php if ($_specificInfo = $block->getSpecificInformation()): ?>
    <table class="data-table admin__table-secondary">
        <?php foreach ($_specificInfo as $_label => $_value): ?>
            <tr>
                <th scope="row"><?= $block->escapeHtml($_label) ?>:</th>
                <td><?= $block->escapeHtml(nl2br(implode("\n", $block->getValueAsArray($_value, true)))); ?></td>
            </tr>
        <?php endforeach; ?>
    </table>
<?php endif; ?>

<?= $block->escapeHtml($block->getChildHtml()); ?>

