<?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
/**
 * @var \Adyen\Payment\Block\Info\PaymentMethodInfo $block
 */
?>
<?php $_info = $block->getInfo(); ?>

<dl class="payment-method adyen_hpp">
    <?php if (!empty($block->getBankTransferData())): ?>
        <?php
        $banktranferData = $block->getBankTransferData();
        $order = $block->getOrder();
        ?>

        <dt><?= $block->escapeHtml(__('Pay using Bank transfer')); ?></dt>
        <dd><?= $block->escapeHtml(
            __('Please transfer the amount using the reference below to the following bank account')
            ); ?></dd>

        <?php
        if (!empty($order->getGrandTotal())): ?>
            <dt><?= $block->escapeHtml(__('Amount')); ?></dt>
            <dd><?= /* @noEscape */ $order->formatPrice($order->getGrandTotal()); ?></dd>
        <?php endif; ?>

        <?php if (!empty($banktranferData['bankTransfer.reference'])): ?>
            <dt><?= $block->escapeHtml(__('With reference')); ?></dt>
            <dd><?= $block->escapeHtml($banktranferData['bankTransfer.reference']); ?></dd>
        <?php endif; ?>

        <?php if (!empty($banktranferData['bankTransfer.owner'])): ?>
            <dt><?= $block->escapeHtml(__('Beneficiary Name')); ?></dt>
            <dd><?= $block->escapeHtml($banktranferData['bankTransfer.owner']); ?></dd>
        <?php endif; ?>

        <?php if (!empty($banktranferData['bankTransfer.bankName'])): ?>
            <dt><?= $block->escapeHtml(__('Bank')); ?></dt>
            <dd><?= $block->escapeHtml($banktranferData['bankTransfer.bankName']); ?></dd>
        <?php endif; ?>

        <?php if (!empty($banktranferData['bankTransfer.iban'])): ?>
            <dt><?= $block->escapeHtml(__('IBAN')); ?></dt>
            <dd><?= $block->escapeHtml($banktranferData['bankTransfer.iban']); ?></dd>
        <?php endif; ?>

        <?php if (!empty($banktranferData['bankTransfer.accountCode'])): ?>
            <dt><?= $block->escapeHtml(__('Bankaccount')); ?></dt>
            <dd><?= $block->escapeHtml($banktranferData['bankTransfer.accountCode']); ?></dd>
        <?php endif; ?>
    <?php elseif (!empty($block->getMultibancoData())): ?>
        <?php $multibancoData = $block->getMultibancoData(); ?>
        <dt><?= $block->escapeHtml(__('Pay using Multibanco')); ?></dt>
        <dd><?= $block->escapeHtml(
            __(
                'Please pay with the provided Multibanco reference and entity before payment deadline in order ' .
                'to complete our payment'
            )
            ); ?></dd>

        <?php if (!empty($multibancoData['entity'])): ?>
            <dt><?= $block->escapeHtml(__('Entity')); ?></dt>
            <dd><?= $block->escapeHtml($multibancoData['entity']); ?></dd>
        <?php endif; ?>

        <?php if (!empty($multibancoData['reference'])): ?>
            <dt><?= $block->escapeHtml(__('Reference')); ?></dt>
            <dd><?= $block->escapeHtml($multibancoData['reference']); ?></dd>
        <?php endif; ?>

        <?php if (!empty($multibancoData['expiresAt'])): ?>
            <dt><?= $block->escapeHtml(__('Expires at')); ?></dt>
            <dd><?= $block->escapeHtml($multibancoData['expiresAt']); ?></dd>
        <?php endif; ?>
    <?php else: ?>
        <?php if ($_methodTitle = $_info->getAdditionalInformation('method_title')): ?>
            <dt class="title"><?= $block->escapeHtml($_methodTitle); ?></dt>
        <?php else: ?>
            <dt class="title"><?= $block->escapeHtml($_info->getMethodInstance()->getTitle()) ?></dt>
        <?php endif; ?>
    <?php endif; ?>

    <?php
        if ($block->getPartialPayments()->getSize() > 1) {
            echo $block->renderPartialPaymentsHtml();
        }
    ?>
</dl>
