From ada529ce973a3ee25084f0d18dba33f84ae5170a Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 31 Jul 2024 13:42:19 +0700 Subject: [PATCH 1/5] Show Additional bills when select gateway --- system/controllers/order.php | 8 +++- system/lan/english.json | 3 +- ui/ui/user-selectGateway.tpl | 86 ++++++++++++++++++++++++++---------- 3 files changed, 71 insertions(+), 26 deletions(-) diff --git a/system/controllers/order.php b/system/controllers/order.php index f22e97ce..7b77bea5 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -345,7 +345,11 @@ switch ($action) { $tax_rate = $tax_rate_setting; } $plan = ORM::for_table('tbl_plans')->find_one($routes['3']); - $tax = Package::tax($plan['price'], $tax_rate); + $add_cost = 0; + if ($router['name'] != 'balance') { + list($bills, $add_cost) = User::getBills($id_customer); + } + $tax = Package::tax($plan['price'] + $add_cost, $tax_rate); $pgs = array_values(explode(',', $config['payment_gateway'])); if (count($pgs) == 0) { sendTelegram("Payment Gateway not set, please set it in Settings"); @@ -359,6 +363,8 @@ switch ($action) { } $ui->assign('route2', $routes[2]); $ui->assign('route3', $routes[3]); + $ui->assign('add_cost', $add_cost); + $ui->assign('bills', $bills); $ui->assign('plan', $plan); $ui->display('user-selectGateway.tpl'); break; diff --git a/system/lan/english.json b/system/lan/english.json index e1361675..127a960d 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -678,5 +678,6 @@ "Logout_Admin_if_not_Available_Online_a_period_of_time": "Logout Admin if not Available\/Online a period of time", "Timeout_Duration": "Timeout Duration", "Enter_the_session_timeout_duration__minutes_": "Enter the session timeout duration (minutes)", - "Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes" + "Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes", + "Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller." } \ No newline at end of file diff --git a/ui/ui/user-selectGateway.tpl b/ui/ui/user-selectGateway.tpl index 77456951..6fd37475 100644 --- a/ui/ui/user-selectGateway.tpl +++ b/ui/ui/user-selectGateway.tpl @@ -11,8 +11,8 @@
@@ -25,44 +25,82 @@ {Lang::T('Plan Name')} {$plan['name_plan']} {if $plan['is_radius'] or $plan['routers']} -
  • - {Lang::T('Location')} {if - $plan['is_radius']}Radius{else}{$plan['routers']}{/if} +
  • + {Lang::T('Location')} {if + $plan['is_radius']}Radius{else}{$plan['routers']} + {/if}
  • {/if}
  • {Lang::T('Type')} {if $plan['prepaid'] eq - 'yes'}Prepaid{else}Postpaid{/if} + 'yes'}Prepaid{else}Postpaid + {/if} {$plan['type']}
  • {Lang::T('Plan Price')} {if $using eq - 'zero'}{Lang::moneyFormat(0)}{else}{Lang::moneyFormat($plan['price'])}{/if} + 'zero'}{Lang::moneyFormat(0)} + {else} + {Lang::moneyFormat($plan['price'])} + {/if}
  • {if $plan['validity']} -
  • - {Lang::T('Plan Validity')} {$plan['validity']} - {$plan['validity_unit']} -
  • +
  • + {Lang::T('Plan Validity')} {$plan['validity']} + {$plan['validity_unit']} +
  • {/if}
    {Lang::T('Summary')}
    From c417fe63e226042d5181209edc2a3bd3235434ea Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 31 Jul 2024 15:55:15 +0700 Subject: [PATCH 2/5] update tbl_payment_gateway to support Stripe --- install/phpnuxbill.sql | 4 ++-- system/lan/english.json | 3 ++- system/updates.json | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql index 06ca775e..1e10fb22 100644 --- a/install/phpnuxbill.sql +++ b/install/phpnuxbill.sql @@ -70,13 +70,13 @@ CREATE TABLE `tbl_payment_gateway` ( `id` int NOT NULL, `username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `gateway` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'xendit | midtrans', - `gateway_trx_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', + `gateway_trx_id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `plan_id` int NOT NULL, `plan_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `routers_id` int NOT NULL, `routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `price` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `pg_url_payment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', + `pg_url_payment` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `payment_method` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `payment_channel` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `pg_request` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, diff --git a/system/lan/english.json b/system/lan/english.json index 127a960d..8752c2b3 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -679,5 +679,6 @@ "Timeout_Duration": "Timeout Duration", "Enter_the_session_timeout_duration__minutes_": "Enter the session timeout duration (minutes)", "Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes", - "Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller." + "Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller.", + "_": "-" } \ No newline at end of file diff --git a/system/updates.json b/system/updates.json index 3d10cad5..c71bddf3 100644 --- a/system/updates.json +++ b/system/updates.json @@ -129,5 +129,9 @@ "2024.7.24" : [ "ALTER TABLE `tbl_voucher` ADD `used_date` DATETIME NULL DEFAULT NULL AFTER `status`;", "UPDATE `tbl_voucher` SET `used_date`=now() WHERE `status`=1;" + ], + "2024.7.31" : [ + "ALTER TABLE `tbl_payment_gateway` CHANGE `gateway_trx_id` `gateway_trx_id` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;", + "ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;" ] } \ No newline at end of file From 4c652488236b7d9420c174def230aa2a851b34ea Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 31 Jul 2024 13:42:19 +0700 Subject: [PATCH 3/5] Show Additional bills when select gateway --- system/controllers/order.php | 8 +++- system/lan/english.json | 3 +- ui/ui/user-selectGateway.tpl | 86 ++++++++++++++++++++++++++---------- 3 files changed, 71 insertions(+), 26 deletions(-) diff --git a/system/controllers/order.php b/system/controllers/order.php index f22e97ce..7b77bea5 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -345,7 +345,11 @@ switch ($action) { $tax_rate = $tax_rate_setting; } $plan = ORM::for_table('tbl_plans')->find_one($routes['3']); - $tax = Package::tax($plan['price'], $tax_rate); + $add_cost = 0; + if ($router['name'] != 'balance') { + list($bills, $add_cost) = User::getBills($id_customer); + } + $tax = Package::tax($plan['price'] + $add_cost, $tax_rate); $pgs = array_values(explode(',', $config['payment_gateway'])); if (count($pgs) == 0) { sendTelegram("Payment Gateway not set, please set it in Settings"); @@ -359,6 +363,8 @@ switch ($action) { } $ui->assign('route2', $routes[2]); $ui->assign('route3', $routes[3]); + $ui->assign('add_cost', $add_cost); + $ui->assign('bills', $bills); $ui->assign('plan', $plan); $ui->display('user-selectGateway.tpl'); break; diff --git a/system/lan/english.json b/system/lan/english.json index e1361675..127a960d 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -678,5 +678,6 @@ "Logout_Admin_if_not_Available_Online_a_period_of_time": "Logout Admin if not Available\/Online a period of time", "Timeout_Duration": "Timeout Duration", "Enter_the_session_timeout_duration__minutes_": "Enter the session timeout duration (minutes)", - "Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes" + "Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes", + "Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller." } \ No newline at end of file diff --git a/ui/ui/user-selectGateway.tpl b/ui/ui/user-selectGateway.tpl index 77456951..6fd37475 100644 --- a/ui/ui/user-selectGateway.tpl +++ b/ui/ui/user-selectGateway.tpl @@ -11,8 +11,8 @@
    @@ -25,44 +25,82 @@ {Lang::T('Plan Name')} {$plan['name_plan']} {if $plan['is_radius'] or $plan['routers']} -
  • - {Lang::T('Location')} {if - $plan['is_radius']}Radius{else}{$plan['routers']}{/if} +
  • + {Lang::T('Location')} {if + $plan['is_radius']}Radius{else}{$plan['routers']} + {/if}
  • {/if}
  • {Lang::T('Type')} {if $plan['prepaid'] eq - 'yes'}Prepaid{else}Postpaid{/if} + 'yes'}Prepaid{else}Postpaid + {/if} {$plan['type']}
  • {Lang::T('Plan Price')} {if $using eq - 'zero'}{Lang::moneyFormat(0)}{else}{Lang::moneyFormat($plan['price'])}{/if} + 'zero'}{Lang::moneyFormat(0)} + {else} + {Lang::moneyFormat($plan['price'])} + {/if}
  • {if $plan['validity']} -
  • - {Lang::T('Plan Validity')} {$plan['validity']} - {$plan['validity_unit']} -
  • +
  • + {Lang::T('Plan Validity')} {$plan['validity']} + {$plan['validity_unit']} +
  • {/if}
    {Lang::T('Summary')}
      {if $tax} -
    • - {Lang::T('Tax')} {Lang::moneyFormat($tax)} -
    • -
    • - {Lang::T('Total')} ({Lang::T('Plan Price')} + {Lang::T('Tax')}){Lang::moneyFormat($plan['price']+$tax)} -
    • +
    • + {Lang::T('Tax')} {Lang::moneyFormat($tax)} +
    • + {if $add_cost>0} + {foreach $bills as $k => $v} +
    • + {$k} {Lang::moneyFormat($v)} +
    • + {/foreach} +
    • + {Lang::T('Additional Cost')} {Lang::moneyFormat($add_cost)} +
    • +
    • + {Lang::T('Total')} ({Lang::T('Plan Price')} + +{Lang::T('Additional Cost')}){Lang::moneyFormat($plan['price']+$add_cost+$tax)} +
    • + {else} +
    • + {Lang::T('Total')} ({Lang::T('Plan Price')} + {Lang::T('Tax')}){Lang::moneyFormat($plan['price']+$tax)} +
    • + {/if} {else} -
    • - {Lang::T('Total')} - {Lang::moneyFormat($plan['price'])} -
    • + {if $add_cost>0} + {foreach $bills as $k => $v} +
    • + {$k} {Lang::moneyFormat($v)} +
    • + {/foreach} +
    • + {Lang::T('Additional Cost')} {Lang::moneyFormat($add_cost)} +
    • +
    • + {Lang::T('Total')} ({Lang::T('Plan Price')} + +{Lang::T('Additional Cost')}){Lang::moneyFormat($plan['price']+$add_cost)} +
    • + {else} +
    • + {Lang::T('Total')} {Lang::moneyFormat($plan['price'])} +
    • + {/if} {/if}
    From 063ae834bcdf7790b8f0ab45be13aca7dc19526a Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 31 Jul 2024 15:55:15 +0700 Subject: [PATCH 4/5] update tbl_payment_gateway to support Stripe --- install/phpnuxbill.sql | 4 ++-- system/lan/english.json | 3 ++- system/updates.json | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql index 06ca775e..1e10fb22 100644 --- a/install/phpnuxbill.sql +++ b/install/phpnuxbill.sql @@ -70,13 +70,13 @@ CREATE TABLE `tbl_payment_gateway` ( `id` int NOT NULL, `username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `gateway` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'xendit | midtrans', - `gateway_trx_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', + `gateway_trx_id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `plan_id` int NOT NULL, `plan_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `routers_id` int NOT NULL, `routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `price` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, - `pg_url_payment` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', + `pg_url_payment` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `payment_method` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `payment_channel` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '', `pg_request` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci, diff --git a/system/lan/english.json b/system/lan/english.json index 127a960d..8752c2b3 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -679,5 +679,6 @@ "Timeout_Duration": "Timeout Duration", "Enter_the_session_timeout_duration__minutes_": "Enter the session timeout duration (minutes)", "Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes", - "Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller." + "Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller.", + "_": "-" } \ No newline at end of file diff --git a/system/updates.json b/system/updates.json index 3d10cad5..c71bddf3 100644 --- a/system/updates.json +++ b/system/updates.json @@ -129,5 +129,9 @@ "2024.7.24" : [ "ALTER TABLE `tbl_voucher` ADD `used_date` DATETIME NULL DEFAULT NULL AFTER `status`;", "UPDATE `tbl_voucher` SET `used_date`=now() WHERE `status`=1;" + ], + "2024.7.31" : [ + "ALTER TABLE `tbl_payment_gateway` CHANGE `gateway_trx_id` `gateway_trx_id` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;", + "ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;" ] } \ No newline at end of file From 210178be84571fbfab78b5963117568ed23ac3cf Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 31 Jul 2024 15:57:43 +0700 Subject: [PATCH 5/5] Fix Show additional Bill when customer order --- version.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.json b/version.json index 0b93a06b..d345658b 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.7.27" + "version": "2024.7.31" } \ No newline at end of file