xendit without callback OK

This commit is contained in:
Ibnu Maksum 2022-09-08 17:09:21 +07:00
parent 65666ac998
commit 8d7b1c6ff0
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
12 changed files with 625 additions and 33 deletions

View File

@ -8,15 +8,15 @@
if($_app_stage = 'Live'){
$xendit_server = 'https://api.xendit.co/v2/';
$midtrans_server = 'https://api.midtrans.com';
$moota_server = 'https://api.xendit.co/v2/';
$tripay_server = 'https://tripay.co.id/api/transaction/create';
}else{
$xendit_server = 'https://api.xendit.co/v2/';
$midtrans_server = 'https://api.sandbox.midtrans.com';
$moota_server = 'https://api.xendit.co/v2/';
$tripay_server = 'https://tripay.co.id/api-sandbox/transaction/create';
}
function create_invoice_xendit($trxID, $amount, $phone, $description){
function xendit_create_invoice($trxID, $amount, $phone, $description){
global $xendit_server,$_c;
$json = [
'external_id' => $trxID,
@ -31,12 +31,12 @@ function create_invoice_xendit($trxID, $amount, $phone, $description){
'invoice_paid' => ['whatsapp','sms'],
'invoice_expired' => ['whatsapp','sms']
],
'success_redirect_url' => APP_URL,
'failure_redirect_url' => APP_URL
'payment_methods ' => explode(',',$_c['xendit_channel']),
'success_redirect_url' => U.'order/view/'.$trxID,
'failure_redirect_url' => U.'order/view/'.$trxID
];
return json_decode(postJsonData($xendit_server, $json, [
'Authorization: Basic '.$_c['xendit_secret']
]),true);
return json_decode(postJsonData($xendit_server.'invoices', $json, ['Authorization: Basic '.base64_encode($_c['xendit_secret_key'].':')]),true);
/*
{
"id": "631597513897510bace2459d", #gateway_trx_id
@ -55,10 +55,10 @@ function create_invoice_xendit($trxID, $amount, $phone, $description){
*/
}
function get_invoice_xendit($xendittrxID){
function xendit_get_invoice($xendittrxID){
global $xendit_server,$_c;
return json_decode(getData($xendit_server.'invoices/'.$xendittrxID, [
'Authorization: Basic '.$_c['xendit_secret']
'Authorization: Basic '.base64_encode($_c['xendit_secret_key'].':')
]),true);
/*
{

View File

@ -0,0 +1,374 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
use PEAR2\Net\RouterOS;
function rechargeUser($id_customer, $router_name, $plan_id, $gateway, $channel){
global $_c,$_L;
$date_now = date("Y-m-d H:i:s");
$date_only = date("Y-m-d");
$time = date("H:i:s");
if ($id_customer == '' or $router_name == '' or $plan_id == '') {
return false;
}
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
$b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->find_one();
$mikrotik = Router::_info($router_name);
if($p['validity_unit']=='Months'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' month'));
}else if($p['validity_unit']=='Days'){
$date_exp = date("Y-m-d", strtotime('+'.$p['validity'].' day'));
}else if($p['validity_unit']=='Hrs'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' hour')));
$date_exp = $datetime[0];
$time = $datetime[1];
}else if($p['validity_unit']=='Mins'){
$datetime = explode(' ',date("Y-m-d H:i:s", strtotime('+'.$p['validity'].' minute')));
$date_exp = $datetime[0];
$time = $datetime[1];
}
if ($p['type'] == 'Hotspot') {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ip hotspot user print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
}
$b->customer_id = $id_customer;
$b->username = $c['username'];
$b->plan_id = $plan_id;
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "admin";
$b->routers = $router_name;
$b->type = "Hotspot";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "admin";
$t->routers = $router_name;
$t->type = "Hotspot";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
/* iBNuX Added:
* Time limit to Mikrotik
* 'Time_Limit', 'Data_Limit', 'Both_Limit'
*/
$addRequest = new RouterOS\Request('/ip/hotspot/user/add');
if ($p['typebp'] == "Limited") {
if ($p['limit_type'] == "Time_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
);
} else if ($p['limit_type'] == "Data_Limit") {
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-bytes-total', $datalimit)
);
} else if ($p['limit_type'] == "Both_Limit") {
if ($p['time_unit'] == 'Hrs')
$timelimit = $p['time_limit'] . ":00:00";
else
$timelimit = "00:" . $p['time_limit'] . ":00";
if ($p['data_unit'] == 'GB')
$datalimit = $p['data_limit'] . "000000000";
else
$datalimit = $p['data_limit'] . "000000";
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
->setArgument('limit-uptime', $timelimit)
->setArgument('limit-bytes-total', $datalimit)
);
}
} else {
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $id_customer;
$d->username = $c['username'];
$d->plan_id = $plan_id;
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "admin";
$d->routers = $router_name;
$d->type = "Hotspot";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "admin";
$t->routers = $router_name;
$t->type = "Hotspot";
$t->save();
}
sendTelegram( "#$c[username] #buy #Hotspot \n".$p['name_plan'].
"\nRouter: ".$router_name.
"\nGateway: ".$gateway.
"\nChannel: ".$channel.
"\nPrice: ".$p['price']);
} else {
if ($b) {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$printRequest = new RouterOS\Request(
'/ppp secret print .proplist=name',
RouterOS\Query::where('name', $c['username'])
);
$userName = $client->sendSync($printRequest)->getProperty('name');
$removeRequest = new RouterOS\Request('/ppp/secret/remove');
$client(
$removeRequest
->setArgument('numbers', $userName)
);
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$b->customer_id = $id_customer;
$b->username = $c['username'];
$b->plan_id = $plan_id;
$b->namebp = $p['name_plan'];
$b->recharged_on = $date_only;
$b->expiration = $date_exp;
$b->time = $time;
$b->status = "on";
$b->method = "admin";
$b->routers = $router_name;
$b->type = "PPPOE";
$b->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "admin";
$t->routers = $router_name;
$t->type = "PPPOE";
$t->save();
} else {
if(!$_c['radius_mode']){
try {
$iport = explode(":", $mikrotik['ip_address']);
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
} catch (Exception $e) {
die("Unable to connect to the router.<br>".$e->getMessage());
}
$addRequest = new RouterOS\Request('/ppp/secret/add');
$client->sendSync(
$addRequest
->setArgument('name', $c['username'])
->setArgument('service', 'pppoe')
->setArgument('profile', $p['name_plan'])
->setArgument('password', $c['password'])
);
}
$d = ORM::for_table('tbl_user_recharges')->create();
$d->customer_id = $id_customer;
$d->username = $c['username'];
$d->plan_id = $plan_id;
$d->namebp = $p['name_plan'];
$d->recharged_on = $date_only;
$d->expiration = $date_exp;
$d->time = $time;
$d->status = "on";
$d->method = "admin";
$d->routers = $router_name;
$d->type = "PPPOE";
$d->save();
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();
$t->invoice = "INV-" . _raid(5);
$t->username = $c['username'];
$t->plan_name = $p['name_plan'];
$t->price = $p['price'];
$t->recharged_on = $date_only;
$t->expiration = $date_exp;
$t->time = $time;
$t->method = "admin";
$t->routers = $router_name;
$t->type = "PPPOE";
$t->save();
}
sendTelegram( "#$c[username] #buy #PPPOE \n".$p['name_plan'].
"\nRouter: ".$router_name.
"\nGateway: ".$gateway.
"\nChannel: ".$channel.
"\nPrice: ".$p['price']);
}
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
sendWhatsapp($c['username'], "*$_c[CompanyName]*\n".
"$_c[address]\n".
"$_c[phone]\n".
"\n\n".
"INVOICE: *$in[invoice]*\n".
"$_L[Date] : $date_now\n".
"$_L[Sales] : $gateway $channel\n".
"\n\n".
"$_L[Type] : *$in[type]*\n".
"$_L[Plan_Name] : *$in[plan_name]*\n".
"$_L[Plan_Price] : *$_c[currency_code] ".number_format($in['price'],2,$_c['dec_point'],$_c['thousands_sep'])."*\n\n".
"$_L[Username] : *$in[username]*\n".
"$_L[Password] : **********\n\n".
"$_L[Created_On] :\n*".date($_c['date_format'], strtotime($in['recharged_on']))." $in[time]*\n".
"$_L[Expires_On] :\n*".date($_c['date_format'], strtotime($in['expiration']))." $in[time]*\n".
"\n\n".
"$_c[note]");
return true;
}

