change to pg- and add duitku

This commit is contained in:
Ibnu Maksum 2022-09-14 15:58:12 +07:00
parent 48350941e9
commit 8a8c7f897f
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
14 changed files with 300 additions and 107 deletions

View File

@ -0,0 +1,45 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
*
* Payment Gateway duitku.com
**/
class PGDuitku
{
protected $user;
protected $trx;
public function __construct($trx, $user)
{
$this->user = $user;
$this->trx = $trx;
}
function getSignature($amount,$datetime)
{
global $_c;
return hash('sha256', $_c['duitku_merchant_id'] . $amount . $datetime . $_c['duitku_merchant_key']);
}
function createTransaction($channel)
{
}
function getStatus($trxID)
{
}
private function getServer()
{
global $_app_stage;
if ($_app_stage == 'Live') {
return 'https://passport.duitku.com/webapi/api/merchant/';
} else {
return 'https://sandbox.duitku.com/webapi/api/merchant/';
}
}
}

View File

@ -24,7 +24,7 @@ class PGTripay
return hash_hmac('sha256', $_c['tripay_merchant'] . $this->trx['id'] . $this->trx['price'], $_c['tripay_secret_key']); return hash_hmac('sha256', $_c['tripay_merchant'] . $this->trx['id'] . $this->trx['price'], $_c['tripay_secret_key']);
} }
function createTransaction($channel) //$trxID, $channel, $amount, $user, $description) function createTransaction($channel)
{ {
global $_c; global $_c;
$json = [ $json = [

View File

@ -13,7 +13,7 @@ switch ($action) {
case 'xendit': case 'xendit':
$ui->assign('_title', 'Xendit - Payment Gateway - '. $config['CompanyName']); $ui->assign('_title', 'Xendit - Payment Gateway - '. $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_xendit.json'), true)); $ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_xendit.json'), true));
$ui->display('app-xendit.tpl'); $ui->display('pg-xendit.tpl');
break; break;
case 'xendit-post': case 'xendit-post':
$xendit_secret_key = _post('xendit_secret_key'); $xendit_secret_key = _post('xendit_secret_key');
@ -56,7 +56,7 @@ switch ($action) {
case 'midtrans': case 'midtrans':
$ui->assign('_title', 'Midtrans - Payment Gateway - '. $config['CompanyName']); $ui->assign('_title', 'Midtrans - Payment Gateway - '. $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_midtrans.json'), true)); $ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_midtrans.json'), true));
$ui->display('app-midtrans.tpl'); $ui->display('pg-midtrans.tpl');
break; break;
case 'midtrans-post': case 'midtrans-post':
$midtrans_merchant_id = _post('midtrans_merchant_id'); $midtrans_merchant_id = _post('midtrans_merchant_id');
@ -110,7 +110,7 @@ switch ($action) {
case 'tripay': case 'tripay':
$ui->assign('_title', 'Tripay - Payment Gateway - '. $config['CompanyName']); $ui->assign('_title', 'Tripay - Payment Gateway - '. $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true)); $ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true));
$ui->display('app-tripay.tpl'); $ui->display('pg-tripay.tpl');
break; break;
case 'tripay-post': case 'tripay-post':
$tripay_merchant = _post('tripay_merchant'); $tripay_merchant = _post('tripay_merchant');
@ -161,4 +161,50 @@ switch ($action) {
r2(U . 'paymentgateway/tripay', 's', $_L['Settings_Saved_Successfully']); r2(U . 'paymentgateway/tripay', 's', $_L['Settings_Saved_Successfully']);
break; break;
case 'duitku':
$ui->assign('_title', 'Duitku - Payment Gateway - '. $config['CompanyName']);
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true));
$ui->display('pg-duitku.tpl');
break;
case 'duitku-post':
$duitku_merchant_id = _post('duitku_merchant_id');
$duitku_merchant_key = _post('duitku_merchant_key');
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_merchant_id')->find_one();
if($d){
$d->value = $duitku_merchant_id;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_merchant_id';
$d->value = $duitku_merchant_id;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_merchant_key')->find_one();
if($d){
$d->value = $duitku_merchant_key;
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_merchant_key';
$d->value = $duitku_merchant_key;
$d->save();
}
$d = ORM::for_table('tbl_appconfig')->where('setting', 'duitku_channel')->find_one();
if($d){
$d->value = implode(',',$_POST['duitku_channel']);
$d->save();
}else{
$d = ORM::for_table('tbl_appconfig')->create();
$d->setting = 'duitku_channel';
$d->value = implode(',',$_POST['duitku_channel']);
$d->save();
}
_log('[' . $admin['username'] . ']: Duitku ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
r2(U . 'paymentgateway/duitku', 's', $_L['Settings_Saved_Successfully']);
break;
default:
$ui->display('a404.tpl');
} }

