Initial commit

This commit is contained in:
Kwesi Banson Jnr
2026-04-08 05:53:02 +00:00
commit 592a161ee6
63 changed files with 4105 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use App\Core\Model;
class AirtelBroker extends Model {
protected static $table = 'airtel_money_wallets';
public static function findActive() {
return self::builder()->where('status', 'active')->get();
}
public static function getBroker($wallet_id){
$details = self::builder()->where('id', $wallet_id)->get();
if ($details == false) {
return false;
}
return $details;
}
}
?>

47
app/Models/Auth.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
class Auth {
private $connection;
// private $bearer_token;
public function __construct($db) {
$this->connection = $db;
}
public function read_api_auth(){
// $bearer = $this->bearer_token;
if(!function_exists('getallheaders')){
return false;
}
$headers = [];
foreach (getallheaders() as $name => $value) {
// echo "$name: $value <br>" . PHP_EOL;
$headers[$name] = $value;
}
$check = array_key_exists('Authorization', $headers);
if ($check == false) {
return false;
}
list($type, $bearer_token) = explode(" ", $headers['Authorization'], 2);
$query = 'SELECT id, name FROM auth_users WHERE bearer_token = ? LIMIT 0,1';
$statement = $this->connection->prepare($query);
$statement->bindParam(1, $bearer_token);
$statement->execute();
$row = $statement->fetch(PDO::FETCH_ASSOC);
if ($row == false) {
return false;
}
else{
return true;
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use App\Core\Model;
class Disbursement extends Model {
protected static $table = 'disbursements';
public static function findActive() {
return self::builder()->where('status', 'active')->get();
}
public static function varifyTransaction($transaction_id, $reference_number){
$transaction = self::builder()->where('transaction_id', $transaction_id)
->where('infotech_transaction_id', $reference_number)
->get();
if ($transaction == false) {
// code...
return false;
}
return $transaction;
}
public static function updateTransaction($id, $params){
$transaction = self::builder()->where('transaction_id', $transaction_id)
->where('infotech_transaction_id', $reference_number)
->get();
if ($transaction == false) {
// code...
return false;
}
return $transaction;
}
}
?>

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use App\Core\Model;
class MpambaBroker extends Model {
protected static $table = 'mpamba_tnm_wallets';
public static function findActive() {
return self::builder()->where('status', 'active')->get();
}
public static function getBroker($wallet_id){
$details = self::builder()->where('wallet_id', $wallet_id)->get();
if ($details == false) {
return false;
}
return $details;
}
}
?>

20
app/Models/User.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use App\Core\Model;
class User extends Model {
// Tell the model which database table to use
protected static $table = 'auth_users';
// You can add custom business logic here
public static function findActive() {
return self::builder()->where('status', 'active')->get();
}
public static function getByToken($token) {
return self::builder()->where('bearer_token', $token)->get();
}
}
?>