View File

@ -1,39 +1,152 @@
<?php
/**
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
**/
_auth();
$ui->assign('_system_menu', 'order');
$action = $routes['1'];
$user = User::_info();
$ui->assign('_user', $user);
//Client Page
$bill = User::_billing();
$ui->assign('_bill', $bill);
require('system/autoload/Paymentgateway.php');
require('system/autoload/Recharge.php');
switch ($action) {
case 'voucher':
$ui->assign('_title', $_L['Order_Voucher'].' - '. $config['CompanyName']);
$ui->assign('_title', $_L['Order_Voucher'] . ' - ' . $config['CompanyName']);
$ui->display('user-order.tpl');
break;
case 'ppoe':
$ui->assign('_title', 'Order PPOE Internet- '. $config['CompanyName']);$routers = ORM::for_table('tbl_routers')->find_many();
$ui->assign('_title', 'Order PPOE Internet - ' . $config['CompanyName']);
$routers = ORM::for_table('tbl_routers')->find_many();
$plans = ORM::for_table('tbl_plans')->where('type', 'PPPOE')->where('enabled', '1')->find_many();
$ui->assign('routers',$routers);
$ui->assign('routers', $routers);
$ui->assign('plans', $plans);
$ui->display('user-orderPPOE.tpl');
break;
case 'hotspot':
$ui->assign('_title', 'Order Hotspot Internet- '. $config['CompanyName']);
$ui->assign('_title', 'Order Hotspot Internet - ' . $config['CompanyName']);
$routers = ORM::for_table('tbl_routers')->find_many();
$plans = ORM::for_table('tbl_plans')->where('type', 'Hotspot')->where('enabled', '1')->find_many();
$ui->assign('routers',$routers);
$ui->assign('routers', $routers);
$ui->assign('plans', $plans);
$ui->display('user-orderHotspot.tpl');
break;
case 'view':
$trxid = $routes['2'] * 1;
$trx = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_one($trxid);
if ($routes['3'] == 'check') {
if ($trx['gateway'] == 'xendit') {
$result = xendit_get_invoice($trx['gateway_trx_id']);
if ($result['status'] == 'PENDING') {
r2(U . "order/view/" . $trxid, 'w', Lang::T("Transaction still unpaid."));
} else if ($result['status'] == 'PAID' && $trx['status'] != 2) {
if (!rechargeUser($user['id'], $trx['routers'], $trx['plan_id'], 'xendit', $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'] == 'midtrans') {
} else if ($trx['gateway'] == 'tripay') {
}
} else if ($routes['3'] == 'cancel') {
$trx->pg_paid_response = json_encode($result);
$trx->status = 4;
$trx->save();
$trx = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->find_one($trxid);
}
if (empty($trx)) {
r2(U . "home", 'e', Lang::T("Transaction Not found"));
}
$router = ORM::for_table('tbl_routers')->find_one($trx['routers_id']);
$plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']);
$bandw = ORM::for_table('tbl_bandwidth')->find_one($plan['id_bw']);
$ui->assign('trx', $trx);
$ui->assign('router', $router);
$ui->assign('plan', $plan);
$ui->assign('bandw', $bandw);
$ui->assign('_title', 'TRX #' . $trxid . ' - ' . $config['CompanyName']);
$ui->display('user-orderView.tpl');
break;
case 'hotspot-buy':
if (empty($_c['xendit_secret_key'])) {
r2(U . "order/hotspot", 'e', Lang::T("Admin has not yet setup Xendit payment gateway, please tell admin"));
}
$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)) {
r2(U . "order/hotspot", 'e', Lang::T("Plan Not found"));
}
if ($_c['payment_gateway'] == 'xendit') {
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->where('status', 1)
->find_one();
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."));
}
$id = $d['id'];
} else {
$d = ORM::for_table('tbl_payment_gateway')->create();
$d->username = $user['username'];
$d->gateway = 'xendit';
$d->plan_id = $plan['id'];
$d->plan_name = $plan['name_plan'];
$d->routers_id = $router['id'];
$d->routers = $router['name'];
$d->price = $plan['price'];
$d->created_date = date('Y-m-d H:i:s');
$d->status = 1;
$d->save();
$id = $d->id();
}
if ($id) {
$result = xendit_create_invoice($id, $plan['price'], $user['username'], $plan['name_plan']);
if (!$result['id']) {
r2(U . "order/hotspot", '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();
} else {
r2(U . "order/view/" . $d['id'], 'w', Lang::T("Failed to create Transaction.."));
}
} else if ($_c['payment_gateway'] == 'midtrans') {
} else if ($_c['payment_gateway'] == 'tripay') {
}
break;
default:
$ui->display('404.tpl');
}
}

