- logger.debug(this.chargingStation.logPrefix() + ' Authorize response received: %j to Authorize request: %j', payload, requestPayload);
+ let authorizeConnectorId: number;
+ for (const connector in this.chargingStation.connectors) {
+ if (Utils.convertToInt(connector) > 0 && this.chargingStation.getConnector(Utils.convertToInt(connector))?.authorizeIdTag === requestPayload.idTag) {
+ authorizeConnectorId = Utils.convertToInt(connector);
+ break;
+ }
+ }
+ if (payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) {
+ this.chargingStation.getConnector(authorizeConnectorId).authorized = true;
+ logger.debug(`${this.chargingStation.logPrefix()} IdTag ${requestPayload.idTag} authorized on connector ${authorizeConnectorId}`);
+ } else {
+ this.chargingStation.getConnector(authorizeConnectorId).authorized = false;
+ delete this.chargingStation.getConnector(authorizeConnectorId).authorizeIdTag;
+ logger.debug(`${this.chargingStation.logPrefix()} IdTag ${requestPayload.idTag} refused with status ${payload.idTagInfo.status} on connector ${authorizeConnectorId}`);
+ }