Voucher Devices is ok to buy and redeem

This commit is contained in:
Ibnu Maksum 2024-08-08 15:10:22 +07:00
parent 630f20094a
commit 7fccf95eb0
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 53 additions and 50 deletions

View File

@ -299,14 +299,15 @@ class Package
$b->save(); $b->save();
} }
if($gateway == 'Voucher' && User::isUserVoucher($channel)){
// maybe someday i will do something in here
}else{
// 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();
$t->username = $c['username']; $t->username = $c['username'];
$t->plan_name = $p['name_plan']; $t->plan_name = $p['name_plan'];
if ($gateway == 'Voucher' && User::isUserVoucher($channel)) {
//its already paid
$t->price = 0;
} else {
if ($p['validity_unit'] == 'Period') { if ($p['validity_unit'] == 'Period') {
// Postpaid price from field // Postpaid price from field
$add_inv = User::getAttribute("Invoice", $id_customer); $add_inv = User::getAttribute("Invoice", $id_customer);
@ -318,6 +319,7 @@ class Package
} else { } else {
$t->price = $p['price'] + $add_cost; $t->price = $p['price'] + $add_cost;
} }
}
$t->recharged_on = $date_only; $t->recharged_on = $date_only;
$t->recharged_time = $time_only; $t->recharged_time = $time_only;
$t->expiration = $date_exp; $t->expiration = $date_exp;
@ -332,7 +334,6 @@ class Package
$t->admin_id = '0'; $t->admin_id = '0';
} }
$t->save(); $t->save();
}
if ($p['validity_unit'] == 'Period') { if ($p['validity_unit'] == 'Period') {
// insert price to fields for invoice next month // insert price to fields for invoice next month
@ -412,14 +413,15 @@ class Package
$d->save(); $d->save();
} }
if($gateway == 'Voucher' && User::isUserVoucher($channel)){
// maybe someday i will do something in here
}else{
// 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();
$t->username = $c['username']; $t->username = $c['username'];
$t->plan_name = $p['name_plan']; $t->plan_name = $p['name_plan'];
if ($gateway == 'Voucher' && User::isUserVoucher($channel)) {
$t->price = 0;
// its already paid
} else {
if ($p['validity_unit'] == 'Period') { if ($p['validity_unit'] == 'Period') {
// Postpaid price always zero for first time // Postpaid price always zero for first time
$note = ''; $note = '';
@ -428,6 +430,7 @@ class Package
} else { } else {
$t->price = $p['price'] + $add_cost; $t->price = $p['price'] + $add_cost;
} }
}
$t->recharged_on = $date_only; $t->recharged_on = $date_only;
$t->recharged_time = $time_only; $t->recharged_time = $time_only;
$t->expiration = $date_exp; $t->expiration = $date_exp;
@ -442,7 +445,6 @@ class Package
} }
$t->type = $p['type']; $t->type = $p['type'];
$t->save(); $t->save();
}
if ($p['validity_unit'] == 'Period' && $p['price'] != 0) { if ($p['validity_unit'] == 'Period' && $p['price'] != 0) {
// insert price to fields for invoice next month // insert price to fields for invoice next month

View File

@ -699,5 +699,6 @@
"Not_Working_for_freeradius": "Not Working for freeradius", "Not_Working_for_freeradius": "Not Working for freeradius",
"User_Cannot_change_this__only_admin__if_it_Empty_it_will_use_Customer_Credentials": "User Cannot change this, only admin. if it Empty it will use Customer Credentials", "User_Cannot_change_this__only_admin__if_it_Empty_it_will_use_Customer_Credentials": "User Cannot change this, only admin. if it Empty it will use Customer Credentials",
"Failed_to_buy_package": "Failed to buy package", "Failed_to_buy_package": "Failed to buy package",
"New_Voucher_Created": "New Voucher Created" "New_Voucher_Created": "New Voucher Created",
"New_Voucher_for_10mbps_Created": "New Voucher for 10mbps Created"
} }