View File

@ -252,7 +252,23 @@ $_L['Cannot_be_change_after_saved'] = 'Cannot be change after saved';
$_L['Explain_Coverage_of_router'] = 'Jelaskan Cakupan wilayah hotspot';
$_L['Name_of_Area_that_router_operated'] = 'Nama Lokasi/Wilayah Router beroperasi';
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
$_L['Status'] = 'Status';
$_L['Status'] = 'Status';
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
$_L['Status'] = 'Status';
$_L['Plan_Not_found'] = 'Plan Not found';
$_L['Failed_to_create_transaction'] = 'Failed to create transaction.';
$_L['Seller_has_not_yet_setup_Xendit_payment_gateway'] = 'Seller has not yet setup Xendit payment gateway';
$_L['Admin_has_not_yet_setup_Xendit_payment_gateway_please_tell_admin'] = 'Admin has not yet setup Xendit payment gateway, please tell admin';
$_L['Buy_this_your_active_package_will_be_overwrite'] = 'Buy this? your active package will be overwrite';
$_L['Buy_this_your_active_package_will_be_overwrite'] = 'Buy this? your active package will be overwrite';
$_L['You_already_have_unpaid_transaction_cancel_it_or_pay_it'] = 'You already have unpaid transaction, cancel it or pay it.';
$_L['Transaction_Not_found'] = 'Transaction Not found';
$_L['PAY_NOW'] = 'PAY NOW';
$_L['Cancel_it'] = 'Cancel it?';
$_L['UNPAID'] = 'UNPAID';
$_L['expired'] = 'expired';
$_L['Check_for_Payment'] = 'Check for Payment';
$_L['Transaction_still_unpaid'] = 'Transaction still unpaid.';
$_L['Paid_Date'] = 'Paid Date';
$_L['Transaction_has_been_paid'] = 'Transaction has been paid.';
$_L['PAID'] = 'PAID';

