Renaming of user report error
MODIFY
src/notification/NotificationHandler.ts
src/notification/NotificationHandler.ts
@@ -837,7 +837,7 @@ export default class NotificationHandler {
try {
// Save
await NotificationHandler.saveNotification(
- tenantID, notificationSource.channel, null, ServerAction.END_USER_ERROR_NOTIFICATION, {
+ tenantID, notificationSource.channel, null, ServerAction.END_USER_REPORT_ERROR, {
notificationData: {
'userID': sourceData.userID,
}
@@ -851,7 +851,7 @@ export default class NotificationHandler {
}
}
} catch (error) {
- Logging.logActionExceptionMessage(tenantID, ServerAction.END_USER_ERROR_NOTIFICATION, error);
+ Logging.logActionExceptionMessage(tenantID, ServerAction.END_USER_REPORT_ERROR, error);
}
}
}

MODIFY
src/notification/remote-push-notification/RemotePushNotificationTask.ts
src/notification/remote-push-notification/RemotePushNotificationTask.ts
@@ -181,7 +181,7 @@ export default class RemotePushNotificationTask implements NotificationTask {
const body = i18nManager.translate('notifications.endUserErrorNotification.body',
{ userName: data.name, errorTitle: data.errorTitle, errorDescription: data.errorDescription ,tenantName: tenant.name });
// Send Notification
- return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.END_USER_ERROR_NOTIFICATION, title, body, user, null,
+ return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.END_USER_REPORT_ERROR, title, body, user, null,
severity
);
}

MODIFY
src/server/rest/CentralRestServerService.ts
src/server/rest/CentralRestServerService.ts
@@ -100,7 +100,7 @@ class RequestMapper {
[ServerAction.CHARGING_STATION_REQUEST_OCPP_PARAMETERS]: ChargingStationService.handleRequestChargingStationOcppParameters.bind(this),
[ServerAction.CAR_CREATE]: CarService.handleCreateCar.bind(this),
[ServerAction.TAG_CREATE]: UserService.handleCreateTag.bind(this),
- [ServerAction.END_USER_ERROR_NOTIFICATION]: NotificationService.handleEndUserErrorNotification.bind(this),
+ [ServerAction.END_USER_REPORT_ERROR]: NotificationService.handleEndUserReportError.bind(this),
});
break;

MODIFY
src/server/rest/service/NotificationService.ts
src/server/rest/service/NotificationService.ts
@@ -54,7 +54,7 @@ export default class NotificationService {
});
}
// Filter
- const filteredRequest = NotificationSecurity.filterEndUserErrorNotificationRequest(req.body);
+ const filteredRequest = NotificationSecurity.filterEndUserReportErrorRequest(req.body);
// Get the User
const user = await UserStorage.getUser(req.user.tenantID, req.user.id);
UtilsService.assertObjectExists(action, user, `User '${req.user.id}' does not exist`,

MODIFY
src/server/rest/service/security/NotificationSecurity.ts
src/server/rest/service/security/NotificationSecurity.ts
-import { HttpEndUserErrorNotificationRequest, HttpNotificationRequest } from '../../../../types/requests/HttpNotificationRequest';
+import { HttpEndUserReportErrorRequest, HttpNotificationRequest } from '../../../../types/requests/HttpNotificationRequest';
import Authorizations from '../../../../authorization/Authorizations';
import { DataResult } from '../../../../types/DataResult';
@@ -19,8 +19,8 @@ export default class NotificationSecurity {
return filteredRequest;
}
- static filterEndUserErrorNotificationRequest(request: any): HttpEndUserErrorNotificationRequest {
- const filteredRequest: HttpEndUserErrorNotificationRequest = {
+ static filterEndUserReportErrorRequest(request: any): HttpEndUserReportErrorRequest {
+ const filteredRequest: HttpEndUserReportErrorRequest = {
errorTitle: sanitize(request.errorTitle),
errorDescription: sanitize(request.errorDescription),
phone: sanitize(request.phone),

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -88,7 +88,7 @@ export enum ServerAction {
REMOTE_PUSH_NOTIFICATION = 'RemotePushNotification',
EMAIL_NOTIFICATION = 'EmailNotification',
- END_USER_ERROR_NOTIFICATION = 'EndUserErrorNotification',
+ END_USER_REPORT_ERROR = 'EndUserErrorNotification',
SYNCHRONIZE_REFUND = 'RefundSynchronize',

MODIFY
src/types/UserNotifications.ts
src/types/UserNotifications.ts
@@ -60,7 +60,7 @@ export enum UserNotificationType {
BILLING_INVOICE_SYNCHRONIZATION_FAILED = 'BillingInvoiceSynchronizationFailed',
CAR_CATALOG_SYNCHRONIZATION_FAILED = 'CarCatalogSynchronizationFailed',
SESSION_NOT_STARTED_AFTER_AUTHORIZE = 'SessionNotStartedAfterAuthorize',
- END_USER_ERROR_NOTIFICATION = 'EndUserErrorNotification'
+ END_USER_REPORT_ERROR = 'EndUserErrorNotification'
}
export enum NotificationSeverity {

MODIFY
src/types/requests/HttpNotificationRequest.ts
src/types/requests/HttpNotificationRequest.ts
@@ -6,7 +6,7 @@ export interface HttpNotificationRequest extends HttpDatabaseRequest {
Channel: string;
}
-export interface HttpEndUserErrorNotificationRequest {
+export interface HttpEndUserReportErrorRequest {
errorTitle: string;
errorDescription: string;
phone: string;

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
@@ -21,7 +21,7 @@ import Constants from './Constants';
import Consumption from '../types/Consumption';
import Cypher from './Cypher';
import { HTTPError } from '../types/HTTPError';
-import { HttpEndUserErrorNotificationRequest } from '../types/requests/HttpNotificationRequest';
+import { HttpEndUserReportErrorRequest } from '../types/requests/HttpNotificationRequest';
import Logging from './Logging';
import OCPIEndpoint from '../types/ocpi/OCPIEndpoint';
import { ObjectID } from 'mongodb';
@@ -2105,7 +2105,7 @@ export default class Utils {
}
}
- public static checkIfEndUserErrorNotificationValid(endUserErrorNotificationValid: HttpEndUserErrorNotificationRequest, req: Request): void {
+ public static checkIfEndUserErrorNotificationValid(endUserErrorNotificationValid: HttpEndUserReportErrorRequest, req: Request): void {
if (!endUserErrorNotificationValid.errorTitle || !endUserErrorNotificationValid.errorDescription) {
throw new AppError({
source: Constants.CENTRAL_SERVER,

Renaming of user report error