obananapay_admin/users/update-kyc.php

45 lines
1.4 KiB
PHP
Raw Normal View History

<?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'];
// 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'];
$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
if ($isAccepted) {
2024-03-12 09:02:44 +08:00
$reason = 'Your KYC Application got approved';
// 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)) {
// 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)) {
// 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.';
}