forked from kevinowino869/mitrobill
balance notification
This commit is contained in:
@ -49,4 +49,13 @@ class Lang
|
||||
public static function arrayCount($arr){
|
||||
return count($arr);
|
||||
}
|
||||
|
||||
public static function getNotifText($key){
|
||||
global $_notifmsg, $_notifmsg_default;
|
||||
if(isset($_notifmsg[$key])){
|
||||
return $_notifmsg[$key];
|
||||
}else{
|
||||
return $_notifmsg_default[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,20 @@ class Message
|
||||
return "$via: $msg";
|
||||
}
|
||||
|
||||
public static function sendBalanceNotification($phone, $name, $balance, $message, $via)
|
||||
{
|
||||
$msg = str_replace('[[name]]', "*$name*", $message);
|
||||
$msg = str_replace('[[balance]]', "*" . Lang::moneyFormat($balance) . "*", $msg);
|
||||
if (
|
||||
!empty($phone) && strlen($phone) > 5
|
||||
&& !empty($message) && in_array($via, ['sms', 'wa'])
|
||||
) {
|
||||
if ($via == 'sms') {
|
||||
Message::sendSMS($phone, $msg);
|
||||
} else if ($via == 'wa') {
|
||||
Message::sendWhatsapp($phone, $msg);
|
||||
}
|
||||
}
|
||||
return "$via: $msg";
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class Package
|
||||
|
||||
Balance::plus($id_customer, $p['price']);
|
||||
|
||||
$textInvoice = $_notifmsg['invoice_balance'];
|
||||
$textInvoice = Lang::getNotifText('invoice_balance');
|
||||
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
|
||||
$textInvoice = str_replace('[[address]]', $_c['address'], $textInvoice);
|
||||
$textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice);
|
||||
@ -165,7 +165,7 @@ class Package
|
||||
"\nRouter: " . $router_name .
|
||||
"\nGateway: " . $gateway .
|
||||
"\nChannel: " . $channel .
|
||||
"\nPrice: " . $p['price']);
|
||||
"\nPrice: " . Lang::moneyFormat($p['price']));
|
||||
} else {
|
||||
|
||||
if ($b) {
|
||||
@ -241,12 +241,12 @@ class Package
|
||||
"\nRouter: " . $router_name .
|
||||
"\nGateway: " . $gateway .
|
||||
"\nChannel: " . $channel .
|
||||
"\nPrice: " . $p['price']);
|
||||
"\nPrice: " . Lang::moneyFormat($p['price']));
|
||||
}
|
||||
|
||||
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
|
||||
|
||||
$textInvoice = $_notifmsg['invoice_paid'];
|
||||
$textInvoice = Lang::getNotifText('invoice_paid');
|
||||
$textInvoice = str_replace('[[company_name]]', $_c['CompanyName'], $textInvoice);
|
||||
$textInvoice = str_replace('[[address]]', $_c['address'], $textInvoice);
|
||||
$textInvoice = str_replace('[[phone]]', $_c['phone'], $textInvoice);
|
||||
|
Reference in New Issue
Block a user