From: Jérôme Benoit Date: Sun, 30 Jul 2023 22:05:03 +0000 (+0200) Subject: fix: check reservation status at the end at start transaction X-Git-Tag: v1.2.20~70 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7b2ed583ff91eb54d1981807f28acdf3939c1808;p=e-mobility-charging-stations-simulator.git fix: check reservation status at the end at start transaction Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index f5b568dc..ad7e8e17 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -825,15 +825,6 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { commandPayload: RemoteStartTransactionRequest, ): Promise { const { connectorId: transactionConnectorId, idTag, chargingProfile } = commandPayload; - if ( - (chargingStation.getConnectorStatus(transactionConnectorId)?.status === - OCPP16ChargePointStatus.Reserved && - chargingStation.getReservationBy('connectorId', transactionConnectorId)?.idTag !== idTag) || - (chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved && - chargingStation.getReservationBy('connectorId', 0)?.idTag !== idTag) - ) { - return OCPP16Constants.OCPP_RESPONSE_REJECTED; - } if (chargingStation.hasConnector(transactionConnectorId) === false) { return this.notifyRemoteStartTransactionRejected( chargingStation, @@ -851,6 +842,15 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { idTag, ); } + if ( + (chargingStation.getConnectorStatus(transactionConnectorId)?.status === + OCPP16ChargePointStatus.Reserved && + chargingStation.getReservationBy('connectorId', transactionConnectorId)?.idTag !== idTag) || + (chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved && + chargingStation.getReservationBy('connectorId', 0)?.idTag !== idTag) + ) { + return OCPP16Constants.OCPP_RESPONSE_REJECTED; + } const remoteStartTransactionLogMsg = ` ${chargingStation.logPrefix()} Transaction remotely STARTED on ${ chargingStation.stationInfo.chargingStationId