@open-charging-cloud/chargy-core 0.4.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -102
- package/dist/BSMCrypt01.d.ts.map +1 -1
- package/dist/Mennekes.d.ts.map +1 -1
- package/dist/browser/index.js +525 -328
- package/dist/browser/index.js.map +1 -1
- package/dist/chargy.d.ts +16 -3
- package/dist/chargy.d.ts.map +1 -1
- package/dist/interfaces/IChargeTransparencyRecord.d.ts +4 -4
- package/dist/interfaces/IChargeTransparencyRecord.d.ts.map +1 -1
- package/dist/interfaces/chargyInterfaces.d.ts +45 -8
- package/dist/interfaces/chargyInterfaces.d.ts.map +1 -1
- package/dist/node/index.js +525 -328
- package/dist/node/index.js.map +1 -1
- package/dist/verificationResults.d.ts +2 -1
- package/dist/verificationResults.d.ts.map +1 -1
- package/i18n.json +45 -0
- package/package.json +3 -1
- package/validationRules.json +8 -0
package/dist/browser/index.js
CHANGED
|
@@ -9873,10 +9873,12 @@ var secp224k1 = class {
|
|
|
9873
9873
|
// src/interfaces/chargyInterfaces.ts
|
|
9874
9874
|
var chargyInterfaces_exports = {};
|
|
9875
9875
|
__export(chargyInterfaces_exports, {
|
|
9876
|
+
CreateError: () => CreateError,
|
|
9876
9877
|
CryptoAlgorithms: () => CryptoAlgorithms,
|
|
9877
9878
|
CryptoHashAlgorithms: () => CryptoHashAlgorithms,
|
|
9878
9879
|
DayOfWeek: () => DayOfWeek,
|
|
9879
9880
|
DisplayPrefixes: () => DisplayPrefixes,
|
|
9881
|
+
ErrorLevel: () => ErrorLevel,
|
|
9880
9882
|
IECCurves: () => IECCurves,
|
|
9881
9883
|
IEncoding: () => IEncoding,
|
|
9882
9884
|
InformationRelevance: () => InformationRelevance,
|
|
@@ -9884,6 +9886,7 @@ __export(chargyInterfaces_exports, {
|
|
|
9884
9886
|
SessionVerificationResult: () => SessionVerificationResult,
|
|
9885
9887
|
SignatureFormats: () => SignatureFormats,
|
|
9886
9888
|
VerificationResult: () => VerificationResult,
|
|
9889
|
+
WarningLevel: () => WarningLevel,
|
|
9887
9890
|
isGeoLocation: () => isGeoLocation,
|
|
9888
9891
|
isICryptoResult: () => isICryptoResult,
|
|
9889
9892
|
isIFileInfo: () => isIFileInfo,
|
|
@@ -9973,6 +9976,24 @@ var DisplayPrefixes = /* @__PURE__ */ ((DisplayPrefixes2) => {
|
|
|
9973
9976
|
DisplayPrefixes2[DisplayPrefixes2["GIGA"] = 3] = "GIGA";
|
|
9974
9977
|
return DisplayPrefixes2;
|
|
9975
9978
|
})(DisplayPrefixes || {});
|
|
9979
|
+
var WarningLevel = /* @__PURE__ */ ((WarningLevel2) => {
|
|
9980
|
+
WarningLevel2["low"] = "low";
|
|
9981
|
+
WarningLevel2["medium"] = "medium";
|
|
9982
|
+
WarningLevel2["high"] = "high";
|
|
9983
|
+
return WarningLevel2;
|
|
9984
|
+
})(WarningLevel || {});
|
|
9985
|
+
var ErrorLevel = /* @__PURE__ */ ((ErrorLevel2) => {
|
|
9986
|
+
ErrorLevel2["low"] = "low";
|
|
9987
|
+
ErrorLevel2["medium"] = "medium";
|
|
9988
|
+
ErrorLevel2["high"] = "high";
|
|
9989
|
+
return ErrorLevel2;
|
|
9990
|
+
})(ErrorLevel || {});
|
|
9991
|
+
function CreateError(message, level = "high" /* high */) {
|
|
9992
|
+
return {
|
|
9993
|
+
level,
|
|
9994
|
+
message
|
|
9995
|
+
};
|
|
9996
|
+
}
|
|
9976
9997
|
function isISessionCryptoResult1(obj) {
|
|
9977
9998
|
return typeof obj === "object" && obj !== null && obj.status !== void 0;
|
|
9978
9999
|
}
|
|
@@ -10004,6 +10025,7 @@ var SessionVerificationResult = /* @__PURE__ */ ((SessionVerificationResult2) =>
|
|
|
10004
10025
|
SessionVerificationResult2["InvalidStopValue"] = "InvalidStopValue";
|
|
10005
10026
|
SessionVerificationResult2["EnergyMeterNotFound"] = "EnergyMeterNotFound";
|
|
10006
10027
|
SessionVerificationResult2["InvalidMeasurement"] = "InvalidMeasurement";
|
|
10028
|
+
SessionVerificationResult2["InplausibleMeasurement"] = "InplausibleMeasurement";
|
|
10007
10029
|
SessionVerificationResult2["PublicKeyNotFound"] = "PublicKeyNotFound";
|
|
10008
10030
|
SessionVerificationResult2["UnknownPublicKeyFormat"] = "UnknownPublicKeyFormat";
|
|
10009
10031
|
SessionVerificationResult2["InvalidPublicKey"] = "InvalidPublicKey";
|
|
@@ -10775,7 +10797,7 @@ var Alfen = class {
|
|
|
10775
10797
|
if (elements?.length != 6 && elements?.length != 7)
|
|
10776
10798
|
return {
|
|
10777
10799
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10778
|
-
message: this.chargy.
|
|
10800
|
+
message: this.chargy.GetMultilanguageText("Invalid number of signed meter values!"),
|
|
10779
10801
|
certainty: 0
|
|
10780
10802
|
};
|
|
10781
10803
|
const FormatId = elements[0];
|
|
@@ -10789,13 +10811,13 @@ var Alfen = class {
|
|
|
10789
10811
|
else if (elements[3] !== common.PublicKey)
|
|
10790
10812
|
return {
|
|
10791
10813
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10792
|
-
message: this.chargy.
|
|
10814
|
+
message: this.chargy.GetMultilanguageText("Inconsistent public keys!"),
|
|
10793
10815
|
certainty: 0
|
|
10794
10816
|
};
|
|
10795
10817
|
if (FormatId !== "AP" || Type?.length !== 1 || BlobVersion?.length !== 1 || BlobVersion !== "3" || PublicKey.byteLength !== 25 || DataSet.byteLength !== 82 || Signature.byteLength !== 48) {
|
|
10796
10818
|
return {
|
|
10797
10819
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10798
|
-
message: this.chargy.
|
|
10820
|
+
message: this.chargy.GetMultilanguageText("Invalid charging session format!"),
|
|
10799
10821
|
certainty: 0
|
|
10800
10822
|
};
|
|
10801
10823
|
}
|
|
@@ -10820,7 +10842,7 @@ var Alfen = class {
|
|
|
10820
10842
|
else if (AdapterId !== common.AdapterId)
|
|
10821
10843
|
return {
|
|
10822
10844
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10823
|
-
message: this.chargy.
|
|
10845
|
+
message: this.chargy.GetMultilanguageText("Inconsistent Alfen adapter identification!"),
|
|
10824
10846
|
certainty: 0
|
|
10825
10847
|
};
|
|
10826
10848
|
if (common.AdapterFWVersion === "")
|
|
@@ -10828,7 +10850,7 @@ var Alfen = class {
|
|
|
10828
10850
|
else if (AdapterFWVersion !== common.AdapterFWVersion)
|
|
10829
10851
|
return {
|
|
10830
10852
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10831
|
-
message: this.chargy.
|
|
10853
|
+
message: this.chargy.GetMultilanguageText("Inconsistent Alfen adapter firmware version!"),
|
|
10832
10854
|
certainty: 0
|
|
10833
10855
|
};
|
|
10834
10856
|
if (common.AdapterFWChecksum === "")
|
|
@@ -10836,7 +10858,7 @@ var Alfen = class {
|
|
|
10836
10858
|
else if (AdapterFWChecksum !== common.AdapterFWChecksum)
|
|
10837
10859
|
return {
|
|
10838
10860
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10839
|
-
message: this.chargy.
|
|
10861
|
+
message: this.chargy.GetMultilanguageText("Inconsistent Alfen adapter firmware checksum!"),
|
|
10840
10862
|
certainty: 0
|
|
10841
10863
|
};
|
|
10842
10864
|
if (common.MeterId === "")
|
|
@@ -10844,7 +10866,7 @@ var Alfen = class {
|
|
|
10844
10866
|
else if (MeterId !== common.MeterId)
|
|
10845
10867
|
return {
|
|
10846
10868
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10847
|
-
message: this.chargy.
|
|
10869
|
+
message: this.chargy.GetMultilanguageText("Inconsistent meter identification!"),
|
|
10848
10870
|
certainty: 0
|
|
10849
10871
|
};
|
|
10850
10872
|
if (common.ObisId === "")
|
|
@@ -10852,7 +10874,7 @@ var Alfen = class {
|
|
|
10852
10874
|
else if (ObisId !== common.ObisId)
|
|
10853
10875
|
return {
|
|
10854
10876
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10855
|
-
message: this.chargy.
|
|
10877
|
+
message: this.chargy.GetMultilanguageText("Inconsistent OBIS code!"),
|
|
10856
10878
|
certainty: 0
|
|
10857
10879
|
};
|
|
10858
10880
|
if (common.UnitEncoded === 0)
|
|
@@ -10860,7 +10882,7 @@ var Alfen = class {
|
|
|
10860
10882
|
else if (UnitEncoded !== common.UnitEncoded)
|
|
10861
10883
|
return {
|
|
10862
10884
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10863
|
-
message: this.chargy.
|
|
10885
|
+
message: this.chargy.GetMultilanguageText("Inconsistent unit (encoded) value!"),
|
|
10864
10886
|
certainty: 0
|
|
10865
10887
|
};
|
|
10866
10888
|
if (common.Scalar === "")
|
|
@@ -10868,7 +10890,7 @@ var Alfen = class {
|
|
|
10868
10890
|
else if (Scalar !== common.Scalar)
|
|
10869
10891
|
return {
|
|
10870
10892
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10871
|
-
message: this.chargy.
|
|
10893
|
+
message: this.chargy.GetMultilanguageText("Inconsistent measurement scalar!"),
|
|
10872
10894
|
certainty: 0
|
|
10873
10895
|
};
|
|
10874
10896
|
if (common.UID === "")
|
|
@@ -10876,7 +10898,7 @@ var Alfen = class {
|
|
|
10876
10898
|
else if (UID !== common.UID)
|
|
10877
10899
|
return {
|
|
10878
10900
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10879
|
-
message: this.chargy.
|
|
10901
|
+
message: this.chargy.GetMultilanguageText("Inconsistent user identification!"),
|
|
10880
10902
|
certainty: 0
|
|
10881
10903
|
};
|
|
10882
10904
|
if (common.InternalSessionId === 0)
|
|
@@ -10884,13 +10906,13 @@ var Alfen = class {
|
|
|
10884
10906
|
else if (InternalSessionId !== common.InternalSessionId)
|
|
10885
10907
|
return {
|
|
10886
10908
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10887
|
-
message: this.chargy.
|
|
10909
|
+
message: this.chargy.GetMultilanguageText("Inconsistent internal charging session identification!"),
|
|
10888
10910
|
certainty: 0
|
|
10889
10911
|
};
|
|
10890
10912
|
if (previousTimestamp !== "" && previousTimestamp > Timestamp)
|
|
10891
10913
|
return {
|
|
10892
10914
|
status: "InconsistentTimestamps" /* InconsistentTimestamps */,
|
|
10893
|
-
message: this.chargy.
|
|
10915
|
+
message: this.chargy.GetMultilanguageText("Inconsistent timestamps!"),
|
|
10894
10916
|
certainty: 0
|
|
10895
10917
|
};
|
|
10896
10918
|
else
|
|
@@ -10914,7 +10936,7 @@ var Alfen = class {
|
|
|
10914
10936
|
if (firstDataSet === void 0 || lastDataSet === void 0)
|
|
10915
10937
|
return {
|
|
10916
10938
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
10917
|
-
message: this.chargy.
|
|
10939
|
+
message: this.chargy.GetMultilanguageText("Invalid number of signed meter values!"),
|
|
10918
10940
|
certainty: 0
|
|
10919
10941
|
};
|
|
10920
10942
|
const _CTR = {
|
|
@@ -11046,7 +11068,7 @@ var Alfen = class {
|
|
|
11046
11068
|
} catch (exception) {
|
|
11047
11069
|
return {
|
|
11048
11070
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
11049
|
-
message: this.chargy.
|
|
11071
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
11050
11072
|
certainty: 0
|
|
11051
11073
|
};
|
|
11052
11074
|
}
|
|
@@ -11371,18 +11393,18 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11371
11393
|
tryToParseBSM_WS36aMeasurements(CTR, ExpectedEVSEId, ExpectedCscSwVersion, Measurements) {
|
|
11372
11394
|
if (!Array.isArray(Measurements)) return {
|
|
11373
11395
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
11374
|
-
message: this.chargy.
|
|
11396
|
+
message: this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues"),
|
|
11375
11397
|
certainty: 0
|
|
11376
11398
|
};
|
|
11377
11399
|
if (Measurements.length < 2) return {
|
|
11378
11400
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
11379
|
-
message: this.chargy.
|
|
11401
|
+
message: this.chargy.GetMultilanguageText("AtLeastTwoSignedMeterValuesRequired"),
|
|
11380
11402
|
certainty: 0
|
|
11381
11403
|
};
|
|
11382
11404
|
const firstMeasurement = Measurements[0];
|
|
11383
11405
|
if (!isMandatoryJSONObject(firstMeasurement)) return {
|
|
11384
11406
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
11385
|
-
message: this.chargy.
|
|
11407
|
+
message: this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidSignedMeterValueP", 1),
|
|
11386
11408
|
certainty: 0
|
|
11387
11409
|
};
|
|
11388
11410
|
const errors = new Array();
|
|
@@ -11391,51 +11413,51 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11391
11413
|
let secondaryErrors = 0;
|
|
11392
11414
|
try {
|
|
11393
11415
|
if (!isMandatoryString(firstMeasurement["@context"]))
|
|
11394
|
-
errors.push(this.chargy.
|
|
11416
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_JSONContextP", 1)));
|
|
11395
11417
|
const meterInfo = firstMeasurement["meterInfo"];
|
|
11396
11418
|
if (!isMandatoryJSONObject(meterInfo)) {
|
|
11397
|
-
errors.push(this.chargy.
|
|
11419
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfoP", 1)));
|
|
11398
11420
|
secondaryErrors += 5;
|
|
11399
11421
|
} else {
|
|
11400
11422
|
if (!isMandatoryString(meterInfo["firmwareVersion"]))
|
|
11401
|
-
errors.push(this.chargy.
|
|
11423
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
11402
11424
|
if (!isMandatoryString(meterInfo["publicKey"]))
|
|
11403
|
-
errors.push(this.chargy.
|
|
11425
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
11404
11426
|
if (!isMandatoryString(meterInfo["meterId"]))
|
|
11405
|
-
errors.push(this.chargy.
|
|
11427
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
11406
11428
|
if (!isMandatoryString(meterInfo["manufacturer"]))
|
|
11407
|
-
errors.push(this.chargy.
|
|
11429
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
11408
11430
|
if (!isMandatoryString(meterInfo["type"]))
|
|
11409
|
-
errors.push(this.chargy.
|
|
11431
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_TypeP", 1)));
|
|
11410
11432
|
}
|
|
11411
11433
|
const contract = firstMeasurement["contract"];
|
|
11412
11434
|
if (!isMandatoryJSONObject(contract)) {
|
|
11413
|
-
errors.push(this.chargy.
|
|
11435
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ContractP", 1)));
|
|
11414
11436
|
secondaryErrors += 2;
|
|
11415
11437
|
} else {
|
|
11416
11438
|
if (!isMandatoryString(contract["id"]))
|
|
11417
|
-
errors.push(this.chargy.
|
|
11439
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_IdP", 1)));
|
|
11418
11440
|
if (!isOptionalString(contract["type"]))
|
|
11419
|
-
errors.push(this.chargy.
|
|
11441
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TypeP", 1)));
|
|
11420
11442
|
}
|
|
11421
11443
|
const value = firstMeasurement["value"];
|
|
11422
11444
|
if (!isMandatoryJSONObject(value)) {
|
|
11423
|
-
errors.push(this.chargy.
|
|
11445
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ValueP", 1)));
|
|
11424
11446
|
secondaryErrors += 8;
|
|
11425
11447
|
} else {
|
|
11426
11448
|
const measurand = value["measurand"];
|
|
11427
11449
|
if (!isMandatoryJSONObject(measurand)) {
|
|
11428
|
-
errors.push(this.chargy.
|
|
11450
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasurandP", 1)));
|
|
11429
11451
|
secondaryErrors += 2;
|
|
11430
11452
|
} else {
|
|
11431
11453
|
if (!isMandatoryString(measurand["id"]))
|
|
11432
|
-
errors.push(this.chargy.
|
|
11454
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_Measurand_IdentificationP", 1)));
|
|
11433
11455
|
if (!isMandatoryString(measurand["name"]))
|
|
11434
|
-
errors.push(this.chargy.
|
|
11456
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_Measurand_NameP", 1)));
|
|
11435
11457
|
}
|
|
11436
11458
|
const measuredValue = value["measuredValue"];
|
|
11437
11459
|
if (!isMandatoryJSONObject(measuredValue)) {
|
|
11438
|
-
errors.push(this.chargy.
|
|
11460
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValueP", 1)));
|
|
11439
11461
|
secondaryErrors += 4;
|
|
11440
11462
|
} else {
|
|
11441
11463
|
}
|
|
@@ -11513,7 +11535,7 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11513
11535
|
if (currentMeasurement === void 0)
|
|
11514
11536
|
throw new Error(`Invalid signed meter value #${String(measurementCounter)}!`);
|
|
11515
11537
|
if (currentMeasurement["@context"] !== common.context)
|
|
11516
|
-
currentErrors.push(this.chargy.
|
|
11538
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_JSONContextP", measurementCounter)));
|
|
11517
11539
|
const currentId = currentMeasurement["@id"];
|
|
11518
11540
|
if (previousId !== "" && typeof currentId === "string") {
|
|
11519
11541
|
if (typeof previousId !== "string")
|
|
@@ -11524,7 +11546,7 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11524
11546
|
// anything (not even NaN). This way we are checking that both counter values
|
|
11525
11547
|
// are numeric too.
|
|
11526
11548
|
parseInt(previousParts[1], 10) >= parseInt(currentParts[1], 10)) {
|
|
11527
|
-
currentErrors.push(this.chargy.
|
|
11549
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeasurementIdP", measurementCounter)));
|
|
11528
11550
|
}
|
|
11529
11551
|
}
|
|
11530
11552
|
previousId = currentId;
|
|
@@ -11533,11 +11555,11 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11533
11555
|
const displayedFormatObj2 = asJSONObject(valueObj2?.["displayedFormat"]);
|
|
11534
11556
|
const currentTime = asString(currentMeasurement["time"]) ?? "";
|
|
11535
11557
|
if (previousTime !== "" && currentTime <= previousTime)
|
|
11536
|
-
currentErrors.push(this.chargy.
|
|
11558
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_TimestampP", measurementCounter)));
|
|
11537
11559
|
previousTime = currentTime;
|
|
11538
11560
|
const currentValue = asNumber(measuredValueObj2?.["value"]);
|
|
11539
11561
|
if (previousValue !== void 0 && currentValue !== void 0 && currentValue < previousValue)
|
|
11540
|
-
currentErrors.push(this.chargy.
|
|
11562
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurement_ValueP", measurementCounter)));
|
|
11541
11563
|
previousValue = currentValue;
|
|
11542
11564
|
const additionalValuesRaw = currentMeasurement["additionalValues"];
|
|
11543
11565
|
if (!isMandatoryJSONArray(additionalValuesRaw))
|
|
@@ -11564,32 +11586,32 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11564
11586
|
if (currentMeasurement["meterInfo"]) {
|
|
11565
11587
|
const meterInfoObj2 = asJSONObject(currentMeasurement["meterInfo"]);
|
|
11566
11588
|
if (meterInfoObj2?.["firmwareVersion"] !== common.meterInfo_firmwareVersion)
|
|
11567
|
-
currentErrors.push(this.chargy.
|
|
11589
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_FirmwareVersionP", measurementCounter)));
|
|
11568
11590
|
if (meterInfoObj2?.["publicKey"] !== common.meterInfo_publicKey)
|
|
11569
|
-
currentErrors.push(this.chargy.
|
|
11591
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_PublicKeyP", measurementCounter)));
|
|
11570
11592
|
if (meterInfoObj2?.["meterId"] !== common.meterInfo_meterId)
|
|
11571
|
-
currentErrors.push(this.chargy.
|
|
11593
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
11572
11594
|
if (meterInfoObj2?.["meterId"] !== additionalValues.filter((element) => element.measurandName === "MA1")[0]?.value)
|
|
11573
|
-
currentErrors.push(this.chargy.
|
|
11595
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
11574
11596
|
if (meterInfoObj2?.["manufacturer"] !== common.meterInfo_manufacturer)
|
|
11575
|
-
currentErrors.push(this.chargy.
|
|
11597
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_ManufacturerP", measurementCounter)));
|
|
11576
11598
|
if (meterInfoObj2?.["type"] !== common.meterInfo_type)
|
|
11577
|
-
currentErrors.push(this.chargy.
|
|
11599
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_TypeP", measurementCounter)));
|
|
11578
11600
|
}
|
|
11579
11601
|
if (currentMeasurement["contract"]) {
|
|
11580
11602
|
const contractObj2 = asJSONObject(currentMeasurement["contract"]);
|
|
11581
11603
|
if (additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("contract-id:")).length == 0)
|
|
11582
|
-
currentErrors.push(this.chargy.
|
|
11604
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
11583
11605
|
if (contractObj2?.["id"] !== common.contract_id)
|
|
11584
|
-
currentErrors.push(this.chargy.
|
|
11606
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
11585
11607
|
if (contractObj2?.["type"] !== common.contract_type)
|
|
11586
|
-
currentErrors.push(this.chargy.
|
|
11608
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_TypeP", measurementCounter)));
|
|
11587
11609
|
const contractInfo = additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("contract-id:"))[0]?.value;
|
|
11588
11610
|
if (contractInfo != null) {
|
|
11589
11611
|
if (contractObj2?.["type"] && contractInfo !== "contract-id: " + (common.contract_type ?? "-") + ":" + common.contract_id)
|
|
11590
|
-
currentErrors.push(this.chargy.
|
|
11612
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
11591
11613
|
if (!contractObj2?.["type"] && contractInfo !== "contract-id: " + common.contract_id)
|
|
11592
|
-
currentErrors.push(this.chargy.
|
|
11614
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
11593
11615
|
}
|
|
11594
11616
|
}
|
|
11595
11617
|
const rcrInAdditional = additionalValues.find((element) => element.measurandName == "RCR");
|
|
@@ -11600,37 +11622,40 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11600
11622
|
if (valueObj2?.["measurand"]) {
|
|
11601
11623
|
const measurandObj2 = asJSONObject(valueObj2["measurand"]);
|
|
11602
11624
|
if (measurandObj2?.["id"] !== common.value_measurand_id || measurandObj2["id"] !== rcrInAdditional?.measurandId)
|
|
11603
|
-
currentErrors.push(this.chargy.
|
|
11625
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurand_IdentificationP", measurementCounter)));
|
|
11604
11626
|
if (measurandObj2?.["name"] !== common.value_measurand_name || measurandObj2["name"] !== rcrInAdditional?.measurandName)
|
|
11605
|
-
currentErrors.push(this.chargy.
|
|
11627
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurand_NameP", measurementCounter)));
|
|
11606
11628
|
}
|
|
11607
11629
|
if (valueObj2?.["measuredValue"]) {
|
|
11608
11630
|
if (measuredValueObj2?.["value"] !== rcrInAdditional?.value)
|
|
11609
|
-
currentErrors.push(this.chargy.
|
|
11631
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValueP", measurementCounter)));
|
|
11610
11632
|
if (measuredValueObj2?.["scale"] !== common.value_measuredValue_scale || measuredValueObj2?.["scale"] !== rcrInAdditional?.scale)
|
|
11611
|
-
currentErrors.push(this.chargy.
|
|
11633
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_ScaleP", measurementCounter)));
|
|
11612
11634
|
if (measuredValueObj2?.["unit"] !== common.value_measuredValue_unit || measuredValueObj2["unit"] !== rcrInAdditional?.unit)
|
|
11613
|
-
currentErrors.push(this.chargy.
|
|
11635
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_UnitP", measurementCounter)));
|
|
11614
11636
|
if (measuredValueObj2?.["unitEncoded"] !== common.value_measuredValue_unitEncoded || measuredValueObj2?.["unitEncoded"] !== rcrInAdditional?.unitEncoded)
|
|
11615
|
-
currentErrors.push(this.chargy.
|
|
11637
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_UnitEncodedP", measurementCounter)));
|
|
11616
11638
|
if (measuredValueObj2?.["valueType"] !== common.value_measuredValue_valueType || measuredValueObj2?.["valueType"] !== rcrInAdditional?.valueType)
|
|
11617
|
-
currentErrors.push(this.chargy.
|
|
11639
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_TypeP", measurementCounter)));
|
|
11618
11640
|
}
|
|
11619
11641
|
if (currentMeasurement["chargePoint"] && asJSONObject(currentMeasurement["chargePoint"])?.["softwareVersion"] !== common.chargePoint_softwareVersion)
|
|
11620
|
-
currentErrors.push(this.chargy.
|
|
11642
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageText("Inconsistent_ChargingStation_FirmwareVersion")));
|
|
11621
11643
|
const signedEVSEId = additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("evse-id:"));
|
|
11622
11644
|
if (signedEVSEId.length == 1) {
|
|
11623
11645
|
const evse__id = (asString(signedEVSEId[0]?.value) ?? "").replace("evse-id:", "").trim();
|
|
11624
11646
|
if (evse__id !== "unknown" && ExpectedEVSEId !== evse__id)
|
|
11625
|
-
currentErrors.push(this.chargy.
|
|
11647
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageText("Inconsistent_EVSE_Identification")));
|
|
11626
11648
|
}
|
|
11627
11649
|
const signedCSCSWVersion = additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("csc-sw-version:"));
|
|
11628
11650
|
if (signedCSCSWVersion.length == 1) {
|
|
11629
11651
|
const csc_sw_version = asString(signedCSCSWVersion[0]?.value)?.replace("csc-sw-version:", "").trim() ?? null;
|
|
11630
11652
|
if (previousCscSwVersion !== null && previousCscSwVersion !== csc_sw_version)
|
|
11631
|
-
currentErrors.push(this.chargy.
|
|
11653
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageText("Inconsistent_ChargingStation_FirmwareVersion")));
|
|
11632
11654
|
if (ExpectedCscSwVersion !== null && ExpectedCscSwVersion !== csc_sw_version)
|
|
11633
|
-
currentWarnings.push(
|
|
11655
|
+
currentWarnings.push({
|
|
11656
|
+
level: "medium" /* medium */,
|
|
11657
|
+
message: this.chargy.GetMultilanguageText("Inconsistent_ChargingStation_FirmwareVersion")
|
|
11658
|
+
});
|
|
11634
11659
|
previousCscSwVersion = csc_sw_version;
|
|
11635
11660
|
}
|
|
11636
11661
|
for (const additionalValue of additionalValues) {
|
|
@@ -11690,32 +11715,32 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11690
11715
|
}
|
|
11691
11716
|
const currentRCRValue = asNumber(RCR?.value) ?? NaN;
|
|
11692
11717
|
if (previousRCR !== -1 && currentRCRValue < previousRCR)
|
|
11693
|
-
currentErrors.push(this.chargy.
|
|
11718
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurement_ValueP", measurementCounter)));
|
|
11694
11719
|
previousRCR = currentRCRValue;
|
|
11695
11720
|
if (RCnt !== currentMeasurement["measurementId"])
|
|
11696
|
-
currentErrors.push(this.chargy.
|
|
11721
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeasurementIdP", measurementCounter)));
|
|
11697
11722
|
if (previousRCnt !== -1 && RCnt != previousRCnt + 1)
|
|
11698
|
-
currentErrors.push(this.chargy.
|
|
11723
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_CounterP", measurementCounter)));
|
|
11699
11724
|
previousRCnt = RCnt;
|
|
11700
11725
|
if (previousOS !== -1 && OS <= previousOS)
|
|
11701
|
-
currentErrors.push(this.chargy.
|
|
11726
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_OperationSecondsCounterP", measurementCounter)));
|
|
11702
11727
|
previousOS = OS;
|
|
11703
11728
|
if (previousEpoch !== -1 && Epoch <= previousEpoch)
|
|
11704
|
-
currentErrors.push(this.chargy.
|
|
11729
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_UNIXEpochP", measurementCounter)));
|
|
11705
11730
|
previousEpoch = Epoch;
|
|
11706
11731
|
const measurementTimestamp1 = new Date(Epoch * 1e3 + TZO * 6e4).toISOString();
|
|
11707
11732
|
const measurementTimestamp2 = measurementTimestamp1.substring(0, measurementTimestamp1.indexOf("."));
|
|
11708
11733
|
const measurementTimestamp3 = measurementTimestamp2 + (TZO > 0 ? "+" : "-") + (Math.abs(TZO) / 60).toString().padStart(2, "0") + ":" + (Math.abs(TZO) % 60).toString().padStart(2, "0");
|
|
11709
11734
|
if (currentTime !== measurementTimestamp3)
|
|
11710
|
-
currentErrors.push(this.chargy.
|
|
11735
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_TimestampP", measurementCounter)));
|
|
11711
11736
|
if (common.MA1 !== null && MA1 !== common.MA1)
|
|
11712
|
-
currentErrors.push(this.chargy.
|
|
11737
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
11713
11738
|
common.MA1 = MA1;
|
|
11714
11739
|
if (common.epochSetCnt !== -1 && EpochSetCnt !== common.epochSetCnt)
|
|
11715
|
-
currentErrors.push(this.chargy.
|
|
11740
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_EpochSet_CounterP", measurementCounter)));
|
|
11716
11741
|
common.epochSetCnt = EpochSetCnt;
|
|
11717
11742
|
if (common.epochSetOS !== -1 && EpochSetOS !== common.epochSetOS)
|
|
11718
|
-
currentErrors.push(this.chargy.
|
|
11743
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_EpochSet_OperationSecondsP", measurementCounter)));
|
|
11719
11744
|
common.epochSetOS = EpochSetOS;
|
|
11720
11745
|
common.dataSets.push({
|
|
11721
11746
|
Typ,
|
|
@@ -11754,7 +11779,7 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11754
11779
|
throw new Error(this.chargy.GetLocalizedMessageWithParameter("Inconsistent_EnergyMeterValueP", 1));
|
|
11755
11780
|
for (let i = 1; i < common.dataSets.length - 1; i++) {
|
|
11756
11781
|
if (common.dataSets[i]?.TypParsed !== "CURRENT")
|
|
11757
|
-
errors.push(this.chargy.
|
|
11782
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_EnergyMeterValueP", measurementCounter + 1)));
|
|
11758
11783
|
}
|
|
11759
11784
|
if (lastDataSet === void 0 || lastDataSet.TypParsed !== "END" && lastDataSet.TypParsed !== "TURN OFF")
|
|
11760
11785
|
throw new Error(this.chargy.GetLocalizedMessageWithParameter("Inconsistent_EnergyMeterValueP", n + 1));
|
|
@@ -11824,7 +11849,11 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11824
11849
|
try {
|
|
11825
11850
|
ASN1Signature = ASN1_SignatureSchema.decode(Buffer.from(dataSet.signature, "hex"), "der");
|
|
11826
11851
|
} catch (exception) {
|
|
11827
|
-
|
|
11852
|
+
const signatureError = this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_SignatureP", 1);
|
|
11853
|
+
const exceptionText = ": " + (exception instanceof Error ? exception.message : String(exception));
|
|
11854
|
+
for (const language of Object.keys(signatureError))
|
|
11855
|
+
signatureError[language] = (signatureError[language] ?? "") + exceptionText;
|
|
11856
|
+
errors.push(CreateError(signatureError));
|
|
11828
11857
|
}
|
|
11829
11858
|
const bsmMeasurementValue = {
|
|
11830
11859
|
timestamp: dataSet.time,
|
|
@@ -11917,7 +11946,9 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
11917
11946
|
CTR.certainty = 1 - errors.length / numberOfFormatChecks;
|
|
11918
11947
|
return CTR;
|
|
11919
11948
|
} catch (exception) {
|
|
11920
|
-
errors.push(
|
|
11949
|
+
errors.push(
|
|
11950
|
+
CreateError({ "en": "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)) })
|
|
11951
|
+
);
|
|
11921
11952
|
}
|
|
11922
11953
|
return {
|
|
11923
11954
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
@@ -13042,14 +13073,14 @@ var Mennekes = class {
|
|
|
13042
13073
|
if (chargingProcesses.length === 0)
|
|
13043
13074
|
return {
|
|
13044
13075
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13045
|
-
message: this.chargy.
|
|
13076
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
13046
13077
|
certainty: 0
|
|
13047
13078
|
};
|
|
13048
13079
|
return await Promise.resolve(this.toChargeTransparencyRecord(chargingProcesses));
|
|
13049
13080
|
} catch (exception) {
|
|
13050
13081
|
return {
|
|
13051
13082
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13052
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
13083
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
13053
13084
|
certainty: 0
|
|
13054
13085
|
};
|
|
13055
13086
|
}
|
|
@@ -13186,7 +13217,10 @@ var MennekesCrypt01 = class extends ACrypt {
|
|
|
13186
13217
|
sessionResult = "InvalidSignature" /* InvalidSignature */;
|
|
13187
13218
|
}
|
|
13188
13219
|
if (sessionResult === "ValidSignature" /* ValidSignature */) {
|
|
13189
|
-
const lawErrors = validateMennekesLawConformity(
|
|
13220
|
+
const lawErrors = validateMennekesLawConformity(
|
|
13221
|
+
measurement.values,
|
|
13222
|
+
this.chargy
|
|
13223
|
+
);
|
|
13190
13224
|
if (lawErrors.length > 0) {
|
|
13191
13225
|
measurement.verificationResult = {
|
|
13192
13226
|
status: "InvalidMeasurement" /* InvalidMeasurement */,
|
|
@@ -13443,18 +13477,20 @@ function toMennekesMeasurementValue(measurement) {
|
|
|
13443
13477
|
"measurement": void 0
|
|
13444
13478
|
};
|
|
13445
13479
|
}
|
|
13446
|
-
function validateMennekesLawConformity(measurementValues) {
|
|
13480
|
+
function validateMennekesLawConformity(measurementValues, chargy) {
|
|
13447
13481
|
const errors = new Array();
|
|
13448
13482
|
const start = measurementValues[0];
|
|
13449
13483
|
const end = measurementValues[measurementValues.length - 1];
|
|
13450
13484
|
if (start == null || end == null)
|
|
13451
|
-
return [
|
|
13485
|
+
return [
|
|
13486
|
+
CreateError(chargy.GetMultilanguageText("Mennekes EDL40 requires at least two measurement values."))
|
|
13487
|
+
];
|
|
13452
13488
|
if (start.eventCounter !== end.eventCounter)
|
|
13453
|
-
errors.push("Event counter mismatch.");
|
|
13489
|
+
errors.push(CreateError(chargy.GetMultilanguageText("Event counter mismatch.")));
|
|
13454
13490
|
if (Number(start.paginationId) >= Number(end.paginationId))
|
|
13455
|
-
errors.push("Pagination must increase from start to end.");
|
|
13491
|
+
errors.push(CreateError(chargy.GetMultilanguageText("Pagination must increase from start to end.")));
|
|
13456
13492
|
if (start.value.gt(end.value))
|
|
13457
|
-
errors.push("Meter value must not decrease.");
|
|
13493
|
+
errors.push(CreateError(chargy.GetMultilanguageText("Meter value must not decrease.")));
|
|
13458
13494
|
return errors;
|
|
13459
13495
|
}
|
|
13460
13496
|
function child(parent, localName) {
|
|
@@ -13829,17 +13865,17 @@ var OCMF = class {
|
|
|
13829
13865
|
const pagination = paging.length > 1 ? parseNumber(paging.substring(1)) : null;
|
|
13830
13866
|
if (transactionType === "undefined" /* undefined */) return {
|
|
13831
13867
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13832
|
-
message: this.chargy.
|
|
13868
|
+
message: this.chargy.GetMultilanguageText("The given OCMF data does not have a valid transaction type!"),
|
|
13833
13869
|
certainty: 0
|
|
13834
13870
|
};
|
|
13835
13871
|
if (!isMandatoryNumber(pagination)) return {
|
|
13836
13872
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13837
|
-
message: this.chargy.
|
|
13873
|
+
message: this.chargy.GetMultilanguageText("The given OCMF data does not have a valid pagination counter!"),
|
|
13838
13874
|
certainty: 0
|
|
13839
13875
|
};
|
|
13840
13876
|
if (firstOCMDJSONDocument.payload.RD.length == 0) return {
|
|
13841
13877
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13842
|
-
message: this.chargy.
|
|
13878
|
+
message: this.chargy.GetMultilanguageText("Each OCMF data set must have at least one meter reading!"),
|
|
13843
13879
|
certainty: 0
|
|
13844
13880
|
};
|
|
13845
13881
|
const CTR = {
|
|
@@ -13937,14 +13973,14 @@ var OCMF = class {
|
|
|
13937
13973
|
const timeSplit = time.split(" ");
|
|
13938
13974
|
if (timeSplit.length != 2) return {
|
|
13939
13975
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13940
|
-
message: this.chargy.
|
|
13976
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time format!"),
|
|
13941
13977
|
certainty: 0
|
|
13942
13978
|
};
|
|
13943
13979
|
const timeRegEx = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2},\d{3}[+-]\d{4}$/;
|
|
13944
13980
|
const timeStamp = timeSplit[0];
|
|
13945
13981
|
if (!isMandatoryString(timeStamp) || !timeRegEx.test(timeStamp)) return {
|
|
13946
13982
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13947
|
-
message: this.chargy.
|
|
13983
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time sync format!"),
|
|
13948
13984
|
certainty: 0
|
|
13949
13985
|
};
|
|
13950
13986
|
const timeStampISO8601 = this.convertToISO8601(timeStamp);
|
|
@@ -13952,7 +13988,7 @@ var OCMF = class {
|
|
|
13952
13988
|
let timeSync = "unknown" /* unknown */;
|
|
13953
13989
|
if (!isMandatoryString(timeSyncText) || !["U", "I", "S", "R"].includes(timeSyncText)) return {
|
|
13954
13990
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13955
|
-
message: this.chargy.
|
|
13991
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time sync format!"),
|
|
13956
13992
|
certainty: 0
|
|
13957
13993
|
};
|
|
13958
13994
|
switch (timeSyncText) {
|
|
@@ -13971,23 +14007,23 @@ var OCMF = class {
|
|
|
13971
14007
|
default:
|
|
13972
14008
|
return {
|
|
13973
14009
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13974
|
-
message: this.chargy.
|
|
14010
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time sync format!"),
|
|
13975
14011
|
certainty: 0
|
|
13976
14012
|
};
|
|
13977
14013
|
}
|
|
13978
14014
|
if (transaction && !["B", "C", "X", "E", "L", "R", "A", "P", "S", "T"].includes(transaction)) return {
|
|
13979
14015
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13980
|
-
message: this.chargy.
|
|
14016
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid transaction type!"),
|
|
13981
14017
|
certainty: 0
|
|
13982
14018
|
};
|
|
13983
14019
|
if (!["kWh", "Wh", "mOhm", "uOhm"].includes(readingUnit)) return {
|
|
13984
14020
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13985
|
-
message: this.chargy.
|
|
14021
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid current type!"),
|
|
13986
14022
|
certainty: 0
|
|
13987
14023
|
};
|
|
13988
14024
|
if (readingCurrentType && !["AC", "DC"].includes(readingCurrentType)) return {
|
|
13989
14025
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13990
|
-
message: this.chargy.
|
|
14026
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid current type!"),
|
|
13991
14027
|
certainty: 0
|
|
13992
14028
|
};
|
|
13993
14029
|
if (CTR.chargingSessions?.[0]?.begin === "?")
|
|
@@ -14056,7 +14092,7 @@ var OCMF = class {
|
|
|
14056
14092
|
} catch (exception) {
|
|
14057
14093
|
return {
|
|
14058
14094
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14059
|
-
message: "Invalid OCMF data: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
14095
|
+
message: this.chargy.GetMultilanguageText("Invalid OCMF data: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
14060
14096
|
certainty: 0
|
|
14061
14097
|
};
|
|
14062
14098
|
}
|
|
@@ -14491,7 +14527,7 @@ var OCMF = class {
|
|
|
14491
14527
|
async TryToParseOCMFDocuments(OCMFDocuments, PublicKey, PublicKeyEncoding, ContainerInfos) {
|
|
14492
14528
|
if (OCMFDocuments.length == 0) return {
|
|
14493
14529
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14494
|
-
message: this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + "!",
|
|
14530
|
+
message: this.chargy.GetMultilanguageText(this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + "!"),
|
|
14495
14531
|
certainty: 0
|
|
14496
14532
|
};
|
|
14497
14533
|
const ocmfJSONDocumentGroups = /* @__PURE__ */ new Map();
|
|
@@ -14511,7 +14547,7 @@ var OCMF = class {
|
|
|
14511
14547
|
} catch (exception) {
|
|
14512
14548
|
return {
|
|
14513
14549
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14514
|
-
message: this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + ": " + (exception instanceof Error ? exception.message : String(exception)),
|
|
14550
|
+
message: this.chargy.GetMultilanguageText(this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + ": " + (exception instanceof Error ? exception.message : String(exception))),
|
|
14515
14551
|
certainty: 0
|
|
14516
14552
|
};
|
|
14517
14553
|
}
|
|
@@ -14539,7 +14575,7 @@ var OCMF = class {
|
|
|
14539
14575
|
default:
|
|
14540
14576
|
ocmfCTRs.push({
|
|
14541
14577
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14542
|
-
message: this.chargy.
|
|
14578
|
+
message: this.chargy.GetMultilanguageText("Unknown OCMF version!"),
|
|
14543
14579
|
certainty: 0
|
|
14544
14580
|
});
|
|
14545
14581
|
break;
|
|
@@ -14551,7 +14587,7 @@ var OCMF = class {
|
|
|
14551
14587
|
}
|
|
14552
14588
|
return {
|
|
14553
14589
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14554
|
-
message: this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + (typeof ocmfJSONDocuments === "string" ? ": " + ocmfJSONDocuments : "!"),
|
|
14590
|
+
message: this.chargy.GetMultilanguageText(this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + (typeof ocmfJSONDocuments === "string" ? ": " + ocmfJSONDocuments : "!")),
|
|
14555
14591
|
certainty: 0
|
|
14556
14592
|
};
|
|
14557
14593
|
}
|
|
@@ -14594,11 +14630,11 @@ var OCPI = class {
|
|
|
14594
14630
|
const public_key = SomeJSON["public_key"];
|
|
14595
14631
|
const signed_values = SomeJSON["signed_values"];
|
|
14596
14632
|
if (!isMandatoryString(encoding_method))
|
|
14597
|
-
errors.push(this.chargy.
|
|
14633
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEncodingMethod")));
|
|
14598
14634
|
if (!isMandatoryString(public_key))
|
|
14599
|
-
errors.push(this.chargy.
|
|
14635
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPublicKey")));
|
|
14600
14636
|
if (!isMandatoryJSONArray(signed_values))
|
|
14601
|
-
errors.push(this.chargy.
|
|
14637
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedValues")));
|
|
14602
14638
|
if (errors.length > 0)
|
|
14603
14639
|
return {
|
|
14604
14640
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
@@ -14700,138 +14736,138 @@ var OCPI = class {
|
|
|
14700
14736
|
const chargingCostsInfo_flat_cost = chargingCostsInfo_flat?.["cost"];
|
|
14701
14737
|
const signedMeterValues = SomeJSON["signedMeterValues"];
|
|
14702
14738
|
if (!isMandatoryString(chargingSessionId))
|
|
14703
|
-
errors.push(this.chargy.
|
|
14739
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid charge transparency record identification!")));
|
|
14704
14740
|
if (!isMandatoryJSONObject(chargePointInfo)) {
|
|
14705
|
-
errors.push(this.chargy.
|
|
14741
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargePointInfo")));
|
|
14706
14742
|
secondaryErrors += 19;
|
|
14707
14743
|
} else {
|
|
14708
14744
|
if (!isMandatoryString(evseId))
|
|
14709
|
-
errors.push(this.chargy.
|
|
14745
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEVSEIdentification")));
|
|
14710
14746
|
if (!isMandatoryJSONObject(placeInfo)) {
|
|
14711
|
-
errors.push(this.chargy.
|
|
14747
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPlaceInfo")));
|
|
14712
14748
|
secondaryErrors += 8;
|
|
14713
14749
|
} else {
|
|
14714
14750
|
if (!isMandatoryJSONObject(geoLocation)) {
|
|
14715
|
-
errors.push(this.chargy.
|
|
14751
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocation")));
|
|
14716
14752
|
secondaryErrors += 2;
|
|
14717
14753
|
} else {
|
|
14718
14754
|
if (!isMandatoryNumber(geoLocation_lat))
|
|
14719
|
-
errors.push(this.chargy.
|
|
14755
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLatitude")));
|
|
14720
14756
|
if (!isMandatoryNumber(geoLocation_lon))
|
|
14721
|
-
errors.push(this.chargy.
|
|
14757
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLongitude")));
|
|
14722
14758
|
}
|
|
14723
14759
|
if (!isMandatoryJSONObject(address)) {
|
|
14724
|
-
errors.push(this.chargy.
|
|
14760
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddress")));
|
|
14725
14761
|
secondaryErrors += 4;
|
|
14726
14762
|
} else {
|
|
14727
14763
|
if (!isMandatoryString(address_street))
|
|
14728
|
-
errors.push(this.chargy.
|
|
14764
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressStreetName")));
|
|
14729
14765
|
if (!isMandatoryString(address_zipCode))
|
|
14730
|
-
errors.push(this.chargy.
|
|
14766
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressZIPCode")));
|
|
14731
14767
|
if (!isMandatoryString(address_town))
|
|
14732
|
-
errors.push(this.chargy.
|
|
14768
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCityName")));
|
|
14733
14769
|
if (!isMandatoryString(address_country))
|
|
14734
|
-
errors.push(this.chargy.
|
|
14770
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCountryName")));
|
|
14735
14771
|
}
|
|
14736
14772
|
}
|
|
14737
14773
|
}
|
|
14738
14774
|
if (!isMandatoryJSONObject(chargingStationInfo)) {
|
|
14739
|
-
errors.push(this.chargy.
|
|
14775
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargingStationInfo")));
|
|
14740
14776
|
secondaryErrors += 5;
|
|
14741
14777
|
} else {
|
|
14742
14778
|
if (!isOptionalString(chargingStation_manufacturer))
|
|
14743
|
-
errors.push(this.chargy.
|
|
14779
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station manufacturer!")));
|
|
14744
14780
|
if (!isOptionalString(chargingStation_type))
|
|
14745
|
-
errors.push(this.chargy.
|
|
14781
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station type!")));
|
|
14746
14782
|
if (!isOptionalString(chargingStation_serialNumber))
|
|
14747
|
-
errors.push(this.chargy.
|
|
14783
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station serial number!")));
|
|
14748
14784
|
if (!isOptionalString(chargingStation_controllerSoftwareVersion))
|
|
14749
|
-
errors.push(this.chargy.
|
|
14785
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station controller software version!")));
|
|
14750
14786
|
if (!isOptionalString(chargingStation_compliance))
|
|
14751
|
-
errors.push(this.chargy.
|
|
14787
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance!")));
|
|
14752
14788
|
if (!isOptionalURL(chargingStation_complianceURL))
|
|
14753
|
-
errors.push(this.chargy.
|
|
14789
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance URL!")));
|
|
14754
14790
|
if (!isOptionalString(chargingStation_conformity))
|
|
14755
|
-
errors.push(this.chargy.
|
|
14791
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity!")));
|
|
14756
14792
|
if (!isOptionalURL(chargingStation_conformity_URL))
|
|
14757
|
-
errors.push(this.chargy.
|
|
14793
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity URL!")));
|
|
14758
14794
|
if (!isOptionalURL(chargingStation_conformity_certificateId))
|
|
14759
|
-
errors.push(this.chargy.
|
|
14795
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity certificate identification!")));
|
|
14760
14796
|
if (!isOptionalString(chargingStation_calibration))
|
|
14761
|
-
errors.push(this.chargy.
|
|
14797
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration!")));
|
|
14762
14798
|
if (!isOptionalURL(chargingStation_calibration_URL))
|
|
14763
|
-
errors.push(this.chargy.
|
|
14799
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration URL!")));
|
|
14764
14800
|
if (!isOptionalURL(chargingStation_calibration_certificateId))
|
|
14765
|
-
errors.push(this.chargy.
|
|
14801
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration certificate identification!")));
|
|
14766
14802
|
}
|
|
14767
14803
|
if (meterInfo) {
|
|
14768
14804
|
if (!isOptionalString(meterInfo_meterId))
|
|
14769
|
-
errors.push(this.chargy.
|
|
14805
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
14770
14806
|
if (!isOptionalString(meterInfo_manufacturer))
|
|
14771
|
-
errors.push(this.chargy.
|
|
14807
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14772
14808
|
if (!isOptionalString(meterInfo_manufacturerURL))
|
|
14773
|
-
errors.push(this.chargy.
|
|
14809
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14774
14810
|
if (!isOptionalString(meterInfo_model))
|
|
14775
|
-
errors.push(this.chargy.
|
|
14811
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14776
14812
|
if (!isOptionalString(meterInfo_modelURL))
|
|
14777
|
-
errors.push(this.chargy.
|
|
14813
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14778
14814
|
if (!isOptionalString(meterInfo_firmwareVersion))
|
|
14779
|
-
errors.push(this.chargy.
|
|
14815
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
14780
14816
|
if (!isOptionalString(meterInfo_hardwareVersion))
|
|
14781
|
-
errors.push(this.chargy.
|
|
14817
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
14782
14818
|
if (!isOptionalString(meterInfo_publicKey))
|
|
14783
|
-
errors.push(this.chargy.
|
|
14819
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14784
14820
|
if (!isOptionalString(meterInfo_publicKeyFormat))
|
|
14785
|
-
errors.push(this.chargy.
|
|
14821
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14786
14822
|
if (!isOptionalString(meterInfo_publicKeyEncoding))
|
|
14787
|
-
errors.push(this.chargy.
|
|
14823
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14788
14824
|
if (!isOptionalString(meterInfo_signatureFormat))
|
|
14789
|
-
errors.push(this.chargy.
|
|
14825
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14790
14826
|
if (!isOptionalString(meterInfo_signatureEncoding))
|
|
14791
|
-
errors.push(this.chargy.
|
|
14827
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14792
14828
|
}
|
|
14793
14829
|
if (connectorInfo) {
|
|
14794
14830
|
if (!isOptionalString(connectorInfo_type))
|
|
14795
|
-
errors.push(this.chargy.
|
|
14831
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
14796
14832
|
if (!isOptionalString(connectorInfo_losses))
|
|
14797
|
-
errors.push(this.chargy.
|
|
14833
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
14798
14834
|
}
|
|
14799
14835
|
if (chargingCostsInfo) {
|
|
14800
14836
|
if (!isMandatoryNumber(chargingCostsInfo_total))
|
|
14801
|
-
errors.push(this.chargy.
|
|
14837
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid total costs within the charging costs!")));
|
|
14802
14838
|
if (!isMandatoryString(chargingCostsInfo_currency))
|
|
14803
|
-
errors.push(this.chargy.
|
|
14839
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid currency within the charging costs!")));
|
|
14804
14840
|
if (chargingCostsInfo_reservation) {
|
|
14805
14841
|
if (!isMandatoryNumber(chargingCostsInfo_reservation_cost))
|
|
14806
|
-
errors.push(this.chargy.
|
|
14842
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation cost within the charging costs!")));
|
|
14807
14843
|
if (!isMandatoryString(chargingCostsInfo_reservation_unit))
|
|
14808
|
-
errors.push(this.chargy.
|
|
14844
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation unit within the charging costs!")));
|
|
14809
14845
|
}
|
|
14810
14846
|
if (chargingCostsInfo_energy) {
|
|
14811
14847
|
if (!isMandatoryNumber(chargingCostsInfo_energy_cost))
|
|
14812
|
-
errors.push(this.chargy.
|
|
14848
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy cost within the charging costs!")));
|
|
14813
14849
|
if (!isMandatoryString(chargingCostsInfo_energy_unit))
|
|
14814
|
-
errors.push(this.chargy.
|
|
14850
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy unit within the charging costs!")));
|
|
14815
14851
|
}
|
|
14816
14852
|
if (chargingCostsInfo_time) {
|
|
14817
14853
|
if (!isMandatoryNumber(chargingCostsInfo_time_cost))
|
|
14818
|
-
errors.push(this.chargy.
|
|
14854
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time cost within the charging costs!")));
|
|
14819
14855
|
if (!isMandatoryString(chargingCostsInfo_time_unit))
|
|
14820
|
-
errors.push(this.chargy.
|
|
14856
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time unit within the charging costs!")));
|
|
14821
14857
|
}
|
|
14822
14858
|
if (chargingCostsInfo_idle) {
|
|
14823
14859
|
if (!isMandatoryNumber(chargingCostsInfo_idle_cost))
|
|
14824
|
-
errors.push(this.chargy.
|
|
14860
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle cost within the charging costs!")));
|
|
14825
14861
|
if (!isMandatoryString(chargingCostsInfo_idle_unit))
|
|
14826
|
-
errors.push(this.chargy.
|
|
14862
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle unit within the charging costs!")));
|
|
14827
14863
|
}
|
|
14828
14864
|
if (chargingCostsInfo_flat) {
|
|
14829
14865
|
if (!isMandatoryNumber(chargingCostsInfo_flat_cost))
|
|
14830
|
-
errors.push(this.chargy.
|
|
14866
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid flat cost within the charging costs!")));
|
|
14831
14867
|
}
|
|
14832
14868
|
}
|
|
14833
14869
|
if (!isMandatoryJSONArray(signedMeterValues) || signedMeterValues.length < 2) {
|
|
14834
|
-
errors.push(this.chargy.
|
|
14870
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues")));
|
|
14835
14871
|
secondaryErrors += 2 * 39;
|
|
14836
14872
|
} else {
|
|
14837
14873
|
const firstSMV = asJSONObject(signedMeterValues[0]);
|
|
@@ -14841,7 +14877,7 @@ var OCPI = class {
|
|
|
14841
14877
|
const context = asString(currentSMV?.["@context"])?.trim() ?? asString(currentSMV?.["format"])?.trim() ?? null;
|
|
14842
14878
|
if (smvContext !== context) return {
|
|
14843
14879
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14844
|
-
message: "Inconsistent signed meter value format!",
|
|
14880
|
+
message: this.chargy.GetMultilanguageText("Inconsistent signed meter value format!"),
|
|
14845
14881
|
certainty: 1
|
|
14846
14882
|
};
|
|
14847
14883
|
}
|
|
@@ -14986,7 +15022,7 @@ var OCPI = class {
|
|
|
14986
15022
|
} catch (exception) {
|
|
14987
15023
|
return {
|
|
14988
15024
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14989
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
15025
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
14990
15026
|
errors,
|
|
14991
15027
|
warnings,
|
|
14992
15028
|
certainty: (numberOfFormatChecks - errors.length - secondaryErrors) / numberOfFormatChecks
|
|
@@ -14995,7 +15031,7 @@ var OCPI = class {
|
|
|
14995
15031
|
}
|
|
14996
15032
|
return {
|
|
14997
15033
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14998
|
-
message: "No chargeIT charge transparency record",
|
|
15034
|
+
message: this.chargy.GetMultilanguageText("No chargeIT charge transparency record"),
|
|
14999
15035
|
errors,
|
|
15000
15036
|
warnings,
|
|
15001
15037
|
certainty: 0
|
|
@@ -15281,7 +15317,7 @@ var PCDF = class {
|
|
|
15281
15317
|
if (externalPublicKey != null && normalizePCDFPublicKeyHex(externalPublicKey) !== publicKey) {
|
|
15282
15318
|
return {
|
|
15283
15319
|
status: "InvalidPublicKey" /* InvalidPublicKey */,
|
|
15284
|
-
message: "Wrong Public Key",
|
|
15320
|
+
message: this.chargy.GetMultilanguageText("Wrong Public Key"),
|
|
15285
15321
|
certainty: 1
|
|
15286
15322
|
};
|
|
15287
15323
|
}
|
|
@@ -15302,7 +15338,7 @@ var PCDF = class {
|
|
|
15302
15338
|
} catch (exception) {
|
|
15303
15339
|
return {
|
|
15304
15340
|
status: exception instanceof PCDFParseError ? "InvalidSessionFormat" /* InvalidSessionFormat */ : "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15305
|
-
message: exception instanceof Error ? exception.message : String(exception),
|
|
15341
|
+
message: this.chargy.GetMultilanguageText(exception instanceof Error ? exception.message : String(exception)),
|
|
15306
15342
|
certainty: 0
|
|
15307
15343
|
};
|
|
15308
15344
|
}
|
|
@@ -15608,7 +15644,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
15608
15644
|
if (signedData == null)
|
|
15609
15645
|
return {
|
|
15610
15646
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15611
|
-
message: "Each value within the given XML container must contain signed data!",
|
|
15647
|
+
message: this.chargy.GetMultilanguageText("Each value within the given XML container must contain signed data!"),
|
|
15612
15648
|
certainty: 0
|
|
15613
15649
|
};
|
|
15614
15650
|
const signedDataFormat = signedData.attributes.getNamedItem("format")?.value.trim().toLowerCase() ?? "";
|
|
@@ -15617,7 +15653,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
15617
15653
|
else if (signedDataFormat !== commonSignedDataFormat)
|
|
15618
15654
|
return {
|
|
15619
15655
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15620
|
-
message: "Invalid mixture of different signed data formats within the given XML container!",
|
|
15656
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signed data formats within the given XML container!"),
|
|
15621
15657
|
certainty: 0
|
|
15622
15658
|
};
|
|
15623
15659
|
const signedDataEncoding = signedData.attributes.getNamedItem("encoding")?.value.trim().toLowerCase() ?? "";
|
|
@@ -15626,14 +15662,14 @@ var SAFEXML = class _SAFEXML {
|
|
|
15626
15662
|
else if (signedDataEncoding !== commonSignedDataEncoding)
|
|
15627
15663
|
return {
|
|
15628
15664
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15629
|
-
message: "Invalid mixture of different signed data encodings within the given XML container!",
|
|
15665
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signed data encodings within the given XML container!"),
|
|
15630
15666
|
certainty: 0
|
|
15631
15667
|
};
|
|
15632
15668
|
const signedDataValue = signedData.textContent.trim();
|
|
15633
15669
|
if (IsNullOrEmpty(signedDataValue))
|
|
15634
15670
|
return {
|
|
15635
15671
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15636
|
-
message: "The signed data value within the given XML container must not be empty!",
|
|
15672
|
+
message: this.chargy.GetMultilanguageText("The signed data value within the given XML container must not be empty!"),
|
|
15637
15673
|
certainty: 0
|
|
15638
15674
|
};
|
|
15639
15675
|
const publicKeyEncoding = publicKey?.attributes.getNamedItem("encoding")?.value.trim().toLowerCase() ?? "";
|
|
@@ -15642,7 +15678,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
15642
15678
|
else if (publicKeyEncoding !== commonPublicKeyEncoding)
|
|
15643
15679
|
return {
|
|
15644
15680
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15645
|
-
message: "Invalid mixture of different public key encodings within the given XML container!",
|
|
15681
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different public key encodings within the given XML container!"),
|
|
15646
15682
|
certainty: 0
|
|
15647
15683
|
};
|
|
15648
15684
|
const publicKeyValue = publicKey?.textContent.trim().replace(/\s+/g, "") ?? "";
|
|
@@ -15651,7 +15687,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
15651
15687
|
else if (publicKeyValue !== commonPublicKey)
|
|
15652
15688
|
return {
|
|
15653
15689
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15654
|
-
message: "Invalid mixture of different public keys within the given XML container!",
|
|
15690
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different public keys within the given XML container!"),
|
|
15655
15691
|
certainty: 0
|
|
15656
15692
|
};
|
|
15657
15693
|
switch (commonSignedDataEncoding) {
|
|
@@ -15671,7 +15707,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
15671
15707
|
default:
|
|
15672
15708
|
return {
|
|
15673
15709
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15674
|
-
message: "Unkown signed data encoding within the given SAFE XML!",
|
|
15710
|
+
message: this.chargy.GetMultilanguageText("Unkown signed data encoding within the given SAFE XML!"),
|
|
15675
15711
|
certainty: 0
|
|
15676
15712
|
};
|
|
15677
15713
|
}
|
|
@@ -15693,7 +15729,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
15693
15729
|
default:
|
|
15694
15730
|
return {
|
|
15695
15731
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15696
|
-
message: this.chargy.
|
|
15732
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
15697
15733
|
certainty: 0
|
|
15698
15734
|
};
|
|
15699
15735
|
}
|
|
@@ -15702,13 +15738,13 @@ var SAFEXML = class _SAFEXML {
|
|
|
15702
15738
|
} catch (exception) {
|
|
15703
15739
|
return {
|
|
15704
15740
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15705
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
15741
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
15706
15742
|
certainty: 0
|
|
15707
15743
|
};
|
|
15708
15744
|
}
|
|
15709
15745
|
return {
|
|
15710
15746
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15711
|
-
message: this.chargy.
|
|
15747
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
15712
15748
|
certainty: 0
|
|
15713
15749
|
};
|
|
15714
15750
|
}
|
|
@@ -15757,14 +15793,14 @@ var XMLContainer = class {
|
|
|
15757
15793
|
default:
|
|
15758
15794
|
return {
|
|
15759
15795
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15760
|
-
message: "Unkown public key encoding within the given XML container!",
|
|
15796
|
+
message: this.chargy.GetMultilanguageText("Unkown public key encoding within the given XML container!"),
|
|
15761
15797
|
certainty: 0
|
|
15762
15798
|
};
|
|
15763
15799
|
}
|
|
15764
15800
|
if (IsNullOrEmpty(publicKeyValue))
|
|
15765
15801
|
return {
|
|
15766
15802
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15767
|
-
message: "The public key within the given XML container must not be empty!",
|
|
15803
|
+
message: this.chargy.GetMultilanguageText("The public key within the given XML container must not be empty!"),
|
|
15768
15804
|
certainty: 0
|
|
15769
15805
|
};
|
|
15770
15806
|
else if (common.publicKey == "")
|
|
@@ -15772,7 +15808,7 @@ var XMLContainer = class {
|
|
|
15772
15808
|
else if (publicKeyValue != common.publicKey)
|
|
15773
15809
|
return {
|
|
15774
15810
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15775
|
-
message: "Invalid mixture of different public keys within the given XML container!",
|
|
15811
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different public keys within the given XML container!"),
|
|
15776
15812
|
certainty: 0
|
|
15777
15813
|
};
|
|
15778
15814
|
}
|
|
@@ -15797,14 +15833,14 @@ var XMLContainer = class {
|
|
|
15797
15833
|
default:
|
|
15798
15834
|
return {
|
|
15799
15835
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15800
|
-
message: "Unkown meter value signature encoding within the given XML container!",
|
|
15836
|
+
message: this.chargy.GetMultilanguageText("Unkown meter value signature encoding within the given XML container!"),
|
|
15801
15837
|
certainty: 0
|
|
15802
15838
|
};
|
|
15803
15839
|
}
|
|
15804
15840
|
if (IsNullOrEmpty(meterValueSignatureValue))
|
|
15805
15841
|
return {
|
|
15806
15842
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15807
|
-
message: "The meter value signature within the given XML container must not be empty!",
|
|
15843
|
+
message: this.chargy.GetMultilanguageText("The meter value signature within the given XML container must not be empty!"),
|
|
15808
15844
|
certainty: 0
|
|
15809
15845
|
};
|
|
15810
15846
|
common.meterValueSignatures.push(meterValueSignatureValue);
|
|
@@ -15815,7 +15851,7 @@ var XMLContainer = class {
|
|
|
15815
15851
|
else if (common.signatureMethod != signatureMethod)
|
|
15816
15852
|
return {
|
|
15817
15853
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15818
|
-
message: "Invalid mixture of different signature methods within the given XML container!",
|
|
15854
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signature methods within the given XML container!"),
|
|
15819
15855
|
certainty: 0
|
|
15820
15856
|
};
|
|
15821
15857
|
const encodingMethod = valueList[i]?.querySelector("encodingMethod")?.textContent.trim().toLowerCase() ?? "";
|
|
@@ -15824,7 +15860,7 @@ var XMLContainer = class {
|
|
|
15824
15860
|
else if (common.encodingMethod != encodingMethod)
|
|
15825
15861
|
return {
|
|
15826
15862
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15827
|
-
message: "Invalid mixture of different signed data formats within the given XML container!",
|
|
15863
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signed data formats within the given XML container!"),
|
|
15828
15864
|
certainty: 0
|
|
15829
15865
|
};
|
|
15830
15866
|
const encodedMeterValue = valueList[i]?.querySelector("encodedMeterValue");
|
|
@@ -15848,21 +15884,21 @@ var XMLContainer = class {
|
|
|
15848
15884
|
default:
|
|
15849
15885
|
return {
|
|
15850
15886
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15851
|
-
message: "Unkown signed data encoding within the given XML container!",
|
|
15887
|
+
message: this.chargy.GetMultilanguageText("Unkown signed data encoding within the given XML container!"),
|
|
15852
15888
|
certainty: 0
|
|
15853
15889
|
};
|
|
15854
15890
|
}
|
|
15855
15891
|
if (IsNullOrEmpty(signedDataValue))
|
|
15856
15892
|
return {
|
|
15857
15893
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15858
|
-
message: "The signed data value within the given XML container must not be empty!",
|
|
15894
|
+
message: this.chargy.GetMultilanguageText("The signed data value within the given XML container must not be empty!"),
|
|
15859
15895
|
certainty: 0
|
|
15860
15896
|
};
|
|
15861
15897
|
common.encodedMeterValues.push(signedDataValue);
|
|
15862
15898
|
} else
|
|
15863
15899
|
return {
|
|
15864
15900
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15865
|
-
message: "The signed data tag within the given XML container must not be empty!",
|
|
15901
|
+
message: this.chargy.GetMultilanguageText("The signed data tag within the given XML container must not be empty!"),
|
|
15866
15902
|
certainty: 0
|
|
15867
15903
|
};
|
|
15868
15904
|
}
|
|
@@ -15870,13 +15906,13 @@ var XMLContainer = class {
|
|
|
15870
15906
|
}
|
|
15871
15907
|
return {
|
|
15872
15908
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15873
|
-
message: this.chargy.
|
|
15909
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
15874
15910
|
certainty: 0
|
|
15875
15911
|
};
|
|
15876
15912
|
} catch (exception) {
|
|
15877
15913
|
return {
|
|
15878
15914
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15879
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
15915
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
15880
15916
|
certainty: 0
|
|
15881
15917
|
};
|
|
15882
15918
|
}
|
|
@@ -15998,7 +16034,7 @@ var ChargeIT = class {
|
|
|
15998
16034
|
if (firstMeterValue === void 0 || lastMeterValue === void 0)
|
|
15999
16035
|
return {
|
|
16000
16036
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16001
|
-
message: this.chargy.
|
|
16037
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
16002
16038
|
certainty: 0
|
|
16003
16039
|
};
|
|
16004
16040
|
CTR["@id"] = lastMeterValue["transactionId"];
|
|
@@ -16183,38 +16219,38 @@ var ChargeIT = class {
|
|
|
16183
16219
|
{
|
|
16184
16220
|
const placeInfo = asJSONObject(SomeJSON["placeInfo"]);
|
|
16185
16221
|
if (placeInfo === void 0) {
|
|
16186
|
-
errors.push(this.chargy.
|
|
16222
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPlaceInfo")));
|
|
16187
16223
|
secondaryErrors += 13;
|
|
16188
16224
|
} else {
|
|
16189
16225
|
const evseId = placeInfo["evseId"];
|
|
16190
16226
|
if (!isMandatoryString(evseId))
|
|
16191
|
-
errors.push(this.chargy.
|
|
16227
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEVSEId")));
|
|
16192
16228
|
const address = asJSONObject(placeInfo["address"]);
|
|
16193
16229
|
if (address === void 0) {
|
|
16194
|
-
errors.push(this.chargy.
|
|
16230
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddress")));
|
|
16195
16231
|
secondaryErrors += 3;
|
|
16196
16232
|
} else {
|
|
16197
16233
|
if (!isMandatoryString(address["street"]))
|
|
16198
|
-
errors.push(this.chargy.
|
|
16234
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressStreetName")));
|
|
16199
16235
|
if (!isMandatoryString(address["zipCode"]))
|
|
16200
|
-
errors.push(this.chargy.
|
|
16236
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressZIPCode")));
|
|
16201
16237
|
if (!isMandatoryString(address["town"]))
|
|
16202
|
-
errors.push(this.chargy.
|
|
16238
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCityName")));
|
|
16203
16239
|
}
|
|
16204
16240
|
const geoLocation = asJSONObject(placeInfo["geoLocation"]);
|
|
16205
16241
|
if (geoLocation === void 0) {
|
|
16206
|
-
errors.push(this.chargy.
|
|
16242
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocation")));
|
|
16207
16243
|
secondaryErrors += 2;
|
|
16208
16244
|
} else {
|
|
16209
16245
|
if (!isMandatoryNumber(geoLocation["lat"]))
|
|
16210
|
-
errors.push(this.chargy.
|
|
16246
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLatitude")));
|
|
16211
16247
|
if (!isMandatoryNumber(geoLocation["lon"]))
|
|
16212
|
-
errors.push(this.chargy.
|
|
16248
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLongitude")));
|
|
16213
16249
|
}
|
|
16214
16250
|
}
|
|
16215
16251
|
const signedMeterValues = SomeJSON["signedMeterValues"];
|
|
16216
16252
|
if (!isMandatoryJSONArray(signedMeterValues) || signedMeterValues.length < 2) {
|
|
16217
|
-
errors.push(this.chargy.
|
|
16253
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues")));
|
|
16218
16254
|
secondaryErrors += 2 * 39;
|
|
16219
16255
|
} else {
|
|
16220
16256
|
numberOfFormatChecks += 39 * (signedMeterValues.length - 2);
|
|
@@ -16223,7 +16259,7 @@ var ChargeIT = class {
|
|
|
16223
16259
|
for (const signedMeterValue of signedMeterValues.map((smv) => asJSONObject(smv))) {
|
|
16224
16260
|
if ((signedMeterValue?.["@context"] ?? oldChargeITMeterValueFormat) !== signedMeterValueContext) {
|
|
16225
16261
|
if (consistent)
|
|
16226
|
-
errors.push(this.chargy.
|
|
16262
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("InconsistentJSONContextInformation")));
|
|
16227
16263
|
consistent = false;
|
|
16228
16264
|
}
|
|
16229
16265
|
}
|
|
@@ -16236,122 +16272,122 @@ var ChargeIT = class {
|
|
|
16236
16272
|
for (const signedMeterValue of signedMeterValues) {
|
|
16237
16273
|
measurementCounter++;
|
|
16238
16274
|
if (!isMandatoryJSONObject(signedMeterValue)) {
|
|
16239
|
-
errors.push(this.chargy.
|
|
16275
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidSignedMeterValueP", measurementCounter)));
|
|
16240
16276
|
secondaryErrors += 38;
|
|
16241
16277
|
} else {
|
|
16242
16278
|
if (!isMandatoryString(signedMeterValue["measurementId"]))
|
|
16243
|
-
errors.push(this.chargy.
|
|
16279
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasurementIdP", measurementCounter)));
|
|
16244
16280
|
if (!isMandatoryNumber(signedMeterValue["timestamp"]))
|
|
16245
|
-
errors.push(this.chargy.
|
|
16281
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_TimestampP", measurementCounter)));
|
|
16246
16282
|
if (!isMandatoryString(signedMeterValue["transactionId"]))
|
|
16247
|
-
errors.push(this.chargy.
|
|
16283
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_TransactionIdP", measurementCounter)));
|
|
16248
16284
|
if (!isMandatoryString(signedMeterValue["signature"]))
|
|
16249
|
-
errors.push(this.chargy.
|
|
16285
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_SignatureP", measurementCounter)));
|
|
16250
16286
|
const meterInfo = signedMeterValue["meterInfo"];
|
|
16251
16287
|
if (!isMandatoryJSONObject(meterInfo)) {
|
|
16252
|
-
errors.push(this.chargy.
|
|
16288
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfoP", measurementCounter)));
|
|
16253
16289
|
secondaryErrors += 5;
|
|
16254
16290
|
} else {
|
|
16255
16291
|
if (!isMandatoryString(meterInfo["meterId"]))
|
|
16256
|
-
errors.push(this.chargy.
|
|
16292
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
16257
16293
|
if (!isMandatoryString(meterInfo["type"]))
|
|
16258
|
-
errors.push(this.chargy.
|
|
16294
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_TypeP", measurementCounter)));
|
|
16259
16295
|
if (!isMandatoryString(meterInfo["firmwareVersion"]))
|
|
16260
|
-
errors.push(this.chargy.
|
|
16296
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", measurementCounter)));
|
|
16261
16297
|
if (!isMandatoryString(meterInfo["publicKey"]))
|
|
16262
|
-
errors.push(this.chargy.
|
|
16298
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", measurementCounter)));
|
|
16263
16299
|
if (!isMandatoryString(meterInfo["manufacturer"]))
|
|
16264
|
-
errors.push(this.chargy.
|
|
16300
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", measurementCounter)));
|
|
16265
16301
|
if (isOptionalJSONArrayError(meterInfo["publicKeySignatures"]))
|
|
16266
|
-
errors.push(this.chargy.
|
|
16302
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Invalid_SignedMeterValue_MeterInfo_PublicKeySignaturesP", measurementCounter)));
|
|
16267
16303
|
}
|
|
16268
16304
|
const contract = signedMeterValue["contract"];
|
|
16269
16305
|
if (!isMandatoryJSONObject(contract)) {
|
|
16270
|
-
errors.push(this.chargy.
|
|
16306
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ContractP", measurementCounter)));
|
|
16271
16307
|
secondaryErrors += 7;
|
|
16272
16308
|
} else {
|
|
16273
16309
|
if (!isMandatoryString(contract["id"]))
|
|
16274
|
-
errors.push(this.chargy.
|
|
16310
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
16275
16311
|
if (!isMandatoryString(contract["type"]))
|
|
16276
|
-
errors.push(this.chargy.
|
|
16312
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TypeP", measurementCounter)));
|
|
16277
16313
|
if (!isMandatoryNumber(contract["timestamp"]))
|
|
16278
|
-
errors.push(this.chargy.
|
|
16314
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampP", measurementCounter)));
|
|
16279
16315
|
const timestampLocal = contract["timestampLocal"];
|
|
16280
16316
|
if (!isMandatoryJSONObject(timestampLocal)) {
|
|
16281
|
-
errors.push(this.chargy.
|
|
16317
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocalP", measurementCounter)));
|
|
16282
16318
|
secondaryErrors += 3;
|
|
16283
16319
|
} else {
|
|
16284
16320
|
if (!isMandatoryNumber(timestampLocal["timestamp"]))
|
|
16285
|
-
errors.push(this.chargy.
|
|
16321
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocal_TimestampP", measurementCounter)));
|
|
16286
16322
|
if (!isMandatoryNumber(timestampLocal["localOffset"]))
|
|
16287
|
-
errors.push(this.chargy.
|
|
16323
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocal_LocalOffsetP", measurementCounter)));
|
|
16288
16324
|
if (!isMandatoryNumber(timestampLocal["seasonOffset"]))
|
|
16289
|
-
errors.push(this.chargy.
|
|
16325
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocal_SeasonOffsetP", measurementCounter)));
|
|
16290
16326
|
}
|
|
16291
16327
|
}
|
|
16292
16328
|
const measuredValue = signedMeterValue["measuredValue"];
|
|
16293
16329
|
if (!isMandatoryJSONObject(measuredValue)) {
|
|
16294
|
-
errors.push(this.chargy.
|
|
16330
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValueP", measurementCounter)));
|
|
16295
16331
|
secondaryErrors += 9;
|
|
16296
16332
|
} else {
|
|
16297
16333
|
if (!isMandatoryString(measuredValue["value"]))
|
|
16298
|
-
errors.push(this.chargy.
|
|
16334
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_ValueP", measurementCounter)));
|
|
16299
16335
|
if (!isMandatoryString(measuredValue["unit"]))
|
|
16300
|
-
errors.push(this.chargy.
|
|
16336
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_UnitP", measurementCounter)));
|
|
16301
16337
|
if (!isMandatoryNumber(measuredValue["scale"]))
|
|
16302
|
-
errors.push(this.chargy.
|
|
16338
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_ScaleP", measurementCounter)));
|
|
16303
16339
|
if (!isMandatoryString(measuredValue["valueType"]))
|
|
16304
|
-
errors.push(this.chargy.
|
|
16340
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_ValueTypeP", measurementCounter)));
|
|
16305
16341
|
if (!isMandatoryNumber(measuredValue["unitEncoded"]))
|
|
16306
|
-
errors.push(this.chargy.
|
|
16342
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_UnitEncodedP", measurementCounter)));
|
|
16307
16343
|
const timestampLocal = measuredValue["timestampLocal"];
|
|
16308
16344
|
if (!isMandatoryJSONObject(timestampLocal)) {
|
|
16309
|
-
errors.push(this.chargy.
|
|
16345
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampLocalP", measurementCounter)));
|
|
16310
16346
|
secondaryErrors += 3;
|
|
16311
16347
|
} else {
|
|
16312
16348
|
if (!isMandatoryNumber(timestampLocal["timestamp"]))
|
|
16313
|
-
errors.push(this.chargy.
|
|
16349
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampLocalTimestampP", measurementCounter)));
|
|
16314
16350
|
if (!isMandatoryNumber(timestampLocal["localOffset"]))
|
|
16315
|
-
errors.push(this.chargy.
|
|
16351
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampLocalOffsetP", measurementCounter)));
|
|
16316
16352
|
if (!isMandatoryNumber(timestampLocal["seasonOffset"]))
|
|
16317
|
-
errors.push(this.chargy.
|
|
16353
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampSeasonOffsetP", measurementCounter)));
|
|
16318
16354
|
}
|
|
16319
16355
|
}
|
|
16320
16356
|
const measurand = signedMeterValue["measurand"];
|
|
16321
16357
|
if (!isMandatoryJSONObject(measurand)) {
|
|
16322
|
-
errors.push(this.chargy.
|
|
16358
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasurandP", measurementCounter)));
|
|
16323
16359
|
secondaryErrors += 2;
|
|
16324
16360
|
} else {
|
|
16325
16361
|
if (!isMandatoryString(measurand["id"]))
|
|
16326
|
-
errors.push(this.chargy.
|
|
16362
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Measurand_IdP", measurementCounter)));
|
|
16327
16363
|
if (!isMandatoryString(measurand["name"]))
|
|
16328
|
-
errors.push(this.chargy.
|
|
16364
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Measurand_NameP", measurementCounter)));
|
|
16329
16365
|
}
|
|
16330
16366
|
const additionalInfo = signedMeterValue["additionalInfo"];
|
|
16331
16367
|
if (!isMandatoryJSONObject(additionalInfo)) {
|
|
16332
|
-
errors.push(this.chargy.
|
|
16368
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformationP", measurementCounter)));
|
|
16333
16369
|
secondaryErrors += 4;
|
|
16334
16370
|
} else {
|
|
16335
16371
|
if (!isMandatoryString(additionalInfo["status"]))
|
|
16336
|
-
errors.push(this.chargy.
|
|
16372
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_StatusP", measurementCounter)));
|
|
16337
16373
|
const indexes = additionalInfo["indexes"];
|
|
16338
16374
|
if (!isMandatoryJSONObject(indexes)) {
|
|
16339
|
-
errors.push(this.chargy.
|
|
16375
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_IndexesP", measurementCounter)));
|
|
16340
16376
|
secondaryErrors += 2;
|
|
16341
16377
|
} else {
|
|
16342
16378
|
if (!isMandatoryNumber(indexes["timer"]))
|
|
16343
|
-
errors.push(this.chargy.
|
|
16379
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_Indexes_TimerP", measurementCounter)));
|
|
16344
16380
|
if (!isMandatoryString(indexes["logBook"]))
|
|
16345
|
-
errors.push(this.chargy.
|
|
16381
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_Indexes_LogBookP", measurementCounter)));
|
|
16346
16382
|
}
|
|
16347
16383
|
}
|
|
16348
16384
|
const chargePoint = signedMeterValue["chargePoint"];
|
|
16349
16385
|
if (!isMandatoryJSONObject(chargePoint)) {
|
|
16350
|
-
errors.push(this.chargy.
|
|
16386
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ChargePointInformationP", measurementCounter)));
|
|
16351
16387
|
secondaryErrors += 1;
|
|
16352
16388
|
} else {
|
|
16353
16389
|
if (!isMandatoryString(chargePoint["softwareVersion"]))
|
|
16354
|
-
errors.push(this.chargy.
|
|
16390
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ChargePointInformation_SoftwareVersionP", measurementCounter)));
|
|
16355
16391
|
}
|
|
16356
16392
|
}
|
|
16357
16393
|
}
|
|
@@ -16529,7 +16565,7 @@ var ChargeIT = class {
|
|
|
16529
16565
|
} catch (exception) {
|
|
16530
16566
|
return {
|
|
16531
16567
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16532
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
16568
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
16533
16569
|
errors,
|
|
16534
16570
|
warnings,
|
|
16535
16571
|
certainty: (numberOfFormatChecks - errors.length - secondaryErrors) / numberOfFormatChecks
|
|
@@ -16602,101 +16638,101 @@ var ChargeIT = class {
|
|
|
16602
16638
|
const totalCosts_flat_cost = totalCosts_flat?.["cost"];
|
|
16603
16639
|
const signedMeterValues = SomeJSON["signedMeterValues"];
|
|
16604
16640
|
if (!isMandatoryString(chargingSessionId))
|
|
16605
|
-
errors.push(this.chargy.
|
|
16641
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid charge transparency record identification!")));
|
|
16606
16642
|
if (!isMandatoryJSONObject(chargePointInfo)) {
|
|
16607
|
-
errors.push(this.chargy.
|
|
16643
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargePointInfo")));
|
|
16608
16644
|
secondaryErrors += 19;
|
|
16609
16645
|
} else {
|
|
16610
16646
|
if (!isMandatoryString(evseId))
|
|
16611
|
-
errors.push(this.chargy.
|
|
16647
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEVSEIdentification")));
|
|
16612
16648
|
if (!isMandatoryJSONObject(placeInfo)) {
|
|
16613
|
-
errors.push(this.chargy.
|
|
16649
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPlaceInfo")));
|
|
16614
16650
|
secondaryErrors += 8;
|
|
16615
16651
|
} else {
|
|
16616
16652
|
if (!isMandatoryJSONObject(geoLocation)) {
|
|
16617
|
-
errors.push(this.chargy.
|
|
16653
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocation")));
|
|
16618
16654
|
secondaryErrors += 2;
|
|
16619
16655
|
} else {
|
|
16620
16656
|
if (!isMandatoryNumber(geoLocation_lat))
|
|
16621
|
-
errors.push(this.chargy.
|
|
16657
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLatitude")));
|
|
16622
16658
|
if (!isMandatoryNumber(geoLocation_lon))
|
|
16623
|
-
errors.push(this.chargy.
|
|
16659
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLongitude")));
|
|
16624
16660
|
}
|
|
16625
16661
|
if (!isMandatoryJSONObject(address)) {
|
|
16626
|
-
errors.push(this.chargy.
|
|
16662
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddress")));
|
|
16627
16663
|
secondaryErrors += 4;
|
|
16628
16664
|
} else {
|
|
16629
16665
|
if (!isMandatoryString(address_street))
|
|
16630
|
-
errors.push(this.chargy.
|
|
16666
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressStreetName")));
|
|
16631
16667
|
if (!isMandatoryString(address_zipCode))
|
|
16632
|
-
errors.push(this.chargy.
|
|
16668
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressZIPCode")));
|
|
16633
16669
|
if (!isMandatoryString(address_town))
|
|
16634
|
-
errors.push(this.chargy.
|
|
16670
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCityName")));
|
|
16635
16671
|
if (!isMandatoryString(address_country))
|
|
16636
|
-
errors.push(this.chargy.
|
|
16672
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCountryName")));
|
|
16637
16673
|
}
|
|
16638
16674
|
}
|
|
16639
16675
|
}
|
|
16640
16676
|
if (!isMandatoryJSONObject(chargingStationInfo)) {
|
|
16641
|
-
errors.push(this.chargy.
|
|
16677
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargingStationInfo")));
|
|
16642
16678
|
secondaryErrors += 5;
|
|
16643
16679
|
} else {
|
|
16644
16680
|
if (!isOptionalString(chargingStation_manufacturer))
|
|
16645
|
-
errors.push(this.chargy.
|
|
16681
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station manufacturer!")));
|
|
16646
16682
|
if (!isOptionalString(chargingStation_type))
|
|
16647
|
-
errors.push(this.chargy.
|
|
16683
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station type!")));
|
|
16648
16684
|
if (!isOptionalString(chargingStation_serialNumber))
|
|
16649
|
-
errors.push(this.chargy.
|
|
16685
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station serial number!")));
|
|
16650
16686
|
if (!isOptionalString(chargingStation_controllerSoftwareVersion))
|
|
16651
|
-
errors.push(this.chargy.
|
|
16687
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station controller software version!")));
|
|
16652
16688
|
if (!isOptionalString(chargingStation_compliance))
|
|
16653
|
-
errors.push(this.chargy.
|
|
16689
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance!")));
|
|
16654
16690
|
if (!isOptionalURL(chargingStation_complianceURL))
|
|
16655
|
-
errors.push(this.chargy.
|
|
16691
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance URL!")));
|
|
16656
16692
|
if (!isOptionalString(chargingStation_conformity))
|
|
16657
|
-
errors.push(this.chargy.
|
|
16693
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity!")));
|
|
16658
16694
|
if (!isOptionalURL(chargingStation_conformity_URL))
|
|
16659
|
-
errors.push(this.chargy.
|
|
16695
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity URL!")));
|
|
16660
16696
|
if (!isOptionalURL(chargingStation_conformity_certificateId))
|
|
16661
|
-
errors.push(this.chargy.
|
|
16697
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity certificate identification!")));
|
|
16662
16698
|
if (!isOptionalString(chargingStation_calibration))
|
|
16663
|
-
errors.push(this.chargy.
|
|
16699
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration!")));
|
|
16664
16700
|
if (!isOptionalURL(chargingStation_calibration_URL))
|
|
16665
|
-
errors.push(this.chargy.
|
|
16701
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration URL!")));
|
|
16666
16702
|
if (!isOptionalURL(chargingStation_calibration_certificateId))
|
|
16667
|
-
errors.push(this.chargy.
|
|
16703
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration certificate identification!")));
|
|
16668
16704
|
}
|
|
16669
16705
|
if (meterInfo) {
|
|
16670
16706
|
if (!isOptionalString(meterInfo_meterId))
|
|
16671
|
-
errors.push(this.chargy.
|
|
16707
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
16672
16708
|
if (!isOptionalString(meterInfo_manufacturer))
|
|
16673
|
-
errors.push(this.chargy.
|
|
16709
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
16674
16710
|
if (!isOptionalString(meterInfo_manufacturerURL))
|
|
16675
|
-
errors.push(this.chargy.
|
|
16711
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
16676
16712
|
if (!isOptionalString(meterInfo_model))
|
|
16677
|
-
errors.push(this.chargy.
|
|
16713
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
16678
16714
|
if (!isOptionalString(meterInfo_modelURL))
|
|
16679
|
-
errors.push(this.chargy.
|
|
16715
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
16680
16716
|
if (!isOptionalString(meterInfo_firmwareVersion))
|
|
16681
|
-
errors.push(this.chargy.
|
|
16717
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
16682
16718
|
if (!isOptionalString(meterInfo_hardwareVersion))
|
|
16683
|
-
errors.push(this.chargy.
|
|
16719
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
16684
16720
|
if (!isOptionalString(meterInfo_publicKey))
|
|
16685
|
-
errors.push(this.chargy.
|
|
16721
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
16686
16722
|
if (!isOptionalString(meterInfo_publicKeyFormat))
|
|
16687
|
-
errors.push(this.chargy.
|
|
16723
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
16688
16724
|
if (!isOptionalString(meterInfo_publicKeyEncoding))
|
|
16689
|
-
errors.push(this.chargy.
|
|
16725
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
16690
16726
|
if (!isOptionalString(meterInfo_signatureFormat))
|
|
16691
|
-
errors.push(this.chargy.
|
|
16727
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
16692
16728
|
if (!isOptionalString(meterInfo_signatureEncoding))
|
|
16693
|
-
errors.push(this.chargy.
|
|
16729
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
16694
16730
|
}
|
|
16695
16731
|
if (connectorInfo) {
|
|
16696
16732
|
if (!isOptionalString(connectorInfo_type))
|
|
16697
|
-
errors.push(this.chargy.
|
|
16733
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
16698
16734
|
if (!isOptionalString(connectorInfo_losses))
|
|
16699
|
-
errors.push(this.chargy.
|
|
16735
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
16700
16736
|
}
|
|
16701
16737
|
if (isMandatoryJSONArray(chargingTariffs)) {
|
|
16702
16738
|
for (let i = 0; i < chargingTariffs.length; i++) {
|
|
@@ -16704,40 +16740,40 @@ var ChargeIT = class {
|
|
|
16704
16740
|
}
|
|
16705
16741
|
if (totalCosts) {
|
|
16706
16742
|
if (!isMandatoryNumber(totalCosts_total))
|
|
16707
|
-
errors.push(this.chargy.
|
|
16743
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid total costs within the charging costs!")));
|
|
16708
16744
|
if (!isMandatoryString(totalCosts_currency))
|
|
16709
|
-
errors.push(this.chargy.
|
|
16745
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid currency within the charging costs!")));
|
|
16710
16746
|
if (totalCosts_reservation) {
|
|
16711
16747
|
if (!isMandatoryNumber(totalCosts_reservation_cost))
|
|
16712
|
-
errors.push(this.chargy.
|
|
16748
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation cost within the charging costs!")));
|
|
16713
16749
|
if (!isMandatoryString(totalCosts_reservation_unit))
|
|
16714
|
-
errors.push(this.chargy.
|
|
16750
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation unit within the charging costs!")));
|
|
16715
16751
|
}
|
|
16716
16752
|
if (totalCosts_energy) {
|
|
16717
16753
|
if (!isMandatoryNumber(totalCosts_energy_cost))
|
|
16718
|
-
errors.push(this.chargy.
|
|
16754
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy cost within the charging costs!")));
|
|
16719
16755
|
if (!isMandatoryString(totalCosts_energy_unit))
|
|
16720
|
-
errors.push(this.chargy.
|
|
16756
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy unit within the charging costs!")));
|
|
16721
16757
|
}
|
|
16722
16758
|
if (totalCosts_time) {
|
|
16723
16759
|
if (!isMandatoryNumber(totalCosts_time_cost))
|
|
16724
|
-
errors.push(this.chargy.
|
|
16760
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time cost within the charging costs!")));
|
|
16725
16761
|
if (!isMandatoryString(totalCosts_time_unit))
|
|
16726
|
-
errors.push(this.chargy.
|
|
16762
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time unit within the charging costs!")));
|
|
16727
16763
|
}
|
|
16728
16764
|
if (totalCosts_idle) {
|
|
16729
16765
|
if (!isMandatoryNumber(totalCosts_idle_cost))
|
|
16730
|
-
errors.push(this.chargy.
|
|
16766
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle cost within the charging costs!")));
|
|
16731
16767
|
if (!isMandatoryString(totalCosts_idle_unit))
|
|
16732
|
-
errors.push(this.chargy.
|
|
16768
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle unit within the charging costs!")));
|
|
16733
16769
|
}
|
|
16734
16770
|
if (totalCosts_flat) {
|
|
16735
16771
|
if (!isMandatoryNumber(totalCosts_flat_cost))
|
|
16736
|
-
errors.push(this.chargy.
|
|
16772
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid flat cost within the charging costs!")));
|
|
16737
16773
|
}
|
|
16738
16774
|
}
|
|
16739
16775
|
if (!isMandatoryJSONArray(signedMeterValues) || signedMeterValues.length < 2) {
|
|
16740
|
-
errors.push(this.chargy.
|
|
16776
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues")));
|
|
16741
16777
|
secondaryErrors += 2 * 39;
|
|
16742
16778
|
} else {
|
|
16743
16779
|
const firstSMV = asJSONObject(signedMeterValues[0]);
|
|
@@ -16747,7 +16783,7 @@ var ChargeIT = class {
|
|
|
16747
16783
|
const context = asString(currentSMV?.["@context"])?.trim() ?? asString(currentSMV?.["format"])?.trim() ?? null;
|
|
16748
16784
|
if (smvContext !== context) return {
|
|
16749
16785
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16750
|
-
message: "Inconsistent signed meter value format!",
|
|
16786
|
+
message: this.chargy.GetMultilanguageText("Inconsistent signed meter value format!"),
|
|
16751
16787
|
certainty: 1
|
|
16752
16788
|
};
|
|
16753
16789
|
}
|
|
@@ -16896,7 +16932,7 @@ var ChargeIT = class {
|
|
|
16896
16932
|
} catch (exception) {
|
|
16897
16933
|
return {
|
|
16898
16934
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16899
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
16935
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
16900
16936
|
errors,
|
|
16901
16937
|
warnings,
|
|
16902
16938
|
certainty: (numberOfFormatChecks - errors.length - secondaryErrors) / numberOfFormatChecks
|
|
@@ -16905,7 +16941,7 @@ var ChargeIT = class {
|
|
|
16905
16941
|
}
|
|
16906
16942
|
return {
|
|
16907
16943
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16908
|
-
message: "No chargeIT charge transparency record",
|
|
16944
|
+
message: this.chargy.GetMultilanguageText("No chargeIT charge transparency record"),
|
|
16909
16945
|
errors,
|
|
16910
16946
|
warnings,
|
|
16911
16947
|
certainty: 0
|
|
@@ -16924,7 +16960,7 @@ var ChargePoint = class {
|
|
|
16924
16960
|
if (!isMandatoryJSONObject(SomeJSON))
|
|
16925
16961
|
return {
|
|
16926
16962
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16927
|
-
message: this.chargy.
|
|
16963
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
16928
16964
|
certainty: 0
|
|
16929
16965
|
};
|
|
16930
16966
|
if (SomeJSON["company_name"] !== void 0 && SomeJSON["display_unit"] !== void 0 && //SomeJSON["energy"] !== undefined &&
|
|
@@ -17247,13 +17283,13 @@ var ChargePoint = class {
|
|
|
17247
17283
|
} catch (exception) {
|
|
17248
17284
|
return {
|
|
17249
17285
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
17250
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
17286
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
17251
17287
|
certainty: 0
|
|
17252
17288
|
};
|
|
17253
17289
|
}
|
|
17254
17290
|
return {
|
|
17255
17291
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
17256
|
-
message: this.chargy.
|
|
17292
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
17257
17293
|
certainty: 0
|
|
17258
17294
|
};
|
|
17259
17295
|
}
|
|
@@ -17276,7 +17312,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
17276
17312
|
if (chargingSession.ctr === void 0) {
|
|
17277
17313
|
return {
|
|
17278
17314
|
status: "InvalidSignature" /* InvalidSignature */,
|
|
17279
|
-
message: this.chargy.
|
|
17315
|
+
message: this.chargy.GetMultilanguageText("InvalidSignature"),
|
|
17280
17316
|
certainty: 0
|
|
17281
17317
|
};
|
|
17282
17318
|
}
|
|
@@ -17312,7 +17348,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
17312
17348
|
if (publicKeys.length == 0)
|
|
17313
17349
|
return {
|
|
17314
17350
|
status: "PublicKeyNotFound" /* PublicKeyNotFound */,
|
|
17315
|
-
message: this.chargy.
|
|
17351
|
+
message: this.chargy.GetMultilanguageText("Public key notFound"),
|
|
17316
17352
|
certainty: 0
|
|
17317
17353
|
};
|
|
17318
17354
|
if (plainText !== "" && chargingSession.signature != null && chargingSession.signature !== "") {
|
|
@@ -17387,7 +17423,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
17387
17423
|
if (measurementValue.result?.status !== "ValidSignature" /* ValidSignature */ && measurementValue.result?.status !== "NoOperation" /* NoOperation */) {
|
|
17388
17424
|
return {
|
|
17389
17425
|
status: "InvalidSignature" /* InvalidSignature */,
|
|
17390
|
-
message: this.chargy.
|
|
17426
|
+
message: this.chargy.GetMultilanguageText("InvalidSignature"),
|
|
17391
17427
|
certainty: 0
|
|
17392
17428
|
};
|
|
17393
17429
|
}
|
|
@@ -17444,7 +17480,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
17444
17480
|
} catch (exception) {
|
|
17445
17481
|
return {
|
|
17446
17482
|
status: "InvalidSignature" /* InvalidSignature */,
|
|
17447
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
17483
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
17448
17484
|
certainty: 0
|
|
17449
17485
|
};
|
|
17450
17486
|
}
|
|
@@ -17869,15 +17905,26 @@ async function importPdfJs() {
|
|
|
17869
17905
|
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfWorkerSrc.default;
|
|
17870
17906
|
return pdfjsLib;
|
|
17871
17907
|
}
|
|
17908
|
+
|
|
17909
|
+
// validationRules.json
|
|
17910
|
+
var validationRules_default = {
|
|
17911
|
+
chargingSession: {
|
|
17912
|
+
totalEnergy: {
|
|
17913
|
+
rule: [">", "500", "kWh"],
|
|
17914
|
+
level: "low"
|
|
17915
|
+
}
|
|
17916
|
+
}
|
|
17917
|
+
};
|
|
17872
17918
|
var Chargy = class {
|
|
17873
17919
|
//#region Data
|
|
17874
17920
|
i18n;
|
|
17875
|
-
|
|
17921
|
+
uiLanguages;
|
|
17876
17922
|
elliptic;
|
|
17877
17923
|
moment;
|
|
17878
17924
|
asn1;
|
|
17879
17925
|
base32Decode;
|
|
17880
17926
|
showPKIDetails;
|
|
17927
|
+
validationRules;
|
|
17881
17928
|
chargingStationOperators = new Array();
|
|
17882
17929
|
chargingPools = new Array();
|
|
17883
17930
|
chargingStations = new Array();
|
|
@@ -17889,17 +17936,48 @@ var Chargy = class {
|
|
|
17889
17936
|
currentCTR = {};
|
|
17890
17937
|
internalCTR = {};
|
|
17891
17938
|
//#endregion
|
|
17892
|
-
constructor(i18n,
|
|
17939
|
+
constructor(i18n, UILanguages, elliptic, moment2, asn1, base32Decode, ShowPKIDetails, validationRules = validationRules_default) {
|
|
17893
17940
|
this.i18n = i18n;
|
|
17894
|
-
this.
|
|
17941
|
+
this.uiLanguages = this.NormalizeUILanguages(UILanguages);
|
|
17895
17942
|
this.elliptic = elliptic;
|
|
17896
17943
|
this.moment = moment2;
|
|
17897
17944
|
this.asn1 = asn1;
|
|
17898
17945
|
this.base32Decode = base32Decode;
|
|
17899
17946
|
this.showPKIDetails = ShowPKIDetails;
|
|
17947
|
+
this.validationRules = validationRules;
|
|
17948
|
+
}
|
|
17949
|
+
SetUILanguages(UILanguages) {
|
|
17950
|
+
this.uiLanguages = this.NormalizeUILanguages(UILanguages);
|
|
17951
|
+
}
|
|
17952
|
+
NormalizeUILanguages(UILanguages) {
|
|
17953
|
+
const languages = new Array();
|
|
17954
|
+
for (const language of UILanguages) {
|
|
17955
|
+
const normalized = language.trim();
|
|
17956
|
+
if (normalized.length > 0 && !languages.includes(normalized)) {
|
|
17957
|
+
languages.push(normalized);
|
|
17958
|
+
}
|
|
17959
|
+
}
|
|
17960
|
+
return languages.length > 0 ? languages : ["en"];
|
|
17900
17961
|
}
|
|
17901
|
-
|
|
17902
|
-
this.
|
|
17962
|
+
FindBestMultilanguageText(Text) {
|
|
17963
|
+
for (const language of this.uiLanguages) {
|
|
17964
|
+
const localLanguage = Text[language];
|
|
17965
|
+
if (localLanguage !== void 0)
|
|
17966
|
+
return localLanguage;
|
|
17967
|
+
}
|
|
17968
|
+
const english = Text["en"];
|
|
17969
|
+
if (english !== void 0)
|
|
17970
|
+
return english;
|
|
17971
|
+
return Object.values(Text).find((value) => value !== void 0);
|
|
17972
|
+
}
|
|
17973
|
+
CompleteMultilanguageText(Text, fallbackText) {
|
|
17974
|
+
const result = {
|
|
17975
|
+
...Text ?? {}
|
|
17976
|
+
};
|
|
17977
|
+
const fallback = this.FindBestMultilanguageText(result) ?? fallbackText;
|
|
17978
|
+
for (const language of this.uiLanguages)
|
|
17979
|
+
result[language] ??= fallback;
|
|
17980
|
+
return result;
|
|
17903
17981
|
}
|
|
17904
17982
|
PublicKeyIdFromFileName(fileName) {
|
|
17905
17983
|
return (fileName.indexOf(".") > -1 ? fileName.substring(0, fileName.indexOf(".")) : fileName).replace(/[-_]?public[-_]?key/i, "");
|
|
@@ -18078,27 +18156,36 @@ var Chargy = class {
|
|
|
18078
18156
|
GetLocalizedMessage(Text) {
|
|
18079
18157
|
const multiLanguage = this.i18n[Text];
|
|
18080
18158
|
if (multiLanguage !== void 0) {
|
|
18081
|
-
const
|
|
18082
|
-
if (
|
|
18083
|
-
return
|
|
18084
|
-
const english = multiLanguage["en"];
|
|
18085
|
-
if (english !== void 0)
|
|
18086
|
-
return english;
|
|
18159
|
+
const localizedMessage = this.FindBestMultilanguageText(multiLanguage);
|
|
18160
|
+
if (localizedMessage !== void 0)
|
|
18161
|
+
return localizedMessage;
|
|
18087
18162
|
}
|
|
18088
18163
|
return Text;
|
|
18089
18164
|
}
|
|
18165
|
+
GetMultilanguageText(Text) {
|
|
18166
|
+
const multiLanguage = this.i18n[Text];
|
|
18167
|
+
return this.CompleteMultilanguageText(multiLanguage, Text);
|
|
18168
|
+
}
|
|
18090
18169
|
GetLocalizedMessageWithParameter(Text, Parameter) {
|
|
18091
18170
|
const multiLanguage = this.i18n[Text];
|
|
18092
18171
|
if (multiLanguage !== void 0) {
|
|
18093
|
-
const
|
|
18094
|
-
if (
|
|
18095
|
-
return
|
|
18096
|
-
const english = multiLanguage["en"];
|
|
18097
|
-
if (english !== void 0)
|
|
18098
|
-
return english.replace("%p", String(Parameter));
|
|
18172
|
+
const localizedMessage = this.FindBestMultilanguageText(multiLanguage);
|
|
18173
|
+
if (localizedMessage !== void 0)
|
|
18174
|
+
return localizedMessage.replace("%p", String(Parameter));
|
|
18099
18175
|
}
|
|
18100
18176
|
return Text.replace("%p", String(Parameter));
|
|
18101
18177
|
}
|
|
18178
|
+
GetMultilanguageTextWithParameter(Text, Parameter) {
|
|
18179
|
+
const multiLanguage = this.i18n[Text];
|
|
18180
|
+
const parameterizedText = {};
|
|
18181
|
+
if (multiLanguage !== void 0) {
|
|
18182
|
+
for (const [language, message] of Object.entries(multiLanguage)) {
|
|
18183
|
+
if (message !== void 0)
|
|
18184
|
+
parameterizedText[language] = message.replace("%p", String(Parameter));
|
|
18185
|
+
}
|
|
18186
|
+
}
|
|
18187
|
+
return this.CompleteMultilanguageText(parameterizedText, Text.replace("%p", String(Parameter)));
|
|
18188
|
+
}
|
|
18102
18189
|
//#endregion
|
|
18103
18190
|
//#region GetDevices...
|
|
18104
18191
|
GetChargingPool = (Id) => {
|
|
@@ -18470,7 +18557,7 @@ var Chargy = class {
|
|
|
18470
18557
|
async DetectAndConvertContentFormat(FileInfos) {
|
|
18471
18558
|
if (FileInfos.length == 0) return {
|
|
18472
18559
|
status: "NoChargeTransparencyRecordsFound" /* NoChargeTransparencyRecordsFound */,
|
|
18473
|
-
message: this.
|
|
18560
|
+
message: this.GetMultilanguageText("No charge transparency records found!"),
|
|
18474
18561
|
certainty: 0
|
|
18475
18562
|
};
|
|
18476
18563
|
let expandedFiles = new Array();
|
|
@@ -18580,7 +18667,7 @@ var Chargy = class {
|
|
|
18580
18667
|
} catch (exception) {
|
|
18581
18668
|
processedFile.result = {
|
|
18582
18669
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18583
|
-
message: this.
|
|
18670
|
+
message: this.GetMultilanguageText("UnknownOrInvalidXMLChargeTransparencyFormat"),
|
|
18584
18671
|
exception,
|
|
18585
18672
|
certainty: 0
|
|
18586
18673
|
};
|
|
@@ -18620,7 +18707,7 @@ var Chargy = class {
|
|
|
18620
18707
|
} catch (exception) {
|
|
18621
18708
|
processedFile.result = {
|
|
18622
18709
|
status: "InvalidPublicKey" /* InvalidPublicKey */,
|
|
18623
|
-
message: this.
|
|
18710
|
+
message: this.GetMultilanguageText("UnknownOrInvalidPublicKeyFormat"),
|
|
18624
18711
|
exception,
|
|
18625
18712
|
certainty: 0
|
|
18626
18713
|
};
|
|
@@ -18634,7 +18721,7 @@ var Chargy = class {
|
|
|
18634
18721
|
} catch (exception) {
|
|
18635
18722
|
processedFile.result = {
|
|
18636
18723
|
status: "InvalidPublicKey" /* InvalidPublicKey */,
|
|
18637
|
-
message: this.
|
|
18724
|
+
message: this.GetMultilanguageText("UnknownOrInvalidPublicKeyFormat"),
|
|
18638
18725
|
exception,
|
|
18639
18726
|
certainty: 0
|
|
18640
18727
|
};
|
|
@@ -18683,7 +18770,7 @@ var Chargy = class {
|
|
|
18683
18770
|
} catch (exception) {
|
|
18684
18771
|
processedFile.result = {
|
|
18685
18772
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18686
|
-
message: this.
|
|
18773
|
+
message: this.GetMultilanguageText("UnknownOrInvalidJSONChargeTransparencyFormat"),
|
|
18687
18774
|
exception,
|
|
18688
18775
|
certainty: 0
|
|
18689
18776
|
};
|
|
@@ -18701,14 +18788,14 @@ var Chargy = class {
|
|
|
18701
18788
|
if (IsAPublicKeyLookup(processedFile.result))
|
|
18702
18789
|
return {
|
|
18703
18790
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18704
|
-
message: this.
|
|
18791
|
+
message: this.GetMultilanguageText("UnknownOrInvalidChargeTransparencyRecord"),
|
|
18705
18792
|
certainty: 0
|
|
18706
18793
|
};
|
|
18707
18794
|
return processedFile.result;
|
|
18708
18795
|
}
|
|
18709
18796
|
return {
|
|
18710
18797
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18711
|
-
message: this.
|
|
18798
|
+
message: this.GetMultilanguageText("UnknownOrInvalidChargeTransparencyRecord"),
|
|
18712
18799
|
certainty: 0
|
|
18713
18800
|
};
|
|
18714
18801
|
} else if (processedFiles.length > 1) {
|
|
@@ -18782,7 +18869,7 @@ var Chargy = class {
|
|
|
18782
18869
|
}
|
|
18783
18870
|
return {
|
|
18784
18871
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18785
|
-
message: this.
|
|
18872
|
+
message: this.GetMultilanguageText("No charge transparency records found!"),
|
|
18786
18873
|
certainty: 0
|
|
18787
18874
|
};
|
|
18788
18875
|
}
|
|
@@ -18792,7 +18879,7 @@ var Chargy = class {
|
|
|
18792
18879
|
if (!IsAChargeTransparencyRecord(CTR))
|
|
18793
18880
|
return {
|
|
18794
18881
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18795
|
-
message: this.
|
|
18882
|
+
message: this.GetMultilanguageText("UnknownOrInvalidJSONChargeTransparencyFormat"),
|
|
18796
18883
|
certainty: 0
|
|
18797
18884
|
};
|
|
18798
18885
|
this.chargingStationOperators = [];
|
|
@@ -18917,46 +19004,156 @@ var Chargy = class {
|
|
|
18917
19004
|
} catch (exception) {
|
|
18918
19005
|
return {
|
|
18919
19006
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
18920
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
19007
|
+
message: this.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
18921
19008
|
certainty: 0
|
|
18922
19009
|
};
|
|
18923
19010
|
}
|
|
18924
19011
|
}
|
|
18925
19012
|
//#endregion
|
|
19013
|
+
//#region (private) hasInplausibleChargingSessionTotalEnergyMeasurement(chargingSession)
|
|
19014
|
+
hasInplausibleChargingSessionTotalEnergyMeasurement(chargingSession) {
|
|
19015
|
+
for (const measurement of chargingSession.measurements) {
|
|
19016
|
+
if (measurement.name !== "ENERGY_TOTAL" || measurement.values.length < 2) {
|
|
19017
|
+
continue;
|
|
19018
|
+
}
|
|
19019
|
+
const firstValue2 = measurement.values[0];
|
|
19020
|
+
const lastValue = measurement.values[measurement.values.length - 1];
|
|
19021
|
+
if (firstValue2 == null || lastValue == null) {
|
|
19022
|
+
continue;
|
|
19023
|
+
}
|
|
19024
|
+
const firstValueKWh = this.measurementValueInKWh(measurement, firstValue2);
|
|
19025
|
+
const lastValueKWh = this.measurementValueInKWh(measurement, lastValue);
|
|
19026
|
+
if (firstValueKWh == null || lastValueKWh == null) {
|
|
19027
|
+
continue;
|
|
19028
|
+
}
|
|
19029
|
+
if (this.isInplausibleChargingSessionTotalEnergy(lastValueKWh - firstValueKWh))
|
|
19030
|
+
return true;
|
|
19031
|
+
}
|
|
19032
|
+
return false;
|
|
19033
|
+
}
|
|
19034
|
+
isInplausibleChargingSessionTotalEnergy(totalEnergyKWh) {
|
|
19035
|
+
const totalEnergyRule = this.validationRules.chargingSession?.totalEnergy?.rule;
|
|
19036
|
+
if (totalEnergyRule == null)
|
|
19037
|
+
return false;
|
|
19038
|
+
const [operator, thresholdValue, thresholdUnit] = totalEnergyRule;
|
|
19039
|
+
const thresholdKWh = this.energyValueInKWh(thresholdValue, thresholdUnit);
|
|
19040
|
+
if (thresholdKWh == null)
|
|
19041
|
+
return false;
|
|
19042
|
+
switch (operator) {
|
|
19043
|
+
case ">":
|
|
19044
|
+
return totalEnergyKWh > thresholdKWh;
|
|
19045
|
+
case ">=":
|
|
19046
|
+
return totalEnergyKWh >= thresholdKWh;
|
|
19047
|
+
case "<":
|
|
19048
|
+
return totalEnergyKWh < thresholdKWh;
|
|
19049
|
+
case "<=":
|
|
19050
|
+
return totalEnergyKWh <= thresholdKWh;
|
|
19051
|
+
case "=":
|
|
19052
|
+
case "==":
|
|
19053
|
+
return totalEnergyKWh === thresholdKWh;
|
|
19054
|
+
default:
|
|
19055
|
+
return false;
|
|
19056
|
+
}
|
|
19057
|
+
}
|
|
19058
|
+
energyValueInKWh(value, unit) {
|
|
19059
|
+
const numericValue = typeof value === "number" ? value : Number.parseFloat(value);
|
|
19060
|
+
if (!Number.isFinite(numericValue))
|
|
19061
|
+
return void 0;
|
|
19062
|
+
switch (unit.trim().toLowerCase()) {
|
|
19063
|
+
case "wh":
|
|
19064
|
+
return numericValue / 1e3;
|
|
19065
|
+
case "kwh":
|
|
19066
|
+
return numericValue;
|
|
19067
|
+
case "mwh":
|
|
19068
|
+
return numericValue * 1e3;
|
|
19069
|
+
default:
|
|
19070
|
+
return void 0;
|
|
19071
|
+
}
|
|
19072
|
+
}
|
|
19073
|
+
measurementValueInKWh(measurement, measurementValue) {
|
|
19074
|
+
const value = measurementValue.value.toNumber();
|
|
19075
|
+
if (!Number.isFinite(value))
|
|
19076
|
+
return void 0;
|
|
19077
|
+
const unit = measurement.unit?.trim().toLowerCase();
|
|
19078
|
+
if (unit === "kwh")
|
|
19079
|
+
return value;
|
|
19080
|
+
if (unit === "wh" || measurement.unitEncoded === 30) {
|
|
19081
|
+
return value / 1e3;
|
|
19082
|
+
}
|
|
19083
|
+
return void 0;
|
|
19084
|
+
}
|
|
19085
|
+
getChargingSessionTotalEnergyWarningLevel() {
|
|
19086
|
+
return this.validationRules.chargingSession?.totalEnergy?.level ?? "low" /* low */;
|
|
19087
|
+
}
|
|
19088
|
+
addChargeTransparencyRecordWarning(CTR, warning) {
|
|
19089
|
+
if (CTR == null)
|
|
19090
|
+
return;
|
|
19091
|
+
CTR.warnings ??= [];
|
|
19092
|
+
if (!CTR.warnings.some((existingWarning) => this.isSameWarning(existingWarning, warning)))
|
|
19093
|
+
CTR.warnings.push(warning);
|
|
19094
|
+
}
|
|
19095
|
+
isSameWarning(left, right) {
|
|
19096
|
+
return left.level === right.level && left.message === right.message;
|
|
19097
|
+
}
|
|
19098
|
+
//#endregion
|
|
18926
19099
|
//#region (private) processChargingSession(chargingSession)
|
|
18927
19100
|
async processChargingSession(chargingSession) {
|
|
19101
|
+
let verificationResult2;
|
|
18928
19102
|
switch (chargingSession["@context"]) {
|
|
18929
19103
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/GDFCrypt01+json":
|
|
18930
19104
|
chargingSession.method = new GDFCrypt01(this);
|
|
18931
|
-
|
|
19105
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19106
|
+
break;
|
|
18932
19107
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/EMHCrypt01+json":
|
|
18933
19108
|
chargingSession.method = new EMHCrypt01(this);
|
|
18934
|
-
|
|
19109
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19110
|
+
break;
|
|
18935
19111
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/OCMFv1.0+json":
|
|
18936
19112
|
chargingSession.method = new OCMFv1_x(this);
|
|
18937
|
-
|
|
19113
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19114
|
+
break;
|
|
18938
19115
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/ChargePointCrypt01+json":
|
|
18939
19116
|
chargingSession.method = new ChargePointCrypt01(this);
|
|
18940
|
-
|
|
19117
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19118
|
+
break;
|
|
18941
19119
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/AlfenCrypt01+json":
|
|
18942
19120
|
chargingSession.method = new AlfenCrypt01(this);
|
|
18943
|
-
|
|
19121
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19122
|
+
break;
|
|
18944
19123
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/MennekesCrypt01+json":
|
|
18945
19124
|
chargingSession.method = new MennekesCrypt01(this);
|
|
18946
|
-
|
|
19125
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19126
|
+
break;
|
|
18947
19127
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/PCDF+json":
|
|
18948
19128
|
chargingSession.method = new PCDFCrypt01(this);
|
|
18949
|
-
|
|
19129
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19130
|
+
break;
|
|
18950
19131
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/bsm-ws36a-v0+json":
|
|
18951
19132
|
chargingSession.method = new BSMCrypt01(this);
|
|
18952
|
-
|
|
19133
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
19134
|
+
break;
|
|
18953
19135
|
default:
|
|
18954
|
-
|
|
19136
|
+
verificationResult2 = {
|
|
18955
19137
|
status: "UnknownSessionFormat" /* UnknownSessionFormat */,
|
|
18956
|
-
message: this.
|
|
19138
|
+
message: this.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
18957
19139
|
certainty: 0
|
|
18958
19140
|
};
|
|
19141
|
+
break;
|
|
19142
|
+
}
|
|
19143
|
+
if (verificationResult2.status === "ValidSignature" /* ValidSignature */ && this.hasInplausibleChargingSessionTotalEnergyMeasurement(chargingSession)) {
|
|
19144
|
+
this.addChargeTransparencyRecordWarning(
|
|
19145
|
+
chargingSession.ctr,
|
|
19146
|
+
{
|
|
19147
|
+
level: this.getChargingSessionTotalEnergyWarningLevel(),
|
|
19148
|
+
message: this.GetMultilanguageText("InplausibleTotalEnergyMeasurementWarning")
|
|
19149
|
+
}
|
|
19150
|
+
);
|
|
19151
|
+
return {
|
|
19152
|
+
...verificationResult2,
|
|
19153
|
+
status: "InplausibleMeasurement" /* InplausibleMeasurement */
|
|
19154
|
+
};
|
|
18959
19155
|
}
|
|
19156
|
+
return verificationResult2;
|
|
18960
19157
|
}
|
|
18961
19158
|
//#endregion
|
|
18962
19159
|
MergeChargeTransparencyRecords(CTRs) {
|
|
@@ -19014,7 +19211,7 @@ var Chargy = class {
|
|
|
19014
19211
|
};
|
|
19015
19212
|
|
|
19016
19213
|
// src/verificationResults.ts
|
|
19017
|
-
function toSessionVerificationResults(CTR, noRecordsMessage = "No charge transparency records found!") {
|
|
19214
|
+
function toSessionVerificationResults(CTR, noRecordsMessage = { "en": "No charge transparency records found!" }) {
|
|
19018
19215
|
const verificationResults = (CTR.chargingSessions ?? []).map((session) => session.verificationResult).filter(isISessionCryptoResult1);
|
|
19019
19216
|
if (verificationResults.length > 0)
|
|
19020
19217
|
return verificationResults;
|
|
@@ -19038,6 +19235,6 @@ buffer/index.js:
|
|
|
19038
19235
|
*)
|
|
19039
19236
|
*/
|
|
19040
19237
|
|
|
19041
|
-
export { ACrypt, Alfen, AlfenCrypt01, BSMCrypt01, CanonicalJSONError, ChargeIT, ChargePoint, ChargePointCrypt01, IChargeTransparencyLiveLink_exports as ChargeTransparencyLiveLink, ChargeTransparencyLiveLinkContext, IChargeTransparencyRecord_exports as ChargeTransparencyRecord, Chargy, chargyInterfaces_exports as ChargyInterfaces, Clone, CloneCTR, ConcatenateBuffers, CreateDiv, CreateDiv2, CryptoAlgorithms, CryptoHashAlgorithms, DayOfWeek, DisplayPrefixes, EMHCrypt01, GDFCrypt01, IECCurves, IEncoding, InformationRelevance, InformationRelevanceToString, IsAChargeTransparencyLiveLink, IsAChargeTransparencyRecord, IsAPublicKeyInfo, IsAPublicKeyLookup, IsASessionCryptoResult, IsNullOrEmpty, JSONSignatureVerificationStatus, MENNEKES_EDL40_OBIS, MENNEKES_EDL40_XMLNS, Mennekes, MennekesCrypt01, OBIS2Hex, OBIS2MeasurementName, OBIS_RegExpr, OCMF, OCMFTransactionTypes, OCMFv1_x, OCPI, PCDF, PCDFCrypt01, PCDFParseError, PCDFValidationError, PCDF_FIELD_ORDER, PCDF_PREFIX, ParseJSON_LD, PublicKeyFormats, IPublicKeyInfo_exports as PublicKeyInfo, SAFEXML, SessionVerificationResult, SetHex, SetInt8, SetText, SetText_withLength, SetTimestamp, SetTimestamp32, SetUInt32, SetUInt32_withCode, SetUInt64, SetUInt64D, SignMessage, SignatureFormats, TimeStatusTypes, UTC2human, VerificationResult, VerifyJSONMessageSignatures, WhenNullOrEmpty, XMLContainer, asJSONArray, asJSONObject, asNumber, asString, buf2hex, buildMennekesSignatureData, bytesToHex2 as bytesToHex, canonicalJSONBytes, canonicalJSONStringify, cleanHex, closeFullscreen, createHexString, dateToMennekesLocalEpochSeconds, extractMennekesChargingProcesses, firstKey, firstValue, getDirectChildByLocalName, getDirectChildrenByLocalName, getElementsByLocalName, getInt16Bytes, getInt32Bytes, getInt64Bytes, getInt8Bytes, getTrimmedTextContent, hashFile, hex2bin, hex32, hexToArrayBuffer, hexToBytes, intFromBytes, isGeoLocation, isICryptoResult, isIFileInfo, isIPublicKeyXY, isISessionCryptoResult1, isISessionCryptoResult2, isJSONLDObject, isMandatoryArrayOfStrings, isMandatoryBoolean, isMandatoryDecimal, isMandatoryJSONArray, isMandatoryJSONObject, isMandatoryNumber, isMandatoryString, isMandatoryURL, isMultilanguageText, isOIDInfo, isObject, isOptionalArrayOfStrings, isOptionalDecimal, isOptionalJSONArray, isOptionalJSONArrayError, isOptionalJSONArrayOk, isOptionalJSONObject, isOptionalNumber, isOptionalString, isOptionalURL, isPCDFText, isString, isStringArray, isStringOrOIDInfo, isStringOrStringArray, jsonPrettyPrinter, measurementName2human, normalizePCDFPublicKeyHex, normalizeXMLText, openFullscreen, pad, parseAndVerifyJSONSignatures, parseDescription, parseHexString, parseMennekesXMLDocument, parseNumber, parseOBIS, parsePCDFDocument, parsePCDFPublicKey, parsePCDFSignature, parseUTC, readQRCodeTextFromImage, readQRCodeTextFromImageData, secp224k1, setUILocale, sha256, sha384, sha512, signJSONMessage, signMessage, stripPCDFControlCharacters, time2human, toArrayBuffer, toSessionVerificationResults, toUint8Array, unquotePCDFText, validatePCDFFields, verifyJSONMessageSignatureResults, verifyJSONMessageSignatures, verifyJSONSignature, verifyJSONSignatureResult, verifyPCDFDocument };
|
|
19238
|
+
export { ACrypt, Alfen, AlfenCrypt01, BSMCrypt01, CanonicalJSONError, ChargeIT, ChargePoint, ChargePointCrypt01, IChargeTransparencyLiveLink_exports as ChargeTransparencyLiveLink, ChargeTransparencyLiveLinkContext, IChargeTransparencyRecord_exports as ChargeTransparencyRecord, Chargy, chargyInterfaces_exports as ChargyInterfaces, Clone, CloneCTR, ConcatenateBuffers, CreateDiv, CreateDiv2, CreateError, CryptoAlgorithms, CryptoHashAlgorithms, DayOfWeek, DisplayPrefixes, EMHCrypt01, ErrorLevel, GDFCrypt01, IECCurves, IEncoding, InformationRelevance, InformationRelevanceToString, IsAChargeTransparencyLiveLink, IsAChargeTransparencyRecord, IsAPublicKeyInfo, IsAPublicKeyLookup, IsASessionCryptoResult, IsNullOrEmpty, JSONSignatureVerificationStatus, MENNEKES_EDL40_OBIS, MENNEKES_EDL40_XMLNS, Mennekes, MennekesCrypt01, OBIS2Hex, OBIS2MeasurementName, OBIS_RegExpr, OCMF, OCMFTransactionTypes, OCMFv1_x, OCPI, PCDF, PCDFCrypt01, PCDFParseError, PCDFValidationError, PCDF_FIELD_ORDER, PCDF_PREFIX, ParseJSON_LD, PublicKeyFormats, IPublicKeyInfo_exports as PublicKeyInfo, SAFEXML, SessionVerificationResult, SetHex, SetInt8, SetText, SetText_withLength, SetTimestamp, SetTimestamp32, SetUInt32, SetUInt32_withCode, SetUInt64, SetUInt64D, SignMessage, SignatureFormats, TimeStatusTypes, UTC2human, VerificationResult, VerifyJSONMessageSignatures, WarningLevel, WhenNullOrEmpty, XMLContainer, asJSONArray, asJSONObject, asNumber, asString, buf2hex, buildMennekesSignatureData, bytesToHex2 as bytesToHex, canonicalJSONBytes, canonicalJSONStringify, cleanHex, closeFullscreen, createHexString, dateToMennekesLocalEpochSeconds, extractMennekesChargingProcesses, firstKey, firstValue, getDirectChildByLocalName, getDirectChildrenByLocalName, getElementsByLocalName, getInt16Bytes, getInt32Bytes, getInt64Bytes, getInt8Bytes, getTrimmedTextContent, hashFile, hex2bin, hex32, hexToArrayBuffer, hexToBytes, intFromBytes, isGeoLocation, isICryptoResult, isIFileInfo, isIPublicKeyXY, isISessionCryptoResult1, isISessionCryptoResult2, isJSONLDObject, isMandatoryArrayOfStrings, isMandatoryBoolean, isMandatoryDecimal, isMandatoryJSONArray, isMandatoryJSONObject, isMandatoryNumber, isMandatoryString, isMandatoryURL, isMultilanguageText, isOIDInfo, isObject, isOptionalArrayOfStrings, isOptionalDecimal, isOptionalJSONArray, isOptionalJSONArrayError, isOptionalJSONArrayOk, isOptionalJSONObject, isOptionalNumber, isOptionalString, isOptionalURL, isPCDFText, isString, isStringArray, isStringOrOIDInfo, isStringOrStringArray, jsonPrettyPrinter, measurementName2human, normalizePCDFPublicKeyHex, normalizeXMLText, openFullscreen, pad, parseAndVerifyJSONSignatures, parseDescription, parseHexString, parseMennekesXMLDocument, parseNumber, parseOBIS, parsePCDFDocument, parsePCDFPublicKey, parsePCDFSignature, parseUTC, readQRCodeTextFromImage, readQRCodeTextFromImageData, secp224k1, setUILocale, sha256, sha384, sha512, signJSONMessage, signMessage, stripPCDFControlCharacters, time2human, toArrayBuffer, toSessionVerificationResults, toUint8Array, unquotePCDFText, validatePCDFFields, verifyJSONMessageSignatureResults, verifyJSONMessageSignatures, verifyJSONSignature, verifyJSONSignatureResult, verifyPCDFDocument };
|
|
19042
19239
|
//# sourceMappingURL=index.js.map
|
|
19043
19240
|
//# sourceMappingURL=index.js.map
|