View File

@ -0,0 +1,98 @@
[
{
"id": "BC",
"name": "BCA"
},
{
"id": "M2",
"name": "Mandiri"
},
{
"id": "VA",
"name": "Maybank"
},
{
"id": "I1",
"name": "BNI"
},
{
"id": "MANDIRIVA",
"name": "Mandiri"
},
{
"id": "B1",
"name": "CIMB Niaga"
},
{
"id": "BT",
"name": "Permata Bank"
},
{
"id": "A1",
"name": "ATM Bersama"
},
{
"id": "AG",
"name": "Artha Graha"
},
{
"id": "NC",
"name": "Bank Neo Commerce/BNC"
},
{
"id": "BR",
"name": "BRIVA"
},
{
"id": "S1",
"name": "Bank Sahabat Sampoerna"
},
{
"id": "OV",
"name": "OVO"
},
{
"id": "SA",
"name": "Shopee Pay"
},
{
"id": "LF",
"name": "LinkAja Apps (Fixed Fee)"
},
{
"id": "LA",
"name": "LinkAja Apps (Percentage Fee)"
},
{
"id": "DA",
"name": "DANA"
},
{
"id": "SP",
"name": "QRIS Shopee Pay"
},
{
"id": "LQ",
"name": "QRIS LinkAja"
},
{
"id": "NQ",
"name": "QRIS Nobu"
},
{
"id": "FT",
"name": "Pegadaian/ALFA/Pos"
},
{
"id": "A2",
"name": "POS Indonesia"
},
{
"id": "IR",
"name": "Indomaret"
},
{
"id": "VC",
"name": "Credit Card (Visa / Master Card / JCB)"
}
]

View File

@ -1,82 +1,66 @@
[ [
{ {
"id": "credit_card", "id": "credit_card",
"name": "Credit Card", "name": "Credit Card"
"min": 10000
}, },
{ {
"id": "bca_va", "id": "bca_va",
"name": "BCA", "name": "BCA"
"min": 10000
}, },
{ {
"id": "permata_va", "id": "permata_va",
"name": "Permata", "name": "Permata"
"min": 10000
}, },
{ {
"id": "bni_va", "id": "bni_va",
"name": "BNI", "name": "BNI"
"min": 10000
}, },
{ {
"id": "bri_va", "id": "bri_va",
"name": "BRI", "name": "BRI"
"min": 10000
}, },
{ {
"id": "echannel", "id": "echannel",
"name": "Mandiri Bill", "name": "Mandiri Bill"
"min": 10000
}, },
{ {
"id": "gopay", "id": "gopay",
"name": "Gopay", "name": "Gopay"
"min": 1000
}, },
{ {
"id": "bca_klikbca", "id": "bca_klikbca",
"name": "KLIKBCA", "name": "KLIKBCA"
"min": 10000
}, },
{ {
"id": "bca_klikpay", "id": "bca_klikpay",
"name": "BCA KLIKPAY", "name": "BCA KLIKPAY"
"min": 10000
}, },
{ {
"id": "cimb_clicks", "id": "cimb_clicks",
"name": "CIMB Clicks", "name": "CIMB Clicks"
"min": 10000
}, },
{ {
"id": "danamon_online", "id": "danamon_online",
"name": "Danamon", "name": "Danamon"
"min": 5000
}, },
{ {
"id": "bri_epay", "id": "bri_epay",
"name": "BRImo", "name": "BRImo"
"min": 10000
}, },
{ {
"id": "indomaret", "id": "indomaret",
"name": "Indomaret", "name": "Indomaret"
"min": 5000
}, },
{ {
"id": "alfamart", "id": "alfamart",
"name": "Alfamart", "name": "Alfamart"
"min": 5000
}, },
{ {
"id": "ShopeePay", "id": "ShopeePay",
"name": "ShopeePay", "name": "ShopeePay"
"min": 1000
}, },
{ {
"id": "uob_ezpay", "id": "uob_ezpay",
"name": "UOB EZ Pay", "name": "UOB EZ Pay"
"min": 1000
} }
] ]

View File

