+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ ++this.connectorsStatus.get(connectorId)!.rejectedAuthorizeRequests
+ PerformanceStatistics.endMeasure(measureId, beginId)
+ return startResponse
+ }
+ logger.info(startTransactionLogMsg)
+ // Start transaction
+ startResponse = await this.chargingStation.ocppRequestService.requestHandler<
+ StartTransactionRequest,
+ StartTransactionResponse
+ >(this.chargingStation, RequestCommand.START_TRANSACTION, {
+ connectorId,
+ idTag
+ })
+ this.handleStartTransactionResponse(connectorId, startResponse)
+ PerformanceStatistics.endMeasure(measureId, beginId)
+ return startResponse
+ }
+ logger.info(`${this.logPrefix(connectorId)} start transaction without an idTag`)
+ startResponse = await this.chargingStation.ocppRequestService.requestHandler<
+ StartTransactionRequest,
+ StartTransactionResponse
+ >(this.chargingStation, RequestCommand.START_TRANSACTION, { connectorId })
+ this.handleStartTransactionResponse(connectorId, startResponse)
+ PerformanceStatistics.endMeasure(measureId, beginId)
+ return startResponse
+ }
+
+ private async stopTransaction (
+ connectorId: number,
+ reason = StopTransactionReason.LOCAL
+ ): Promise<StopTransactionResponse | undefined> {
+ const measureId = 'StopTransaction with ATG'
+ const beginId = PerformanceStatistics.beginMeasure(measureId)
+ let stopResponse: StopTransactionResponse | undefined
+ if (this.chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
+ logger.info(
+ `${this.logPrefix(connectorId)} stop transaction with id ${
+ this.chargingStation.getConnectorStatus(connectorId)?.transactionId
+ }`
+ )
+ stopResponse = await this.chargingStation.stopTransactionOnConnector(connectorId, reason)
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ ++this.connectorsStatus.get(connectorId)!.stopTransactionRequests
+ if (stopResponse.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ ++this.connectorsStatus.get(connectorId)!.acceptedStopTransactionRequests
+ } else {
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ ++this.connectorsStatus.get(connectorId)!.rejectedStopTransactionRequests
+ }