set payment gateway

This commit is contained in:
Ibnu Maksum 2022-09-06 10:31:22 +07:00
parent 9dd85dc38e
commit deecd28cf7
No known key found for this signature in database
GPG key ID: 7FC82848810579E5
5 changed files with 265 additions and 3 deletions

View file

@ -12,11 +12,78 @@ $ui->assign('_admin', $admin);
switch ($action) {
case 'xendit':
$ui->assign('_title', 'Xendit - Payment Gateway - '. $config['CompanyName']);
$ui->display('a404.tpl');
$ui->display('app-xendit.tpl');
break;
case 'xendit-post':
$xendit_secret_key = _post('xendit_secret_key');
$xendit_verification_token = _post('xendit_verification_token');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_secret_key')->find_one();
if($d){
$d->value = $xendit_secret_key;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_secret_key';
$d->value = $xendit_secret_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_verification_token')->find_one();
if($d){
$d->value = $xendit_verification_token;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'xendit_verification_token';
$d->value = $xendit_verification_token;
$d->save();
}
_log('[' . $admin['username'] . ']: Xendit ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
r2(U . 'paymentgateway/xendit', 's', $_L['Settings_Saved_Successfully']);
break;
case 'midtrans':
$ui->assign('_title', 'Midtrans - Payment Gateway - '. $config['CompanyName']);
$ui->display('a404.tpl');
$ui->display('app-midtrans.tpl');
break;
case 'midtrans-post':
$midtrans_merchant_id = _post('midtrans_merchant_id');
$midtrans_client_key = _post('midtrans_client_key');
$midtrans_server_key = _post('midtrans_server_key');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'midtrans_merchant_id')->find_one();
if($d){
$d->value = $midtrans_merchant_id;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'midtrans_merchant_id';
$d->value = $midtrans_merchant_id;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'midtrans_client_key')->find_one();
if($d){
$d->value = $midtrans_client_key;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'midtrans_client_key';
$d->value = $midtrans_client_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'midtrans_server_key')->find_one();
if($d){
$d->value = $midtrans_server_key;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'midtrans_server_key';
$d->value = $midtrans_server_key;
$d->save();
}
_log('[' . $admin['username'] . ']: Midtrans ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
r2(U . 'paymentgateway/midtrans', 's', $_L['Settings_Saved_Successfully']);
break;
}

View file

@ -204,6 +204,7 @@ switch ($action) {
$telegram_target_id = _post('telegram_target_id');
$sms_url = _post('sms_url');
$address = _post('address');
$payment_gateway = _post('payment_gateway');
if ($company == '') {
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
} else {
@ -244,7 +245,7 @@ switch ($action) {
$d = ORM::for_table('tbl_appconfig')->where('setting', 'sms_url')->find_one();
if($d){
$d->setting = $sms_url;
$d->value = $sms_url;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
@ -253,6 +254,17 @@ switch ($action) {
$d->save();
}
$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();
}
$note = _post('note');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'note')->find_one();
$d->value = $note;

56
ui/ui/app-midtrans.tpl Normal file
View file

@ -0,0 +1,56 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/midtrans-post" >
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">MIDTRANS</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">ID Merchant</label>
<div class="col-md-6">
<input type="text" class="form-control" id="midtrans_merchant_id" name="midtrans_merchant_id" placeholder="G" value="{$_c['midtrans_merchant_id']}">
<a href="https://dashboard.midtrans.com/settings/config_info" target="_blank" class="help-block">https://dashboard.midtrans.com/settings/config_info</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Client Key</label>
<div class="col-md-6">
<input type="text" class="form-control" id="midtrans_client_key" name="midtrans_client_key" placeholder="Mid-client-XXXXXXXX" value="{$_c['midtrans_client_key']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Server Key</label>
<div class="col-md-6">
<input type="text" class="form-control" id="midtrans_server_key" name="midtrans_server_key" placeholder="Mid-server-XXXXXXXX" value="{$_c['midtrans_server_key']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Payment Notification URL</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" value="{$_url}callback/midtrans">
<p class="help-block">Payment Notification URL, Recurring Notification URL, Pay Account Notification URL</p>
<a href="https://dashboard.midtrans.com/settings/vtweb_configuration" target="_blank" class="help-block">https://dashboard.midtrans.com/settings/vtweb_configuration</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Finish Redirect URL</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" value="{$_url}accounts/transaction">
<p class="help-block">Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL</p>
<a href="https://dashboard.midtrans.com/settings/vtweb_configuration" target="_blank" class="help-block">https://dashboard.midtrans.com/settings/vtweb_configuration</a>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
{include file="sections/footer.tpl"}

85
ui/ui/app-settings.tpl Normal file
View file

@ -0,0 +1,85 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/app-post" >
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">{$_L['General_Settings']}</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">{$_L['App_Name']}</label>
<div class="col-md-6">
<input type="text" required class="form-control" id="company" name="company" value="{$_c['CompanyName']}">
<span class="help-block">{$_L['App_Name_Help_Text']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Address']}</label>
<div class="col-md-6">
<textarea class="form-control" id="address" name="address" rows="3">{$_c['address']}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Phone_Number']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Payment Gateway</label>
<div class="col-md-6">
<select name="payment_gateway" id="payment_gateway" class="form-control">
<option value="none">None</option>
<option value="xendit" {if $_c['payment_gateway'] eq 'xendit'}selected="selected" {/if}>Xendit</option>
<option value="midtrans" {if $_c['payment_gateway'] eq 'midtrans'}selected="selected" {/if}>Midtrans</option>
</select>
</div>
</div>
</div>
<div class="panel-heading">Telegram Notification</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Telegram Bot Token</label>
<div class="col-md-6">
<input type="text" class="form-control" id="telegram_bot" name="telegram_bot" value="{$_c['telegram_bot']}" placeholder="123456:asdasgdkuasghddlashdashldhalskdklasd">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Telegram Target ID</label>
<div class="col-md-6">
<input type="text" class="form-control" id="telegram_target_id" name="telegram_target_id" value="{$_c['telegram_target_id']}" placeholder="12345678">
</div>
</div>
</div>
<div class="panel-heading">Whatsapp Notification</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Server URL</label>
<div class="col-md-6">
<input type="text" class="form-control" id="sms_url" name="sms_url" value="{$_c['sms_url']}" placeholder="https://domain/?param_number=[number]&param_text=[text]&secret=">
<p class="help-block">Must include <b>[text]</b> &amp; <b>[number]</b>, it will be replaced.</p>
</div>
</div>
</div>
<div class="panel-heading">Invoice</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Note Invoice</label>
<div class="col-md-6">
<textarea class="form-control" id="note" name="note" rows="3">{$_c['note']}</textarea>
<span class="help-block">{$_L['You_can_use_html_tag']}</span>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
{include file="sections/footer.tpl"}

42
ui/ui/app-xendit.tpl Normal file
View file

@ -0,0 +1,42 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/xendit-post" >
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default panel-hovered panel-stacked mb30">
<div class="panel-heading">XENDIT</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Secret Key</label>
<div class="col-md-6">
<input type="text" class="form-control" id="xendit_secret_key" name="xendit_secret_key" placeholder="xnd_" value="{$_c['xendit_secret_key']}">
<a href="https://dashboard.xendit.co/settings/developers#api-keys" target="_blank" class="help-block">https://dashboard.xendit.co/settings/developers#api-keys</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Verification Token</label>
<div class="col-md-6">
<input type="text" class="form-control" id="xendit_verification_token" name="xendit_verification_token" placeholder="cece1878a4a24754fb193309d3977f4dc0e86e907c4fb188cbccd10d8ef67fd3" value="{$_c['xendit_verification_token']}">
<a href="https://dashboard.xendit.co/settings/developers#callbacks" target="_blank" class="help-block">https://dashboard.xendit.co/settings/developers#callbacks</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Callback URL</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" onclick="this.select()" value="{$_url}callback/xendit">
<a href="https://dashboard.xendit.co/settings/developers#callbacks" target="_blank" class="help-block">https://dashboard.xendit.co/settings/developers#callbacks</a>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
{include file="sections/footer.tpl"}