@ -1,92 +1,74 @@
[ [
{ {
"id": "PERMATAVA", "id": "PERMATAVA",
"name": "Permata Bank", "name": "Permata Bank"
"min": 10000
}, },
{ {
"id": "MYBVA", "id": "MYBVA",
"name": "Maybank", "name": "Maybank"
"min": 10000
}, },
{ {
"id": "BNIVA", "id": "BNIVA",
"name": "BNI", "name": "BNI"
"min": 10000
}, },
{ {
"id": "BRIVA", "id": "BRIVA",
"name": "BRI", "name": "BRI"
"min": 10000
}, },
{ {
"id": "MANDIRIVA", "id": "MANDIRIVA",
"name": "Mandiri", "name": "Mandiri"
"min": 10000
}, },
{ {
"id": "BCAVA", "id": "BCAVA",
"name": "BCA", "name": "BCA"
"min": 10000
}, },
{ {
"id": "SMSVA", "id": "SMSVA",
"name": "Sinarmas", "name": "Sinarmas"
"min": 10000
}, },
{ {
"id": "MUAMALATVA", "id": "MUAMALATVA",
"name": "Muamalat", "name": "Muamalat"
"min": 10000
}, },
{ {
"id": "SAMPOERNAVA", "id": "SAMPOERNAVA",
"name": "Sahabat Sampoerna", "name": "Sahabat Sampoerna"
"min": 10000
}, },
{ {
"id": "BSIVA", "id": "BSIVA",
"name": "BSI", "name": "BSI"
"min": 10000
}, },
{ {
"id": "ALFAMART", "id": "ALFAMART",
"name": "Alfamart ", "name": "Alfamart "
"min": 5000
}, },
{ {
"id": "INDOMARET", "id": "INDOMARET",
"name": "Indomaret ", "name": "Indomaret "
"min": 10000
}, },
{ {
"id": "ALFAMIDI", "id": "ALFAMIDI",
"name": "Alfamidi ", "name": "Alfamidi "
"min": 5000
}, },
{ {
"id": "OVO", "id": "OVO",
"name": "OVO", "name": "OVO"
"min": 1000
}, },
{ {
"id": "QRIS", "id": "QRIS",
"name": "QRIS by ShopeePay", "name": "QRIS by ShopeePay"
"min": 1000
}, },
{ {
"id": "QRISC", "id": "QRISC",
"name": "QRIS (Customizable)", "name": "QRIS (Customizable)"
"min": 1000
}, },
{ {
"id": "QRIS2", "id": "QRIS2",
"name": "QRIS", "name": "QRIS"
"min": 1000
}, },
{ {
"id": "SHOPEEPAY", "id": "SHOPEEPAY",
"name": "ShopeePay ", "name": "ShopeePay "
"min": 1000
} }
] ]

View File

@ -1,82 +1,66 @@
[ [
{ {
"id": "CREDIT_CARD", "id": "CREDIT_CARD",
"name": "CREDIT CARD", "name": "CREDIT CARD"
"min": 10000
}, },
{ {
"id": "PERMATA", "id": "PERMATA",
"name": "Permata Bank", "name": "Permata Bank"
"min": 10000
}, },
{ {
"id": "BNI", "id": "BNI",
"name": "BNI", "name": "BNI"
"min": 10000
}, },
{ {
"id": "BRI", "id": "BRI",
"name": "BRI", "name": "BRI"
"min": 10000
}, },
{ {
"id": "MANDIRI", "id": "MANDIRI",
"name": "Mandiri", "name": "Mandiri"
"min": 10000
}, },
{ {
"id": "BCA", "id": "BCA",
"name": "BCA", "name": "BCA"
"min": 10000
}, },
{ {
"id": "BSI", "id": "BSI",
"name": "BSI", "name": "BSI"
"min": 10000
}, },
{ {
"id": "DD_BRI", "id": "DD_BRI",
"name": "Direct Debit BRI", "name": "Direct Debit BRI"
"min": 10000
}, },
{ {
"id": "DD_BCA_KLIKPAY", "id": "DD_BCA_KLIKPAY",
"name": "Direct Debit BCA KLIKPAY", "name": "Direct Debit BCA KLIKPAY"
"min": 10000
}, },
{ {
"id": "ALFAMART", "id": "ALFAMART",
"name": "Alfamart ", "name": "Alfamart "
"min": 5000
}, },
{ {
"id": "INDOMARET", "id": "INDOMARET",
"name": "Indomaret ", "name": "Indomaret "
"min": 10000
}, },
{ {
"id": "OVO", "id": "OVO",
"name": "OVO", "name": "OVO"
"min": 1000
}, },
{ {
"id": "DANA", "id": "DANA",
"name": "DANA", "name": "DANA"
"min": 1000
}, },
{ {
"id": "LINKAJA", "id": "LINKAJA",
"name": "LinkAja", "name": "LinkAja"
"min": 1000
}, },
{ {
"id": "SHOPEEPAY", "id": "SHOPEEPAY",
"name": "ShopeePay ", "name": "ShopeePay "
"min": 1000
}, },
{ {
"id": "QRIS", "id": "QRIS",
"name": "QRIS", "name": "QRIS"
"min": 1000
} }
] ]

