Check if OCPI component is active before saving the tariffID
MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -165,9 +165,11 @@ export default class ChargingStationService {
}
chargingStation.public = filteredRequest.public;
}
+ if (Utils.isComponentActiveFromToken(req.user, TenantComponents.OCPI)) {
if (Utils.objectHasProperty(filteredRequest, 'tariffID')) {
chargingStation.tariffID = filteredRequest.tariffID;
}
+ }
if (Utils.objectHasProperty(filteredRequest, 'excludeFromSmartCharging')) {
chargingStation.excludeFromSmartCharging = filteredRequest.excludeFromSmartCharging;
}
@@ -217,9 +219,13 @@ export default class ChargingStationService {
connector.numberOfConnectedPhase = filteredConnector.numberOfConnectedPhase;
}
connector.phaseAssignmentToGrid = filteredConnector.phaseAssignmentToGrid;
+ if (Utils.isComponentActiveFromToken(req.user, TenantComponents.OCPI)) {
+ if (Utils.objectHasProperty(filteredConnector, 'tariffID')) {
connector.tariffID = filteredConnector.tariffID;
}
}
+ }
+ }
// Manual Config
if (chargingStation.manualConfiguration) {
// Existing charge points

MODIFY
src/server/rest/v1/service/SiteService.ts
src/server/rest/v1/service/SiteService.ts
@@ -413,9 +413,11 @@ export default class SiteService {
}
site.public = filteredRequest.public;
}
+ if (Utils.isComponentActiveFromToken(req.user, TenantComponents.OCPI)) {
if (Utils.objectHasProperty(filteredRequest, 'tariffID')) {
site.tariffID = filteredRequest.tariffID;
}
+ }
if (Utils.objectHasProperty(filteredRequest, 'autoUserSiteAssignment')) {
site.autoUserSiteAssignment = filteredRequest.autoUserSiteAssignment;
}

Check if OCPI component is active before saving the tariffID