Added Car Conenctor settings
MODIFY
src/assets/server/rest/v1/schemas/tenant/tenant-components.json
src/assets/server/rest/v1/schemas/tenant/tenant-components.json
"sanitize": "mongo"
}
}
+ },
+ "carConnector": {
+ "type": "object",
+ "properties": {
+ "active": {
+ "type": "boolean",
+ "sanitize": "mongo"
+ }
+ }
}
}
}

MODIFY
src/server/rest/v1/service/security/SettingSecurity.ts
src/server/rest/v1/service/security/SettingSecurity.ts
-import { AnalyticsSettingsType, AssetConnectionSetting, AssetConnectionType, AssetSettingsType, BillingSettingsType, ConcurRefundSetting, CryptoSettingsType, OcpiBusinessDetails, OcpiSetting, OicpBusinessDetails, OicpSetting, PricingSettingsType, RefundSettingsType, RoamingSettingsType, SettingDB, SettingDBContent, SettingLink, SimplePricingSetting, SmartChargingSettingsType, UserSettingsType } from '../../../../../types/Setting';
+import { AnalyticsSettingsType, AssetConnectionSetting, AssetConnectionType, AssetSettingsType, BillingSettingsType, CarConnectorConnectionSetting, CarConnectorConnectionType, CarConnectorSettingsType, ConcurRefundSetting, CryptoSettingsType, OcpiBusinessDetails, OcpiSetting, OicpBusinessDetails, OicpSetting, PricingSettingsType, RefundSettingsType, RoamingSettingsType, SettingDB, SettingDBContent, SettingLink, SimplePricingSetting, SmartChargingSettingsType, UserSettingsType } from '../../../../../types/Setting';
import { HttpSettingRequest, HttpSettingsRequest } from '../../../../../types/requests/HttpSettingRequest';
import Utils from '../../../../../utils/Utils';
@@ -226,6 +226,32 @@ export default class SettingSecurity {
settings.content.asset.connections.push(sanitizedConnection);
}
break;
+ case CarConnectorSettingsType.CAR_CONNECTOR:
+ settings.content.carConnector = {
+ connections: [],
+ };
+ for (const connection of request.content.carConnector.connections) {
+ const sanitizedConnection: CarConnectorConnectionSetting = {
+ id: sanitize(connection.id),
+ name: sanitize(connection.name),
+ description: sanitize(connection.description),
+ type: sanitize(connection.type),
+ timestamp: new Date(),
+ };
+ // Check type
+ switch (connection.type) {
+ case CarConnectorConnectionType.MERCEDES:
+ sanitizedConnection.mercedesConnection = {
+ authenticationUrl: sanitize(connection.mercedesConnection.authenticationUrl),
+ apiUrl: sanitize(connection.mercedesConnection.apiUrl),
+ clientId: sanitize(connection.mercedesConnection.clientId),
+ clientSecret: sanitize(connection.mercedesConnection.clientSecret),
+ };
+ break;
+ }
+ settings.content.carConnector.connections.push(sanitizedConnection);
+ }
+ break;
case CryptoSettingsType.CRYPTO:
settings.content.crypto = {
key: sanitize(request.content.crypto.key),

MODIFY
src/types/Setting.ts
src/types/Setting.ts
@@ -37,7 +37,8 @@ export interface SettingDBContent {
| AssetSettingsType
| SmartChargingContentType
| CryptoSettingsType
- | UserSettingsType;
+ | UserSettingsType
+ | CarConnectorSettingsType;
ocpi?: OcpiSetting;
oicp?: OicpSetting;
simple?: SimplePricingSetting;
@@ -48,6 +49,7 @@ export interface SettingDBContent {
concur?: ConcurRefundSetting;
sapSmartCharging?: SapSmartChargingSetting;
asset?: AssetSetting;
+ carConnector?: CarConnectorSetting;
crypto?: CryptoSetting;
user?: UserSetting;
}
@@ -296,6 +298,42 @@ export interface AssetGreencomConnectionType {
export interface AssetSchneiderConnectionType extends AssetUserPasswordConnectionType {
}
+export enum CarConnectorSettingsType {
+ CAR_CONNECTOR = 'carConnector',
+}
+
+export interface CarConnectorSettings extends Setting {
+ identifier: TenantComponents.CAR_CONNECTOR;
+ type: CarConnectorSettingsType;
+ carConnector?: CarConnectorSetting;
+}
+
+export interface CarConnectorSetting {
+ connections: CarConnectorConnectionSetting[];
+}
+
+export interface CarConnectorConnectionSetting {
+ id: string;
+ name: string;
+ description: string;
+ timestamp: Date;
+ type: CarConnectorConnectionType;
+ mercedesConnection?: CarConnectorMercedesConnectionType;
+}
+
+export enum CarConnectorConnectionType {
+ NONE = '',
+ MERCEDES = 'mercedes',
+}
+
+export interface CarConnectorMercedesConnectionType {
+ authenticationUrl: string;
+ apiUrl: string;
+ clientId: string;
+ clientSecret: string;
+}
+
+
export enum CryptoSettingsType {
CRYPTO = 'crypto'
}

MODIFY
src/types/TenantComponents.ts
src/types/TenantComponents.ts
@@ -9,6 +9,7 @@ enum TenantComponents {
BILLING = 'billing',
ASSET = 'asset',
SMART_CHARGING = 'smartCharging',
- CAR = 'car'
+ CAR = 'car',
+ CAR_CONNECTOR = 'carConnector'
}
export default TenantComponents;

MODIFY
src/utils/Utils.ts
src/utils/Utils.ts
-import { AnalyticsSettingsType, AssetSettingsType, BillingSettingsType, CryptoKeyProperties, PricingSettingsType, RefundSettingsType, RoamingSettingsType, SettingDBContent, SmartChargingContentType } from '../types/Setting';
+import { AnalyticsSettingsType, AssetSettingsType, BillingSettingsType, CarConnectorSettingsType, CryptoKeyProperties, PricingSettingsType, RefundSettingsType, RoamingSettingsType, SettingDBContent, SmartChargingContentType } from '../types/Setting';
import { Car, CarCatalog } from '../types/Car';
import { ChargePointStatus, OCPPProtocol, OCPPVersion, OCPPVersionURLPath } from '../types/ocpp/OCPPServer';
import ChargingStation, { ChargePoint, ChargingStationEndpoint, Connector, ConnectorCurrentLimitSource, CurrentType } from '../types/ChargingStation';
@@ -1312,7 +1312,7 @@ export default class Utils {
break;
// Asset
case TenantComponents.ASSET:
- if (!currentSettingContent || currentSettingContent.type !== activeComponent.type) {
+ if (!currentSettingContent) {
// Only Asset
return {
'type': AssetSettingsType.ASSET,
@@ -1322,6 +1322,18 @@ export default class Utils {
} as SettingDBContent;
}
break;
+ // Car Connector
+ case TenantComponents.CAR_CONNECTOR:
+ if (!currentSettingContent) {
+ // Only Car Connector
+ return {
+ 'type': CarConnectorSettingsType.CAR_CONNECTOR,
+ 'carConnector': {
+ connections: []
+ }
+ } as SettingDBContent;
+ }
+ break;
}
}

Added Car Conenctor settings