<?php
session_start();

/*
|--------------------------------------------------------------------------
| AJAX REQUEST HANDLER
|--------------------------------------------------------------------------
*/
if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    header('Content-Type: application/json');

    $valid_code = "67584";
    $entered_code = trim($_POST['card_last5'] ?? '');

    if ($entered_code === $valid_code) {

        echo json_encode([
            "status" => "success",
            "message" => "Verification successful"
        ]);
        exit;

    } else {

        echo json_encode([
            "status" => "error",
            "message" => "Invalid debit card code. Please try again. kindly contact your Account Officer for assistance and technical support.
We appreciate your patience and understanding.

Thank you for banking with us."
        ]);
        exit;
    }
}
?>