plugin system for payment gateway
This commit is contained in:
parent
0bd6c9e3c7
commit
061224b469
@ -1,95 +0,0 @@
|
||||
<?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 createTransaction($channel)
|
||||
{
|
||||
global $_c;
|
||||
$json = [
|
||||
'paymentMethod' => $channel,
|
||||
'paymentAmount' => $this->trx['price'],
|
||||
'merchantCode' => $_c['duitku_merchant_id'],
|
||||
'merchantOrderId' => $this->trx['id'],
|
||||
'productDetails' => $this->trx['plan_name'],
|
||||
'merchantUserInfo' => $this->user['fullname'],
|
||||
'customerVaName' => $this->user['fullname'],
|
||||
'email' => (empty($this->user['email'])) ? $this->user['username'] . '@' . $_SERVER['HTTP_HOST'] : $this->user['email'],
|
||||
'phoneNumber' => $this->user['phonenumber'],
|
||||
'itemDetails' => [
|
||||
[
|
||||
'name' => $this->trx['plan_name'],
|
||||
'price' => $this->trx['price'],
|
||||
'quantity' => 1
|
||||
]
|
||||
],
|
||||
'returnUrl' => U . 'order/view/' . $this->trx['id'] . '/check',
|
||||
'signature' => md5($_c['duitku_merchant_id'] . $this->trx['id'] . $this->trx['price'] . $_c['duitku_merchant_key'])
|
||||
];
|
||||
return json_decode(Http::postJsonData($this->getServer() . 'v2/inquiry', $json), true);
|
||||
/*
|
||||
{
|
||||
"merchantCode": "DXXXX",
|
||||
"reference": "DXXXXCX80TZJ85Q70QCI",
|
||||
"paymentUrl": "https://sandbox.duitku.com/topup/topupdirectv2.aspx?ref=BCA7WZ7EIDXXXXWEC",
|
||||
"vaNumber": "7007014001444348",
|
||||
"qrString": "",
|
||||
"amount": "40000",
|
||||
"statusCode": "00",
|
||||
"statusMessage": "SUCCESS"
|
||||
}
|
||||
00 - Success
|
||||
01 - Pending
|
||||
02 - Canceled
|
||||
*/
|
||||
}
|
||||
|
||||
function getStatus()
|
||||
{
|
||||
global $_c;
|
||||
$json = [
|
||||
'merchantCode' => $_c['duitku_merchant_id'],
|
||||
'merchantOrderId' => $this->trx['id'],
|
||||
'signature' => md5($_c['duitku_merchant_id'] . $this->trx['id'] . $_c['duitku_merchant_key'])
|
||||
];
|
||||
return json_decode(Http::postJsonData($this->getServer() . 'transactionStatus', $json), true);
|
||||
/*
|
||||
{
|
||||
"merchantOrderId": "abcde12345",
|
||||
"reference": "DXXXXCX80TZJ85Q70QCI",
|
||||
"amount": "100000",
|
||||
"statusCode": "00",
|
||||
"statusMessage": "SUCCESS"
|
||||
}
|
||||
00 - Success
|
||||
01 - Pending
|
||||
02 - Canceled
|
||||
*/
|
||||
}
|
||||
|
||||
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/';
|
||||
}
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
*
|
||||
* Payment Gateway Tripay
|
||||
**/
|
||||
|
||||
class PGTripay
|
||||
{
|
||||
protected $user;
|
||||
protected $trx;
|
||||
|
||||
public function __construct($trx, $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->trx = $trx;
|
||||
}
|
||||
|
||||
function getSignature()
|
||||
{
|
||||
global $_c;
|
||||
return hash_hmac('sha256', $_c['tripay_merchant'] . $this->trx['id'] . $this->trx['price'], $_c['tripay_secret_key']);
|
||||
}
|
||||
|
||||
function createTransaction($channel)
|
||||
{
|
||||
global $_c;
|
||||
$json = [
|
||||
'method' => $channel,
|
||||
'amount' => $this->trx['price'],
|
||||
'merchant_ref' => $this->trx['id'],
|
||||
'customer_name' => $this->user['fullname'],
|
||||
'customer_email' => (empty($this->user['email'])) ? $this->user['username'] . '@' . $_SERVER['HTTP_HOST'] : $this->user['email'],
|
||||
'customer_phone' => $this->user['phonenumber'],
|
||||
'order_items' => [
|
||||
[
|
||||
'name' => $this->trx['plan_name'],
|
||||
'price' => $this->trx['price'],
|
||||
'quantity' => 1
|
||||
]
|
||||
],
|
||||
'return_url' => U . 'order/view/' . $this->trx['id'] . '/check',
|
||||
'signature' => $this->getSignature()
|
||||
];
|
||||
return json_decode(Http::postJsonData($this->getServer() . 'transaction/create', $json, ['Authorization: Bearer ' . $_c['tripay_api_key']]), true);
|
||||
/*
|
||||
{
|
||||
"success": true,
|
||||
"message": "",
|
||||
"data": {
|
||||
"reference": "T0001000000000000006",
|
||||
"merchant_ref": "INV345675",
|
||||
"payment_selection_type": "static",
|
||||
"payment_method": "BRIVA",
|
||||
"payment_name": "BRI Virtual Account",
|
||||
"customer_name": "Nama Pelanggan",
|
||||
"customer_email": "emailpelanggan@domain.com",
|
||||
"customer_phone": "081234567890",
|
||||
"callback_url": "https://domainanda.com/callback",
|
||||
"return_url": "https://domainanda.com/redirect",
|
||||
"amount": 1000000,
|
||||
"fee_merchant": 1500,
|
||||
"fee_customer": 0,
|
||||
"total_fee": 1500,
|
||||
"amount_received": 998500,
|
||||
"pay_code": "57585748548596587",
|
||||
"pay_url": null,
|
||||
"checkout_url": "https://tripay.co.id/checkout/T0001000000000000006",
|
||||
"status": "UNPAID",
|
||||
"expired_time": 1582855837,
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function getStatus($trxID)
|
||||
{
|
||||
global $_c;
|
||||
return json_decode(Http::getData($this->getServer() . 'transaction/detail?'.http_build_query(['reference'=>$trxID]), [
|
||||
'Authorization: Bearer ' . $_c['tripay_api_key']
|
||||
]), true);
|
||||
/*
|
||||
{
|
||||
"success": true,
|
||||
"message": "",
|
||||
"data": {
|
||||
"reference": "T0001000000000000006",
|
||||
"merchant_ref": "INV345675",
|
||||
"payment_selection_type": "static",
|
||||
"payment_method": "BRIVA",
|
||||
"payment_name": "BRI Virtual Account",
|
||||
"customer_name": "Nama Pelanggan",
|
||||
"customer_email": "emailpelanggan@domain.com",
|
||||
"customer_phone": "081234567890",
|
||||
"callback_url": "https://domainanda.com/callback",
|
||||
"return_url": "https://domainanda.com/redirect",
|
||||
"amount": 1000000,
|
||||
"fee_merchant": 1500,
|
||||
"fee_customer": 0,
|
||||
"total_fee": 1500,
|
||||
"amount_received": 998500,
|
||||
"pay_code": "57585748548596587",
|
||||
"pay_url": null,
|
||||
"checkout_url": "https://tripay.co.id/checkout/T0001000000000000006",
|
||||
"status": "PAID",
|
||||
"expired_time": 1582855837,
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private function getServer()
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'Live') {
|
||||
return 'https://tripay.co.id/api/';
|
||||
} else {
|
||||
return 'https://tripay.co.id/api-sandbox/';
|
||||
}
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
*
|
||||
* Payment Gateway Xendit
|
||||
**/
|
||||
|
||||
class PGXendit {
|
||||
protected $user;
|
||||
protected $trx;
|
||||
protected $channel;
|
||||
|
||||
public function __construct($trx,$user) {
|
||||
$this->user = $user;
|
||||
$this->trx = $trx;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function createInvoice()
|
||||
{
|
||||
global $_c;
|
||||
$json = [
|
||||
'external_id' => $this->trx['id'],
|
||||
'amount' => $this->trx['price'],
|
||||
'description' => $this->trx['plan_name'],
|
||||
'customer' => [
|
||||
'mobile_number' => $this->user['phonenumber'],
|
||||
],
|
||||
'customer_notification_preference' => [
|
||||
'invoice_created' => ['whatsapp', 'sms'],
|
||||
'invoice_reminder' => ['whatsapp', 'sms'],
|
||||
'invoice_paid' => ['whatsapp', 'sms'],
|
||||
'invoice_expired' => ['whatsapp', 'sms']
|
||||
],
|
||||
'payment_methods ' => explode(',', $_c['xendit_channel']),
|
||||
'success_redirect_url' => U . 'order/view/' . $this->trx['id'] . '/check',
|
||||
'failure_redirect_url' => U . 'order/view/' . $this->trx['id'] . '/check'
|
||||
];
|
||||
|
||||
return json_decode(Http::postJsonData($this->getServer() . 'invoices', $json, ['Authorization: Basic ' . base64_encode($_c['xendit_secret_key'] . ':')]), true);
|
||||
/*
|
||||
{
|
||||
"id": "631597513897510bace2459d", #gateway_trx_id
|
||||
"external_id": "test-va-success-1662359375",
|
||||
"user_id": "599bd7f1ccab55b020bb1147",
|
||||
"status": "PENDING",
|
||||
"merchant_name": "Xendit",
|
||||
"merchant_profile_picture_url": "https://xnd-companies.s3.amazonaws.com/prod/1538466380522_868.png",
|
||||
"amount": 3000000,
|
||||
"description": "Test - VA Successful invoice payment",
|
||||
"expiry_date": "2022-09-06T06:29:37.251Z",
|
||||
"invoice_url": "https://checkout-staging.xendit.co/web/631597513897510bace2459d"
|
||||
"created": "2022-09-05T06:29:37.954Z",
|
||||
"updated": "2022-09-05T06:29:37.954Z"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function getInvoice($xendittrxID)
|
||||
{
|
||||
global $_c;
|
||||
return json_decode(Http::getData($this->getServer() . 'invoices/' . $xendittrxID, [
|
||||
'Authorization: Basic ' . base64_encode($_c['xendit_secret_key'] . ':')
|
||||
]), true);
|
||||
/*
|
||||
{
|
||||
"id": "631597513897510bace2459d", #gateway_trx_id
|
||||
"external_id": "test-va-success-1662359375",
|
||||
"user_id": "599bd7f1ccab55b020bb1147",
|
||||
"status": "PENDING", // CHECK THIS
|
||||
"merchant_name": "Xendit",
|
||||
"merchant_profile_picture_url": "https://xnd-companies.s3.amazonaws.com/prod/1538466380522_868.png",
|
||||
"amount": 3000000,
|
||||
"description": "Test - VA Successful invoice payment",
|
||||
"expiry_date": "2022-09-06T06:29:37.251Z",
|
||||
"invoice_url": "https://checkout-staging.xendit.co/web/631597513897510bace2459d"
|
||||
"created": "2022-09-05T06:29:37.954Z",
|
||||
"updated": "2022-09-05T06:29:37.954Z"
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private function getServer(){
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'Live') {
|
||||
return 'https://api.xendit.co/v2/';
|
||||
} else {
|
||||
return 'https://api.xendit.co/v2/';
|
||||
}
|
||||
}
|
||||
}
|
@ -18,8 +18,8 @@ switch ($action) {
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->find_many();
|
||||
$paginator = Paginator::bootstrap('tbl_payment_gateway','username',$user['username']);
|
||||
$ui->assign('paginator',$paginator);
|
||||
$paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
|
||||
$ui->assign('paginator', $paginator);
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('_title', Lang::T('Order History') . ' - ' . $config['CompanyName']);
|
||||
$ui->display('user-orderHistory.tpl');
|
||||
@ -37,13 +37,13 @@ switch ($action) {
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
if($d){
|
||||
if ($d) {
|
||||
if (empty($d['pg_url_payment'])) {
|
||||
r2(U . "order/buy/" . $trx['routers_id'] .'/'.$trx['plan_id'], 'w', Lang::T("Checking payment"));
|
||||
}else{
|
||||
r2(U . "order/view/" . $d['id'].'/check/', 's', Lang::T("You have unpaid transaction"));
|
||||
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));
|
||||
} else {
|
||||
r2(U . "order/view/" . $d['id'] . '/check/', 's', Lang::T("You have unpaid transaction"));
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
r2(U . "order/package/", 's', Lang::T("You have no unpaid transaction"));
|
||||
}
|
||||
case 'view':
|
||||
@ -51,99 +51,22 @@ switch ($action) {
|
||||
$trx = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->find_one($trxid);
|
||||
// jika tidak ditemukan, berarti punya orang lain
|
||||
if (empty($trx)) {
|
||||
r2(U . "order/package", 'w', Lang::T("Payment not found"));
|
||||
}
|
||||
// jika url kosong, balikin ke buy
|
||||
if (empty($trx['pg_url_payment'])) {
|
||||
r2(U . "order/buy/" . $trx['routers_id'] .'/'.$trx['plan_id'], 'w', Lang::T("Checking payment"));
|
||||
r2(U . "order/buy/" . $trx['routers_id'] . '/' . $trx['plan_id'], 'w', Lang::T("Checking payment"));
|
||||
}
|
||||
if ($routes['3'] == 'check') {
|
||||
if ($trx['gateway'] == 'xendit') {
|
||||
$pg = new PGXendit($trx,$user);
|
||||
$result = $pg->getInvoice($trx['gateway_trx_id']);
|
||||
if (!file_exists('system/paymentgateway/' . $trx['gateway'] . '.php')) {
|
||||
r2(U . 'order/view/' . $trxid, 'e', Lang::T("No Payment Gateway Available"));
|
||||
}
|
||||
include 'system/paymentgateway/' . $trx['gateway'] . '.php';
|
||||
call_user_func($trx['gateway'] . '_validate_config');
|
||||
call_user_func($_c['payment_gateway'] . '_get_status', $trx, $user);
|
||||
|
||||
if ($result['status'] == 'PENDING') {
|
||||
r2(U . "order/view/" . $trxid, 'w', Lang::T("Transaction still unpaid."));
|
||||
} else if (in_array($result['status'],['PAID','SETTLED']) && $trx['status'] != 2) {
|
||||
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_method'] . ' ' . $result['payment_channel'])) {
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Failed to activate your Package, try again later."));
|
||||
}
|
||||
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->payment_method = $result['payment_method'];
|
||||
$trx->payment_channel = $result['payment_channel'];
|
||||
$trx->paid_date = date('Y-m-d H:i:s', strtotime($result['updated']));
|
||||
$trx->status = 2;
|
||||
$trx->save();
|
||||
|
||||
r2(U . "order/view/" . $trxid, 's', Lang::T("Transaction has been paid."));
|
||||
} else if ($result['status'] == 'EXPIRED') {
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->status = 3;
|
||||
$trx->save();
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Transaction expired."));
|
||||
}else if($trx['status'] == 2){
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Transaction has been paid.."));
|
||||
}
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Unknown Command."));
|
||||
} else if ($trx['gateway'] == 'tripay') {
|
||||
$pg = new PGTripay($trx,$user);
|
||||
$result = $pg->getStatus($trx['gateway_trx_id']);
|
||||
if ($result['success']!=1) {
|
||||
sendTelegram("Tripay payment status failed\n\n".json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . "order/view/" . $trxid, 'w', Lang::T("Payment check failed."));
|
||||
}
|
||||
$result = $result['data'];
|
||||
if ($result['status'] == 'UNPAID') {
|
||||
r2(U . "order/view/" . $trxid, 'w', Lang::T("Transaction still unpaid."));
|
||||
} else if (in_array($result['status'],['PAID','SETTLED']) && $trx['status'] != 2) {
|
||||
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_method'] . ' ' . $result['payment_channel'])) {
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Failed to activate your Package, try again later."));
|
||||
}
|
||||
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->payment_method = $result['payment_method'];
|
||||
$trx->payment_channel = $result['payment_name'];
|
||||
$trx->paid_date = date('Y-m-d H:i:s', $result['paid_at']);
|
||||
$trx->status = 2;
|
||||
$trx->save();
|
||||
|
||||
r2(U . "order/view/" . $trxid, 's', Lang::T("Transaction has been paid."));
|
||||
} else if (in_array($result['status'],['EXPIRED','FAILED','REFUND'])) {
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->status = 3;
|
||||
$trx->save();
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Transaction expired."));
|
||||
}else if($trx['status'] == 2){
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Transaction has been paid.."));
|
||||
}
|
||||
} else if ($trx['gateway'] == 'duitku') {
|
||||
$pg = new PGDuitku($trx,$user);
|
||||
$result = $pg->getStatus($trx['id']);
|
||||
if ($result['reference']!=$trx['gateway_trx_id']) {
|
||||
sendTelegram("Duitku payment status failed\n\n".json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . "order/view/" . $trxid, 'w', Lang::T("Payment check failed."));
|
||||
}
|
||||
if ($result['statusCode'] == '01') {
|
||||
r2(U . "order/view/" . $trxid, 'w', Lang::T("Transaction still unpaid."));
|
||||
} else if ($result['statusCode']=='00' && $trx['status'] != 2) {
|
||||
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_method'] . ' ' . $result['payment_channel'])) {
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Failed to activate your Package, try again later."));
|
||||
}
|
||||
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->paid_date = date('Y-m-d H:i:s');
|
||||
$trx->status = 2;
|
||||
$trx->save();
|
||||
|
||||
r2(U . "order/view/" . $trxid, 's', Lang::T("Transaction has been paid."));
|
||||
} else if ($result['statusCode']=='02') {
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->status = 3;
|
||||
$trx->save();
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Transaction expired or Failed."));
|
||||
}else if($trx['status'] == 2){
|
||||
r2(U . "order/view/" . $trxid, 'd', Lang::T("Transaction has been paid.."));
|
||||
}
|
||||
}
|
||||
} else if ($routes['3'] == 'cancel') {
|
||||
$trx->pg_paid_response = '{}';
|
||||
$trx->status = 4;
|
||||
@ -152,7 +75,7 @@ switch ($action) {
|
||||
$trx = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->find_one($trxid);
|
||||
if('midtrans'==$trx['gateway']){
|
||||
if ('midtrans' == $trx['gateway']) {
|
||||
//Hapus invoice link
|
||||
}
|
||||
}
|
||||
@ -173,7 +96,12 @@ switch ($action) {
|
||||
if ($_c['payment_gateway'] == 'none') {
|
||||
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
|
||||
}
|
||||
$back = "order/package";
|
||||
if (!file_exists('system/paymentgateway/' . $_c['payment_gateway'] . '.php')) {
|
||||
r2(U . 'home', 'e', Lang::T("No Payment Gateway Available"));
|
||||
}
|
||||
include 'system/paymentgateway/' . $_c['payment_gateway'] . '.php';
|
||||
call_user_func($_c['payment_gateway'] . '_validate_config');
|
||||
|
||||
$router = ORM::for_table('tbl_routers')->where('enabled', '1')->find_one($routes['2'] * 1);
|
||||
$plan = ORM::for_table('tbl_plans')->where('enabled', '1')->find_one($routes['3'] * 1);
|
||||
if (empty($router) || empty($plan)) {
|
||||
@ -183,19 +111,19 @@ switch ($action) {
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
if($d){
|
||||
if ($d) {
|
||||
if ($d['pg_url_payment']) {
|
||||
r2(U . "order/view/" . $d['id'], 'w', Lang::T("You already have unpaid transaction, cancel it or pay it."));
|
||||
}else{
|
||||
if($_c['payment_gateway']==$d['gateway']){
|
||||
} else {
|
||||
if ($_c['payment_gateway'] == $d['gateway']) {
|
||||
$id = $d['id'];
|
||||
}else{
|
||||
} else {
|
||||
$d->status = 4;
|
||||
$d->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(empty($id)){
|
||||
if (empty($id)) {
|
||||
$d = ORM::for_table('tbl_payment_gateway')->create();
|
||||
$d->username = $user['username'];
|
||||
$d->gateway = $_c['payment_gateway'];
|
||||
@ -208,7 +136,7 @@ switch ($action) {
|
||||
$d->status = 1;
|
||||
$d->save();
|
||||
$id = $d->id();
|
||||
}else{
|
||||
} else {
|
||||
$d->username = $user['username'];
|
||||
$d->gateway = $_c['payment_gateway'];
|
||||
$d->plan_id = $plan['id'];
|
||||
@ -220,107 +148,10 @@ switch ($action) {
|
||||
$d->status = 1;
|
||||
$d->save();
|
||||
}
|
||||
if ($_c['payment_gateway'] == 'xendit') {
|
||||
if (empty($_c['xendit_secret_key'])) {
|
||||
sendTelegram("Xendit payment gateway not configured");
|
||||
r2(U . $back, 'e', Lang::T("Admin has not yet setup Xendit payment gateway, please tell admin"));
|
||||
}
|
||||
if ($id) {
|
||||
$pg = new PGXendit($d,$user);
|
||||
$result = $pg->createInvoice($id, $plan['price'], $user['username'], $plan['name_plan']);
|
||||
if (!$result['id']) {
|
||||
r2(U . $back, 'e', Lang::T("Failed to create transaction."));
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
$d->gateway_trx_id = $result['id'];
|
||||
$d->pg_url_payment = $result['invoice_url'];
|
||||
$d->pg_request = json_encode($result);
|
||||
$d->expired_date = date('Y-m-d H:i:s', strtotime($result['expiry_date']));
|
||||
$d->save();
|
||||
header('Location: ' . $result['invoice_url']);
|
||||
exit();
|
||||
if (!$id) {
|
||||
r2(U . "order/package/" . $d['id'], 'e', Lang::T("Failed to create Transaction.."));
|
||||
} else {
|
||||
r2(U . "order/view/" . $d['id'], 'w', Lang::T("Failed to create Transaction.."));
|
||||
}
|
||||
} else if ($_c['payment_gateway'] == 'tripay') {
|
||||
if (empty($_c['tripay_secret_key'])) {
|
||||
sendTelegram("Tripay payment gateway not configured");
|
||||
r2(U . $back, 'e', Lang::T("Admin has not yet setup Tripay payment gateway, please tell admin"));
|
||||
}
|
||||
if(!in_array($routes['4'],explode(",",$_c['tripay_channel']))){
|
||||
$ui->assign('_title', 'Tripay Channel - ' . $config['CompanyName']);
|
||||
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true));
|
||||
$ui->assign('tripay_channels', explode(",",$_c['tripay_channel']));
|
||||
$ui->assign('path', $routes['2'].'/'.$routes['3']);
|
||||
$ui->display('tripay_channel.tpl');
|
||||
break;
|
||||
}
|
||||
if ($id) {
|
||||
$pg = new PGTripay($d,$user);
|
||||
$result = $pg->createTransaction($routes['4']);
|
||||
if ($result['success']!=1) {
|
||||
sendTelegram("Tripay payment failed\n\n".json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . $back, 'e', Lang::T("Failed to create transaction."));
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
$d->gateway_trx_id = $result['data']['reference'];
|
||||
$d->pg_url_payment = $result['data']['checkout_url'];
|
||||
$d->pg_request = json_encode($result);
|
||||
$d->expired_date = date('Y-m-d H:i:s', $result['data']['expired_time']);
|
||||
$d->save();
|
||||
r2(U . "order/view/" . $id, 'w', Lang::T("Create Transaction Success"));
|
||||
exit();
|
||||
} else {
|
||||
r2(U . "order/view/" . $d['id'], 'w', Lang::T("Failed to create Transaction.."));
|
||||
}
|
||||
} else if ($_c['payment_gateway'] == 'duitku') {
|
||||
if (empty($_c['duitku_merchant_key'])) {
|
||||
sendTelegram("Duitku payment gateway not configured");
|
||||
r2(U . $back, 'e', Lang::T("Admin has not yet setup Duitku payment gateway, please tell admin"));
|
||||
}
|
||||
$channels = json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true);
|
||||
if(!in_array($routes['4'],explode(",",$_c['duitku_channel']))){
|
||||
$ui->assign('_title', 'Duitku Channel - ' . $config['CompanyName']);
|
||||
$ui->assign('channels', $channels);
|
||||
$ui->assign('duitku_channels', explode(",",$_c['duitku_channel']));
|
||||
$ui->assign('path', $routes['2'].'/'.$routes['3']);
|
||||
$ui->display('duitku_channel.tpl');
|
||||
break;
|
||||
}
|
||||
if ($id) {
|
||||
$pg = new PGDuitku($d,$user);
|
||||
$result = $pg->createTransaction($routes['4']);
|
||||
if (empty($result['paymentUrl'])) {
|
||||
sendTelegram("Duitku payment failed\n\n".json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . $back, 'e', Lang::T("Failed to create transaction."));
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
$d->gateway_trx_id = $result['reference'];
|
||||
$d->pg_url_payment = $result['paymentUrl'];
|
||||
$d->payment_method = $routes['4'];
|
||||
foreach($channels as $channel){
|
||||
if($channel['id']==$routes['4']){
|
||||
$d->payment_channel = $channel['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$d->pg_request = json_encode($result);
|
||||
$d->expired_date = date('Y-m-d H:i:s', strtotime("+1 day"));
|
||||
$d->save();
|
||||
r2(U . "order/view/" . $id, 'w', Lang::T("Create Transaction Success"));
|
||||
exit();
|
||||
} else {
|
||||
r2(U . "order/view/" . $d['id'], 'w', Lang::T("Failed to create Transaction.."));
|
||||
}
|
||||
call_user_func($_c['payment_gateway'] . '_create_transaction', $d, $user);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -5,206 +5,51 @@
|
||||
_admin();
|
||||
$ui->assign('_system_menu', 'paymentgateway');
|
||||
|
||||
$action = $routes['1'];
|
||||
$action = alphanumeric($routes['1']);
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
|
||||
switch ($action) {
|
||||
case 'xendit':
|
||||
$ui->assign('_title', 'Xendit - Payment Gateway - '. $config['CompanyName']);
|
||||
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_xendit.json'), true));
|
||||
$ui->display('pg-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();
|
||||
if(file_exists('system/paymentgateway/'.$action.'.php')){
|
||||
include 'system/paymentgateway/'.$action.'.php';
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if(function_exists($action.'_save_config')){
|
||||
call_user_func($action.'_save_config');
|
||||
}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();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_channel')->find_one();
|
||||
if($d){
|
||||
$d->value = implode(',',$_POST['xendit_channel']);
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'xendit_channel';
|
||||
$d->value = implode(',',$_POST['xendit_channel']);
|
||||
$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->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_midtrans.json'), true));
|
||||
$ui->display('pg-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();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'midtrans_channel')->find_one();
|
||||
if($d){
|
||||
$d->value = implode(',',$_POST['midtrans_channel']);
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'midtrans_channel';
|
||||
$d->value = implode(',',$_POST['midtrans_channel']);
|
||||
$d->save();
|
||||
}
|
||||
|
||||
_log('[' . $admin['username'] . ']: Midtrans ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
|
||||
|
||||
r2(U . 'paymentgateway/midtrans', 's', $_L['Settings_Saved_Successfully']);
|
||||
break;
|
||||
case 'tripay':
|
||||
$ui->assign('_title', 'Tripay - Payment Gateway - '. $config['CompanyName']);
|
||||
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true));
|
||||
$ui->display('pg-tripay.tpl');
|
||||
break;
|
||||
case 'tripay-post':
|
||||
$tripay_merchant = _post('tripay_merchant');
|
||||
$tripay_api_key = _post('tripay_api_key');
|
||||
$tripay_secret_key = _post('tripay_secret_key');
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_merchant')->find_one();
|
||||
if($d){
|
||||
$d->value = $tripay_merchant;
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_merchant';
|
||||
$d->value = $tripay_merchant;
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_api_key')->find_one();
|
||||
if($d){
|
||||
$d->value = $tripay_api_key;
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_api_key';
|
||||
$d->value = $tripay_api_key;
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_secret_key')->find_one();
|
||||
if($d){
|
||||
$d->value = $tripay_secret_key;
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_secret_key';
|
||||
$d->value = $tripay_secret_key;
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_channel')->find_one();
|
||||
if($d){
|
||||
$d->value = implode(',',$_POST['tripay_channel']);
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_channel';
|
||||
$d->value = implode(',',$_POST['tripay_channel']);
|
||||
$d->save();
|
||||
}
|
||||
|
||||
_log('[' . $admin['username'] . ']: Tripay ' . $_L['Settings_Saved_Successfully'].json_encode($_POST['tripay_channel']), 'Admin', $admin['id']);
|
||||
|
||||
r2(U . 'paymentgateway/tripay', 's', $_L['Settings_Saved_Successfully']);
|
||||
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');
|
||||
}
|
||||
}else{
|
||||
if(function_exists($action.'_show_config')){
|
||||
call_user_func($action.'_show_config');
|
||||
}else{
|
||||
$ui->display('a404.tpl');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!empty($action)){
|
||||
r2(U . 'paymentgateway', 'w', Lang::T('Payment Gateway Not Found'));
|
||||
}else{
|
||||
$files = scandir('system/paymentgateway/');
|
||||
foreach($files as $file){
|
||||
if(pathinfo($file, PATHINFO_EXTENSION)=='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 - '. $config['CompanyName']);
|
||||
$ui->assign('pgs', $pgs);
|
||||
$ui->display('paymentgateway.tpl');
|
||||
}
|
||||
}
|
@ -207,7 +207,6 @@ switch ($action) {
|
||||
$address = _post('address');
|
||||
$tawkto = _post('tawkto');
|
||||
$radius_mode = _post('radius_mode')*1;
|
||||
$payment_gateway = _post('payment_gateway');
|
||||
if ($company == '') {
|
||||
r2(U . 'settings/app', 'e', $_L['All_field_is_required']);
|
||||
} else {
|
||||
@ -268,16 +267,6 @@ 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();
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tawkto')->find_one();
|
||||
if($d){
|
||||
|
@ -291,3 +291,5 @@ $_L['Order_History'] = 'Order History';
|
||||
$_L['Gateway'] = 'Gateway';
|
||||
$_L['Date_Done'] = 'Date Done';
|
||||
$_L['Unpaid_Order'] = 'Unpaid Order';
|
||||
$_L['Payment_Gateway_Not_Found'] = 'Payment Gateway Not Found';
|
||||
$_L['Payment_Gateway_saved_successfully'] = 'Payment Gateway saved successfully';
|
||||
|
170
system/paymentgateway/duitku.php
Normal file
170
system/paymentgateway/duitku.php
Normal file
@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
*
|
||||
* Payment Gateway duitku.com
|
||||
**/
|
||||
|
||||
function duitku_validate_config()
|
||||
{
|
||||
global $config;
|
||||
if (empty($config['duitku_merchant_key'])) {
|
||||
sendTelegram("Duitku payment gateway not configured");
|
||||
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Duitku payment gateway, please tell admin"));
|
||||
}
|
||||
}
|
||||
|
||||
function duitku_show_config()
|
||||
{
|
||||
global $ui, $config;
|
||||
$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');
|
||||
}
|
||||
|
||||
function duitku_save_config()
|
||||
{
|
||||
global $admin;
|
||||
$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 ' . Lang::T('Settings_Saved_Successfully'), 'Admin', $admin['id']);
|
||||
r2(U . 'paymentgateway/duitku', 's', Lang::T('Settings_Saved_Successfully'));
|
||||
}
|
||||
|
||||
function duitku_create_transaction($trx, $user)
|
||||
{
|
||||
global $config, $routes, $ui;
|
||||
|
||||
$channels = json_decode(file_get_contents('system/paymentgateway/channel_duitku.json'), true);
|
||||
if (!in_array($routes[4], explode(",", $config['duitku_channel']))) {
|
||||
$ui->assign('_title', 'Duitku Channel - ' . $config['CompanyName']);
|
||||
$ui->assign('channels', $channels);
|
||||
$ui->assign('duitku_channels', explode(",", $config['duitku_channel']));
|
||||
$ui->assign('path', $routes['2'] . '/' . $routes['3']);
|
||||
$ui->display('duitku_channel.tpl');
|
||||
die();
|
||||
}
|
||||
|
||||
$json = [
|
||||
'paymentMethod' => $routes[4],
|
||||
'paymentAmount' => $trx['price'],
|
||||
'merchantCode' => $config['duitku_merchant_id'],
|
||||
'merchantOrderId' => $trx['id'],
|
||||
'productDetails' => $trx['plan_name'],
|
||||
'merchantUserInfo' => $user['fullname'],
|
||||
'customerVaName' => $user['fullname'],
|
||||
'email' => (empty($user['email'])) ? $user['username'] . '@' . $_SERVER['HTTP_HOST'] : $user['email'],
|
||||
'phoneNumber' => $user['phonenumber'],
|
||||
'itemDetails' => [
|
||||
[
|
||||
'name' => $trx['plan_name'],
|
||||
'price' => $trx['price'],
|
||||
'quantity' => 1
|
||||
]
|
||||
],
|
||||
'returnUrl' => U . 'order/view/' . $trx['id'] . '/check',
|
||||
'signature' => md5($config['duitku_merchant_id'] . $trx['id'] . $trx['price'] . $config['duitku_merchant_key'])
|
||||
];
|
||||
|
||||
$result = json_decode(Http::postJsonData(duitku_get_server() . 'v2/inquiry', $json), true);
|
||||
|
||||
if (empty($result['paymentUrl'])) {
|
||||
sendTelegram("Duitku payment failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
$d->gateway_trx_id = $result['reference'];
|
||||
$d->pg_url_payment = $result['paymentUrl'];
|
||||
$d->payment_method = $routes['4'];
|
||||
foreach ($channels as $channel) {
|
||||
if ($channel['id'] == $routes['4']) {
|
||||
$d->payment_channel = $channel['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$d->pg_request = json_encode($result);
|
||||
$d->expired_date = date('Y-m-d H:i:s', strtotime("+1 day"));
|
||||
$d->save();
|
||||
r2(U . "order/view/" . $d['id'], 's', Lang::T("Create Transaction Success"));
|
||||
}
|
||||
|
||||
function duitku_get_status($trx, $user)
|
||||
{
|
||||
global $config;
|
||||
$json = [
|
||||
'merchantCode' => $config['duitku_merchant_id'],
|
||||
'merchantOrderId' => $trx['id'],
|
||||
'signature' => md5($config['duitku_merchant_id'] . $trx['id'] . $config['duitku_merchant_key'])
|
||||
];
|
||||
$result = json_decode(Http::postJsonData(duitku_get_server() . 'transactionStatus', $json), true);
|
||||
if ($result['reference'] != $trx['gateway_trx_id']) {
|
||||
sendTelegram("Duitku payment status failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Payment check failed."));
|
||||
}
|
||||
if ($result['statusCode'] == '01') {
|
||||
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
|
||||
} else if ($result['statusCode'] == '00' && $trx['status'] != 2) {
|
||||
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_method'] . ' ' . $result['payment_channel'])) {
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
|
||||
}
|
||||
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->paid_date = date('Y-m-d H:i:s');
|
||||
$trx->status = 2;
|
||||
$trx->save();
|
||||
|
||||
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
|
||||
} else if ($result['statusCode'] == '02') {
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->status = 3;
|
||||
$trx->save();
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired or Failed."));
|
||||
} else if ($trx['status'] == 2) {
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
|
||||
}
|
||||
}
|
||||
|
||||
function duitku_get_server()
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'Live') {
|
||||
return 'https://passport.duitku.com/webapi/api/merchant/';
|
||||
} else {
|
||||
return 'https://sandbox.duitku.com/webapi/api/merchant/';
|
||||
}
|
||||
}
|
172
system/paymentgateway/tripay.php
Normal file
172
system/paymentgateway/tripay.php
Normal file
@ -0,0 +1,172 @@
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
*
|
||||
* Payment Gateway tripay.com
|
||||
**/
|
||||
|
||||
function duitku_validate_config()
|
||||
{
|
||||
global $config;
|
||||
if (empty($config['tripay_secret_key'])) {
|
||||
sendTelegram("Tripay payment gateway not configured");
|
||||
r2(U . 'order/package', 'w', Lang::T("Admin has not yet setup Tripay payment gateway, please tell admin"));
|
||||
}
|
||||
}
|
||||
|
||||
function tripay_show_config()
|
||||
{
|
||||
global $ui, $config;
|
||||
$ui->assign('_title', 'Tripay - Payment Gateway - ' . $config['CompanyName']);
|
||||
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true));
|
||||
$ui->display('pg-tripay.tpl');
|
||||
}
|
||||
|
||||
function tripay_save_config()
|
||||
{
|
||||
global $admin, $_L;
|
||||
$tripay_merchant = _post('tripay_merchant');
|
||||
$tripay_api_key = _post('tripay_api_key');
|
||||
$tripay_secret_key = _post('tripay_secret_key');
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_merchant')->find_one();
|
||||
if ($d) {
|
||||
$d->value = $tripay_merchant;
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_merchant';
|
||||
$d->value = $tripay_merchant;
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_api_key')->find_one();
|
||||
if ($d) {
|
||||
$d->value = $tripay_api_key;
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_api_key';
|
||||
$d->value = $tripay_api_key;
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_secret_key')->find_one();
|
||||
if ($d) {
|
||||
$d->value = $tripay_secret_key;
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_secret_key';
|
||||
$d->value = $tripay_secret_key;
|
||||
$d->save();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'tripay_channel')->find_one();
|
||||
if ($d) {
|
||||
$d->value = implode(',', $_POST['tripay_channel']);
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'tripay_channel';
|
||||
$d->value = implode(',', $_POST['tripay_channel']);
|
||||
$d->save();
|
||||
}
|
||||
|
||||
_log('[' . $admin['username'] . ']: Tripay ' . $_L['Settings_Saved_Successfully'] . json_encode($_POST['tripay_channel']), 'Admin', $admin['id']);
|
||||
|
||||
r2(U . 'paymentgateway/tripay', 's', $_L['Settings_Saved_Successfully']);
|
||||
}
|
||||
|
||||
|
||||
function tripay_create_transaction($channel, $trx, $user)
|
||||
{
|
||||
global $config, $routes, $ui;
|
||||
$channels = json_decode(file_get_contents('system/paymentgateway/channel_tripay.json'), true);
|
||||
if (!in_array($routes[4], explode(",", $config['tripay_channel']))) {
|
||||
$ui->assign('_title', 'Tripay Channel - ' . $config['CompanyName']);
|
||||
$ui->assign('channels', $channels);
|
||||
$ui->assign('tripay_channels', explode(",", $config['tripay_channel']));
|
||||
$ui->assign('path', $routes[2] . '/' . $routes[3]);
|
||||
$ui->display('tripay_channel.tpl');
|
||||
die();
|
||||
}
|
||||
$json = [
|
||||
'method' => $channel,
|
||||
'amount' => $trx['price'],
|
||||
'merchant_ref' => $trx['id'],
|
||||
'customer_name' => $user['fullname'],
|
||||
'customer_email' => (empty($user['email'])) ? $user['username'] . '@' . $_SERVER['HTTP_HOST'] : $user['email'],
|
||||
'customer_phone' => $user['phonenumber'],
|
||||
'order_items' => [
|
||||
[
|
||||
'name' => $trx['plan_name'],
|
||||
'price' => $trx['price'],
|
||||
'quantity' => 1
|
||||
]
|
||||
],
|
||||
'return_url' => U . 'order/view/' . $trx['id'] . '/check',
|
||||
'signature' => hash_hmac('sha256', $config['tripay_merchant'] . $trx['id'] . $trx['price'], $config['tripay_secret_key'])
|
||||
];
|
||||
$result = json_decode(Http::postJsonData(tripay_get_server() . 'transaction/create', $json, ['Authorization: Bearer ' . $config['tripay_api_key']]), true);
|
||||
if ($result['success'] != 1) {
|
||||
sendTelegram("Tripay payment failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
$d->gateway_trx_id = $result['data']['reference'];
|
||||
$d->pg_url_payment = $result['data']['checkout_url'];
|
||||
$d->pg_request = json_encode($result);
|
||||
$d->expired_date = date('Y-m-d H:i:s', $result['data']['expired_time']);
|
||||
$d->save();
|
||||
r2(U . "order/view/" . $d['id'], 's', Lang::T("Create Transaction Success"));
|
||||
|
||||
}
|
||||
|
||||
function tripay_get_status($trx, $user)
|
||||
{
|
||||
global $config;
|
||||
$result = json_decode(Http::getData(tripay_get_server() . 'transaction/detail?' . http_build_query(['reference' => $trx['id']]), [
|
||||
'Authorization: Bearer ' . $config['tripay_api_key']
|
||||
]), true);
|
||||
if ($result['success'] != 1) {
|
||||
sendTelegram("Tripay payment status failed\n\n" . json_encode($result, JSON_PRETTY_PRINT));
|
||||
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Payment check failed."));
|
||||
}
|
||||
$result = $result['data'];
|
||||
if ($result['status'] == 'UNPAID') {
|
||||
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
|
||||
} else if (in_array($result['status'], ['PAID', 'SETTLED']) && $trx['status'] != 2) {
|
||||
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_method'] . ' ' . $result['payment_channel'])) {
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
|
||||
}
|
||||
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->payment_method = $result['payment_method'];
|
||||
$trx->payment_channel = $result['payment_name'];
|
||||
$trx->paid_date = date('Y-m-d H:i:s', $result['paid_at']);
|
||||
$trx->status = 2;
|
||||
$trx->save();
|
||||
|
||||
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
|
||||
} else if (in_array($result['status'], ['EXPIRED', 'FAILED', 'REFUND'])) {
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->status = 3;
|
||||
$trx->save();
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired."));
|
||||
} else if ($trx['status'] == 2) {
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
|
||||
}
|
||||
}
|
||||
|
||||
function tripay_get_server()
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'Live') {
|
||||
return 'https://tripay.co.id/api/';
|
||||
} else {
|
||||
return 'https://tripay.co.id/api-sandbox/';
|
||||
}
|
||||
}
|
140
system/paymentgateway/xendit.php
Normal file
140
system/paymentgateway/xendit.php
Normal file
@ -0,0 +1,140 @@
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
*
|
||||
* Payment Gateway xendit.com
|
||||
**/
|
||||
|
||||
|
||||
function xendit_show_config()
|
||||
{
|
||||
global $ui, $config;
|
||||
$ui->assign('_title', 'Xendit - Payment Gateway - ' . $config['CompanyName']);
|
||||
$ui->assign('channels', json_decode(file_get_contents('system/paymentgateway/channel_xendit.json'), true));
|
||||
$ui->display('pg-xendit.tpl');
|
||||
}
|
||||
|
||||
function xendit_save_config()
|
||||
{
|
||||
global $admin, $_L;
|
||||
$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();
|
||||
}
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'xendit_channel')->find_one();
|
||||
if ($d) {
|
||||
$d->value = implode(',', $_POST['xendit_channel']);
|
||||
$d->save();
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'xendit_channel';
|
||||
$d->value = implode(',', $_POST['xendit_channel']);
|
||||
$d->save();
|
||||
}
|
||||
|
||||
_log('[' . $admin['username'] . ']: Xendit ' . $_L['Settings_Saved_Successfully'], 'Admin', $admin['id']);
|
||||
|
||||
r2(U . 'paymentgateway/xendit', 's', $_L['Settings_Saved_Successfully']);
|
||||
}
|
||||
|
||||
|
||||
function xendit_create_transaction($trx, $user)
|
||||
{
|
||||
global $config;
|
||||
$json = [
|
||||
'external_id' => $trx['id'],
|
||||
'amount' => $trx['price'],
|
||||
'description' => $trx['plan_name'],
|
||||
'customer' => [
|
||||
'mobile_number' => $user['phonenumber'],
|
||||
],
|
||||
'customer_notification_preference' => [
|
||||
'invoice_created' => ['whatsapp', 'sms'],
|
||||
'invoice_reminder' => ['whatsapp', 'sms'],
|
||||
'invoice_paid' => ['whatsapp', 'sms'],
|
||||
'invoice_expired' => ['whatsapp', 'sms']
|
||||
],
|
||||
'payment_methods ' => explode(',', $config['xendit_channel']),
|
||||
'success_redirect_url' => U . 'order/view/' . $trx['id'] . '/check',
|
||||
'failure_redirect_url' => U . 'order/view/' . $trx['id'] . '/check'
|
||||
];
|
||||
|
||||
$result = json_decode(Http::postJsonData(xendit_get_server() . 'invoices', $json, ['Authorization: Basic ' . base64_encode($config['xendit_secret_key'] . ':')]), true);
|
||||
if (!$result['id']) {
|
||||
r2(U . 'order/package', 'e', Lang::T("Failed to create transaction."));
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
$d->gateway_trx_id = $result['id'];
|
||||
$d->pg_url_payment = $result['invoice_url'];
|
||||
$d->pg_request = json_encode($result);
|
||||
$d->expired_date = date('Y-m-d H:i:s', strtotime($result['expiry_date']));
|
||||
$d->save();
|
||||
header('Location: ' . $result['invoice_url']);
|
||||
exit();
|
||||
}
|
||||
|
||||
function xendit_get_status($trx, $user)
|
||||
{
|
||||
global $config;
|
||||
$result = json_decode(Http::getData(xendit_get_server() . 'invoices/' . $trx['id'], [
|
||||
'Authorization: Basic ' . base64_encode($config['xendit_secret_key'] . ':')
|
||||
]), true);
|
||||
|
||||
if ($result['status'] == 'PENDING') {
|
||||
r2(U . "order/view/" . $trx['id'], 'w', Lang::T("Transaction still unpaid."));
|
||||
} else if (in_array($result['status'], ['PAID', 'SETTLED']) && $trx['status'] != 2) {
|
||||
if (!Package::rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], $trx['gateway'], $result['payment_method'] . ' ' . $result['payment_channel'])) {
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Failed to activate your Package, try again later."));
|
||||
}
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->payment_method = $result['payment_method'];
|
||||
$trx->payment_channel = $result['payment_channel'];
|
||||
$trx->paid_date = date('Y-m-d H:i:s', strtotime($result['updated']));
|
||||
$trx->status = 2;
|
||||
$trx->save();
|
||||
|
||||
r2(U . "order/view/" . $trx['id'], 's', Lang::T("Transaction has been paid."));
|
||||
} else if ($result['status'] == 'EXPIRED') {
|
||||
$trx->pg_paid_response = json_encode($result);
|
||||
$trx->status = 3;
|
||||
$trx->save();
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction expired."));
|
||||
} else if ($trx['status'] == 2) {
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Transaction has been paid.."));
|
||||
}
|
||||
r2(U . "order/view/" . $trx['id'], 'd', Lang::T("Unknown Command."));
|
||||
}
|
||||
|
||||
function xendit_get_server()
|
||||
{
|
||||
global $_app_stage;
|
||||
if ($_app_stage == 'Live') {
|
||||
return 'https://api.xendit.co/v2/';
|
||||
} else {
|
||||
return 'https://api.xendit.co/v2/';
|
||||
}
|
||||
}
|
@ -26,18 +26,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 - Indonesia & Philippines</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="duitku" {if $_c['payment_gateway'] eq 'duitku'}selected="selected" {/if}>Duitku - Indonesia</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group hidden">
|
||||
<label class="col-md-2 control-label">Radius Mode?</label>
|
||||
<div class="col-md-6">
|
||||
|
34
ui/ui/paymentgateway.tpl
Normal file
34
ui/ui/paymentgateway.tpl
Normal file
@ -0,0 +1,34 @@
|
||||
{include file="sections/header.tpl"}
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-info panel-hovered">
|
||||
<div class="panel-heading">{Lang::T('Payment Gateway')}</div>
|
||||
<div class="panel-body row">
|
||||
{foreach $pgs as $pg}
|
||||
<div class="col-sm-4 mb20">
|
||||
<a href="{$_url}paymentgateway/{$pg}"
|
||||
class="btn btn-block btn-{if $pg==$_c['payment_gateway']}success{else}default{/if}">{ucwords($pg)}</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<form method="post">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 control-label">Payment Gateway</label>
|
||||
<div class="col-md-8">
|
||||
<select name="payment_gateway" id="payment_gateway" class="form-control">
|
||||
<option value="none">None</option>
|
||||
{foreach $pgs as $pg}
|
||||
<option value="{$pg}" {if $_c['payment_gateway'] eq {$pg}}selected="selected" {/if}>{ucwords($pg)}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button class="btn btn-block btn-primary waves-effect waves-light" type="submit">{$_L['Save']}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="sections/footer.tpl"}
|
@ -1,6 +1,6 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/duitku-post" >
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/duitku" >
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-default panel-hovered panel-stacked mb30">
|
||||
|
@ -1,68 +0,0 @@
|
||||
{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" onclick="this.select()" value="{$_url}callback/midtrans">
|
||||
<p class="help-block">{Lang::T('Payment Notification URL, Recurring Notification URL, Pay Account Notification URL')}</p>
|
||||
<p class="help-block">Midtrans wajib pake URL Notification</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" onclick="this.select()" value="{$_url}order/unpaid">
|
||||
<p class="help-block">{Lang::T('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">
|
||||
<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['midtrans_channel'], $channel['id']) !== false}checked="true"{/if} id="midtrans_channel" name="midtrans_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=midtrans.com
|
||||
add dst-host=*.midtrans.com</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{include file="sections/footer.tpl"}
|
@ -1,6 +1,6 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/tripay-post" >
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/tripay" >
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-default panel-hovered panel-stacked mb30">
|
||||
|
@ -1,6 +1,6 @@
|
||||
{include file="sections/header.tpl"}
|
||||
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/xendit-post" >
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}paymentgateway/xendit" >
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-default panel-hovered panel-stacked mb30">
|
||||
@ -13,7 +13,6 @@
|
||||
<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">
|
||||
|
@ -261,19 +261,11 @@
|
||||
<li> </li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $_system_menu eq 'paymentgateway'}class="open"{/if}>
|
||||
<a href="#" onClick="toggleDropdownMobile(this)">
|
||||
<li {if $_system_menu eq 'paymentgateway'}class="active"{/if}>
|
||||
<a href="{$_url}paymentgateway">
|
||||
<i class="ion ion-cash"></i>
|
||||
<span class="text">{Lang::T('Payment Gateway')}</span>
|
||||
<i class="arrow ion-chevron-left"></i>
|
||||
</a>
|
||||
<ul class="inner-drop list-unstyled">
|
||||
<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/tripay">Tripay</a></li>
|
||||
<li {if $_system_menu eq 'paymentgateway'}class="active"{/if}><a href="{$_url}paymentgateway/duitku">Duitku</a></li>
|
||||
<li> </li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $_system_menu eq 'community'}class="active"{/if}>
|
||||
<a href="{$_url}community">
|
||||
|
Loading…
x
Reference in New Issue
Block a user