Recharge with additional Cost
This commit is contained in:
parent
60c573821b
commit
c8f4574984
@ -135,6 +135,10 @@ switch ($action) {
|
|||||||
$channel = $admin['fullname'];
|
$channel = $admin['fullname'];
|
||||||
$cust = User::_info($id_customer);
|
$cust = User::_info($id_customer);
|
||||||
if ($using == 'balance' && $config['enable_balance'] == 'yes') {
|
if ($using == 'balance' && $config['enable_balance'] == 'yes') {
|
||||||
|
$add_cost = User::getAttribute("Additional Cost", $id_customer);
|
||||||
|
if(empty($add_cost)){
|
||||||
|
$add_cost = 0;
|
||||||
|
}
|
||||||
$plan = ORM::for_table('tbl_plans')->find_one($planId);
|
$plan = ORM::for_table('tbl_plans')->find_one($planId);
|
||||||
if (!$cust) {
|
if (!$cust) {
|
||||||
r2(U . 'prepaid/recharge', 'e', Lang::T('Customer not found'));
|
r2(U . 'prepaid/recharge', 'e', Lang::T('Customer not found'));
|
||||||
@ -142,7 +146,7 @@ switch ($action) {
|
|||||||
if (!$plan) {
|
if (!$plan) {
|
||||||
r2(U . 'prepaid/recharge', 'e', Lang::T('Plan not found'));
|
r2(U . 'prepaid/recharge', 'e', Lang::T('Plan not found'));
|
||||||
}
|
}
|
||||||
if ($cust['balance'] < $plan['price']) {
|
if ($cust['balance'] < ($plan['price']+$add_cost)) {
|
||||||
r2(U . 'prepaid/recharge', 'e', Lang::T('insufficient balance'));
|
r2(U . 'prepaid/recharge', 'e', Lang::T('insufficient balance'));
|
||||||
}
|
}
|
||||||
$gateway = 'Recharge Balance';
|
$gateway = 'Recharge Balance';
|
||||||
@ -153,7 +157,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
if (Package::rechargeUser($id_customer, $server, $planId, $gateway, $channel)) {
|
if (Package::rechargeUser($id_customer, $server, $planId, $gateway, $channel)) {
|
||||||
if ($using == 'balance') {
|
if ($using == 'balance') {
|
||||||
Balance::min($cust['id'], $plan['price']);
|
Balance::min($cust['id'], $plan['price']+$add_cost);
|
||||||
}
|
}
|
||||||
$in = ORM::for_table('tbl_transactions')->where('username', $cust['username'])->order_by_desc('id')->find_one();
|
$in = ORM::for_table('tbl_transactions')->where('username', $cust['username'])->order_by_desc('id')->find_one();
|
||||||
Package::createInvoice($in);
|
Package::createInvoice($in);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user