2024-03-01 10:28:18 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function validate_user($id, $pwd)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-06 10:18:57 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/users/id/$id";
|
2024-03-01 10:28:18 +08:00
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
curl_setopt_array(
|
|
|
|
$curl,
|
|
|
|
array(
|
2024-03-06 10:18:57 +08:00
|
|
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/id/648058013436143c807101e4',
|
2024-03-01 10:28:18 +08:00
|
|
|
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);
|
|
|
|
$array = json_decode($response, true);
|
|
|
|
if ($array['user']['password'] == $pwd) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function get_user_info($email)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-06 10:18:57 +08:00
|
|
|
//$url = "https://testapi.obpay.online/api/users/id/$email";
|
|
|
|
$url = "https://testapi.obpay.online/api/users/$email";
|
2024-03-01 10:28:18 +08:00
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/egalang@premiummegastructures.com',
|
2024-03-01 10:28:18 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-03-06 10:18:57 +08:00
|
|
|
|
2024-03-01 10:28:18 +08:00
|
|
|
function get_user_info2($email)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-06 10:18:57 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/users/id/$email";
|
2024-03-01 10:28:18 +08:00
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
curl_setopt_array($curl, array(
|
|
|
|
//CURLOPT_URL => 'https://api.obananapay.com/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 activate_account($user_id)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-06 10:18:57 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/users/$user_id/sub";
|
2024-03-01 10:28:18 +08:00
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/645a0c93008258b5e9a2cd20/sub',
|
2024-03-01 10:28:18 +08:00
|
|
|
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 get_transactions()
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/transactions/',
|
2024-03-01 10:28:18 +08:00
|
|
|
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_users()
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/users/',
|
2024-03-01 10:28:18 +08:00
|
|
|
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'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
2024-03-06 10:18:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2024-03-08 13:46:41 +08:00
|
|
|
function get_kyc($bToken)
|
2024-03-06 10:18:57 +08:00
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/kycs/',
|
|
|
|
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(
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-06 10:18:57 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2024-03-08 13:46:41 +08:00
|
|
|
function get_kyc_info($IDkyc, $bToken)
|
2024-03-06 10:18:57 +08:00
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
//$url = "https://testapi.obpay.online/api/users/id/$email";
|
2024-03-07 14:23:47 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/kycs/$IDkyc";
|
2024-03-06 10:18:57 +08:00
|
|
|
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(
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-06 10:18:57 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
2024-03-08 13:46:41 +08:00
|
|
|
function reject_kyc($IDkyc, $IDuser, $reason, $bToken, $Admin_UserId)
|
|
|
|
|
2024-03-06 10:18:57 +08:00
|
|
|
{
|
2024-03-07 14:23:47 +08:00
|
|
|
// First cURL request to reject KYC
|
2024-03-06 10:18:57 +08:00
|
|
|
$curl = curl_init();
|
2024-03-07 14:23:47 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/kycs/update/$IDkyc";
|
2024-03-06 10:18:57 +08:00
|
|
|
curl_setopt_array($curl, array(
|
2024-03-07 14:23:47 +08:00
|
|
|
CURLOPT_URL => $url,
|
2024-03-06 10:18:57 +08:00
|
|
|
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',
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-06 10:18:57 +08:00
|
|
|
),
|
|
|
|
));
|
2024-03-07 14:23:47 +08:00
|
|
|
$response1 = curl_exec($curl);
|
2024-03-06 10:18:57 +08:00
|
|
|
curl_close($curl);
|
2024-03-07 14:23:47 +08:00
|
|
|
|
|
|
|
// Second cURL request to update user's KYC status
|
|
|
|
$response1 = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
|
|
$curl2 = curl_init();
|
|
|
|
$url2 = "https://testapi.obpay.online/api/users/$IDuser/sub";
|
|
|
|
$data = '{"kycStatus":"new", "kycRef":"' . $IDkyc . '"}';
|
|
|
|
curl_setopt_array($curl2, array(
|
|
|
|
CURLOPT_URL => $url2,
|
|
|
|
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 => $data,
|
|
|
|
CURLOPT_HTTPHEADER => array(
|
|
|
|
'Content-Type: application/json',
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-07 14:23:47 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
$response2 = curl_exec($curl2);
|
|
|
|
curl_close($curl2);
|
|
|
|
|
2024-03-07 18:28:59 +08:00
|
|
|
$curl3 = curl_init();
|
|
|
|
$postfields = '{
|
2024-03-08 13:46:41 +08:00
|
|
|
"from_id":"' . $Admin_UserId . '",
|
2024-03-07 18:28:59 +08:00
|
|
|
"to_id":"' . $IDuser . '",
|
2024-03-12 08:57:05 +08:00
|
|
|
"title":"KYC Application Denied.",
|
|
|
|
"message":"Your KYC Application was rejected due to the following reason/s: ' . $reason . '.",
|
2024-03-07 18:28:59 +08:00
|
|
|
"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',
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-07 18:28:59 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response3 = curl_exec($curl3);
|
|
|
|
curl_close($curl3);
|
|
|
|
|
2024-03-07 14:23:47 +08:00
|
|
|
// Return an array containing both responses
|
2024-03-07 18:28:59 +08:00
|
|
|
return array($response1, $response2, $response3);
|
2024-03-06 10:18:57 +08:00
|
|
|
}
|
|
|
|
|
2024-03-08 13:46:41 +08:00
|
|
|
function accept_kyc($IDkyc, $IDuser, $reason, $bToken, $Admin_UserId)
|
2024-03-06 10:18:57 +08:00
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-08 13:46:41 +08:00
|
|
|
|
2024-03-07 14:23:47 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/kycs/update/$IDkyc";
|
2024-03-06 10:18:57 +08:00
|
|
|
curl_setopt_array($curl, array(
|
2024-03-07 14:23:47 +08:00
|
|
|
CURLOPT_URL => $url,
|
2024-03-06 10:18:57 +08:00
|
|
|
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',
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-06 10:18:57 +08:00
|
|
|
),
|
|
|
|
));
|
2024-03-07 14:23:47 +08:00
|
|
|
|
|
|
|
$response1 = curl_exec($curl);
|
2024-03-06 10:18:57 +08:00
|
|
|
curl_close($curl);
|
2024-03-07 14:23:47 +08:00
|
|
|
$curl2 = curl_init();
|
|
|
|
$url2 = "https://testapi.obpay.online/api/users/$IDuser/sub";
|
|
|
|
$data = '{"kycStatus":"validated", "kycRef":"' . $IDkyc . '"}';
|
|
|
|
curl_setopt_array($curl2, array(
|
|
|
|
CURLOPT_URL => $url2,
|
|
|
|
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 => $data,
|
|
|
|
CURLOPT_HTTPHEADER => array(
|
|
|
|
'Content-Type: application/json',
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-07 14:23:47 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
$response2 = curl_exec($curl2);
|
|
|
|
curl_close($curl2);
|
|
|
|
|
2024-03-07 18:28:59 +08:00
|
|
|
$curl3 = curl_init();
|
|
|
|
$postfields = '{
|
2024-03-08 13:46:41 +08:00
|
|
|
"from_id":"' . $Admin_UserId . '",
|
2024-03-07 18:28:59 +08:00
|
|
|
"to_id":"' . $IDuser . '",
|
2024-03-12 08:57:05 +08:00
|
|
|
"title":"KYC Application Accepted.",
|
|
|
|
"message":"Greetings! ' . $reason . '.",
|
2024-03-07 18:28:59 +08:00
|
|
|
"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',
|
2024-03-08 13:46:41 +08:00
|
|
|
'Authorization: Bearer ' . $bToken . ''
|
2024-03-07 18:28:59 +08:00
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response3 = curl_exec($curl3);
|
|
|
|
curl_close($curl3);
|
|
|
|
|
|
|
|
return array($response1, $response2, $response3);
|
2024-03-06 10:18:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
2024-03-01 10:28:18 +08:00
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function user_login($email, $password)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
$postfields = '{"users":"' . $email . '", "password":"' . $password . '"}';
|
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/auth/login',
|
2024-03-01 10:28:18 +08:00
|
|
|
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_POSTFIELDS => '{"users":"webdev@obanana.com", "password":"P@$$w0rd!"}',
|
|
|
|
CURLOPT_HTTPHEADER => array(
|
|
|
|
'Content-Type: application/json'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function user_balance($user_id, $token)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-06 10:18:57 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/users/id/$user_id";
|
2024-03-01 10:28:18 +08:00
|
|
|
$httpheader = "Authorization: Bearer $token";
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, array($httpheader));
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
//CURLOPT_URL => 'https://testapi.obpay.online/api/users/id/6458dd6066139b3fee29a9cf',
|
2024-03-01 10:28:18 +08:00
|
|
|
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 random_string($n)
|
|
|
|
{
|
|
|
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
|
$randomString = '';
|
|
|
|
|
|
|
|
for ($i = 0; $i < $n; $i++) {
|
|
|
|
$index = rand(0, strlen($characters) - 1);
|
|
|
|
$randomString .= $characters[$index];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $randomString;
|
|
|
|
}
|
|
|
|
|
|
|
|
function cash_in($user_id, $amount, $notes, $refno)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
$postfields = '{
|
|
|
|
"from_id":"6458dd6066139b3fee29a9cf",
|
|
|
|
"to_id":"' . $user_id . '",
|
|
|
|
"amount": ' . $amount . ',
|
|
|
|
"type":"cash in",
|
|
|
|
"status":"new",
|
|
|
|
"notes":"' . $notes . '",
|
|
|
|
"ref_no":"' . $refno . '"
|
|
|
|
}';
|
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/transactions/create',
|
2024-03-01 10:28:18 +08:00
|
|
|
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.eyJpZCI6IjY0MjRkOTYyZmNiMWU0ZjgyNDU0NmM4OSIsImlhdCI6MTY4MDEzNzU2NH0.9EHOeaXkYS5mGYG-g-_tgRpw338JzxECLec9cU2zhys'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function cash_out($user_id, $amount, $notes, $refno)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
$postfields = '{
|
|
|
|
"from_id":"' . $user_id . '",
|
|
|
|
"to_id":"6458dd6066139b3fee29a9cf",
|
|
|
|
"amount": ' . $amount . ',
|
|
|
|
"type":"cash in",
|
|
|
|
"status":"new",
|
|
|
|
"notes":"' . $notes . '",
|
|
|
|
"ref_no":"' . $refno . '"
|
|
|
|
}';
|
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/transactions/create',
|
2024-03-01 10:28:18 +08:00
|
|
|
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.eyJpZCI6IjY0MjRkOTYyZmNiMWU0ZjgyNDU0NmM4OSIsImlhdCI6MTY4MDEzNzU2NH0.9EHOeaXkYS5mGYG-g-_tgRpw338JzxECLec9cU2zhys'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function create_notification($to_id, $amount)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
$postfields = '{
|
|
|
|
"from_id":"6458dd6066139b3fee29a9cf",
|
|
|
|
"to_id":"' . $to_id . '",
|
|
|
|
"title":"Cash-In Received",
|
|
|
|
"message":"You have received PHP' . $amount . '.",
|
|
|
|
"status":"new"
|
|
|
|
}
|
|
|
|
';
|
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/notifications/create',
|
2024-03-01 10:28:18 +08:00
|
|
|
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'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function create_notification_co($from_id, $amount)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
$postfields = '{
|
|
|
|
"from_id":"' . $from_id . '",
|
|
|
|
"to_id":"6458dd6066139b3fee29a9cf",
|
|
|
|
"title":"Cash-out completed",
|
|
|
|
"message":"You have sent PHP' . $amount . '.",
|
|
|
|
"status":"new"
|
|
|
|
}
|
|
|
|
';
|
|
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);
|
|
|
|
curl_setopt_array($curl, array(
|
2024-03-06 10:18:57 +08:00
|
|
|
CURLOPT_URL => 'https://testapi.obpay.online/api/notifications/create',
|
2024-03-01 10:28:18 +08:00
|
|
|
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'
|
|
|
|
),
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendSMSotp($phone, $otp)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
|
|
|
$url = "http://124.6.185.87:1688/services/api/messaging/?To=$phone&Message=Your%20One-Time%20PIN%20is%20$otp.%20DO%20NOT%20SHARE%20THIS%20WITH%20ANYONE.%20If%20you%20did%20not%20request%20for%20an%20OTP%2C%20pls%20call%20(02)%208807-6379";
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
curl_setopt_array($curl, array(
|
|
|
|
//CURLOPT_URL => 'http://124.6.185.87:1688/services/api/messaging/?To=09475367847&Message=Your%20One-Time%20PIN%20is%20OgsKLi.%20DO%20NOT%20SHARE%20THIS%20WITH%20ANYONE.%20If%20you%20did%20not%20request%20for%20an%20OTP%2C%20pls%20call%20(02)%208807-6379',
|
|
|
|
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',
|
|
|
|
));
|
|
|
|
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getUserById($id)
|
|
|
|
{
|
|
|
|
$curl = curl_init();
|
2024-03-06 10:18:57 +08:00
|
|
|
$url = "https://testapi.obpay.online/api/users/id/" . $id;
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
2024-03-01 10:28:18 +08:00
|
|
|
curl_setopt_array($curl, array(
|
|
|
|
//CURLOPT_URL => 'https://api.obpay.online/api/users/id/6458dd6066139b3fee29a9cf',
|
|
|
|
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;
|
|
|
|
}
|