modified remotepushnotif :
typed title and body
removed toString
re org if / elseif into if/else
MODIFY
src/notification/remote-push-notification/RemotePushNotificationTask.ts
src/notification/remote-push-notification/RemotePushNotificationTask.ts
@@ -359,20 +359,21 @@ export default class RemotePushNotificationTask implements NotificationTask {
// Set the locale
const i18nManager = I18nManager.getInstanceForLocale(user.locale);
// Get Message Text
- let title = '';
- let body = '';
- if (data.invoiceStatus === 'open') {
- title = i18nManager.translate('notifications.billingNewInvoiceOpen.title');
- body = i18nManager.translate('notifications.billingNewInvoiceOpen.body',
- { invoiceNumber: data.invoiceNumber, amount: data.invoiceAmount });
- } else if (data.invoiceStatus === 'paid') {
+ let title: string;
+ let body: string;
+ if (data.invoiceStatus === 'paid') {
title = i18nManager.translate('notifications.billingNewInvoicePaid.title');
body = i18nManager.translate('notifications.billingNewInvoicePaid.body',
{ invoiceNumber: data.invoiceNumber, amount: data.invoiceAmount });
+ } else {
+ // if status is 'open'
+ title = i18nManager.translate('notifications.billingNewInvoiceOpen.title');
+ body = i18nManager.translate('notifications.billingNewInvoiceOpen.body',
+ { invoiceNumber: data.invoiceNumber, amount: data.invoiceAmount });
}
// Send Notification
return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.BILLING_NEW_INVOICE,
- title, body, user, { 'invoiceNumber': data.invoiceNumber.toString() }, severity);
+ title, body, user, { 'invoiceNumber': data.invoiceNumber }, severity);
}
public async sendBillingNewInvoicePaid(data: BillingNewInvoiceNotification, user: User, tenant: Tenant, severity: NotificationSeverity): Promise<void> {
@@ -384,7 +385,7 @@ export default class RemotePushNotificationTask implements NotificationTask {
{ invoiceNumber: data.invoiceNumber });
// Send Notification
return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.BILLING_NEW_INVOICE,
- title, body, user, { 'invoiceNumber': data.invoiceNumber.toString() }, severity);
+ title, body, user, { 'invoiceNumber': data.invoiceNumber }, severity);
}
public async sendBillingNewInvoiceOpen(data: BillingNewInvoiceNotification, user: User, tenant: Tenant, severity: NotificationSeverity): Promise<void> {
@@ -396,7 +397,7 @@ export default class RemotePushNotificationTask implements NotificationTask {
{ invoiceNumber: data.invoiceNumber });
// Send Notification
return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.BILLING_NEW_INVOICE,
- title, body, user, { 'invoiceNumber': data.invoiceNumber.toString() }, severity);
+ title, body, user, { 'invoiceNumber': data.invoiceNumber }, severity);
}
public async sendAccountVerificationNotification(data: AccountVerificationNotification, user: User, tenant: Tenant, severity: NotificationSeverity): Promise<void> {

modified remotepushnotif :
- typed title and body
- removed toString
- re org if / elseif into if/else