<?php

$errorOrSuccess = rand(1, 10);

if ($errorOrSuccess <=1) {
    error();
} else {
    success();
}

function error()
{
    header('Content-Type: application/json');
    header('HTTP/1.0 401 Unauthorized');
    $json = [
        'error' => 'not allowed to continue without a valid kiosk header or a valid agent token',
        'errorCode' => 'NO_AGENT_OR_MACHINE',
        'timeStamp' => '2021-08-06T07:58:31.157366997Z'
    ];
    echo json_encode($json);

}

function success()
{
    header('Content-Type: application/json');
    $string = file_get_contents("redeemable-vouchers.json");
    echo $string;

}