Recharge with balance or zero cost

This commit is contained in:
Ibnu Maksum
2024-03-12 15:09:00 +07:00
parent 6d15437333
commit c9058769ce
6 changed files with 69 additions and 16 deletions

View File

@ -19,7 +19,7 @@ class Package
*/
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel)
{
global $config, $admin, $c, $p, $b, $t, $d;
global $config, $admin, $c, $p, $b, $t, $d, $zero;
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time_only = date("H:i:s");
@ -31,6 +31,20 @@ class Package
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
if(isset($zero) && $zero==1){
$p['price'] = 0;
}
if(!$p['enabled']){
if(!isset($admin) || !isset($admin['id']) || empty($admin['id'])){
r2(U . 'home', 'e', Lang::T('Plan Not found'));
}
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
r2(U . 'dashboard', 'e', Lang::T('Plan Not found'));
}
}
if ($p['validity_unit'] == 'Period') {
$f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
if (!$f) {

View File

@ -39,9 +39,11 @@ class User
}
}
public static function _info()
public static function _info($id = 0)
{
$id = User::getID();
if(!$id){
$id = User::getID();
}
$d = ORM::for_table('tbl_customers')->find_one($id);
if(empty($d['username'])){