2024-03-06 10:18:57 +08:00
|
|
|
<?php
|
2024-03-08 13:46:41 +08:00
|
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['token'])) {
|
|
|
|
$_SESSION['url'] = "users/";
|
|
|
|
header("Location: /login/");
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
$user_id = $_SESSION['user_id'];
|
2024-03-06 10:18:57 +08:00
|
|
|
// update-kyc.php
|
|
|
|
|
|
|
|
// Include functions-test.php
|
|
|
|
include '../functions-test.php';
|
|
|
|
|
|
|
|
// Check if the user ID and isAccepted parameters are set in the URL parameters
|
2024-03-07 14:23:47 +08:00
|
|
|
if (isset($_GET['kycID'], $_GET['userID'], $_GET['isAccepted'])) {
|
|
|
|
$kycID = $_GET['kycID'];
|
2024-03-06 10:18:57 +08:00
|
|
|
$userID = $_GET['userID'];
|
|
|
|
$isAccepted = ($_GET['isAccepted'] === 'true');
|
2024-03-07 16:45:33 +08:00
|
|
|
$reason = $_GET['reason'];
|
2024-03-08 13:46:41 +08:00
|
|
|
$BearerToken = $_SESSION['token'];
|
2024-03-07 16:45:33 +08:00
|
|
|
|
2024-03-06 10:18:57 +08:00
|
|
|
if ($isAccepted) {
|
2024-03-08 17:16:37 +08:00
|
|
|
$reason = 'Congratulations, Your KYC got accepted !!';
|
2024-03-06 10:18:57 +08:00
|
|
|
// If isAccepted is true, call accept_kyc function
|
2024-03-08 13:46:41 +08:00
|
|
|
if (accept_kyc($kycID, $userID, $reason, $BearerToken, $user_id)) {
|
2024-03-06 10:18:57 +08:00
|
|
|
// If accept_kyc is successful, redirect to users-kyc.php
|
|
|
|
header('Location: users-kyc.php');
|
|
|
|
exit();
|
|
|
|
} else {
|
|
|
|
echo 'Failed to accept KYC.';
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// If isAccepted is false, call reject_kyc function
|
2024-03-08 13:46:41 +08:00
|
|
|
if (reject_kyc($kycID, $userID, $reason, $BearerToken, $user_id)) {
|
2024-03-06 10:18:57 +08:00
|
|
|
// If reject_kyc is successful, redirect to users-kyc.php
|
|
|
|
header('Location: users-kyc.php');
|
|
|
|
exit();
|
|
|
|
} else {
|
|
|
|
echo 'Failed to reject KYC.';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
echo 'Invalid parameters.';
|
|
|
|
}
|