customer creation
This commit is contained in:
@@ -24,9 +24,28 @@ class DigiFiBVN extends BaseController
|
|||||||
|
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
if ($data['bvn'] != '' && $data['verification_id'] !='' && $data['otp'] !='') {
|
if ($data['bvn'] != '' && $data['verification_id'] !='' && $data['otp'] !='') {
|
||||||
|
$customer = [];
|
||||||
|
// we need OTP verified here to continue
|
||||||
|
|
||||||
|
$sqlC = "SELECT * FROM bvn_checks WHERE bvn ='".$data['bvn']."' AND uid='".$data['verification_id']."'";
|
||||||
|
$query = $this->db->query($sqlC);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
if ( count($results) > 0 ){
|
||||||
|
$sqlM = "SELECT * FROM customers WHERE bvn = '".$data['bvn']."' ";
|
||||||
|
$qu0 = $this->db->query($sqlM);
|
||||||
|
$customer = $qu0->getResultArray();
|
||||||
|
if ( count( $customer) == 0 ){
|
||||||
|
// lets create this USER
|
||||||
|
$udata = [
|
||||||
|
'bvn' => $data['bvn'],
|
||||||
|
'firstname' =>'firstname-'.rand(1,1000),
|
||||||
|
'lastname' => 'lastname-'.rand(1,1000)
|
||||||
|
];
|
||||||
|
$customer = $this->insert_db('customers',$udata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$final_out = $data;
|
$final_out = $data;
|
||||||
|
|
||||||
$key = getenv('JWT_SECRET');
|
$key = getenv('JWT_SECRET');
|
||||||
$iat = time(); // current timestamp value
|
$iat = time(); // current timestamp value
|
||||||
$exp = $iat + 3600;
|
$exp = $iat + 3600;
|
||||||
@@ -45,10 +64,7 @@ class DigiFiBVN extends BaseController
|
|||||||
$response = [
|
$response = [
|
||||||
'message' => 'Account Verified',
|
'message' => 'Account Verified',
|
||||||
'call_return' => '100',
|
'call_return' => '100',
|
||||||
"uid" => "3119b744-42ad-4834-bb83-b737588754ca",
|
'customer'=> $customer,
|
||||||
"firstname"=>'Firstname',
|
|
||||||
"lastname"=>'lastname',
|
|
||||||
"last_login"=> "2024-04-26 13:35:19.750027",
|
|
||||||
"token" =>$token
|
"token" =>$token
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -62,12 +78,23 @@ class DigiFiBVN extends BaseController
|
|||||||
return $this->fail($response, 409);
|
return $this->fail($response, 409);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
"uid" => "3119b744-42ad-4834-bb83-b737588754ca",
|
||||||
|
"firstname"=>'Firstname',
|
||||||
|
"lastname"=>'lastname',
|
||||||
|
"last_login"=> "2024-04-26 13:35:19.750027",
|
||||||
|
"test" => $results,
|
||||||
|
*/
|
||||||
public function startBVNVerify()
|
public function startBVNVerify()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
if ($data['bvn'] != '') {
|
if ($data['bvn'] != '') {
|
||||||
$addedData = $this->insert_db('bvn_checks',$data);
|
$udata = [
|
||||||
|
'bvn' => $data['bvn']
|
||||||
|
];
|
||||||
|
$addedData = $this->insert_db('bvn_checks',$udata);
|
||||||
|
|
||||||
if( $addedData["uid"] ==''){
|
if( $addedData["uid"] ==''){
|
||||||
$response = [
|
$response = [
|
||||||
|
|||||||
Reference in New Issue
Block a user