View File

@ -20,7 +20,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name">
<input type="text" class="form-control" id="name" name="name" maxlength="40">
<p class="help-block">{Lang::T('Cannot be change after saved')}</p>
</div>
</div>

View File

@ -21,7 +21,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name" value="{$d['name_plan']}" readonly>
<input type="text" class="form-control" id="name" name="name" maxlength="40" value="{$d['name_plan']}" readonly>
</div>
</div>
<div class="form-group">

View File

@ -20,7 +20,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name_plan" name="name_plan">
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan">
</div>
</div>
<div class="form-group">

View File

@ -21,7 +21,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Plan_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name_plan" name="name_plan" value="{$d['name_plan']}" readonly>
<input type="text" class="form-control" id="name_plan" maxlength="40" name="name_plan" value="{$d['name_plan']}" readonly>
</div>
</div>
<div class="form-group">

View File

@ -21,7 +21,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name">
<input type="text" class="form-control" id="name" name="name" maxlength="32">
<p class="help-block">{Lang::T('Name of Area that router operated')}</p>
</div>
</div>

View File

@ -21,7 +21,7 @@
<div class="form-group">
<label class="col-md-2 control-label">{$_L['Router_Name']}</label>
<div class="col-md-6">
<input type="text" class="form-control" id="name" name="name" value="{$d['name']}">
<input type="text" class="form-control" id="name" name="name" maxlength="32" value="{$d['name']}">
<p class="help-block">{Lang::T('Name of Area that router operated')}</p>
</div>
</div>

View File

