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

use Adyen\Payment\Api\Data\OrderPaymentInterface;
use Adyen\Payment\Block\Info\Giftcard;

/**
 * @see \Magento\Payment\Block\Info
 * @var Giftcard $block
 */

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

?>

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

<?php if ($block->getPartialPayments()->getSize() > 1): ?>
    <?= $block->renderPartialPaymentsHtml(); ?>
<?php elseif ($block->getPartialPayments()->getSize() === 1): ?>
    <?php
        /** @var OrderPaymentInterface $payment */
        $payment = $block->getPartialPayments()->getFirstItem();
    ?>
    <div><?= $block->escapeHtml(__('Payment Method: %1', $payment->getPaymentMethod())); ?></div>
    <div>
        <?php if ($_isDemoMode): ?>
            <?= $block->escapeHtml(__('Adyen PSP Reference: ')); ?>
            <a href="https://ca-test.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=<?= $block->escapeHtml(
                $payment->getPspreference()
            ); ?>&txType=Payment" target="_blank"><?= $block->escapeHtml($payment->getPspreference()); ?></a>
        <?php else: ?>
            <?= $block->escapeHtml(__('Adyen PSP Reference: ')); ?>
            <a href="https://ca-live.adyen.com/ca/ca/accounts/showTx.shtml?pspReference=<?= $block->escapeHtml(
                $payment->getPspreference()
            ); ?>&txType=Payment" target="_blank"><?= $block->escapeHtml($payment->getPspreference()); ?></a>
        <?php endif; ?>
    </div>
<?php endif; ?>

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