View File

@ -7,8 +7,8 @@ if(php_sapi_name() !== 'cli'){
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE"); die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
} }
require('config.php'); require(__DIR__.'/config.php');
require('orm.php'); require(__DIR__.'/orm.php');
use PEAR2\Net\RouterOS; use PEAR2\Net\RouterOS;
require_once 'autoload/PEAR2/Autoload.php'; require_once 'autoload/PEAR2/Autoload.php';

View File

@ -34,10 +34,11 @@
<option value="xendit" {if $_c['payment_gateway'] eq 'xendit'}selected="selected" {/if}>Xendit - Indonesia &amp; Philippines</option> <option value="xendit" {if $_c['payment_gateway'] eq 'xendit'}selected="selected" {/if}>Xendit - Indonesia &amp; Philippines</option>
{* <option value="midtrans" {if $_c['payment_gateway'] eq 'midtrans'}selected="selected" {/if}>Midtrans</option> *} {* <option value="midtrans" {if $_c['payment_gateway'] eq 'midtrans'}selected="selected" {/if}>Midtrans</option> *}
<option value="tripay" {if $_c['payment_gateway'] eq 'tripay'}selected="selected" {/if}>Tripay - Indonesia</option> <option value="tripay" {if $_c['payment_gateway'] eq 'tripay'}selected="selected" {/if}>Tripay - Indonesia</option>
<option value="duitku" {if $_c['payment_gateway'] eq 'duitku'}selected="selected" {/if}>Duitku - Indonesia</option>
</select> </select>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group hidden">
<label class="col-md-2 control-label">Radius Mode?</label> <label class="col-md-2 control-label">Radius Mode?</label>
<div class="col-md-6"> <div class="col-md-6">
<select name="radius_mode" id="radius_mode" class="form-control"> <select name="radius_mode" id="radius_mode" class="form-control">

52
ui/ui/pg-duitku.tpl Normal file
View File

@ -0,0 +1,52 @@
{include file="sections/header.tpl"}
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/duitku-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">DUITKU</div>
<div class="panel-body">
<div class="form-group">
<label class="col-md-2 control-label">Kode Merchant</label>
<div class="col-md-6">
<input type="text" class="form-control" id="duitku_merchant_id" name="duitku_merchant_id" placeholder="D" value="{$_c['duitku_merchant_id']}">
<a href="https://duitku.com/merchant/Project" target="_blank" class="help-block">https://duitku.com/merchant/Project</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Merchant/API Key</label>
<div class="col-md-6">
<input type="text" class="form-control" id="duitku_merchant_key" name="duitku_merchant_key" placeholder="xxxxxxxxxxxxxxxxx" value="{$_c['duitku_merchant_key']}">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Url Callback Proyek</label>
<div class="col-md-6">
<input type="text" readonly class="form-control" onclick="this.select()" value="{$_url}callback/duitku">
<a href="https://duitku.com/merchant/Project" target="_blank" class="help-block">https://duitku.com/merchant/Project</a>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Channels</label>
<div class="col-md-6">
{foreach $channels as $channel}
<label class="checkbox-inline"><input type="checkbox" {if strpos($_c['duitku_channel'], $channel['id']) !== false}checked="true"{/if} id="duitku_channel" name="duitku_channel[]" value="{$channel['id']}"> {$channel['name']}</label>
{/foreach}
</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>
<pre>/ip hotspot walled-garden
add dst-host=duitku.com
add dst-host=*.duitku.com</pre>
</div>
</div>
</div>
</div>
</form>
{include file="sections/footer.tpl"}

View File

@ -271,6 +271,7 @@
<li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/xendit">Xendit</a></li> <li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/xendit">Xendit</a></li>
{* <li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/midtrans">Midtrans</a></li> *} {* <li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/midtrans">Midtrans</a></li> *}
<li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/tripay">Tripay</a></li> <li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/tripay">Tripay</a></li>
<li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/duitku">Duitku</a></li>
<li>&nbsp;</li> <li>&nbsp;</li>
</ul> </ul>
</li> </li>