@ -34,7 +34,7 @@
</table>
</div>
<div class="panel-footer">
<a href="{$_url}order/hotspot-buy/{$router['id']}/{$plan['id']}" class="btn btn-sm btn-block btn-primary">Buy</a>
<a href="{$_url}order/hotspot-buy/{$router['id']}/{$plan['id']}" onclick="return confirm('{Lang::T('Buy this? your active package will be overwrite')}')" class="btn btn-sm btn-block btn-primary">Buy</a>
</div>
</div>
</div>

89
ui/ui/user-orderView.tpl Normal file
View File

@ -0,0 +1,89 @@
{include file="sections/user-header.tpl"}
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="panel mb20 {if $trx['status']==1}panel-warning{elseif $trx['status']==2}panel-success{elseif $trx['status']==3}panel-danger{elseif $trx['status']==4}panel-danger{else}panel-default{/if} panel-hovered">
<div class="panel-footer">Transaction #{$trx['id']}</div>
<div class="panel-body">
<div class="panel panel-default panel-hovered">
<div class="panel-heading">{$router['name']}</div>
<div class="panel-body">
{$router['description']}
</div>
</div>
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td>{Lang::T('Status')}</td>
<td>{if $trx['status']==1}{Lang::T('UNPAID')}{elseif $trx['status']==2}{Lang::T('PAID')}{elseif $trx['status']==3}{Lang::T('FAILED')}{elseif $trx['status']==4}{Lang::T('CANCELED')}{else}{Lang::T('UNKNOWN')}{/if}</td>
</tr>
<tr>
<td>{Lang::T('expired')}</td>
<td>{date($_c['date_format'], strtotime($trx['expired_date']))} {date('H:i', strtotime($trx['expired_date']))} </td>
</tr>
{if $trx['status']==2}
<tr>
<td>{Lang::T('Paid Date')}</td>
<td>{date($_c['date_format'], strtotime($trx['paid_date']))} {date('H:i', strtotime($trx['paid_date']))} </td>
</tr>
{/if}
<tr>
<td>{$_L['Plan_Name']}</td>
<td>{$plan['name_plan']}</td>
</tr>
<tr>
<td>{$_L['Plan_Price']}</td>
<td>{$plan['price']}</td>
</tr>
<tr>
<td>{Lang::T('Type')}</td>
<td>{$plan['type']}</td>
</tr>
{if $plan['type'] eq 'Hotspot'}
<tr>
<td>{Lang::T('Plan_Type')}</td>
<td>{Lang::T($plan['typebp'])}</td>
</tr>
{if $plan['typebp'] eq 'Limited'}
{if $plan['limit_type'] eq 'Time_Limit' or $plan['limit_type'] eq 'Both_Limit'}
<tr>
<td>{Lang::T('Time_Limit')}</td>
<td>{$ds['time_limit']} {$ds['time_unit']}</td>
</tr>
{/if}
{if $plan['limit_type'] eq 'Data_Limit' or $plan['limit_type'] eq 'Both_Limit'}
<tr>
<td>{Lang::T('Data_Limit')}</td>
<td>{$ds['data_limit']} {$ds['data_unit']}</td>
</tr>
{/if}
{/if}
{/if}
<tr>
<td>{$_L['Plan_Validity']}</td>
<td>{$plan['validity']} {$plan['validity_unit']}</td>
</tr>
<tr>
<td>{$_L['Bandwidth_Plans']}</td>
<td>{$bandw['name_bw']}<br>{$bandw['rate_down']}{$bandw['rate_down_unit']}/{$bandw['rate_up']}{$bandw['rate_up_unit']}</td>
</tr>
</tbody>
</table>
</div>
{if $trx['status']==1}
<div class="panel-footer ">
<div class="btn-group btn-group-justified">
<a href="{$trx['pg_url_payment']}" class="btn btn-primary">{Lang::T('PAY NOW')}</a>
<a href="{$_url}order/view/{$trx['id']}/check" class="btn btn-info">{Lang::T('Check for Payment')}</a>
</div>
</div>
<div class="panel-footer ">
<a href="{$_url}order/view/{$trx['id']}/cancel" class="btn btn-danger" onclick="return confirm('{Lang::T('Cancel it?')}')">{Lang::T('Cancel')}</a>
</div>
{/if}
</div>
</div>
</div>
{include file="sections/user-footer.tpl"}