<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");

include_once '../database.php';
include_once '../customers.php';

$database = new Database();
$db = $database->getConnection();
$item = new Customers($db);

$item->id = isset($_GET['id']) ? $_GET['id'] : die();

if($item->redeemPoints()){
    echo json_encode(['status'=>'success','message'=>"Points has been reedeem"]);
} else{
    echo json_encode(['status'=>'error','message'=>"Points has not been reedeem"]);
}
?>