Merge branch 'louie-kyc' of https://code.obanana.io/Obanana.Corporation/obananapay_admin into louie-kyc
This commit is contained in:
commit
833d35ad50
|
@ -207,7 +207,7 @@ function get_kyc_info($IDkyc)
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reject_kyc($IDkyc, $IDuser)
|
function reject_kyc($IDkyc, $IDuser, $reason)
|
||||||
{
|
{
|
||||||
// First cURL request to reject KYC
|
// First cURL request to reject KYC
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
@ -254,11 +254,39 @@ function reject_kyc($IDkyc, $IDuser)
|
||||||
$response2 = curl_exec($curl2);
|
$response2 = curl_exec($curl2);
|
||||||
curl_close($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 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();
|
$curl = curl_init();
|
||||||
$url = "https://testapi.obpay.online/api/kycs/update/$IDkyc";
|
$url = "https://testapi.obpay.online/api/kycs/update/$IDkyc";
|
||||||
|
@ -301,7 +329,35 @@ function accept_kyc($IDkyc, $IDuser)
|
||||||
$response2 = curl_exec($curl2);
|
$response2 = curl_exec($curl2);
|
||||||
curl_close($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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<fieldset disabled>
|
<fieldset disabled>
|
||||||
<form>
|
<form>
|
||||||
<label for="email">USER ID:</label>
|
<label for="IdUser">USER ID:</label>
|
||||||
<input class="form-control" type="text" id="email" name="kycID" value="<?php echo $array['userRef']['_id']; ?>" readonly>
|
<input class="form-control" type="text" id="IdUser" name="kycID" value="<?php echo $array['userRef']['_id']; ?>" readonly>
|
||||||
|
|
||||||
<label for="fullName">Full Name:</label>
|
<label for="fullName">Full Name:</label>
|
||||||
<input class="form-control" type="text" id="fullName" name="fullName" value="<?php echo $array['userRef']['fName'] . ' ' . $array['userRef']['lName']; ?>" readonly>
|
<input class="form-control" type="text" id="fullName" name="fullName" value="<?php echo $array['userRef']['fName'] . ' ' . $array['userRef']['lName']; ?>" readonly>
|
||||||
|
@ -93,8 +93,8 @@
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<form>
|
<form>
|
||||||
<fieldset disabled>
|
<fieldset disabled>
|
||||||
<label for="email">KYC ID</label>
|
<label for="KycIdUser">KYC ID</label>
|
||||||
<input class="form-control" type="text" id="email" name="kycID" value="<?php echo $array['_id']; ?>" readonly>
|
<input class="form-control" type="text" id="KycIdUser" name="kycID" value="<?php echo $array['_id']; ?>" readonly>
|
||||||
<label for="additionalFullName">Full Name:</label>
|
<label for="additionalFullName">Full Name:</label>
|
||||||
<input class="form-control" type="text" id="additionalFullName" name="additionalFullName" value="<?php echo $array['full_name']; ?>" readonly>
|
<input class="form-control" type="text" id="additionalFullName" name="additionalFullName" value="<?php echo $array['full_name']; ?>" readonly>
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ if (isset($_GET['kycID'], $_GET['userID'], $_GET['isAccepted'])) {
|
||||||
$reason = $_GET['reason'];
|
$reason = $_GET['reason'];
|
||||||
|
|
||||||
if ($isAccepted) {
|
if ($isAccepted) {
|
||||||
|
$reason = 'Congratulations, Your KYC got accepted!!';
|
||||||
// If isAccepted is true, call accept_kyc function
|
// 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
|
// If accept_kyc is successful, redirect to users-kyc.php
|
||||||
header('Location: users-kyc.php');
|
header('Location: users-kyc.php');
|
||||||
exit();
|
exit();
|
||||||
|
@ -22,7 +23,7 @@ if (isset($_GET['kycID'], $_GET['userID'], $_GET['isAccepted'])) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If isAccepted is false, call reject_kyc function
|
// 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
|
// If reject_kyc is successful, redirect to users-kyc.php
|
||||||
header('Location: users-kyc.php');
|
header('Location: users-kyc.php');
|
||||||
exit();
|
exit();
|
||||||
|
|
Loading…
Reference in New Issue