<?php
/**
 *                       ######
 *                       ######
 * ############    ####( ######  #####. ######  ############   ############
 * #############  #####( ######  #####. ######  #############  #############
 *        ######  #####( ######  #####. ######  #####  ######  #####  ######
 * ###### ######  #####( ######  #####. ######  #####  #####   #####  ######
 * ###### ######  #####( ######  #####. ######  #####          #####  ######
 * #############  #############  #############  #############  #####  ######
 *  ############   ############  #############   ############  #####  ######
 *                                      ######
 *                               #############
 *                               ############
 *
 * Adyen Payment module (https://www.adyen.com/)
 *
 * Copyright (c) 2018 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>
        <?php if ($_isDemoMode): ?>
            <?= $block->escapeHtml(__('Adyen PSP Reference: ')); ?>
            <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: ?>
            <?= $block->escapeHtml(__('Adyen PSP Reference: ')); ?>
            <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 ($_info->getAdditionalInformation('adyen_total_fraud_score') != ""): ?>
    <?= $block->escapeHtml(
        __('Total fraud score: %1', $_info->getAdditionalInformation('adyen_total_fraud_score'))
    ); ?><br/>
<?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()); ?>
<style>
    table.terminal-api-receipt {
        margin-top: 10px
    }

    td.terminal-api-receipt-name {
        padding: inherit;
        font-weight: 700
    }

    td.terminal-api-receipt-value {
        padding: inherit;
    }

    tr.terminal-api-receipt {
        padding-bottom: 5px;
    }
</style>
<?= $block->escapeHtml($block->getMethod()->getInfoInstance()->getAdditionalInformation('receipt')); ?>
