- // Authorization successful start transaction
- await this.chargingStation.ocppRequestService.sendStartTransaction(transactionConnectorID, commandPayload.idTag);
- logger.debug(this.chargingStation.logPrefix() + ' Transaction remotely STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorID.toString() + ' for idTag ' + commandPayload.idTag);
- return Constants.OCPP_RESPONSE_ACCEPTED;
+ if (!authorized || (authorized && this.chargingStation.getMayAuthorizeAtRemoteStart())) {
+ const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(transactionConnectorId, commandPayload.idTag);
+ if (authorizeResponse?.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
+ authorized = true;
+ } else {
+ authorized = false;
+ }
+ }
+ if (authorized) {
+ // Authorization successful, start transaction
+ if (this.setRemoteStartTransactionChargingProfile(transactionConnectorId, commandPayload.chargingProfile)) {
+ if ((await this.chargingStation.ocppRequestService.sendStartTransaction(transactionConnectorId, commandPayload.idTag)).idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) {
+ logger.debug(this.chargingStation.logPrefix() + ' Transaction remotely STARTED on ' + this.chargingStation.stationInfo.chargingStationId + '#' + transactionConnectorId.toString() + ' for idTag ' + commandPayload.idTag);
+ return Constants.OCPP_RESPONSE_ACCEPTED;
+ }
+ return await this.notifyRemoteStartTransactionRejected(transactionConnectorId, commandPayload.idTag);
+ }
+ return await this.notifyRemoteStartTransactionRejected(transactionConnectorId, commandPayload.idTag);
+ }
+ return await this.notifyRemoteStartTransactionRejected(transactionConnectorId, commandPayload.idTag);