let startResponse: StartTransactionResponse;
if (this.chargingStation.hasAuthorizedTags()) {
const idTag = this.chargingStation.getRandomIdTag();
- if (this.chargingStation.getAutomaticTransactionGeneratorRequireAuthorize()) {
+ if (this.getRequireAuthorize()) {
this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag;
// Authorize idTag
const authorizeResponse: AuthorizeResponse =
- await this.chargingStation.ocppRequestService.sendMessageHandler<
+ await this.chargingStation.ocppRequestService.requestHandler<
AuthorizeRequest,
AuthorizeResponse
- >(RequestCommand.AUTHORIZE, {
+ >(this.chargingStation, RequestCommand.AUTHORIZE, {
idTag,
});
this.connectorsStatus.get(connectorId).authorizeRequests++;
this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests++;
logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag);
// Start transaction
- startResponse = await this.chargingStation.ocppRequestService.sendMessageHandler<
+ startResponse = await this.chargingStation.ocppRequestService.requestHandler<
StartTransactionRequest,
StartTransactionResponse
- >(RequestCommand.START_TRANSACTION, {
+ >(this.chargingStation, RequestCommand.START_TRANSACTION, {
connectorId,
idTag,
});
}
logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag);
// Start transaction
- startResponse = await this.chargingStation.ocppRequestService.sendMessageHandler<
+ startResponse = await this.chargingStation.ocppRequestService.requestHandler<
StartTransactionRequest,
StartTransactionResponse
- >(RequestCommand.START_TRANSACTION, {
+ >(this.chargingStation, RequestCommand.START_TRANSACTION, {
connectorId,
idTag,
});
return startResponse;
}
logger.info(this.logPrefix(connectorId) + ' start transaction without an idTag');
- startResponse = await this.chargingStation.ocppRequestService.sendMessageHandler<
+ startResponse = await this.chargingStation.ocppRequestService.requestHandler<
StartTransactionRequest,
StartTransactionResponse
- >(RequestCommand.START_TRANSACTION, { connectorId });
+ >(this.chargingStation, RequestCommand.START_TRANSACTION, { connectorId });
PerformanceStatistics.endMeasure(measureId, beginId);
return startResponse;
}
connectorId,
this.chargingStation.getEnergyActiveImportRegisterByTransactionId(transactionId)
);
- await this.chargingStation.ocppRequestService.sendMessageHandler<
+ await this.chargingStation.ocppRequestService.requestHandler<
MeterValuesRequest,
MeterValuesResponse
- >(RequestCommand.METER_VALUES, {
+ >(this.chargingStation, RequestCommand.METER_VALUES, {
connectorId,
transactionId,
meterValue: transactionEndMeterValue,
});
}
- stopResponse = await this.chargingStation.ocppRequestService.sendMessageHandler<
+ stopResponse = await this.chargingStation.ocppRequestService.requestHandler<
StopTransactionRequest,
StopTransactionResponse
- >(RequestCommand.STOP_TRANSACTION, {
+ >(this.chargingStation, RequestCommand.STOP_TRANSACTION, {
transactionId,
meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId(transactionId),
idTag: this.chargingStation.getTransactionIdTag(transactionId),
return stopResponse;
}
+ private getRequireAuthorize(): boolean {
+ return (
+ this.chargingStation.stationInfo?.AutomaticTransactionGenerator?.requireAuthorize ?? true
+ );
+ }
+
private logPrefix(connectorId?: number): string {
if (connectorId) {
return Utils.logPrefix(