From 758a0a99a93890f15fa93511cdae5465eb095049 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Mon, 11 Mar 2024 09:34:25 +0100 Subject: [PATCH] We are excited to introduce a new feature I am delighted to announce that a highly requested feature has been added to Nuxbill! We now support Multiple Payment Gateways, allowing customers to choose their preferred payment method. This update brings greater flexibility and convenience to our users. --- system/controllers/order.php | 31 ++++++++++++++++++++++++++----- ui/ui/paymentgateway.tpl | 17 ++++++++--------- ui/ui/user-selectGateway.tpl | 30 ++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 ui/ui/user-selectGateway.tpl diff --git a/system/controllers/order.php b/system/controllers/order.php index cee6b454..3b59e7b9 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -267,18 +267,39 @@ switch ($action) { $ui->display('user-sendPlan.tpl'); break; case 'buy': + $ui->assign('_title', Lang::T('Select Payment Gateway')); + $ui->assign('_system_menu', 'package'); if (strpos($user['email'], '@') === false) { r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address")); } - if ($config['payment_gateway'] == 'none') { - r2(U . 'home', 'e', Lang::T("No Payment Gateway Available")); - } if (!file_exists($PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $config['payment_gateway'] . '.php')) { r2(U . 'home', 'e', Lang::T("No Payment Gateway Available")); } + require_once $PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $config['payment_gateway'] . '.php'; + $files = scandir($PAYMENTGATEWAY_PATH); + foreach ($files as $file) { + if (pathinfo($file, PATHINFO_EXTENSION) == 'php') { + $pgs[] = str_replace('.php', '', $file); + } + } + $ui->assign('pgs', $pgs); + $ui->assign('route2', $routes[2]); + $ui->assign('route3', $routes[3]); + + //$ui->assign('plan', $plan); + $ui->display('user-selectGateway.tpl'); + break; + + case 'pay_now': + $gateway = $_POST['gateway']; + //$routes[2] = $_GET['route2']; + //$routes[3] = $_GET['route3']; + if ($gateway == 'none') { + r2(U . 'order/buy/' . $routes[2] . '/' . $routes[3], 'e', Lang::T("No Payment Gateway Selected")); + } run_hook('customer_buy_plan'); #HOOK - include $PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $config['payment_gateway'] . '.php'; - call_user_func($config['payment_gateway'] . '_validate_config'); + include $PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $gateway . '.php'; + call_user_func($gateway . '_validate_config'); if ($routes['2'] == 'radius') { $router['id'] = 0; diff --git a/ui/ui/paymentgateway.tpl b/ui/ui/paymentgateway.tpl index f1d40571..3100bb30 100644 --- a/ui/ui/paymentgateway.tpl +++ b/ui/ui/paymentgateway.tpl @@ -1,17 +1,16 @@ {include file="sections/header.tpl"}