don't put to tbl_transactions if customer redeem voucher code Created by Voucher Device

This commit is contained in:
Ibnu Maksum 2024-08-08 14:58:04 +07:00
parent 9ad9ba45b1
commit 630f20094a
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 67 additions and 53 deletions

View File

@ -299,6 +299,9 @@ class Package
$b->save();
}
if($gateway == 'Voucher' && User::isUserVoucher($channel)){
// maybe someday i will do something in here
}else{
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = $inv = "INV-" . Package::_raid();
@ -329,6 +332,7 @@ class Package
$t->admin_id = '0';
}
$t->save();
}
if ($p['validity_unit'] == 'Period') {
// insert price to fields for invoice next month
@ -407,6 +411,10 @@ class Package
}
$d->save();
}
if($gateway == 'Voucher' && User::isUserVoucher($channel)){
// maybe someday i will do something in here
}else{
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = $inv = "INV-" . Package::_raid();
@ -434,6 +442,7 @@ class Package
}
$t->type = $p['type'];
$t->save();
}
if ($p['validity_unit'] == 'Period' && $p['price'] != 0) {
// insert price to fields for invoice next month

View File

@ -196,6 +196,11 @@ class User
return $d;
}
public static function isUserVoucher($kode) {
$regex = '/^GC\d+C.{10}$/';
return preg_match($regex, $kode);
}
public static function _billing($id = 0)
{
if (!$id) {