data save
This commit is contained in:
@@ -10,13 +10,15 @@ $routes->get('/', 'Home::index');
|
|||||||
|
|
||||||
$routes->post('/digibko/v1/identity/token', 'DigiFiAuth::startBkoToken');
|
$routes->post('/digibko/v1/identity/token', 'DigiFiAuth::startBkoToken');
|
||||||
|
|
||||||
|
$routes->get('/digibko/v1/dashboard/bvn/recent', 'DigiFiAuth::startBkoToken');
|
||||||
|
$routes->get('/digibko/v1/applications/pending', 'BkoReports::pendingApplication');
|
||||||
|
|
||||||
$routes->post('/digiusers/v1/bvn', 'DigiFiBVN::startBVNVerify');
|
$routes->post('/digiusers/v1/bvn', 'DigiFiBVN::startBVNVerify');
|
||||||
$routes->post('/digiusers/v1/bvn/verify', 'DigiFiBVN::completeBVNVerify');
|
$routes->post('/digiusers/v1/bvn/verify', 'DigiFiBVN::completeBVNVerify');
|
||||||
|
|
||||||
$routes->post('/digiusers/v1/dash', 'Users::userDash');
|
$routes->get('/digiusers/v1/dash', 'Users::userDash');
|
||||||
|
|
||||||
$routes->post('/digiusers/v1/loan/apply', 'Loan::loanApply');
|
$routes->post('/digiusers/v1/loan/apply', 'Loan::loanApply');
|
||||||
$routes->post('/digiusers/v1/loan/loanlist', 'Loan::loanlist');
|
$routes->get('/digiusers/v1/loan/loanlist', 'Loan::loanlist');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Controllers;
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\API\ResponseTrait;
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use CodeIgniter\HTTP\CLIRequest;
|
use CodeIgniter\HTTP\CLIRequest;
|
||||||
use CodeIgniter\HTTP\IncomingRequest;
|
use CodeIgniter\HTTP\IncomingRequest;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BaseController
|
* Class BaseController
|
||||||
@@ -27,7 +29,7 @@ abstract class BaseController extends Controller
|
|||||||
* @var CLIRequest|IncomingRequest
|
* @var CLIRequest|IncomingRequest
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected $request;
|
||||||
|
use ResponseTrait;
|
||||||
/**
|
/**
|
||||||
* An array of helpers to be loaded automatically upon
|
* An array of helpers to be loaded automatically upon
|
||||||
* class instantiation. These helpers will be available
|
* class instantiation. These helpers will be available
|
||||||
@@ -35,6 +37,8 @@ abstract class BaseController extends Controller
|
|||||||
*
|
*
|
||||||
* @var list<string>
|
* @var list<string>
|
||||||
*/
|
*/
|
||||||
|
protected $db;
|
||||||
|
private $con_name = 'digifi_db'; // 'wrench_blog';
|
||||||
protected $helpers = [];
|
protected $helpers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,5 +58,22 @@ abstract class BaseController extends Controller
|
|||||||
// Preload any models, libraries, etc, here.
|
// Preload any models, libraries, etc, here.
|
||||||
|
|
||||||
// E.g.: $this->session = \Config\Services::session();
|
// E.g.: $this->session = \Config\Services::session();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->db = \Config\Database::connect($this->con_name);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo 'Caught Data Connect Exception ::: ', $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function insert_db($table_name, $insert_data) : array{
|
||||||
|
$row = [];
|
||||||
|
$this->db->table($table_name)->insert($insert_data);
|
||||||
|
|
||||||
|
$query = $this->db->query("SELECT * FROM $table_name ORDER BY id DESC LIMIT 1");
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
// echo $row->name;
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|
||||||
|
class BkoReports extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function pendingApplication() :ResponseInterface
|
||||||
|
{
|
||||||
|
return $this->respond([], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,18 +10,12 @@ use Firebase\JWT\JWT;
|
|||||||
class DigiFiBVN extends BaseController
|
class DigiFiBVN extends BaseController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
protected $db;
|
// protected $db;
|
||||||
public $con_name = 'digifi_db'; // 'wrench_blog';
|
|
||||||
var $request;
|
var $request;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$this->db = \Config\Database::connect($this->con_name);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo 'Caught Data Connect Exception ::: ', $e->getMessage(), "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->request = \Config\Services::request();
|
$this->request = \Config\Services::request();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,14 +67,21 @@ class DigiFiBVN extends BaseController
|
|||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
if ($data['bvn'] != '') {
|
if ($data['bvn'] != '') {
|
||||||
|
$addedData = $this->insert_db('bvn_checks',$data);
|
||||||
|
|
||||||
$sqL = "INSERT INTO bvn_checks(bvn) VALUES('".$data['bvn']."')";
|
if( $addedData["uid"] ==''){
|
||||||
$query = $this->db->query($sqL);
|
$response = [
|
||||||
|
'message' => 'Failure',
|
||||||
|
'call_return' => '100',
|
||||||
|
'token' => ''
|
||||||
|
];
|
||||||
|
return $this->fail($response, 500);
|
||||||
|
}
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
'message' => 'Verification text sent to user',
|
'message' => 'Verification text sent to user',
|
||||||
'call_return' => '100',
|
'call_return' => '100',
|
||||||
'verification_id' => 'e99c9c7555c97807b86b750cfe6323d15b2b09e561022205dc679534825f2acf'
|
'verification_id' => $addedData["uid"],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->respond($response, 200);
|
return $this->respond($response, 200);
|
||||||
|
|||||||
Reference in New Issue
Block a user