From: Jérôme Benoit Date: Tue, 1 Aug 2023 23:47:42 +0000 (+0200) Subject: refactor: cleanup RFID authorization code X-Git-Tag: v1.2.20~43 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ec54600d41e798a66e61e6311ee07cccfb1aea2b;p=e-mobility-charging-stations-simulator.git refactor: cleanup RFID authorization code Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index b7474087..f5bbe160 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -232,7 +232,6 @@ export class OCPPServiceUtils { `${chargingStation.logPrefix()} The charging station expects to authorize RFID tags but nor local authorization nor remote authorization are enabled. Misbehavior may occur`, ); } - let authorized = false; if ( chargingStation.getLocalAuthListEnabled() === true && OCPPServiceUtils.isIdTagLocalAuthorized(chargingStation, idTag) @@ -240,15 +239,11 @@ export class OCPPServiceUtils { const connectorStatus: ConnectorStatus = chargingStation.getConnectorStatus(connectorId)!; connectorStatus.localAuthorizeIdTag = idTag; connectorStatus.idTagLocalAuthorized = true; - authorized = true; + return true; } else if (chargingStation.getRemoteAuthorization()) { - authorized = await OCPPServiceUtils.isIdTagRemoteAuthorized( - chargingStation, - connectorId, - idTag, - ); + return await OCPPServiceUtils.isIdTagRemoteAuthorized(chargingStation, connectorId, idTag); } - return authorized; + return false; } protected static checkConnectorStatusTransition(