add new field trx_invoice to tbl_payment_gateway, to know which transaction is for
This commit is contained in:
parent
2e3e5d2b84
commit
766ba59734
@ -321,3 +321,4 @@ ALTER TABLE `tbl_transactions` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `ty
|
||||
ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;
|
||||
ALTER TABLE `tbl_plans` CHANGE `allow_purchase` `prepaid` ENUM('yes','no') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'yes' COMMENT 'is prepaid';
|
||||
ALTER TABLE `tbl_transactions` ADD `note` VARCHAR(256) NOT NULL DEFAULT '' COMMENT 'for note' AFTER `type`;
|
||||
ALTER TABLE `tbl_payment_gateway` ADD `trx_invoice` VARCHAR(25) NOT NULL DEFAULT '' COMMENT 'from tbl_transactions' AFTER `paid_date`;
|
@ -15,15 +15,17 @@ class Package
|
||||
* @param int $plan_id plan id for this package
|
||||
* @param string $gateway payment gateway name
|
||||
* @param string $channel channel payment gateway
|
||||
* @param array $pgids payment gateway ids
|
||||
* @return boolean
|
||||
*/
|
||||
public static function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel, $note = '')
|
||||
{
|
||||
global $config, $admin, $c, $p, $b, $t, $d, $zero;
|
||||
global $config, $admin, $c, $p, $b, $t, $d, $zero, $trx;
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
$date_only = date("Y-m-d");
|
||||
$time_only = date("H:i:s");
|
||||
$time = date("H:i:s");
|
||||
$inv = "";
|
||||
|
||||
if ($id_customer == '' or $router_name == '' or $plan_id == '') {
|
||||
return false;
|
||||
@ -76,9 +78,8 @@ class Package
|
||||
|
||||
if ($router_name == 'balance') {
|
||||
// insert table transactions
|
||||
$inv = "INV-" . Package::_raid();
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = $inv;
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
$t->price = $p['price'];
|
||||
@ -239,7 +240,7 @@ class Package
|
||||
|
||||
// insert table transactions
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = "INV-" . Package::_raid();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
if ($p['validity_unit'] == 'Period') {
|
||||
@ -323,7 +324,7 @@ class Package
|
||||
|
||||
// insert table transactions
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = "INV-" . Package::_raid();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
if ($p['validity_unit'] == 'Period') {
|
||||
@ -435,7 +436,7 @@ class Package
|
||||
|
||||
// insert table transactions
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = "INV-" . Package::_raid();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
if ($p['validity_unit'] == 'Period') {
|
||||
@ -518,7 +519,7 @@ class Package
|
||||
|
||||
// insert table transactions
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = "INV-" . Package::_raid();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
if ($p['validity_unit'] == 'Period') {
|
||||
@ -583,7 +584,10 @@ class Package
|
||||
}
|
||||
run_hook("recharge_user_finish");
|
||||
Message::sendInvoice($c, $t);
|
||||
return true;
|
||||
if($trx){
|
||||
$trx->trx_invoice = $inv;
|
||||
}
|
||||
return $inv;
|
||||
}
|
||||
|
||||
public static function changeTo($username, $plan_id, $from_id)
|
||||
|
@ -221,7 +221,8 @@ switch ($action) {
|
||||
if ($active && $active['plan_id'] != $plan['id']) {
|
||||
r2(U . "order/package", 'e', Lang::T("Target has active plan, different with current plant.") . " [ <b>$active[namebp]</b> ]");
|
||||
}
|
||||
if (Package::rechargeUser($target['id'], $router_name, $plan['id'], $user['username'], 'Balance')) {
|
||||
$result = Package::rechargeUser($target['id'], $router_name, $plan['id'], $user['username'], 'Balance');
|
||||
if (!empty($result)) {
|
||||
// if success, then get the balance
|
||||
Balance::min($user['id'], $plan['price']);
|
||||
//sender
|
||||
@ -239,6 +240,7 @@ switch ($action) {
|
||||
$d->paid_date = date('Y-m-d H:i:s');
|
||||
$d->expired_date = date('Y-m-d H:i:s');
|
||||
$d->pg_url_payment = 'balance';
|
||||
$d->trx_invoice = $result;
|
||||
$d->status = 2;
|
||||
$d->save();
|
||||
$trx_id = $d->id();
|
||||
@ -257,6 +259,7 @@ switch ($action) {
|
||||
$d->paid_date = date('Y-m-d H:i:s');
|
||||
$d->expired_date = date('Y-m-d H:i:s');
|
||||
$d->pg_url_payment = 'balance';
|
||||
$d->trx_invoice = $result;
|
||||
$d->status = 2;
|
||||
$d->save();
|
||||
r2(U . "order/view/$trx_id", 's', Lang::T("Success to send package"));
|
||||
|
@ -422,5 +422,8 @@
|
||||
"success": "Sukses",
|
||||
"Click_Here": "Klik disini",
|
||||
"Your_friend_do_not_have_active_package": "Teman Anda tidak memiliki paket aktif",
|
||||
"If_your_friend_have_Additional_Cost__you_will_pay_for_that_too": "Jika teman Anda memiliki Biaya Tambahan, Anda juga akan membayarnya"
|
||||
"If_your_friend_have_Additional_Cost__you_will_pay_for_that_too": "Jika teman Anda memiliki Biaya Tambahan, Anda juga akan membayarnya",
|
||||
"Select_Payment_Gateway": "Pilih Gerbang Pembayaran",
|
||||
"Available_Payment_Gateway": "Gerbang Pembayaran yang Tersedia",
|
||||
"Pay_Now": "Bayar sekarang"
|
||||
}
|
@ -90,5 +90,8 @@
|
||||
],
|
||||
"2023.3.20": [
|
||||
"ALTER TABLE `tbl_customers` CHANGE `pppoe_password` `pppoe_password` VARCHAR(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'For PPPOE Login';"
|
||||
],
|
||||
"2024.4.5" : [
|
||||
"ALTER TABLE `tbl_payment_gateway` ADD `trx_invoice` VARCHAR(25) NOT NULL DEFAULT '' COMMENT 'from tbl_transactions' AFTER `paid_date`;"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user