louie-kyc #1

Merged
erwin merged 27 commits from louie-kyc into main 2024-04-19 10:33:46 +08:00
2 changed files with 63 additions and 6 deletions
Showing only changes of commit 5fe21dfb55 - Show all commits

View File

@ -207,7 +207,7 @@ function get_kyc_info($IDkyc)
return $response;
}
function reject_kyc($IDkyc, $IDuser)
function reject_kyc($IDkyc, $IDuser, $reason)
{
// First cURL request to reject KYC
$curl = curl_init();
@ -254,11 +254,39 @@ function reject_kyc($IDkyc, $IDuser)
$response2 = curl_exec($curl2);
curl_close($curl2);
$curl3 = curl_init();
$postfields = '{
"from_id":"6458dd6066139b3fee29a9cf",
"to_id":"' . $IDuser . '",
"title":"KYC Denied!!",
"message":"Your KYC got Rejected because ' . $reason . '.",
"status":"new"
}';
curl_setopt($curl3, CURLOPT_POSTFIELDS, $postfields);
curl_setopt_array($curl3, array(
CURLOPT_URL => 'https://testapi.obpay.online/api/notifications/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MjE1NmU0ZTVhMTUwNjk2MTI3NGYyMCIsImlhdCI6MTY3OTkwNjU2OH0.1hDJwO760_p83FsQQwCduz0PIBBNFnMKYK3RvDqE9dA'
),
));
$response3 = curl_exec($curl3);
curl_close($curl3);
// Return an array containing both responses
return array($response1, $response2);
return array($response1, $response2, $response3);
}
function accept_kyc($IDkyc, $IDuser)
function accept_kyc($IDkyc, $IDuser, $reason)
{
$curl = curl_init();
$url = "https://testapi.obpay.online/api/kycs/update/$IDkyc";
@ -301,7 +329,35 @@ function accept_kyc($IDkyc, $IDuser)
$response2 = curl_exec($curl2);
curl_close($curl2);
return array($response1, $response2);
$curl3 = curl_init();
$postfields = '{
"from_id":"6458dd6066139b3fee29a9cf",
"to_id":"' . $IDuser . '",
"title":"KYC Accepted!!",
"message":"Greetings!! ' . $reason . '.",
"status":"new"
}';
curl_setopt($curl3, CURLOPT_POSTFIELDS, $postfields);
curl_setopt_array($curl3, array(
CURLOPT_URL => 'https://testapi.obpay.online/api/notifications/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MjE1NmU0ZTVhMTUwNjk2MTI3NGYyMCIsImlhdCI6MTY3OTkwNjU2OH0.1hDJwO760_p83FsQQwCduz0PIBBNFnMKYK3RvDqE9dA'
),
));
$response3 = curl_exec($curl3);
curl_close($curl3);
return array($response1, $response2, $response3);
}

View File

@ -12,8 +12,9 @@ if (isset($_GET['kycID'], $_GET['userID'], $_GET['isAccepted'])) {
$reason = $_GET['reason'];
if ($isAccepted) {
$reason = 'Congratulations, Your KYC got accepted!!';
// If isAccepted is true, call accept_kyc function
if (accept_kyc($kycID, $userID)) {
if (accept_kyc($kycID, $userID, $reason)) {
// If accept_kyc is successful, redirect to users-kyc.php
header('Location: users-kyc.php');
exit();
@ -22,7 +23,7 @@ if (isset($_GET['kycID'], $_GET['userID'], $_GET['isAccepted'])) {
}
} else {
// If isAccepted is false, call reject_kyc function
if (reject_kyc($kycID, $userID)) {
if (reject_kyc($kycID, $userID, $reason)) {
// If reject_kyc is successful, redirect to users-kyc.php
header('Location: users-kyc.php');
exit();