bvn verify
This commit is contained in:
@@ -174,6 +174,38 @@ abstract class BaseController extends Controller
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function sendSMS33($smsNumber,$smsMessage){
|
||||||
|
|
||||||
|
$base_url = "https://v3.api.termii.com";
|
||||||
|
$api_key = "TLYsgMTZBeasJHHimcWXG1QPHmjH7FPwnbKwiqTEwGCu6TrK0v13hCn8N6SYZp";
|
||||||
|
|
||||||
|
$curl = curl_init();
|
||||||
|
$data = array("api_key" => $api_key, "to" => $smsNumber, "from" => "digiFi",
|
||||||
|
"sms" => $smsMessage, "type" => "plain", "channel" => "generic" );
|
||||||
|
|
||||||
|
$post_data = json_encode($data);
|
||||||
|
|
||||||
|
curl_setopt_array($curl, array(
|
||||||
|
CURLOPT_URL => $base_url."/api/sms/send",
|
||||||
|
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 => $post_data,
|
||||||
|
CURLOPT_HTTPHEADER => array(
|
||||||
|
"Content-Type: application/json"
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = curl_exec($curl);
|
||||||
|
|
||||||
|
curl_close($curl);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
public function readCustomer($uid){
|
public function readCustomer($uid){
|
||||||
$userUid = trim($uid);
|
$userUid = trim($uid);
|
||||||
$mysql ="SELECT * from customers where uid::text ='".$userUid."'";
|
$mysql ="SELECT * from customers where uid::text ='".$userUid."'";
|
||||||
|
|||||||
@@ -19,6 +19,21 @@ class DigiFiBVN extends BaseController
|
|||||||
$this->request = \Config\Services::request();
|
$this->request = \Config\Services::request();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function verifyOTP($verification_id, $otp): bool{
|
||||||
|
$ret = false;
|
||||||
|
$sqlC = " SELECT * FROM
|
||||||
|
bvn_checks
|
||||||
|
WHERE pin ='".$otp."'
|
||||||
|
AND uid= '".$verification_id."' ";
|
||||||
|
|
||||||
|
$query = $this->db->query($sqlC);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
if ( count($results) > 0 ){
|
||||||
|
|
||||||
|
$ret = true;
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
public function completeBVNVerify(){
|
public function completeBVNVerify(){
|
||||||
|
|
||||||
@@ -27,7 +42,7 @@ class DigiFiBVN extends BaseController
|
|||||||
&& $data['verification_id'] !=''
|
&& $data['verification_id'] !=''
|
||||||
&& $data['otp'] !=''
|
&& $data['otp'] !=''
|
||||||
) {
|
) {
|
||||||
if ( $data['otp'] !='12345'){
|
if ( !$this->verifyOTP($data['verification_id'], $data['otp']) /* $data['otp'] !='12345'*/){
|
||||||
$response = [
|
$response = [
|
||||||
'message' => 'Invalid account or OTP',
|
'message' => 'Invalid account or OTP',
|
||||||
'call_return' => '0',
|
'call_return' => '0',
|
||||||
@@ -111,6 +126,11 @@ class DigiFiBVN extends BaseController
|
|||||||
"last_login"=> "2024-04-26 13:35:19.750027",
|
"last_login"=> "2024-04-26 13:35:19.750027",
|
||||||
"test" => $results,
|
"test" => $results,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//+2347032847884
|
||||||
|
//
|
||||||
|
// sendSMS($smsNumber,$smsMessage)
|
||||||
|
|
||||||
public function startBVNVerify()
|
public function startBVNVerify()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
@@ -118,10 +138,24 @@ class DigiFiBVN extends BaseController
|
|||||||
if ($data['bvn'] != '') {
|
if ($data['bvn'] != '') {
|
||||||
|
|
||||||
$bvnData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/bvn", json_encode($data));
|
$bvnData = $this->APIcall("POST", "http://10.10.10.48:6332/api/verify/bvn", json_encode($data));
|
||||||
|
// send SMS HERE
|
||||||
|
$pin = rand(10000, 99999);
|
||||||
|
|
||||||
|
$smsSend = $this->sendSMS("2347032847884", "This is your pin number ". $pin);
|
||||||
|
//+2347032847884
|
||||||
|
//
|
||||||
|
// sendSMS($smsNumber,$smsMessage)
|
||||||
|
|
||||||
|
/*
|
||||||
|
SMS API PORTAL
|
||||||
|
https://accounts.termii.com/#/
|
||||||
|
Email - mdigifi@gmail.com
|
||||||
|
Password - Clust@r24
|
||||||
|
*/
|
||||||
|
|
||||||
$udata = [
|
$udata = [
|
||||||
'bvn' => $data['bvn']
|
'bvn' => $data['bvn'],
|
||||||
|
'pin' => $pin
|
||||||
];
|
];
|
||||||
$addedData = $this->insert_db('bvn_checks',$udata);
|
$addedData = $this->insert_db('bvn_checks',$udata);
|
||||||
|
|
||||||
@@ -135,6 +169,8 @@ class DigiFiBVN extends BaseController
|
|||||||
return $this->fail($response, 500);
|
return $this->fail($response, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$workingUID = $addedData["uid"];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*| Type | Collation | Nullable | Default
|
*| Type | Collation | Nullable | Default
|
||||||
-------------+-----------------------------+-----------+----------+----------------------------------------
|
-------------+-----------------------------+-----------+----------+----------------------------------------
|
||||||
@@ -176,12 +212,23 @@ Indexes:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sqlUpdate = "UPDATE bvn_checks SET firstname ='$firstname', lastname='$lastname', middlename='$middlename' , phone='$phone' , birthdate='$birthdate' , gender='$gender' , nationality='$nationality' WHERE bvn = '$bvn' ";
|
$sqlUpdate = "UPDATE bvn_checks
|
||||||
|
SET firstname ='$firstname',
|
||||||
|
lastname='$lastname',
|
||||||
|
middlename='$middlename' ,
|
||||||
|
phone='$phone' ,
|
||||||
|
birthdate='$birthdate' ,
|
||||||
|
gender='$gender' ,
|
||||||
|
nationality='$nationality'
|
||||||
|
WHERE bvn = '$bvn'
|
||||||
|
AND uid::text = '".$workingUID."' ";
|
||||||
|
log_message('critical', "BVN UPDATE URL FINAL => ".$sqlUpdate );
|
||||||
$query = $this->db->query($sqlUpdate);
|
$query = $this->db->query($sqlUpdate);
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
'message' => 'Verification text sent to user',
|
'message' => 'Verification text sent to user',
|
||||||
'call_return' => '100',
|
'call_return' => '100',
|
||||||
|
'sms_send' => $smsSend,
|
||||||
'verification_id' => $addedData["uid"],
|
'verification_id' => $addedData["uid"],
|
||||||
'status' => $bvnData["res"]["status"],
|
'status' => $bvnData["res"]["status"],
|
||||||
'test_bvn' => $bvnData["res"]["data"]
|
'test_bvn' => $bvnData["res"]["data"]
|
||||||
|
|||||||
Reference in New Issue
Block a user