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,7 +276,9 @@ class Package
} }
} }
//} //}
// if started with voucher, don't insert into tbl_user_recharges
// this is not necessary, but in case a bug come
if(strlen($p['device'])>7 && substr($p['device'], 0 , 7) != 'Voucher'){
$b->customer_id = $id_customer; $b->customer_id = $id_customer;
$b->username = $c['username']; $b->username = $c['username'];
$b->plan_id = $plan_id; $b->plan_id = $plan_id;
@ -296,6 +297,7 @@ class Package
$b->admin_id = '0'; $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,7 +385,8 @@ class Package
); );
} }
} }
// if started with voucher, don't insert into tbl_user_recharges
if(strlen($p['device'])>7 && substr($p['device'], 0 , 7) != 'Voucher'){
$d = ORM::for_table('tbl_user_recharges')->create(); $d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $id_customer; $d->customer_id = $id_customer;
$d->username = $c['username']; $d->username = $c['username'];
@ -403,7 +406,7 @@ class Package
$d->admin_id = '0'; $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();