getting ready for voucher selling only

This commit is contained in:
Ibnu Maksum 2024-08-08 14:44:27 +07:00
parent bbed893759
commit ce7d8859b0
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -28,7 +28,6 @@ class Package
$inv = ""; $inv = "";
$isVoucher = false; $isVoucher = false;
$c = []; $c = [];
if ($trx && $trx['status'] == 2) { if ($trx && $trx['status'] == 2) {
// if its already paid, return it // if its already paid, return it
return; return;
@ -277,25 +276,28 @@ class Package
} }
} }
//} //}
// if started with voucher, don't insert into tbl_user_recharges
$b->customer_id = $id_customer; // this is not necessary, but in case a bug come
$b->username = $c['username']; if(strlen($p['device'])>7 && substr($p['device'], 0 , 7) != 'Voucher'){
$b->plan_id = $plan_id; $b->customer_id = $id_customer;
$b->namebp = $p['name_plan']; $b->username = $c['username'];
$b->recharged_on = $date_only; $b->plan_id = $plan_id;
$b->recharged_time = $time_only; $b->namebp = $p['name_plan'];
$b->expiration = $date_exp; $b->recharged_on = $date_only;
$b->time = $time; $b->recharged_time = $time_only;
$b->status = "on"; $b->expiration = $date_exp;
$b->method = "$gateway - $channel"; $b->time = $time;
$b->routers = $router_name; $b->status = "on";
$b->type = $p['type']; $b->method = "$gateway - $channel";
if ($admin) { $b->routers = $router_name;
$b->admin_id = ($admin['id']) ? $admin['id'] : '0'; $b->type = $p['type'];
} else { if ($admin) {
$b->admin_id = '0'; $b->admin_id = ($admin['id']) ? $admin['id'] : '0';
} else {
$b->admin_id = '0';
}
$b->save();
} }
$b->save();
// insert table transactions // insert table transactions
$t = ORM::for_table('tbl_transactions')->create(); $t = ORM::for_table('tbl_transactions')->create();
@ -383,27 +385,28 @@ class Package
); );
} }
} }
// if started with voucher, don't insert into tbl_user_recharges
$d = ORM::for_table('tbl_user_recharges')->create(); if(strlen($p['device'])>7 && substr($p['device'], 0 , 7) != 'Voucher'){
$d->customer_id = $id_customer; $d = ORM::for_table('tbl_user_recharges')->create();
$d->username = $c['username']; $d->customer_id = $id_customer;
$d->plan_id = $plan_id; $d->username = $c['username'];
$d->namebp = $p['name_plan']; $d->plan_id = $plan_id;
$d->recharged_on = $date_only; $d->namebp = $p['name_plan'];
$d->recharged_time = $time_only; $d->recharged_on = $date_only;
$d->expiration = $date_exp; $d->recharged_time = $time_only;
$d->time = $time; $d->expiration = $date_exp;
$d->status = "on"; $d->time = $time;
$d->method = "$gateway - $channel"; $d->status = "on";
$d->routers = $router_name; $d->method = "$gateway - $channel";
$d->type = $p['type']; $d->routers = $router_name;
if ($admin) { $d->type = $p['type'];
$d->admin_id = ($admin['id']) ? $admin['id'] : '0'; if ($admin) {
} else { $d->admin_id = ($admin['id']) ? $admin['id'] : '0';
$d->admin_id = '0'; } else {
$d->admin_id = '0';
}
$d->save();
} }
$d->save();
// insert table transactions // insert table transactions
$t = ORM::for_table('tbl_transactions')->create(); $t = ORM::for_table('tbl_transactions')->create();
$t->invoice = $inv = "INV-" . Package::_raid(); $t->invoice = $inv = "INV-" . Package::_raid();