Routes
This commit is contained in:
@@ -11,4 +11,12 @@ $routes->get('/', 'Home::index');
|
|||||||
$routes->post('/digibko/v1/identity/token', 'DigiFiAuth::startBkoToken');
|
$routes->post('/digibko/v1/identity/token', 'DigiFiAuth::startBkoToken');
|
||||||
|
|
||||||
|
|
||||||
$routes->post('/digiusers/v1/identity/otoken', 'DigiFiAuth::starttoken');
|
$routes->post('/digiusers/v1/bvn', 'DigiFiBVN::startBVNVerify');
|
||||||
|
$routes->post('/digiusers/v1/bvn/verify', 'DigiFiBVN::completeBVNVerify');
|
||||||
|
|
||||||
|
$routes->post('/digiusers/v1/dash', 'Users::userDash');
|
||||||
|
|
||||||
|
$routes->post('/digiusers/v1/loan/apply', 'Loan::loanApply');
|
||||||
|
$routes->post('/digiusers/v1/loan/loanlist', 'Loan::loanlist');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class DigiFiAuth extends BaseController
|
|||||||
$payload = array(
|
$payload = array(
|
||||||
"iss" => "Issuer of the JWT",
|
"iss" => "Issuer of the JWT",
|
||||||
"aud" => "Audience that the JWT",
|
"aud" => "Audience that the JWT",
|
||||||
"sub" => "Subject of the JWT",
|
"sub" => "Backoffice VerifiedT",
|
||||||
"iat" => $iat, //Time the JWT issued at
|
"iat" => $iat, //Time the JWT issued at
|
||||||
"exp" => $exp, // Expiration time of token
|
"exp" => $exp, // Expiration time of token
|
||||||
"user_detail" =>$final_out,
|
"user_detail" =>$final_out,
|
||||||
@@ -44,6 +44,8 @@ class DigiFiAuth extends BaseController
|
|||||||
$response = [
|
$response = [
|
||||||
'message' => 'Login was successful',
|
'message' => 'Login was successful',
|
||||||
'call_return' => '100',
|
'call_return' => '100',
|
||||||
|
'name' => 'didiFy Admin',
|
||||||
|
'username' => $data['username'],
|
||||||
'token' => $token
|
'token' => $token
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -57,10 +59,5 @@ class DigiFiAuth extends BaseController
|
|||||||
];
|
];
|
||||||
return $this->fail($response , 409);
|
return $this->fail($response , 409);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//return json_encode( $response );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
use Firebase\JWT\JWT;
|
||||||
|
|
||||||
|
class DigiFiBVN extends BaseController
|
||||||
|
{
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
var $request;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->request = \Config\Services::request();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function completeBVNVerify(){
|
||||||
|
|
||||||
|
return $this->respond([], 200);
|
||||||
|
}
|
||||||
|
public function startBVNVerify()
|
||||||
|
{
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
|
if ($data['bvn'] != '') {
|
||||||
|
|
||||||
|
$final_out = $data;
|
||||||
|
|
||||||
|
$key = getenv('JWT_SECRET');
|
||||||
|
$iat = time(); // current timestamp value
|
||||||
|
$exp = $iat + 3600;
|
||||||
|
|
||||||
|
$payload = array(
|
||||||
|
"iss" => "Issuer of the JWT",
|
||||||
|
"aud" => "Audience that the JWT",
|
||||||
|
"sub" => "Subject of the JWT",
|
||||||
|
"iat" => $iat, //Time the JWT issued at
|
||||||
|
"exp" => $exp, // Expiration time of token
|
||||||
|
"user_detail" => $final_out,
|
||||||
|
);
|
||||||
|
|
||||||
|
$token = JWT::encode($payload, $key, 'HS256');
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'message' => 'Verification text sent to user',
|
||||||
|
'call_return' => '100',
|
||||||
|
'verification_id' => 'e99c9c7555c97807b86b750cfe6323d15b2b09e561022205dc679534825f2acf'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->respond($response, 200);
|
||||||
|
} else {
|
||||||
|
$response = [
|
||||||
|
'message' => 'Login failed',
|
||||||
|
'call_return' => '100',
|
||||||
|
'token' => ''
|
||||||
|
];
|
||||||
|
return $this->fail($response, 409);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//return json_encode( $response );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
class Loan extends BaseController
|
||||||
|
{
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
var $request;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->request = \Config\Services::request();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loanApply(){
|
||||||
|
|
||||||
|
return $this->respond([], 200);
|
||||||
|
}
|
||||||
|
public function loanlist(){
|
||||||
|
|
||||||
|
return $this->respond([], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
|
||||||
|
class Users extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
use ResponseTrait;
|
||||||
|
|
||||||
|
var $request;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->request = \Config\Services::request();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function userDash(){
|
||||||
|
|
||||||
|
return $this->respond([], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user