mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2024-11-10 17:26:48 +08:00
Multiple Payment gateway Fix
This commit is contained in:
parent
7a9f937a9e
commit
3bb55320e3
7 changed files with 88 additions and 47 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -2,6 +2,16 @@
|
|||
|
||||
# CHANGELOG
|
||||
|
||||
## 2024.3.12
|
||||
|
||||
- Check if Validity Period, so calculate price will not affected other validity
|
||||
- Add firewall using .htaccess for apache only
|
||||
- Multiple Payment Gateway by @Focuslinkstech
|
||||
- Fix Logic Multiple Payment gateway
|
||||
- Fix delete Attribute
|
||||
- Allow Delete Payment Gateway
|
||||
- Allow Delete Plugin
|
||||
|
||||
## 2024.3.6
|
||||
|
||||
- change attributes view
|
||||
|
|
|
@ -272,20 +272,30 @@ switch ($action) {
|
|||
if (strpos($user['email'], '@') === false) {
|
||||
r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address"));
|
||||
}
|
||||
$files = scandir($PAYMENTGATEWAY_PATH);
|
||||
foreach ($files as $file) {
|
||||
if (pathinfo($file, PATHINFO_EXTENSION) == 'php') {
|
||||
$pgs[] = str_replace('.php', '', $file);
|
||||
$pgs = array_values(explode(',', $config['payment_gateway']));
|
||||
if(count($pgs)==0){
|
||||
sendTelegram("Payment Gateway not set, please set it in Settings");
|
||||
_log(Lang::T("Payment Gateway not set, please set it in Settings"));
|
||||
r2(U . "home", 'e', Lang::T("Failed to create Transaction.."));
|
||||
}
|
||||
if(count($pgs)>1){
|
||||
$ui->assign('pgs',$pgs );
|
||||
//$ui->assign('pgs', $pgs);
|
||||
$ui->assign('route2', $routes[2]);
|
||||
$ui->assign('route3', $routes[3]);
|
||||
|
||||
//$ui->assign('plan', $plan);
|
||||
$ui->display('user-selectGateway.tpl');
|
||||
break;
|
||||
}else{
|
||||
if(empty($pgs[0])){
|
||||
sendTelegram("Payment Gateway not set, please set it in Settings");
|
||||
_log(Lang::T("Payment Gateway not set, please set it in Settings"));
|
||||
r2(U . "home", 'e', Lang::T("Failed to create Transaction.."));
|
||||
}else{
|
||||
$_POST['gateway'] = $pgs[0];
|
||||
}
|
||||
}
|
||||
$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 'buy':
|
||||
$gateway = _post('gateway');
|
||||
if (empty($gateway) && !empty($_SESSION['gateway'])) {
|
||||
|
|
|
@ -19,6 +19,24 @@ if ($action == 'delete') {
|
|||
r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway Deleted'));
|
||||
}
|
||||
|
||||
if (_post('save') == 'actives') {
|
||||
$pgs = '';
|
||||
if(is_array($_POST['pgs'])){
|
||||
$pgs = implode(',', $_POST['pgs']);
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'payment_gateway')->find_one();
|
||||
if ($d) {
|
||||
$d->value = $pgs;
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'payment_gateway';
|
||||
$d->value = $pgs;
|
||||
$d->save();
|
||||
}
|
||||
r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway saved successfully'));
|
||||
}
|
||||
|
||||
if (file_exists($PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $action . '.php')) {
|
||||
include $PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $action . '.php';
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
@ -44,22 +62,9 @@ if (file_exists($PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $action . '.php'))
|
|||
$pgs[] = str_replace('.php', '', $file);
|
||||
}
|
||||
}
|
||||
if (isset($_POST['payment_gateway'])) {
|
||||
$payment_gateway = _post('payment_gateway');
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'payment_gateway')->find_one();
|
||||
if ($d) {
|
||||
$d->value = $payment_gateway;
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'payment_gateway';
|
||||
$d->value = $payment_gateway;
|
||||
$d->save();
|
||||
}
|
||||
r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway saved successfully'));
|
||||
}
|
||||
$ui->assign('_title', 'Payment Gateway Settings');
|
||||
$ui->assign('pgs', $pgs);
|
||||
$ui->assign('actives', explode(',', $config['payment_gateway']));
|
||||
$ui->display('paymentgateway.tpl');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -461,5 +461,12 @@
|
|||
"Customer_Announcement": "Customer Announcement",
|
||||
"1_Period___1_Month__Expires_the_20th_of_each_month": "1 Period = 1 Month, Expires the 20th of each month",
|
||||
"Period": "Period",
|
||||
"Add": "Add"
|
||||
"Add": "Add",
|
||||
"Select_Payment_Gateway": "Select Payment Gateway",
|
||||
"Available_Payment_Gateway": "Available Payment Gateway",
|
||||
"Pay_Now": "Pay Now",
|
||||
"Please_select_Payment_Gateway": "Please select Payment Gateway",
|
||||
"Payment_Gateway_Deleted": "Payment Gateway Deleted",
|
||||
"Payment_Gateway_not_set__please_set_it_in_Settings": "Payment Gateway not set, please set it in Settings",
|
||||
"Failed_to_create_Transaction__": "Failed to create Transaction.."
|
||||
}
|
|
@ -1,22 +1,31 @@
|
|||
{include file="sections/header.tpl"}
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3">
|
||||
<div class="panel panel-info panel-hovered">
|
||||
<div class="panel-heading">{Lang::T('Payment Gateway')}</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<tbody>
|
||||
{foreach $pgs as $pg}
|
||||
<tr>
|
||||
<td><a href="{$_url}paymentgateway/{$pg}"
|
||||
class="btn btn-block btn-default text-left">{ucwords($pg)}</a></td>
|
||||
<td width="10"><a href="{$_url}paymentgateway/delete/{$pg}" onclick="return confirm('{Lang::T('Delete')} {$pg}?')" class="btn btn-danger"><i
|
||||
class="glyphicon glyphicon-trash"></i></a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-md-offset-3">
|
||||
<div class="panel panel-info panel-hovered">
|
||||
<div class="panel-heading">{Lang::T('Payment Gateway')}</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed">
|
||||
<tbody>
|
||||
{foreach $pgs as $pg}
|
||||
<tr>
|
||||
<td width="10" align="center" valign="center"><input type="checkbox" name="pgs[]"
|
||||
{if in_array($pg, $actives)}checked{/if}
|
||||
value="{$pg}"></td>
|
||||
<td><a href="{$_url}paymentgateway/{$pg}"
|
||||
class="btn btn-block btn-{if in_array($pg, $actives)}info{else}default{/if} text-left">{ucwords($pg)}</a></td>
|
||||
<td width="10"><a href="{$_url}paymentgateway/delete/{$pg}"
|
||||
onclick="return confirm('{Lang::T('Delete')} {$pg}?')" class="btn btn-danger"><i
|
||||
class="glyphicon glyphicon-trash"></i></a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel-footer"><button type="submit"
|
||||
class="btn btn-primary btn-block" name="save" value="actives">{Lang::T('Save Changes')}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{include file="sections/footer.tpl"}
|
|
@ -11,8 +11,8 @@
|
|||
<div class="col-md-8">
|
||||
<select name="gateway" id="gateway" class="form-control">
|
||||
{foreach $pgs as $pg}
|
||||
<option value="{$pg}">
|
||||
{ucwords($pg)}</option>
|
||||
<option value="{$pg}">
|
||||
{ucwords($pg)}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "2024.3.6"
|
||||
"version": "2024.3.12"
|
||||
}
|
Loading…
Reference in a new issue