+ protected validateIncomingRequestPayload<T extends JsonType>(
+ chargingStation: ChargingStation,
+ commandName: IncomingRequestCommand,
+ schema: JSONSchemaType<T>,
+ payload: T,
+ ): boolean {
+ if (chargingStation.getOcppStrictCompliance() === false) {
+ return true;
+ }
+ const validate = this.ajv.compile(schema);
+ if (validate(payload)) {
+ return true;
+ }
+ logger.error(
+ `${chargingStation.logPrefix()} ${moduleName}.validateIncomingRequestPayload: Command '${commandName}' incoming request PDU is invalid: %j`,
+ validate.errors,
+ );
+ throw new OCPPError(
+ OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!),
+ 'Incoming request PDU is invalid',
+ commandName,
+ JSON.stringify(validate.errors, null, 2),
+ );
+ }
+
+ protected handleRequestClearCache(chargingStation: ChargingStation): ClearCacheResponse {
+ if (chargingStation.idTagsCache.deleteIdTags(getIdTagsFile(chargingStation.stationInfo)!)) {
+ return OCPPConstants.OCPP_RESPONSE_ACCEPTED;
+ }
+ return OCPPConstants.OCPP_RESPONSE_REJECTED;
+ }
+
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ public abstract incomingRequestHandler<ReqType extends JsonType, ResType extends JsonType>(