+ currentDate: string | number | Date,
+ logPrefix: string
+): boolean => {
+ switch (chargingProfile.chargingProfileKind) {
+ case ChargingProfileKindType.RECURRING:
+ if (!canProceedRecurringChargingProfile(chargingProfile, logPrefix)) {
+ return false
+ }
+ prepareRecurringChargingProfile(chargingProfile, currentDate, logPrefix)
+ break
+ case ChargingProfileKindType.RELATIVE:
+ if (chargingProfile.chargingSchedule.startSchedule != null) {
+ logger.warn(
+ `${logPrefix} ${moduleName}.prepareChargingProfileKind: Relative charging profile id ${chargingProfile.chargingProfileId} has a startSchedule property defined. It will be ignored or used if the connector has a transaction started`
+ )
+ delete chargingProfile.chargingSchedule.startSchedule
+ }
+ if (connectorStatus?.transactionStarted === true) {
+ chargingProfile.chargingSchedule.startSchedule = connectorStatus.transactionStart
+ }
+ // FIXME: Handle relative charging profile duration
+ break
+ }
+ return true
+}
+
+export const canProceedChargingProfile = (
+ chargingProfile: ChargingProfile,
+ currentDate: string | number | Date,
+ logPrefix: string