Added kyc php files, added functions in function-test
This commit is contained in:
parent
710295fea3
commit
77218b76a8
|
@ -21,7 +21,7 @@ $user_id = $_SESSION['user_id'];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<body class="dt-example dt-example-bootstrap" >
|
<body class="dt-example dt-example-bootstrap">
|
||||||
<nav class="navbar navbar-default">
|
<nav class="navbar navbar-default">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
|
@ -38,6 +38,7 @@ $user_id = $_SESSION['user_id'];
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="active"><a href="#">Transactions</a></li>
|
<li class="active"><a href="#">Transactions</a></li>
|
||||||
<li><a href="/users/users-test.php">Users</a></li>
|
<li><a href="/users/users-test.php">Users</a></li>
|
||||||
|
<li><a href="/users/users-kyc.php">KYC</a></li>
|
||||||
<!-- <li class="dropdown">
|
<!-- <li class="dropdown">
|
||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Loan
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Loan
|
||||||
<span class="caret"></span></a>
|
<span class="caret"></span></a>
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
function validate_user($id, $pwd)
|
function validate_user($id, $pwd)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$url = "172.17.0.3:3000/api/users/id/$id";
|
$url = "https://testapi.obpay.online/api/users/id/$id";
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
curl_setopt_array(
|
curl_setopt_array(
|
||||||
$curl,
|
$curl,
|
||||||
array(
|
array(
|
||||||
//CURLOPT_URL => '172.17.0.3:3000/api/users/id/648058013436143c807101e4',
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/id/648058013436143c807101e4',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -34,11 +34,11 @@ function validate_user($id, $pwd)
|
||||||
function get_user_info($email)
|
function get_user_info($email)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
//$url = "172.17.0.3:3000/api/users/id/$email";
|
//$url = "https://testapi.obpay.online/api/users/id/$email";
|
||||||
$url = "172.17.0.3:3000/api/users/$email";
|
$url = "https://testapi.obpay.online/api/users/$email";
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
//CURLOPT_URL => '172.17.0.3:3000/api/users/egalang@premiummegastructures.com',
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/egalang@premiummegastructures.com',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -57,10 +57,11 @@ function get_user_info($email)
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_user_info2($email)
|
function get_user_info2($email)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$url = "http://172.17.0.3:3000/api/users/id/$email";
|
$url = "https://testapi.obpay.online/api/users/id/$email";
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
//CURLOPT_URL => 'https://api.obananapay.com/api/users/egalang@premiummegastructures.com',
|
//CURLOPT_URL => 'https://api.obananapay.com/api/users/egalang@premiummegastructures.com',
|
||||||
|
@ -85,10 +86,10 @@ function get_user_info2($email)
|
||||||
function activate_account($user_id)
|
function activate_account($user_id)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$url = "172.17.0.3:3000/api/users/$user_id/sub";
|
$url = "https://testapi.obpay.online/api/users/$user_id/sub";
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
//CURLOPT_URL => '172.17.0.3:3000/api/users/645a0c93008258b5e9a2cd20/sub',
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/645a0c93008258b5e9a2cd20/sub',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -112,7 +113,7 @@ function get_transactions()
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/transactions/',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/transactions/',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -136,7 +137,33 @@ function get_users()
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/users/',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/users/',
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MmUzYTIzOTQwNTg5Y2UxM2Q4MjVlOSIsImlhdCI6MTY4MDc1MTI4M30.nk_GgSbyA8WuGYa9DgKJNvCVjl5GLHPAOt2rOujwUxs'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
|
||||||
|
curl_close($curl);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_kyc()
|
||||||
|
{
|
||||||
|
$curl = curl_init();
|
||||||
|
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
CURLOPT_URL => 'https://testapi.obpay.online/api/kycs/',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -155,13 +182,116 @@ function get_users()
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_kyc_info($IDuser)
|
||||||
|
{
|
||||||
|
$curl = curl_init();
|
||||||
|
//$url = "https://testapi.obpay.online/api/users/id/$email";
|
||||||
|
$url = "https://testapi.obpay.online/api/kycs/$IDuser";
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/egalang@premiummegastructures.com',
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MmUzYTIzOTQwNTg5Y2UxM2Q4MjVlOSIsImlhdCI6MTY4MDc1MTI4M30.nk_GgSbyA8WuGYa9DgKJNvCVjl5GLHPAOt2rOujwUxs'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
curl_close($curl);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reject_kyc($IDuser)
|
||||||
|
{
|
||||||
|
$curl = curl_init();
|
||||||
|
$url = "https://testapi.obpay.online/api/kycs/update/$IDuser";
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/645a0c93008258b5e9a2cd20/sub',
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'PATCH',
|
||||||
|
CURLOPT_POSTFIELDS => '{"status":"rejected"}',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MjRkOTYyZmNiMWU0ZjgyNDU0NmM4OSIsImlhdCI6MTY4MDEzNzU2NH0.9EHOeaXkYS5mGYG-g-_tgRpw338JzxECLec9cU2zhys'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
curl_close($curl);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
function accept_kyc($IDuser)
|
||||||
|
{
|
||||||
|
$curl = curl_init();
|
||||||
|
$url = "https://testapi.obpay.online/api/kycs/update/$IDuser";
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/645a0c93008258b5e9a2cd20/sub',
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'PATCH',
|
||||||
|
CURLOPT_POSTFIELDS => '{"status":"validated"}',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MjRkOTYyZmNiMWU0ZjgyNDU0NmM4OSIsImlhdCI6MTY4MDEzNzU2NH0.9EHOeaXkYS5mGYG-g-_tgRpw338JzxECLec9cU2zhys'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
curl_close($curl);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function delete_kyc_info($IDuser)
|
||||||
|
{
|
||||||
|
$curl = curl_init();
|
||||||
|
|
||||||
|
// Append the $refNum to the API URL for deletion
|
||||||
|
$url = "https://testapi.obpay.online/api/kycs/$IDuser/delete";
|
||||||
|
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
CURLOPT_URL => $url,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_ENCODING => '',
|
||||||
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
CURLOPT_TIMEOUT => 0,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
|
CURLOPT_CUSTOMREQUEST => 'DELETE',
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0MmUzYTIzOTQwNTg5Y2UxM2Q4MjVlOSIsImlhdCI6MTY4MDc1MTI4M30.nk_GgSbyA8WuGYa9DgKJNvCVjl5GLHPAOt2rOujwUxs'
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
|
||||||
|
curl_close($curl);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
function user_login($email, $password)
|
function user_login($email, $password)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$postfields = '{"users":"' . $email . '", "password":"' . $password . '"}';
|
$postfields = '{"users":"' . $email . '", "password":"' . $password . '"}';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/auth/login',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/auth/login',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -184,12 +314,12 @@ function user_login($email, $password)
|
||||||
function user_balance($user_id, $token)
|
function user_balance($user_id, $token)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$url = "172.17.0.3:3000/api/users/id/$user_id";
|
$url = "https://testapi.obpay.online/api/users/id/$user_id";
|
||||||
$httpheader = "Authorization: Bearer $token";
|
$httpheader = "Authorization: Bearer $token";
|
||||||
curl_setopt($curl, CURLOPT_URL, $url);
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array($httpheader));
|
curl_setopt($curl, CURLOPT_HTTPHEADER, array($httpheader));
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
//CURLOPT_URL => '172.17.0.3:3000/api/users/id/6458dd6066139b3fee29a9cf',
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/id/6458dd6066139b3fee29a9cf',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -233,7 +363,7 @@ function cash_in($user_id, $amount, $notes, $refno)
|
||||||
}';
|
}';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/transactions/create',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/transactions/create',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -267,7 +397,7 @@ function cash_out($user_id, $amount, $notes, $refno)
|
||||||
}';
|
}';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/transactions/create',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/transactions/create',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -300,7 +430,7 @@ function create_notification($to_id, $amount)
|
||||||
';
|
';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/notifications/create',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/notifications/create',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -333,7 +463,7 @@ function create_notification_co($from_id, $amount)
|
||||||
';
|
';
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.3:3000/api/notifications/create',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/notifications/create',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -378,8 +508,8 @@ function sendSMSotp($phone, $otp)
|
||||||
function getUserById($id)
|
function getUserById($id)
|
||||||
{
|
{
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
$url = "172.17.0.3:3000/api/users/id/".$id;
|
$url = "https://testapi.obpay.online/api/users/id/" . $id;
|
||||||
curl_setopt($curl,CURLOPT_URL,$url);
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
//CURLOPT_URL => 'https://api.obpay.online/api/users/id/6458dd6066139b3fee29a9cf',
|
//CURLOPT_URL => 'https://api.obpay.online/api/users/id/6458dd6066139b3fee29a9cf',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
session_start();
|
session_start();
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$pwd = $_POST['pwd'];
|
$pwd = $_POST['pwd'];
|
||||||
$data = '{ "users":"'.$email.'", "password":"'.$pwd.'" }';
|
$data = '{ "users":"' . $email . '", "password":"' . $pwd . '" }';
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => '172.17.0.4:3000/api/auth/login',
|
CURLOPT_URL => 'https://testapi.obpay.online/api/auth/login',
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
CURLOPT_MAXREDIRS => 10,
|
||||||
|
@ -23,15 +23,15 @@ $response = curl_exec($curl);
|
||||||
|
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
$array = json_decode($response, true);
|
$array = json_decode($response, true);
|
||||||
if($array['token']!=null){
|
if ($array['token'] != null) {
|
||||||
if($array['user']['type']!='admin'){
|
if ($array['user']['type'] != 'admin') {
|
||||||
header("Location: /login/?msg=1");
|
header("Location: /login/?msg=1");
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['token']=$array['token'];
|
$_SESSION['token'] = $array['token'];
|
||||||
$_SESSION['user_id']=$array['user']['_id'];
|
$_SESSION['user_id'] = $array['user']['_id'];
|
||||||
$_SESSION['user_type']=$array['user']['type'];
|
$_SESSION['user_type'] = $array['user']['type'];
|
||||||
header("Location: /admin-test.php".$_SESSION['url']);
|
header("Location: /admin-test.php" . $_SESSION['url']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
header("Location: /login/?msg=2");
|
header("Location: /login/?msg=2");
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
include '../functions-test.php';
|
||||||
|
|
||||||
|
if (isset($_GET['userID'])) {
|
||||||
|
$userID = $_GET['userID'];
|
||||||
|
|
||||||
|
// Delete KYC info
|
||||||
|
$response = delete_kyc_info($userID);
|
||||||
|
|
||||||
|
// Check if deletion was successful
|
||||||
|
if ($response) {
|
||||||
|
// Redirect back to users-kyc.php
|
||||||
|
header("Location: users-kyc.php");
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
// Handle error (if needed)
|
||||||
|
echo "Error deleting KYC info.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle case where userID is not provided
|
||||||
|
echo "Invalid request.";
|
||||||
|
}
|
|
@ -0,0 +1,240 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php include '../header.php'; ?>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
justify-content: space-between;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainContainer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding-left: 10rem;
|
||||||
|
padding-right: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
width: 45%;
|
||||||
|
padding: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section h2 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.image-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 48%;
|
||||||
|
height: auto;
|
||||||
|
max-height: 200px;
|
||||||
|
object-fit: cover;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkboxFormContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-container {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
/* Adjust the margin as needed */
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-label {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-default">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<a class="navbar-brand">Verify KYCs</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="mainContainer">
|
||||||
|
<div class="section form-container">
|
||||||
|
<?php
|
||||||
|
$IDuser = isset($_GET['userID']) ? $_GET['userID'] : '';
|
||||||
|
include '../functions-test.php';
|
||||||
|
$response = get_kyc_info($IDuser);
|
||||||
|
$array = json_decode($response, true);
|
||||||
|
|
||||||
|
// Check if the decoding was successful
|
||||||
|
if ($array !== null) {
|
||||||
|
?>
|
||||||
|
<h2>Selfie</h2>
|
||||||
|
<div class="image-container">
|
||||||
|
<?php
|
||||||
|
// Display selfie image
|
||||||
|
if (!empty($array['selfie'])) {
|
||||||
|
echo '<img src="' . $array['selfie'] . '" alt="Selfie Image">';
|
||||||
|
} else {
|
||||||
|
echo '<p>No selfie available.</p>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<h3>User Information</h3>
|
||||||
|
<div class="form-container">
|
||||||
|
<fieldset disabled>
|
||||||
|
<form>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<label for="email">Email:</label>
|
||||||
|
<input class="form-control" type="text" id="email" name="email" value="<?php echo $array['userRef']['email']; ?>" readonly>
|
||||||
|
|
||||||
|
<label for="additionalStatus">Status:</label>
|
||||||
|
<input class="form-control" type="text" id="additionalStatus" name="additionalStatus" value="<?php echo $array['status']; ?>" readonly>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo 'Failed to decode JSON response.';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section form-container">
|
||||||
|
<h2>Images</h2>
|
||||||
|
<div class="image-container">
|
||||||
|
<?php
|
||||||
|
if (!empty($array['images'])) {
|
||||||
|
foreach ($array['images'] as $image) {
|
||||||
|
echo '<img src="' . $image['link'] . '" alt="KYC Image">';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '<p>No images available.</p>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<h3>KYC Information</h3>
|
||||||
|
<div class="form-container">
|
||||||
|
<form>
|
||||||
|
<fieldset disabled>
|
||||||
|
<label for="additionalFullName">Full Name:</label>
|
||||||
|
<input class="form-control" type="text" id="additionalFullName" name="additionalFullName" value="<?php echo $array['full_name']; ?>" readonly>
|
||||||
|
|
||||||
|
<label for="idNum">ID Number:</label>
|
||||||
|
<input class="form-control" type="text" id="idNum" name="idNum" value="<?php echo $array['id_num']; ?>" readonly>
|
||||||
|
|
||||||
|
<label for="dob">Date of Birth:</label>
|
||||||
|
<input class="form-control" type="text" id="dob" name="dob" value="<?php echo $array['date_of_birth']; ?>" readonly>
|
||||||
|
|
||||||
|
<label for="address">Address:</label>
|
||||||
|
<input class="form-control" type="text" id="address" name="address" value="<?php echo $array['address']; ?>" readonly>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section form-container">
|
||||||
|
<h2>Confirm KYC Details</h2>
|
||||||
|
<div class="checkboxFormContainer">
|
||||||
|
<form id="checkboxForm">
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<label for="checkbox1" class="checkbox-label">Full Name
|
||||||
|
<input type="checkbox" id="checkbox1" name="checkbox1">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<label for="checkbox2" class="checkbox-label">ID Number
|
||||||
|
<input type="checkbox" id="checkbox2" name="checkbox2">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<label for="checkbox3" class="checkbox-label">Date of Birth
|
||||||
|
<input type="checkbox" id="checkbox3" name="checkbox3">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox-container">
|
||||||
|
<label for="checkbox4" class="checkbox-label">Address
|
||||||
|
<input type="checkbox" id="checkbox4" name="checkbox4">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-container">
|
||||||
|
<h3>Change the status?</h3>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-danger" id="rejectButton" onclick="window.location.href='update-kyc.php?userID=<?php echo $IDuser; ?>&isAccepted=false';">Reject</button>
|
||||||
|
<button type="button" class="btn btn-success" id="acceptButton" onclick="handleKycAction('<?php echo $IDuser; ?>', true);" disabled>Accept</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function handleCheckboxChange() {
|
||||||
|
// Check the status of checkboxes and enable/disable the "Accept" button
|
||||||
|
var areAllChecked = document.querySelectorAll('#checkboxForm input[type="checkbox"]:checked').length === 4;
|
||||||
|
document.getElementById('acceptButton').disabled = !areAllChecked;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach the handleCheckboxChange function to each checkbox's onchange event
|
||||||
|
var checkboxes = document.querySelectorAll('#checkboxForm input[type="checkbox"]');
|
||||||
|
checkboxes.forEach(function(checkbox) {
|
||||||
|
checkbox.addEventListener('change', handleCheckboxChange);
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleKycAction(userID, isAccepted) {
|
||||||
|
if (isAccepted) {
|
||||||
|
// Handle the logic for accept
|
||||||
|
// You may call acceptFunction or perform other actions
|
||||||
|
window.location.href = 'update-kyc.php?userID=' + userID + '&isAccepted=true';
|
||||||
|
} else {
|
||||||
|
// Handle the logic for reject
|
||||||
|
// Redirect to update-kyc.php with the additional parameter
|
||||||
|
window.location.href = 'update-kyc.php?userID=' + userID + '&isAccepted=false';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
// 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
|
||||||
|
if (isset($_GET['userID'], $_GET['isAccepted'])) {
|
||||||
|
$userID = $_GET['userID'];
|
||||||
|
$isAccepted = ($_GET['isAccepted'] === 'true');
|
||||||
|
|
||||||
|
// Call the appropriate function based on isAccepted value
|
||||||
|
if ($isAccepted) {
|
||||||
|
// If isAccepted is true, call accept_kyc function
|
||||||
|
if (accept_kyc($userID)) {
|
||||||
|
// 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
|
||||||
|
if (reject_kyc($userID)) {
|
||||||
|
// 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.';
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if (!isset($_SESSION['token'])) {
|
||||||
|
$_SESSION['url'] = "users/";
|
||||||
|
header("Location: /login/");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$user_id = $_SESSION['user_id'];
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<?php include '../header.php'; ?>
|
||||||
|
<script type="text/javascript" class="init">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#example').DataTable({
|
||||||
|
// dom: 'Bfrtip',
|
||||||
|
// buttons: [
|
||||||
|
// 'csv'
|
||||||
|
// ],
|
||||||
|
responsive: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function confirmDelete(userID) {
|
||||||
|
if (confirm("Are you sure you want to delete this KYC record?")) {
|
||||||
|
window.location.href = 'delete-kyc.php?userID=' + userID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<body class="dt-example dt-example-bootstrap">
|
||||||
|
<nav class="navbar navbar-default">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="#">oBananaPay</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="/admin-test.php">Transactions</a></li>
|
||||||
|
<li><a href="users-test.php">Users</a></li>
|
||||||
|
<li class="active"><a href="#">KYC</a></li>
|
||||||
|
<!-- <li class="dropdown">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Loan
|
||||||
|
<span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="/loan/">Applications</a></li>
|
||||||
|
<li><a href="/loan/transfer.php">Batch Transfer</a></li>
|
||||||
|
<li><a href="/loan/payment.php">Payments</a></li>
|
||||||
|
</ul>
|
||||||
|
</li> -->
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a href="/logout.php">Logout <span class="glyphicon glyphicon-log-out" aria-hidden="true"></span></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="container">
|
||||||
|
<h1>Know-Your-Customer</h1>
|
||||||
|
<?php
|
||||||
|
include '../functions-test.php';
|
||||||
|
$response = get_kyc();
|
||||||
|
$array = json_decode($response, true);
|
||||||
|
?>
|
||||||
|
<table id="example" class="table table-bordered display responsive nowrap" style="width:100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width='1'>User ID</th>
|
||||||
|
<th>Reference Number</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Date of Birth</th>
|
||||||
|
<th>ID Number</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th> Action </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ($array as $x => $val) {
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td>" . $val['_id'] . "</td>";
|
||||||
|
echo "<td>" . $val['userRef'] . "</td>";
|
||||||
|
echo "<td>" . $val['full_name'] . "</td>";
|
||||||
|
echo "<td>" . $val['date_of_birth'] . "</td>";
|
||||||
|
echo "<td>" . $val['id_num'] . "</td>";
|
||||||
|
echo "<td>" . $val['status'] . "</td>";
|
||||||
|
echo "<td>" .
|
||||||
|
"<button class='btn btn-info' onclick=location.href='edit-kyc.php?userID=" . $val['_id'] . "'>Edit</button>" .
|
||||||
|
"<button class='btn btn-default' onclick='confirmDelete(\"" . $val['_id'] . "\")'>Delete</button>" .
|
||||||
|
"</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -39,6 +39,7 @@ $user_id = $_SESSION['user_id'];
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a href="/admin-test.php">Transactions</a></li>
|
<li><a href="/admin-test.php">Transactions</a></li>
|
||||||
<li class="active"><a href="#">Users</a></li>
|
<li class="active"><a href="#">Users</a></li>
|
||||||
|
<li><a href="users-kyc.php">KYC</a></li>
|
||||||
<!-- <li class="dropdown">
|
<!-- <li class="dropdown">
|
||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Loan
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Loan
|
||||||
<span class="caret"></span></a>
|
<span class="caret"></span></a>
|
||||||
|
@ -87,8 +88,8 @@ $user_id = $_SESSION['user_id'];
|
||||||
echo "<td>" . $val['type'] . "</td>";
|
echo "<td>" . $val['type'] . "</td>";
|
||||||
echo "<td>" . $val['status'] . "</td>";
|
echo "<td>" . $val['status'] . "</td>";
|
||||||
$json = getUserById($val['_id']);
|
$json = getUserById($val['_id']);
|
||||||
$balance = json_decode($json,true);
|
$balance = json_decode($json, true);
|
||||||
echo "<td>".$balance['balance']."</td>";
|
echo "<td>" . $balance['balance'] . "</td>";
|
||||||
echo "<td>" . substr($val['createdAt'], 0, 10) . "</td>";
|
echo "<td>" . substr($val['createdAt'], 0, 10) . "</td>";
|
||||||
echo "<td>" . substr($val['createdAt'], 11, 8) . "</td>";
|
echo "<td>" . substr($val['createdAt'], 11, 8) . "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
|
Loading…
Reference in New Issue