++this.connectorsStatus.get(connectorId)!.authorizeRequests!;
if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
if (
- isNullOrUndefined(this.chargingStation.getConnectorStatus(connectorId)!.authorizeIdTag)
+ isNullOrUndefined(this.chargingStation.getConnectorStatus(connectorId)?.authorizeIdTag)
) {
logger.warn(
`${this.chargingStation.logPrefix()} IdTag ${idTag} is not set as authorized remotely, applying deferred initialization`,
): Promise<GenericResponse> {
const { connectorId: transactionConnectorId, idTag, chargingProfile } = commandPayload;
if (
- (chargingStation.getConnectorStatus(transactionConnectorId)!.status ===
+ (chargingStation.getConnectorStatus(transactionConnectorId)?.status ===
OCPP16ChargePointStatus.Reserved &&
chargingStation.getReservationBy('connectorId', transactionConnectorId)?.idTag !== idTag) ||
- (chargingStation.getConnectorStatus(0)!.status === OCPP16ChargePointStatus.Reserved &&
+ (chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved &&
chargingStation.getReservationBy('connectorId', 0)?.idTag !== idTag)
) {
return OCPP16Constants.OCPP_RESPONSE_REJECTED;
idTag,
reservationId: chargingStation.getReservationBy(
'connectorId',
- chargingStation.getConnectorStatus(0)!.status === OCPP16ChargePointStatus.Reserved
+ chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved
? 0
: transactionConnectorId,
)!,
idTag,
reservationId: chargingStation.getReservationBy(
'connectorId',
- chargingStation.getConnectorStatus(0)!.status === OCPP16ChargePointStatus.Reserved
+ chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved
? 0
: transactionConnectorId,
)!,
requestPayload.meterStart,
);
const reservedOnConnectorZero =
- chargingStation.getConnectorStatus(0)!.status === OCPP16ChargePointStatus.Reserved;
+ chargingStation.getConnectorStatus(0)?.status === OCPP16ChargePointStatus.Reserved;
if (
- chargingStation.getConnectorStatus(transactionConnectorId)!.status ===
+ chargingStation.getConnectorStatus(transactionConnectorId)?.status ===
OCPP16ChargePointStatus.Reserved ||
reservedOnConnectorZero
) {
- const reservation = chargingStation.getReservationBy(
- 'connectorId',
- reservedOnConnectorZero ? 0 : transactionConnectorId,
- )!;
await chargingStation.removeReservation(
- reservation,
+ chargingStation.getReservationBy(
+ 'connectorId',
+ reservedOnConnectorZero ? 0 : transactionConnectorId,
+ )!,
ReservationTerminationReason.TRANSACTION_STARTED,
);
}