Validate response PDU (#137)
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPRequestService.ts
index 1149cda56ddceb29dc689f2985fd96a539f36dfc..9bf06e935d04c41f95e12ba30b1ad2d8fb7ffa25 100644 (file)
@@ -1,4 +1,10 @@
-import { ErrorResponse, Response } from '../../types/ocpp/Responses';
+import OCPPError from '../../exception/OCPPError';
+import PerformanceStatistics from '../../performance/PerformanceStatistics';
+import { EmptyObject } from '../../types/EmptyObject';
+import { HandleErrorParams } from '../../types/Error';
+import { JsonObject, JsonType } from '../../types/JsonType';
+import { ErrorType } from '../../types/ocpp/ErrorType';
+import { MessageType } from '../../types/ocpp/MessageType';
 import {
   IncomingRequestCommand,
   OutgoingRequest,
@@ -6,19 +12,14 @@ import {
   RequestParams,
   ResponseType,
 } from '../../types/ocpp/Requests';
-import { JsonObject, JsonType } from '../../types/JsonType';
-
-import ChargingStation from '../ChargingStation';
+import { ErrorResponse, Response } from '../../types/ocpp/Responses';
 import Constants from '../../utils/Constants';
-import { EmptyObject } from '../../types/EmptyObject';
-import { ErrorType } from '../../types/ocpp/ErrorType';
-import { HandleErrorParams } from '../../types/Error';
-import { MessageType } from '../../types/ocpp/MessageType';
-import OCPPError from '../../exception/OCPPError';
-import type OCPPResponseService from './OCPPResponseService';
-import PerformanceStatistics from '../../performance/PerformanceStatistics';
-import Utils from '../../utils/Utils';
 import logger from '../../utils/Logger';
+import Utils from '../../utils/Utils';
+import type ChargingStation from '../ChargingStation';
+import type OCPPResponseService from './OCPPResponseService';
+
+const moduleName = 'OCPPRequestService';
 
 export default abstract class OCPPRequestService {
   private static instance: OCPPRequestService | null = null;
@@ -188,7 +189,6 @@ export default abstract class OCPPRequestService {
           /**
            * Function that will receive the request's response
            *
-           * @param chargingStation
            * @param payload
            * @param requestPayload
            */
@@ -255,7 +255,7 @@ export default abstract class OCPPRequestService {
     }
     throw new OCPPError(
       ErrorType.SECURITY_ERROR,
-      `Cannot send command ${commandName} payload when the charging station is in ${chargingStation.getRegistrationStatus()} state on the central server`,
+      `Cannot send command ${commandName} PDU when the charging station is in ${chargingStation.getRegistrationStatus()} state on the central server`,
       commandName
     );
   }