@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/node/index.js
CHANGED
|
@@ -8110,10 +8110,12 @@ var secp224k1 = class {
|
|
|
8110
8110
|
// src/interfaces/chargyInterfaces.ts
|
|
8111
8111
|
var chargyInterfaces_exports = {};
|
|
8112
8112
|
__export(chargyInterfaces_exports, {
|
|
8113
|
+
CreateError: () => CreateError,
|
|
8113
8114
|
CryptoAlgorithms: () => CryptoAlgorithms,
|
|
8114
8115
|
CryptoHashAlgorithms: () => CryptoHashAlgorithms,
|
|
8115
8116
|
DayOfWeek: () => DayOfWeek,
|
|
8116
8117
|
DisplayPrefixes: () => DisplayPrefixes,
|
|
8118
|
+
ErrorLevel: () => ErrorLevel,
|
|
8117
8119
|
IECCurves: () => IECCurves,
|
|
8118
8120
|
IEncoding: () => IEncoding,
|
|
8119
8121
|
InformationRelevance: () => InformationRelevance,
|
|
@@ -8121,6 +8123,7 @@ __export(chargyInterfaces_exports, {
|
|
|
8121
8123
|
SessionVerificationResult: () => SessionVerificationResult,
|
|
8122
8124
|
SignatureFormats: () => SignatureFormats,
|
|
8123
8125
|
VerificationResult: () => VerificationResult,
|
|
8126
|
+
WarningLevel: () => WarningLevel,
|
|
8124
8127
|
isGeoLocation: () => isGeoLocation,
|
|
8125
8128
|
isICryptoResult: () => isICryptoResult,
|
|
8126
8129
|
isIFileInfo: () => isIFileInfo,
|
|
@@ -8210,6 +8213,24 @@ var DisplayPrefixes = /* @__PURE__ */ ((DisplayPrefixes2) => {
|
|
|
8210
8213
|
DisplayPrefixes2[DisplayPrefixes2["GIGA"] = 3] = "GIGA";
|
|
8211
8214
|
return DisplayPrefixes2;
|
|
8212
8215
|
})(DisplayPrefixes || {});
|
|
8216
|
+
var WarningLevel = /* @__PURE__ */ ((WarningLevel2) => {
|
|
8217
|
+
WarningLevel2["low"] = "low";
|
|
8218
|
+
WarningLevel2["medium"] = "medium";
|
|
8219
|
+
WarningLevel2["high"] = "high";
|
|
8220
|
+
return WarningLevel2;
|
|
8221
|
+
})(WarningLevel || {});
|
|
8222
|
+
var ErrorLevel = /* @__PURE__ */ ((ErrorLevel2) => {
|
|
8223
|
+
ErrorLevel2["low"] = "low";
|
|
8224
|
+
ErrorLevel2["medium"] = "medium";
|
|
8225
|
+
ErrorLevel2["high"] = "high";
|
|
8226
|
+
return ErrorLevel2;
|
|
8227
|
+
})(ErrorLevel || {});
|
|
8228
|
+
function CreateError(message, level = "high" /* high */) {
|
|
8229
|
+
return {
|
|
8230
|
+
level,
|
|
8231
|
+
message
|
|
8232
|
+
};
|
|
8233
|
+
}
|
|
8213
8234
|
function isISessionCryptoResult1(obj) {
|
|
8214
8235
|
return typeof obj === "object" && obj !== null && obj.status !== void 0;
|
|
8215
8236
|
}
|
|
@@ -8241,6 +8262,7 @@ var SessionVerificationResult = /* @__PURE__ */ ((SessionVerificationResult2) =>
|
|
|
8241
8262
|
SessionVerificationResult2["InvalidStopValue"] = "InvalidStopValue";
|
|
8242
8263
|
SessionVerificationResult2["EnergyMeterNotFound"] = "EnergyMeterNotFound";
|
|
8243
8264
|
SessionVerificationResult2["InvalidMeasurement"] = "InvalidMeasurement";
|
|
8265
|
+
SessionVerificationResult2["InplausibleMeasurement"] = "InplausibleMeasurement";
|
|
8244
8266
|
SessionVerificationResult2["PublicKeyNotFound"] = "PublicKeyNotFound";
|
|
8245
8267
|
SessionVerificationResult2["UnknownPublicKeyFormat"] = "UnknownPublicKeyFormat";
|
|
8246
8268
|
SessionVerificationResult2["InvalidPublicKey"] = "InvalidPublicKey";
|
|
@@ -9012,7 +9034,7 @@ var Alfen = class {
|
|
|
9012
9034
|
if (elements?.length != 6 && elements?.length != 7)
|
|
9013
9035
|
return {
|
|
9014
9036
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9015
|
-
message: this.chargy.
|
|
9037
|
+
message: this.chargy.GetMultilanguageText("Invalid number of signed meter values!"),
|
|
9016
9038
|
certainty: 0
|
|
9017
9039
|
};
|
|
9018
9040
|
const FormatId = elements[0];
|
|
@@ -9026,13 +9048,13 @@ var Alfen = class {
|
|
|
9026
9048
|
else if (elements[3] !== common.PublicKey)
|
|
9027
9049
|
return {
|
|
9028
9050
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9029
|
-
message: this.chargy.
|
|
9051
|
+
message: this.chargy.GetMultilanguageText("Inconsistent public keys!"),
|
|
9030
9052
|
certainty: 0
|
|
9031
9053
|
};
|
|
9032
9054
|
if (FormatId !== "AP" || Type?.length !== 1 || BlobVersion?.length !== 1 || BlobVersion !== "3" || PublicKey.byteLength !== 25 || DataSet.byteLength !== 82 || Signature.byteLength !== 48) {
|
|
9033
9055
|
return {
|
|
9034
9056
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9035
|
-
message: this.chargy.
|
|
9057
|
+
message: this.chargy.GetMultilanguageText("Invalid charging session format!"),
|
|
9036
9058
|
certainty: 0
|
|
9037
9059
|
};
|
|
9038
9060
|
}
|
|
@@ -9057,7 +9079,7 @@ var Alfen = class {
|
|
|
9057
9079
|
else if (AdapterId !== common.AdapterId)
|
|
9058
9080
|
return {
|
|
9059
9081
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9060
|
-
message: this.chargy.
|
|
9082
|
+
message: this.chargy.GetMultilanguageText("Inconsistent Alfen adapter identification!"),
|
|
9061
9083
|
certainty: 0
|
|
9062
9084
|
};
|
|
9063
9085
|
if (common.AdapterFWVersion === "")
|
|
@@ -9065,7 +9087,7 @@ var Alfen = class {
|
|
|
9065
9087
|
else if (AdapterFWVersion !== common.AdapterFWVersion)
|
|
9066
9088
|
return {
|
|
9067
9089
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9068
|
-
message: this.chargy.
|
|
9090
|
+
message: this.chargy.GetMultilanguageText("Inconsistent Alfen adapter firmware version!"),
|
|
9069
9091
|
certainty: 0
|
|
9070
9092
|
};
|
|
9071
9093
|
if (common.AdapterFWChecksum === "")
|
|
@@ -9073,7 +9095,7 @@ var Alfen = class {
|
|
|
9073
9095
|
else if (AdapterFWChecksum !== common.AdapterFWChecksum)
|
|
9074
9096
|
return {
|
|
9075
9097
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9076
|
-
message: this.chargy.
|
|
9098
|
+
message: this.chargy.GetMultilanguageText("Inconsistent Alfen adapter firmware checksum!"),
|
|
9077
9099
|
certainty: 0
|
|
9078
9100
|
};
|
|
9079
9101
|
if (common.MeterId === "")
|
|
@@ -9081,7 +9103,7 @@ var Alfen = class {
|
|
|
9081
9103
|
else if (MeterId !== common.MeterId)
|
|
9082
9104
|
return {
|
|
9083
9105
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9084
|
-
message: this.chargy.
|
|
9106
|
+
message: this.chargy.GetMultilanguageText("Inconsistent meter identification!"),
|
|
9085
9107
|
certainty: 0
|
|
9086
9108
|
};
|
|
9087
9109
|
if (common.ObisId === "")
|
|
@@ -9089,7 +9111,7 @@ var Alfen = class {
|
|
|
9089
9111
|
else if (ObisId !== common.ObisId)
|
|
9090
9112
|
return {
|
|
9091
9113
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9092
|
-
message: this.chargy.
|
|
9114
|
+
message: this.chargy.GetMultilanguageText("Inconsistent OBIS code!"),
|
|
9093
9115
|
certainty: 0
|
|
9094
9116
|
};
|
|
9095
9117
|
if (common.UnitEncoded === 0)
|
|
@@ -9097,7 +9119,7 @@ var Alfen = class {
|
|
|
9097
9119
|
else if (UnitEncoded !== common.UnitEncoded)
|
|
9098
9120
|
return {
|
|
9099
9121
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9100
|
-
message: this.chargy.
|
|
9122
|
+
message: this.chargy.GetMultilanguageText("Inconsistent unit (encoded) value!"),
|
|
9101
9123
|
certainty: 0
|
|
9102
9124
|
};
|
|
9103
9125
|
if (common.Scalar === "")
|
|
@@ -9105,7 +9127,7 @@ var Alfen = class {
|
|
|
9105
9127
|
else if (Scalar !== common.Scalar)
|
|
9106
9128
|
return {
|
|
9107
9129
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9108
|
-
message: this.chargy.
|
|
9130
|
+
message: this.chargy.GetMultilanguageText("Inconsistent measurement scalar!"),
|
|
9109
9131
|
certainty: 0
|
|
9110
9132
|
};
|
|
9111
9133
|
if (common.UID === "")
|
|
@@ -9113,7 +9135,7 @@ var Alfen = class {
|
|
|
9113
9135
|
else if (UID !== common.UID)
|
|
9114
9136
|
return {
|
|
9115
9137
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9116
|
-
message: this.chargy.
|
|
9138
|
+
message: this.chargy.GetMultilanguageText("Inconsistent user identification!"),
|
|
9117
9139
|
certainty: 0
|
|
9118
9140
|
};
|
|
9119
9141
|
if (common.InternalSessionId === 0)
|
|
@@ -9121,13 +9143,13 @@ var Alfen = class {
|
|
|
9121
9143
|
else if (InternalSessionId !== common.InternalSessionId)
|
|
9122
9144
|
return {
|
|
9123
9145
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9124
|
-
message: this.chargy.
|
|
9146
|
+
message: this.chargy.GetMultilanguageText("Inconsistent internal charging session identification!"),
|
|
9125
9147
|
certainty: 0
|
|
9126
9148
|
};
|
|
9127
9149
|
if (previousTimestamp !== "" && previousTimestamp > Timestamp)
|
|
9128
9150
|
return {
|
|
9129
9151
|
status: "InconsistentTimestamps" /* InconsistentTimestamps */,
|
|
9130
|
-
message: this.chargy.
|
|
9152
|
+
message: this.chargy.GetMultilanguageText("Inconsistent timestamps!"),
|
|
9131
9153
|
certainty: 0
|
|
9132
9154
|
};
|
|
9133
9155
|
else
|
|
@@ -9151,7 +9173,7 @@ var Alfen = class {
|
|
|
9151
9173
|
if (firstDataSet === void 0 || lastDataSet === void 0)
|
|
9152
9174
|
return {
|
|
9153
9175
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9154
|
-
message: this.chargy.
|
|
9176
|
+
message: this.chargy.GetMultilanguageText("Invalid number of signed meter values!"),
|
|
9155
9177
|
certainty: 0
|
|
9156
9178
|
};
|
|
9157
9179
|
const _CTR = {
|
|
@@ -9283,7 +9305,7 @@ var Alfen = class {
|
|
|
9283
9305
|
} catch (exception) {
|
|
9284
9306
|
return {
|
|
9285
9307
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9286
|
-
message: this.chargy.
|
|
9308
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
9287
9309
|
certainty: 0
|
|
9288
9310
|
};
|
|
9289
9311
|
}
|
|
@@ -9608,18 +9630,18 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9608
9630
|
tryToParseBSM_WS36aMeasurements(CTR, ExpectedEVSEId, ExpectedCscSwVersion, Measurements) {
|
|
9609
9631
|
if (!Array.isArray(Measurements)) return {
|
|
9610
9632
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9611
|
-
message: this.chargy.
|
|
9633
|
+
message: this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues"),
|
|
9612
9634
|
certainty: 0
|
|
9613
9635
|
};
|
|
9614
9636
|
if (Measurements.length < 2) return {
|
|
9615
9637
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9616
|
-
message: this.chargy.
|
|
9638
|
+
message: this.chargy.GetMultilanguageText("AtLeastTwoSignedMeterValuesRequired"),
|
|
9617
9639
|
certainty: 0
|
|
9618
9640
|
};
|
|
9619
9641
|
const firstMeasurement = Measurements[0];
|
|
9620
9642
|
if (!isMandatoryJSONObject(firstMeasurement)) return {
|
|
9621
9643
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
9622
|
-
message: this.chargy.
|
|
9644
|
+
message: this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidSignedMeterValueP", 1),
|
|
9623
9645
|
certainty: 0
|
|
9624
9646
|
};
|
|
9625
9647
|
const errors = new Array();
|
|
@@ -9628,51 +9650,51 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9628
9650
|
let secondaryErrors = 0;
|
|
9629
9651
|
try {
|
|
9630
9652
|
if (!isMandatoryString(firstMeasurement["@context"]))
|
|
9631
|
-
errors.push(this.chargy.
|
|
9653
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_JSONContextP", 1)));
|
|
9632
9654
|
const meterInfo = firstMeasurement["meterInfo"];
|
|
9633
9655
|
if (!isMandatoryJSONObject(meterInfo)) {
|
|
9634
|
-
errors.push(this.chargy.
|
|
9656
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfoP", 1)));
|
|
9635
9657
|
secondaryErrors += 5;
|
|
9636
9658
|
} else {
|
|
9637
9659
|
if (!isMandatoryString(meterInfo["firmwareVersion"]))
|
|
9638
|
-
errors.push(this.chargy.
|
|
9660
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
9639
9661
|
if (!isMandatoryString(meterInfo["publicKey"]))
|
|
9640
|
-
errors.push(this.chargy.
|
|
9662
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
9641
9663
|
if (!isMandatoryString(meterInfo["meterId"]))
|
|
9642
|
-
errors.push(this.chargy.
|
|
9664
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
9643
9665
|
if (!isMandatoryString(meterInfo["manufacturer"]))
|
|
9644
|
-
errors.push(this.chargy.
|
|
9666
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
9645
9667
|
if (!isMandatoryString(meterInfo["type"]))
|
|
9646
|
-
errors.push(this.chargy.
|
|
9668
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_TypeP", 1)));
|
|
9647
9669
|
}
|
|
9648
9670
|
const contract = firstMeasurement["contract"];
|
|
9649
9671
|
if (!isMandatoryJSONObject(contract)) {
|
|
9650
|
-
errors.push(this.chargy.
|
|
9672
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ContractP", 1)));
|
|
9651
9673
|
secondaryErrors += 2;
|
|
9652
9674
|
} else {
|
|
9653
9675
|
if (!isMandatoryString(contract["id"]))
|
|
9654
|
-
errors.push(this.chargy.
|
|
9676
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_IdP", 1)));
|
|
9655
9677
|
if (!isOptionalString(contract["type"]))
|
|
9656
|
-
errors.push(this.chargy.
|
|
9678
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TypeP", 1)));
|
|
9657
9679
|
}
|
|
9658
9680
|
const value = firstMeasurement["value"];
|
|
9659
9681
|
if (!isMandatoryJSONObject(value)) {
|
|
9660
|
-
errors.push(this.chargy.
|
|
9682
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ValueP", 1)));
|
|
9661
9683
|
secondaryErrors += 8;
|
|
9662
9684
|
} else {
|
|
9663
9685
|
const measurand = value["measurand"];
|
|
9664
9686
|
if (!isMandatoryJSONObject(measurand)) {
|
|
9665
|
-
errors.push(this.chargy.
|
|
9687
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasurandP", 1)));
|
|
9666
9688
|
secondaryErrors += 2;
|
|
9667
9689
|
} else {
|
|
9668
9690
|
if (!isMandatoryString(measurand["id"]))
|
|
9669
|
-
errors.push(this.chargy.
|
|
9691
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_Measurand_IdentificationP", 1)));
|
|
9670
9692
|
if (!isMandatoryString(measurand["name"]))
|
|
9671
|
-
errors.push(this.chargy.
|
|
9693
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_Measurand_NameP", 1)));
|
|
9672
9694
|
}
|
|
9673
9695
|
const measuredValue = value["measuredValue"];
|
|
9674
9696
|
if (!isMandatoryJSONObject(measuredValue)) {
|
|
9675
|
-
errors.push(this.chargy.
|
|
9697
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValueP", 1)));
|
|
9676
9698
|
secondaryErrors += 4;
|
|
9677
9699
|
} else {
|
|
9678
9700
|
}
|
|
@@ -9750,7 +9772,7 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9750
9772
|
if (currentMeasurement === void 0)
|
|
9751
9773
|
throw new Error(`Invalid signed meter value #${String(measurementCounter)}!`);
|
|
9752
9774
|
if (currentMeasurement["@context"] !== common.context)
|
|
9753
|
-
currentErrors.push(this.chargy.
|
|
9775
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_JSONContextP", measurementCounter)));
|
|
9754
9776
|
const currentId = currentMeasurement["@id"];
|
|
9755
9777
|
if (previousId !== "" && typeof currentId === "string") {
|
|
9756
9778
|
if (typeof previousId !== "string")
|
|
@@ -9761,7 +9783,7 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9761
9783
|
// anything (not even NaN). This way we are checking that both counter values
|
|
9762
9784
|
// are numeric too.
|
|
9763
9785
|
parseInt(previousParts[1], 10) >= parseInt(currentParts[1], 10)) {
|
|
9764
|
-
currentErrors.push(this.chargy.
|
|
9786
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeasurementIdP", measurementCounter)));
|
|
9765
9787
|
}
|
|
9766
9788
|
}
|
|
9767
9789
|
previousId = currentId;
|
|
@@ -9770,11 +9792,11 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9770
9792
|
const displayedFormatObj2 = asJSONObject(valueObj2?.["displayedFormat"]);
|
|
9771
9793
|
const currentTime = asString(currentMeasurement["time"]) ?? "";
|
|
9772
9794
|
if (previousTime !== "" && currentTime <= previousTime)
|
|
9773
|
-
currentErrors.push(this.chargy.
|
|
9795
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_TimestampP", measurementCounter)));
|
|
9774
9796
|
previousTime = currentTime;
|
|
9775
9797
|
const currentValue = asNumber(measuredValueObj2?.["value"]);
|
|
9776
9798
|
if (previousValue !== void 0 && currentValue !== void 0 && currentValue < previousValue)
|
|
9777
|
-
currentErrors.push(this.chargy.
|
|
9799
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurement_ValueP", measurementCounter)));
|
|
9778
9800
|
previousValue = currentValue;
|
|
9779
9801
|
const additionalValuesRaw = currentMeasurement["additionalValues"];
|
|
9780
9802
|
if (!isMandatoryJSONArray(additionalValuesRaw))
|
|
@@ -9801,32 +9823,32 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9801
9823
|
if (currentMeasurement["meterInfo"]) {
|
|
9802
9824
|
const meterInfoObj2 = asJSONObject(currentMeasurement["meterInfo"]);
|
|
9803
9825
|
if (meterInfoObj2?.["firmwareVersion"] !== common.meterInfo_firmwareVersion)
|
|
9804
|
-
currentErrors.push(this.chargy.
|
|
9826
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_FirmwareVersionP", measurementCounter)));
|
|
9805
9827
|
if (meterInfoObj2?.["publicKey"] !== common.meterInfo_publicKey)
|
|
9806
|
-
currentErrors.push(this.chargy.
|
|
9828
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_PublicKeyP", measurementCounter)));
|
|
9807
9829
|
if (meterInfoObj2?.["meterId"] !== common.meterInfo_meterId)
|
|
9808
|
-
currentErrors.push(this.chargy.
|
|
9830
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
9809
9831
|
if (meterInfoObj2?.["meterId"] !== additionalValues.filter((element) => element.measurandName === "MA1")[0]?.value)
|
|
9810
|
-
currentErrors.push(this.chargy.
|
|
9832
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
9811
9833
|
if (meterInfoObj2?.["manufacturer"] !== common.meterInfo_manufacturer)
|
|
9812
|
-
currentErrors.push(this.chargy.
|
|
9834
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_ManufacturerP", measurementCounter)));
|
|
9813
9835
|
if (meterInfoObj2?.["type"] !== common.meterInfo_type)
|
|
9814
|
-
currentErrors.push(this.chargy.
|
|
9836
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_TypeP", measurementCounter)));
|
|
9815
9837
|
}
|
|
9816
9838
|
if (currentMeasurement["contract"]) {
|
|
9817
9839
|
const contractObj2 = asJSONObject(currentMeasurement["contract"]);
|
|
9818
9840
|
if (additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("contract-id:")).length == 0)
|
|
9819
|
-
currentErrors.push(this.chargy.
|
|
9841
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
9820
9842
|
if (contractObj2?.["id"] !== common.contract_id)
|
|
9821
|
-
currentErrors.push(this.chargy.
|
|
9843
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
9822
9844
|
if (contractObj2?.["type"] !== common.contract_type)
|
|
9823
|
-
currentErrors.push(this.chargy.
|
|
9845
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_TypeP", measurementCounter)));
|
|
9824
9846
|
const contractInfo = additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("contract-id:"))[0]?.value;
|
|
9825
9847
|
if (contractInfo != null) {
|
|
9826
9848
|
if (contractObj2?.["type"] && contractInfo !== "contract-id: " + (common.contract_type ?? "-") + ":" + common.contract_id)
|
|
9827
|
-
currentErrors.push(this.chargy.
|
|
9849
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
9828
9850
|
if (!contractObj2?.["type"] && contractInfo !== "contract-id: " + common.contract_id)
|
|
9829
|
-
currentErrors.push(this.chargy.
|
|
9851
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
9830
9852
|
}
|
|
9831
9853
|
}
|
|
9832
9854
|
const rcrInAdditional = additionalValues.find((element) => element.measurandName == "RCR");
|
|
@@ -9837,37 +9859,40 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9837
9859
|
if (valueObj2?.["measurand"]) {
|
|
9838
9860
|
const measurandObj2 = asJSONObject(valueObj2["measurand"]);
|
|
9839
9861
|
if (measurandObj2?.["id"] !== common.value_measurand_id || measurandObj2["id"] !== rcrInAdditional?.measurandId)
|
|
9840
|
-
currentErrors.push(this.chargy.
|
|
9862
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurand_IdentificationP", measurementCounter)));
|
|
9841
9863
|
if (measurandObj2?.["name"] !== common.value_measurand_name || measurandObj2["name"] !== rcrInAdditional?.measurandName)
|
|
9842
|
-
currentErrors.push(this.chargy.
|
|
9864
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurand_NameP", measurementCounter)));
|
|
9843
9865
|
}
|
|
9844
9866
|
if (valueObj2?.["measuredValue"]) {
|
|
9845
9867
|
if (measuredValueObj2?.["value"] !== rcrInAdditional?.value)
|
|
9846
|
-
currentErrors.push(this.chargy.
|
|
9868
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValueP", measurementCounter)));
|
|
9847
9869
|
if (measuredValueObj2?.["scale"] !== common.value_measuredValue_scale || measuredValueObj2?.["scale"] !== rcrInAdditional?.scale)
|
|
9848
|
-
currentErrors.push(this.chargy.
|
|
9870
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_ScaleP", measurementCounter)));
|
|
9849
9871
|
if (measuredValueObj2?.["unit"] !== common.value_measuredValue_unit || measuredValueObj2["unit"] !== rcrInAdditional?.unit)
|
|
9850
|
-
currentErrors.push(this.chargy.
|
|
9872
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_UnitP", measurementCounter)));
|
|
9851
9873
|
if (measuredValueObj2?.["unitEncoded"] !== common.value_measuredValue_unitEncoded || measuredValueObj2?.["unitEncoded"] !== rcrInAdditional?.unitEncoded)
|
|
9852
|
-
currentErrors.push(this.chargy.
|
|
9874
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_UnitEncodedP", measurementCounter)));
|
|
9853
9875
|
if (measuredValueObj2?.["valueType"] !== common.value_measuredValue_valueType || measuredValueObj2?.["valueType"] !== rcrInAdditional?.valueType)
|
|
9854
|
-
currentErrors.push(this.chargy.
|
|
9876
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_TypeP", measurementCounter)));
|
|
9855
9877
|
}
|
|
9856
9878
|
if (currentMeasurement["chargePoint"] && asJSONObject(currentMeasurement["chargePoint"])?.["softwareVersion"] !== common.chargePoint_softwareVersion)
|
|
9857
|
-
currentErrors.push(this.chargy.
|
|
9879
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageText("Inconsistent_ChargingStation_FirmwareVersion")));
|
|
9858
9880
|
const signedEVSEId = additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("evse-id:"));
|
|
9859
9881
|
if (signedEVSEId.length == 1) {
|
|
9860
9882
|
const evse__id = (asString(signedEVSEId[0]?.value) ?? "").replace("evse-id:", "").trim();
|
|
9861
9883
|
if (evse__id !== "unknown" && ExpectedEVSEId !== evse__id)
|
|
9862
|
-
currentErrors.push(this.chargy.
|
|
9884
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageText("Inconsistent_EVSE_Identification")));
|
|
9863
9885
|
}
|
|
9864
9886
|
const signedCSCSWVersion = additionalValues.filter((element) => element.measurandName?.startsWith("Meta") && asString(element.value)?.startsWith("csc-sw-version:"));
|
|
9865
9887
|
if (signedCSCSWVersion.length == 1) {
|
|
9866
9888
|
const csc_sw_version = asString(signedCSCSWVersion[0]?.value)?.replace("csc-sw-version:", "").trim() ?? null;
|
|
9867
9889
|
if (previousCscSwVersion !== null && previousCscSwVersion !== csc_sw_version)
|
|
9868
|
-
currentErrors.push(this.chargy.
|
|
9890
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageText("Inconsistent_ChargingStation_FirmwareVersion")));
|
|
9869
9891
|
if (ExpectedCscSwVersion !== null && ExpectedCscSwVersion !== csc_sw_version)
|
|
9870
|
-
currentWarnings.push(
|
|
9892
|
+
currentWarnings.push({
|
|
9893
|
+
level: "medium" /* medium */,
|
|
9894
|
+
message: this.chargy.GetMultilanguageText("Inconsistent_ChargingStation_FirmwareVersion")
|
|
9895
|
+
});
|
|
9871
9896
|
previousCscSwVersion = csc_sw_version;
|
|
9872
9897
|
}
|
|
9873
9898
|
for (const additionalValue of additionalValues) {
|
|
@@ -9927,32 +9952,32 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9927
9952
|
}
|
|
9928
9953
|
const currentRCRValue = asNumber(RCR?.value) ?? NaN;
|
|
9929
9954
|
if (previousRCR !== -1 && currentRCRValue < previousRCR)
|
|
9930
|
-
currentErrors.push(this.chargy.
|
|
9955
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_Measurement_ValueP", measurementCounter)));
|
|
9931
9956
|
previousRCR = currentRCRValue;
|
|
9932
9957
|
if (RCnt !== currentMeasurement["measurementId"])
|
|
9933
|
-
currentErrors.push(this.chargy.
|
|
9958
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeasurementIdP", measurementCounter)));
|
|
9934
9959
|
if (previousRCnt !== -1 && RCnt != previousRCnt + 1)
|
|
9935
|
-
currentErrors.push(this.chargy.
|
|
9960
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_CounterP", measurementCounter)));
|
|
9936
9961
|
previousRCnt = RCnt;
|
|
9937
9962
|
if (previousOS !== -1 && OS <= previousOS)
|
|
9938
|
-
currentErrors.push(this.chargy.
|
|
9963
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_OperationSecondsCounterP", measurementCounter)));
|
|
9939
9964
|
previousOS = OS;
|
|
9940
9965
|
if (previousEpoch !== -1 && Epoch <= previousEpoch)
|
|
9941
|
-
currentErrors.push(this.chargy.
|
|
9966
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_UNIXEpochP", measurementCounter)));
|
|
9942
9967
|
previousEpoch = Epoch;
|
|
9943
9968
|
const measurementTimestamp1 = new Date(Epoch * 1e3 + TZO * 6e4).toISOString();
|
|
9944
9969
|
const measurementTimestamp2 = measurementTimestamp1.substring(0, measurementTimestamp1.indexOf("."));
|
|
9945
9970
|
const measurementTimestamp3 = measurementTimestamp2 + (TZO > 0 ? "+" : "-") + (Math.abs(TZO) / 60).toString().padStart(2, "0") + ":" + (Math.abs(TZO) % 60).toString().padStart(2, "0");
|
|
9946
9971
|
if (currentTime !== measurementTimestamp3)
|
|
9947
|
-
currentErrors.push(this.chargy.
|
|
9972
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_TimestampP", measurementCounter)));
|
|
9948
9973
|
if (common.MA1 !== null && MA1 !== common.MA1)
|
|
9949
|
-
currentErrors.push(this.chargy.
|
|
9974
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
9950
9975
|
common.MA1 = MA1;
|
|
9951
9976
|
if (common.epochSetCnt !== -1 && EpochSetCnt !== common.epochSetCnt)
|
|
9952
|
-
currentErrors.push(this.chargy.
|
|
9977
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_EpochSet_CounterP", measurementCounter)));
|
|
9953
9978
|
common.epochSetCnt = EpochSetCnt;
|
|
9954
9979
|
if (common.epochSetOS !== -1 && EpochSetOS !== common.epochSetOS)
|
|
9955
|
-
currentErrors.push(this.chargy.
|
|
9980
|
+
currentErrors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_SignedMeterValue_EpochSet_OperationSecondsP", measurementCounter)));
|
|
9956
9981
|
common.epochSetOS = EpochSetOS;
|
|
9957
9982
|
common.dataSets.push({
|
|
9958
9983
|
Typ,
|
|
@@ -9991,7 +10016,7 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
9991
10016
|
throw new Error(this.chargy.GetLocalizedMessageWithParameter("Inconsistent_EnergyMeterValueP", 1));
|
|
9992
10017
|
for (let i = 1; i < common.dataSets.length - 1; i++) {
|
|
9993
10018
|
if (common.dataSets[i]?.TypParsed !== "CURRENT")
|
|
9994
|
-
errors.push(this.chargy.
|
|
10019
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Inconsistent_EnergyMeterValueP", measurementCounter + 1)));
|
|
9995
10020
|
}
|
|
9996
10021
|
if (lastDataSet === void 0 || lastDataSet.TypParsed !== "END" && lastDataSet.TypParsed !== "TURN OFF")
|
|
9997
10022
|
throw new Error(this.chargy.GetLocalizedMessageWithParameter("Inconsistent_EnergyMeterValueP", n + 1));
|
|
@@ -10061,7 +10086,11 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
10061
10086
|
try {
|
|
10062
10087
|
ASN1Signature = ASN1_SignatureSchema.decode(Buffer.from(dataSet.signature, "hex"), "der");
|
|
10063
10088
|
} catch (exception) {
|
|
10064
|
-
|
|
10089
|
+
const signatureError = this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_SignatureP", 1);
|
|
10090
|
+
const exceptionText = ": " + (exception instanceof Error ? exception.message : String(exception));
|
|
10091
|
+
for (const language of Object.keys(signatureError))
|
|
10092
|
+
signatureError[language] = (signatureError[language] ?? "") + exceptionText;
|
|
10093
|
+
errors.push(CreateError(signatureError));
|
|
10065
10094
|
}
|
|
10066
10095
|
const bsmMeasurementValue = {
|
|
10067
10096
|
timestamp: dataSet.time,
|
|
@@ -10154,7 +10183,9 @@ var BSMCrypt01 = class extends ACrypt {
|
|
|
10154
10183
|
CTR.certainty = 1 - errors.length / numberOfFormatChecks;
|
|
10155
10184
|
return CTR;
|
|
10156
10185
|
} catch (exception) {
|
|
10157
|
-
errors.push(
|
|
10186
|
+
errors.push(
|
|
10187
|
+
CreateError({ "en": "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)) })
|
|
10188
|
+
);
|
|
10158
10189
|
}
|
|
10159
10190
|
return {
|
|
10160
10191
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
@@ -11279,14 +11310,14 @@ var Mennekes = class {
|
|
|
11279
11310
|
if (chargingProcesses.length === 0)
|
|
11280
11311
|
return {
|
|
11281
11312
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
11282
|
-
message: this.chargy.
|
|
11313
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
11283
11314
|
certainty: 0
|
|
11284
11315
|
};
|
|
11285
11316
|
return await Promise.resolve(this.toChargeTransparencyRecord(chargingProcesses));
|
|
11286
11317
|
} catch (exception) {
|
|
11287
11318
|
return {
|
|
11288
11319
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
11289
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
11320
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
11290
11321
|
certainty: 0
|
|
11291
11322
|
};
|
|
11292
11323
|
}
|
|
@@ -11423,7 +11454,10 @@ var MennekesCrypt01 = class extends ACrypt {
|
|
|
11423
11454
|
sessionResult = "InvalidSignature" /* InvalidSignature */;
|
|
11424
11455
|
}
|
|
11425
11456
|
if (sessionResult === "ValidSignature" /* ValidSignature */) {
|
|
11426
|
-
const lawErrors = validateMennekesLawConformity(
|
|
11457
|
+
const lawErrors = validateMennekesLawConformity(
|
|
11458
|
+
measurement.values,
|
|
11459
|
+
this.chargy
|
|
11460
|
+
);
|
|
11427
11461
|
if (lawErrors.length > 0) {
|
|
11428
11462
|
measurement.verificationResult = {
|
|
11429
11463
|
status: "InvalidMeasurement" /* InvalidMeasurement */,
|
|
@@ -11680,18 +11714,20 @@ function toMennekesMeasurementValue(measurement) {
|
|
|
11680
11714
|
"measurement": void 0
|
|
11681
11715
|
};
|
|
11682
11716
|
}
|
|
11683
|
-
function validateMennekesLawConformity(measurementValues) {
|
|
11717
|
+
function validateMennekesLawConformity(measurementValues, chargy) {
|
|
11684
11718
|
const errors = new Array();
|
|
11685
11719
|
const start = measurementValues[0];
|
|
11686
11720
|
const end = measurementValues[measurementValues.length - 1];
|
|
11687
11721
|
if (start == null || end == null)
|
|
11688
|
-
return [
|
|
11722
|
+
return [
|
|
11723
|
+
CreateError(chargy.GetMultilanguageText("Mennekes EDL40 requires at least two measurement values."))
|
|
11724
|
+
];
|
|
11689
11725
|
if (start.eventCounter !== end.eventCounter)
|
|
11690
|
-
errors.push("Event counter mismatch.");
|
|
11726
|
+
errors.push(CreateError(chargy.GetMultilanguageText("Event counter mismatch.")));
|
|
11691
11727
|
if (Number(start.paginationId) >= Number(end.paginationId))
|
|
11692
|
-
errors.push("Pagination must increase from start to end.");
|
|
11728
|
+
errors.push(CreateError(chargy.GetMultilanguageText("Pagination must increase from start to end.")));
|
|
11693
11729
|
if (start.value.gt(end.value))
|
|
11694
|
-
errors.push("Meter value must not decrease.");
|
|
11730
|
+
errors.push(CreateError(chargy.GetMultilanguageText("Meter value must not decrease.")));
|
|
11695
11731
|
return errors;
|
|
11696
11732
|
}
|
|
11697
11733
|
function child(parent, localName) {
|
|
@@ -12066,17 +12102,17 @@ var OCMF = class {
|
|
|
12066
12102
|
const pagination = paging.length > 1 ? parseNumber(paging.substring(1)) : null;
|
|
12067
12103
|
if (transactionType === "undefined" /* undefined */) return {
|
|
12068
12104
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12069
|
-
message: this.chargy.
|
|
12105
|
+
message: this.chargy.GetMultilanguageText("The given OCMF data does not have a valid transaction type!"),
|
|
12070
12106
|
certainty: 0
|
|
12071
12107
|
};
|
|
12072
12108
|
if (!isMandatoryNumber(pagination)) return {
|
|
12073
12109
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12074
|
-
message: this.chargy.
|
|
12110
|
+
message: this.chargy.GetMultilanguageText("The given OCMF data does not have a valid pagination counter!"),
|
|
12075
12111
|
certainty: 0
|
|
12076
12112
|
};
|
|
12077
12113
|
if (firstOCMDJSONDocument.payload.RD.length == 0) return {
|
|
12078
12114
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12079
|
-
message: this.chargy.
|
|
12115
|
+
message: this.chargy.GetMultilanguageText("Each OCMF data set must have at least one meter reading!"),
|
|
12080
12116
|
certainty: 0
|
|
12081
12117
|
};
|
|
12082
12118
|
const CTR = {
|
|
@@ -12174,14 +12210,14 @@ var OCMF = class {
|
|
|
12174
12210
|
const timeSplit = time.split(" ");
|
|
12175
12211
|
if (timeSplit.length != 2) return {
|
|
12176
12212
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12177
|
-
message: this.chargy.
|
|
12213
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time format!"),
|
|
12178
12214
|
certainty: 0
|
|
12179
12215
|
};
|
|
12180
12216
|
const timeRegEx = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2},\d{3}[+-]\d{4}$/;
|
|
12181
12217
|
const timeStamp = timeSplit[0];
|
|
12182
12218
|
if (!isMandatoryString(timeStamp) || !timeRegEx.test(timeStamp)) return {
|
|
12183
12219
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12184
|
-
message: this.chargy.
|
|
12220
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time sync format!"),
|
|
12185
12221
|
certainty: 0
|
|
12186
12222
|
};
|
|
12187
12223
|
const timeStampISO8601 = this.convertToISO8601(timeStamp);
|
|
@@ -12189,7 +12225,7 @@ var OCMF = class {
|
|
|
12189
12225
|
let timeSync = "unknown" /* unknown */;
|
|
12190
12226
|
if (!isMandatoryString(timeSyncText) || !["U", "I", "S", "R"].includes(timeSyncText)) return {
|
|
12191
12227
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12192
|
-
message: this.chargy.
|
|
12228
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time sync format!"),
|
|
12193
12229
|
certainty: 0
|
|
12194
12230
|
};
|
|
12195
12231
|
switch (timeSyncText) {
|
|
@@ -12208,23 +12244,23 @@ var OCMF = class {
|
|
|
12208
12244
|
default:
|
|
12209
12245
|
return {
|
|
12210
12246
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12211
|
-
message: this.chargy.
|
|
12247
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid time sync format!"),
|
|
12212
12248
|
certainty: 0
|
|
12213
12249
|
};
|
|
12214
12250
|
}
|
|
12215
12251
|
if (transaction && !["B", "C", "X", "E", "L", "R", "A", "P", "S", "T"].includes(transaction)) return {
|
|
12216
12252
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12217
|
-
message: this.chargy.
|
|
12253
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid transaction type!"),
|
|
12218
12254
|
certainty: 0
|
|
12219
12255
|
};
|
|
12220
12256
|
if (!["kWh", "Wh", "mOhm", "uOhm"].includes(readingUnit)) return {
|
|
12221
12257
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12222
|
-
message: this.chargy.
|
|
12258
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid current type!"),
|
|
12223
12259
|
certainty: 0
|
|
12224
12260
|
};
|
|
12225
12261
|
if (readingCurrentType && !["AC", "DC"].includes(readingCurrentType)) return {
|
|
12226
12262
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12227
|
-
message: this.chargy.
|
|
12263
|
+
message: this.chargy.GetMultilanguageText("The given OCMF meter value does not have a valid current type!"),
|
|
12228
12264
|
certainty: 0
|
|
12229
12265
|
};
|
|
12230
12266
|
if (CTR.chargingSessions?.[0]?.begin === "?")
|
|
@@ -12293,7 +12329,7 @@ var OCMF = class {
|
|
|
12293
12329
|
} catch (exception) {
|
|
12294
12330
|
return {
|
|
12295
12331
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12296
|
-
message: "Invalid OCMF data: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
12332
|
+
message: this.chargy.GetMultilanguageText("Invalid OCMF data: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
12297
12333
|
certainty: 0
|
|
12298
12334
|
};
|
|
12299
12335
|
}
|
|
@@ -12728,7 +12764,7 @@ var OCMF = class {
|
|
|
12728
12764
|
async TryToParseOCMFDocuments(OCMFDocuments, PublicKey, PublicKeyEncoding, ContainerInfos) {
|
|
12729
12765
|
if (OCMFDocuments.length == 0) return {
|
|
12730
12766
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12731
|
-
message: this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + "!",
|
|
12767
|
+
message: this.chargy.GetMultilanguageText(this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + "!"),
|
|
12732
12768
|
certainty: 0
|
|
12733
12769
|
};
|
|
12734
12770
|
const ocmfJSONDocumentGroups = /* @__PURE__ */ new Map();
|
|
@@ -12748,7 +12784,7 @@ var OCMF = class {
|
|
|
12748
12784
|
} catch (exception) {
|
|
12749
12785
|
return {
|
|
12750
12786
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12751
|
-
message: this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + ": " + (exception instanceof Error ? exception.message : String(exception)),
|
|
12787
|
+
message: this.chargy.GetMultilanguageText(this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + ": " + (exception instanceof Error ? exception.message : String(exception))),
|
|
12752
12788
|
certainty: 0
|
|
12753
12789
|
};
|
|
12754
12790
|
}
|
|
@@ -12776,7 +12812,7 @@ var OCMF = class {
|
|
|
12776
12812
|
default:
|
|
12777
12813
|
ocmfCTRs.push({
|
|
12778
12814
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12779
|
-
message: this.chargy.
|
|
12815
|
+
message: this.chargy.GetMultilanguageText("Unknown OCMF version!"),
|
|
12780
12816
|
certainty: 0
|
|
12781
12817
|
});
|
|
12782
12818
|
break;
|
|
@@ -12788,7 +12824,7 @@ var OCMF = class {
|
|
|
12788
12824
|
}
|
|
12789
12825
|
return {
|
|
12790
12826
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
12791
|
-
message: this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + (typeof ocmfJSONDocuments === "string" ? ": " + ocmfJSONDocuments : "!"),
|
|
12827
|
+
message: this.chargy.GetMultilanguageText(this.chargy.GetLocalizedMessage("The given OCMF data could not be parsed") + (typeof ocmfJSONDocuments === "string" ? ": " + ocmfJSONDocuments : "!")),
|
|
12792
12828
|
certainty: 0
|
|
12793
12829
|
};
|
|
12794
12830
|
}
|
|
@@ -12831,11 +12867,11 @@ var OCPI = class {
|
|
|
12831
12867
|
const public_key = SomeJSON["public_key"];
|
|
12832
12868
|
const signed_values = SomeJSON["signed_values"];
|
|
12833
12869
|
if (!isMandatoryString(encoding_method))
|
|
12834
|
-
errors.push(this.chargy.
|
|
12870
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEncodingMethod")));
|
|
12835
12871
|
if (!isMandatoryString(public_key))
|
|
12836
|
-
errors.push(this.chargy.
|
|
12872
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPublicKey")));
|
|
12837
12873
|
if (!isMandatoryJSONArray(signed_values))
|
|
12838
|
-
errors.push(this.chargy.
|
|
12874
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedValues")));
|
|
12839
12875
|
if (errors.length > 0)
|
|
12840
12876
|
return {
|
|
12841
12877
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
@@ -12937,138 +12973,138 @@ var OCPI = class {
|
|
|
12937
12973
|
const chargingCostsInfo_flat_cost = chargingCostsInfo_flat?.["cost"];
|
|
12938
12974
|
const signedMeterValues = SomeJSON["signedMeterValues"];
|
|
12939
12975
|
if (!isMandatoryString(chargingSessionId))
|
|
12940
|
-
errors.push(this.chargy.
|
|
12976
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid charge transparency record identification!")));
|
|
12941
12977
|
if (!isMandatoryJSONObject(chargePointInfo)) {
|
|
12942
|
-
errors.push(this.chargy.
|
|
12978
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargePointInfo")));
|
|
12943
12979
|
secondaryErrors += 19;
|
|
12944
12980
|
} else {
|
|
12945
12981
|
if (!isMandatoryString(evseId))
|
|
12946
|
-
errors.push(this.chargy.
|
|
12982
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEVSEIdentification")));
|
|
12947
12983
|
if (!isMandatoryJSONObject(placeInfo)) {
|
|
12948
|
-
errors.push(this.chargy.
|
|
12984
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPlaceInfo")));
|
|
12949
12985
|
secondaryErrors += 8;
|
|
12950
12986
|
} else {
|
|
12951
12987
|
if (!isMandatoryJSONObject(geoLocation)) {
|
|
12952
|
-
errors.push(this.chargy.
|
|
12988
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocation")));
|
|
12953
12989
|
secondaryErrors += 2;
|
|
12954
12990
|
} else {
|
|
12955
12991
|
if (!isMandatoryNumber(geoLocation_lat))
|
|
12956
|
-
errors.push(this.chargy.
|
|
12992
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLatitude")));
|
|
12957
12993
|
if (!isMandatoryNumber(geoLocation_lon))
|
|
12958
|
-
errors.push(this.chargy.
|
|
12994
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLongitude")));
|
|
12959
12995
|
}
|
|
12960
12996
|
if (!isMandatoryJSONObject(address)) {
|
|
12961
|
-
errors.push(this.chargy.
|
|
12997
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddress")));
|
|
12962
12998
|
secondaryErrors += 4;
|
|
12963
12999
|
} else {
|
|
12964
13000
|
if (!isMandatoryString(address_street))
|
|
12965
|
-
errors.push(this.chargy.
|
|
13001
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressStreetName")));
|
|
12966
13002
|
if (!isMandatoryString(address_zipCode))
|
|
12967
|
-
errors.push(this.chargy.
|
|
13003
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressZIPCode")));
|
|
12968
13004
|
if (!isMandatoryString(address_town))
|
|
12969
|
-
errors.push(this.chargy.
|
|
13005
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCityName")));
|
|
12970
13006
|
if (!isMandatoryString(address_country))
|
|
12971
|
-
errors.push(this.chargy.
|
|
13007
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCountryName")));
|
|
12972
13008
|
}
|
|
12973
13009
|
}
|
|
12974
13010
|
}
|
|
12975
13011
|
if (!isMandatoryJSONObject(chargingStationInfo)) {
|
|
12976
|
-
errors.push(this.chargy.
|
|
13012
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargingStationInfo")));
|
|
12977
13013
|
secondaryErrors += 5;
|
|
12978
13014
|
} else {
|
|
12979
13015
|
if (!isOptionalString(chargingStation_manufacturer))
|
|
12980
|
-
errors.push(this.chargy.
|
|
13016
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station manufacturer!")));
|
|
12981
13017
|
if (!isOptionalString(chargingStation_type))
|
|
12982
|
-
errors.push(this.chargy.
|
|
13018
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station type!")));
|
|
12983
13019
|
if (!isOptionalString(chargingStation_serialNumber))
|
|
12984
|
-
errors.push(this.chargy.
|
|
13020
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station serial number!")));
|
|
12985
13021
|
if (!isOptionalString(chargingStation_controllerSoftwareVersion))
|
|
12986
|
-
errors.push(this.chargy.
|
|
13022
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station controller software version!")));
|
|
12987
13023
|
if (!isOptionalString(chargingStation_compliance))
|
|
12988
|
-
errors.push(this.chargy.
|
|
13024
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance!")));
|
|
12989
13025
|
if (!isOptionalURL(chargingStation_complianceURL))
|
|
12990
|
-
errors.push(this.chargy.
|
|
13026
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance URL!")));
|
|
12991
13027
|
if (!isOptionalString(chargingStation_conformity))
|
|
12992
|
-
errors.push(this.chargy.
|
|
13028
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity!")));
|
|
12993
13029
|
if (!isOptionalURL(chargingStation_conformity_URL))
|
|
12994
|
-
errors.push(this.chargy.
|
|
13030
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity URL!")));
|
|
12995
13031
|
if (!isOptionalURL(chargingStation_conformity_certificateId))
|
|
12996
|
-
errors.push(this.chargy.
|
|
13032
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity certificate identification!")));
|
|
12997
13033
|
if (!isOptionalString(chargingStation_calibration))
|
|
12998
|
-
errors.push(this.chargy.
|
|
13034
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration!")));
|
|
12999
13035
|
if (!isOptionalURL(chargingStation_calibration_URL))
|
|
13000
|
-
errors.push(this.chargy.
|
|
13036
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration URL!")));
|
|
13001
13037
|
if (!isOptionalURL(chargingStation_calibration_certificateId))
|
|
13002
|
-
errors.push(this.chargy.
|
|
13038
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration certificate identification!")));
|
|
13003
13039
|
}
|
|
13004
13040
|
if (meterInfo) {
|
|
13005
13041
|
if (!isOptionalString(meterInfo_meterId))
|
|
13006
|
-
errors.push(this.chargy.
|
|
13042
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
13007
13043
|
if (!isOptionalString(meterInfo_manufacturer))
|
|
13008
|
-
errors.push(this.chargy.
|
|
13044
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
13009
13045
|
if (!isOptionalString(meterInfo_manufacturerURL))
|
|
13010
|
-
errors.push(this.chargy.
|
|
13046
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
13011
13047
|
if (!isOptionalString(meterInfo_model))
|
|
13012
|
-
errors.push(this.chargy.
|
|
13048
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
13013
13049
|
if (!isOptionalString(meterInfo_modelURL))
|
|
13014
|
-
errors.push(this.chargy.
|
|
13050
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
13015
13051
|
if (!isOptionalString(meterInfo_firmwareVersion))
|
|
13016
|
-
errors.push(this.chargy.
|
|
13052
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
13017
13053
|
if (!isOptionalString(meterInfo_hardwareVersion))
|
|
13018
|
-
errors.push(this.chargy.
|
|
13054
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
13019
13055
|
if (!isOptionalString(meterInfo_publicKey))
|
|
13020
|
-
errors.push(this.chargy.
|
|
13056
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
13021
13057
|
if (!isOptionalString(meterInfo_publicKeyFormat))
|
|
13022
|
-
errors.push(this.chargy.
|
|
13058
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
13023
13059
|
if (!isOptionalString(meterInfo_publicKeyEncoding))
|
|
13024
|
-
errors.push(this.chargy.
|
|
13060
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
13025
13061
|
if (!isOptionalString(meterInfo_signatureFormat))
|
|
13026
|
-
errors.push(this.chargy.
|
|
13062
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
13027
13063
|
if (!isOptionalString(meterInfo_signatureEncoding))
|
|
13028
|
-
errors.push(this.chargy.
|
|
13064
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
13029
13065
|
}
|
|
13030
13066
|
if (connectorInfo) {
|
|
13031
13067
|
if (!isOptionalString(connectorInfo_type))
|
|
13032
|
-
errors.push(this.chargy.
|
|
13068
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
13033
13069
|
if (!isOptionalString(connectorInfo_losses))
|
|
13034
|
-
errors.push(this.chargy.
|
|
13070
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
13035
13071
|
}
|
|
13036
13072
|
if (chargingCostsInfo) {
|
|
13037
13073
|
if (!isMandatoryNumber(chargingCostsInfo_total))
|
|
13038
|
-
errors.push(this.chargy.
|
|
13074
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid total costs within the charging costs!")));
|
|
13039
13075
|
if (!isMandatoryString(chargingCostsInfo_currency))
|
|
13040
|
-
errors.push(this.chargy.
|
|
13076
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid currency within the charging costs!")));
|
|
13041
13077
|
if (chargingCostsInfo_reservation) {
|
|
13042
13078
|
if (!isMandatoryNumber(chargingCostsInfo_reservation_cost))
|
|
13043
|
-
errors.push(this.chargy.
|
|
13079
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation cost within the charging costs!")));
|
|
13044
13080
|
if (!isMandatoryString(chargingCostsInfo_reservation_unit))
|
|
13045
|
-
errors.push(this.chargy.
|
|
13081
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation unit within the charging costs!")));
|
|
13046
13082
|
}
|
|
13047
13083
|
if (chargingCostsInfo_energy) {
|
|
13048
13084
|
if (!isMandatoryNumber(chargingCostsInfo_energy_cost))
|
|
13049
|
-
errors.push(this.chargy.
|
|
13085
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy cost within the charging costs!")));
|
|
13050
13086
|
if (!isMandatoryString(chargingCostsInfo_energy_unit))
|
|
13051
|
-
errors.push(this.chargy.
|
|
13087
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy unit within the charging costs!")));
|
|
13052
13088
|
}
|
|
13053
13089
|
if (chargingCostsInfo_time) {
|
|
13054
13090
|
if (!isMandatoryNumber(chargingCostsInfo_time_cost))
|
|
13055
|
-
errors.push(this.chargy.
|
|
13091
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time cost within the charging costs!")));
|
|
13056
13092
|
if (!isMandatoryString(chargingCostsInfo_time_unit))
|
|
13057
|
-
errors.push(this.chargy.
|
|
13093
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time unit within the charging costs!")));
|
|
13058
13094
|
}
|
|
13059
13095
|
if (chargingCostsInfo_idle) {
|
|
13060
13096
|
if (!isMandatoryNumber(chargingCostsInfo_idle_cost))
|
|
13061
|
-
errors.push(this.chargy.
|
|
13097
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle cost within the charging costs!")));
|
|
13062
13098
|
if (!isMandatoryString(chargingCostsInfo_idle_unit))
|
|
13063
|
-
errors.push(this.chargy.
|
|
13099
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle unit within the charging costs!")));
|
|
13064
13100
|
}
|
|
13065
13101
|
if (chargingCostsInfo_flat) {
|
|
13066
13102
|
if (!isMandatoryNumber(chargingCostsInfo_flat_cost))
|
|
13067
|
-
errors.push(this.chargy.
|
|
13103
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid flat cost within the charging costs!")));
|
|
13068
13104
|
}
|
|
13069
13105
|
}
|
|
13070
13106
|
if (!isMandatoryJSONArray(signedMeterValues) || signedMeterValues.length < 2) {
|
|
13071
|
-
errors.push(this.chargy.
|
|
13107
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues")));
|
|
13072
13108
|
secondaryErrors += 2 * 39;
|
|
13073
13109
|
} else {
|
|
13074
13110
|
const firstSMV = asJSONObject(signedMeterValues[0]);
|
|
@@ -13078,7 +13114,7 @@ var OCPI = class {
|
|
|
13078
13114
|
const context = asString(currentSMV?.["@context"])?.trim() ?? asString(currentSMV?.["format"])?.trim() ?? null;
|
|
13079
13115
|
if (smvContext !== context) return {
|
|
13080
13116
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13081
|
-
message: "Inconsistent signed meter value format!",
|
|
13117
|
+
message: this.chargy.GetMultilanguageText("Inconsistent signed meter value format!"),
|
|
13082
13118
|
certainty: 1
|
|
13083
13119
|
};
|
|
13084
13120
|
}
|
|
@@ -13223,7 +13259,7 @@ var OCPI = class {
|
|
|
13223
13259
|
} catch (exception) {
|
|
13224
13260
|
return {
|
|
13225
13261
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13226
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
13262
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
13227
13263
|
errors,
|
|
13228
13264
|
warnings,
|
|
13229
13265
|
certainty: (numberOfFormatChecks - errors.length - secondaryErrors) / numberOfFormatChecks
|
|
@@ -13232,7 +13268,7 @@ var OCPI = class {
|
|
|
13232
13268
|
}
|
|
13233
13269
|
return {
|
|
13234
13270
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13235
|
-
message: "No chargeIT charge transparency record",
|
|
13271
|
+
message: this.chargy.GetMultilanguageText("No chargeIT charge transparency record"),
|
|
13236
13272
|
errors,
|
|
13237
13273
|
warnings,
|
|
13238
13274
|
certainty: 0
|
|
@@ -13518,7 +13554,7 @@ var PCDF = class {
|
|
|
13518
13554
|
if (externalPublicKey != null && normalizePCDFPublicKeyHex(externalPublicKey) !== publicKey) {
|
|
13519
13555
|
return {
|
|
13520
13556
|
status: "InvalidPublicKey" /* InvalidPublicKey */,
|
|
13521
|
-
message: "Wrong Public Key",
|
|
13557
|
+
message: this.chargy.GetMultilanguageText("Wrong Public Key"),
|
|
13522
13558
|
certainty: 1
|
|
13523
13559
|
};
|
|
13524
13560
|
}
|
|
@@ -13539,7 +13575,7 @@ var PCDF = class {
|
|
|
13539
13575
|
} catch (exception) {
|
|
13540
13576
|
return {
|
|
13541
13577
|
status: exception instanceof PCDFParseError ? "InvalidSessionFormat" /* InvalidSessionFormat */ : "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13542
|
-
message: exception instanceof Error ? exception.message : String(exception),
|
|
13578
|
+
message: this.chargy.GetMultilanguageText(exception instanceof Error ? exception.message : String(exception)),
|
|
13543
13579
|
certainty: 0
|
|
13544
13580
|
};
|
|
13545
13581
|
}
|
|
@@ -13845,7 +13881,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
13845
13881
|
if (signedData == null)
|
|
13846
13882
|
return {
|
|
13847
13883
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13848
|
-
message: "Each value within the given XML container must contain signed data!",
|
|
13884
|
+
message: this.chargy.GetMultilanguageText("Each value within the given XML container must contain signed data!"),
|
|
13849
13885
|
certainty: 0
|
|
13850
13886
|
};
|
|
13851
13887
|
const signedDataFormat = signedData.attributes.getNamedItem("format")?.value.trim().toLowerCase() ?? "";
|
|
@@ -13854,7 +13890,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
13854
13890
|
else if (signedDataFormat !== commonSignedDataFormat)
|
|
13855
13891
|
return {
|
|
13856
13892
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13857
|
-
message: "Invalid mixture of different signed data formats within the given XML container!",
|
|
13893
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signed data formats within the given XML container!"),
|
|
13858
13894
|
certainty: 0
|
|
13859
13895
|
};
|
|
13860
13896
|
const signedDataEncoding = signedData.attributes.getNamedItem("encoding")?.value.trim().toLowerCase() ?? "";
|
|
@@ -13863,14 +13899,14 @@ var SAFEXML = class _SAFEXML {
|
|
|
13863
13899
|
else if (signedDataEncoding !== commonSignedDataEncoding)
|
|
13864
13900
|
return {
|
|
13865
13901
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13866
|
-
message: "Invalid mixture of different signed data encodings within the given XML container!",
|
|
13902
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signed data encodings within the given XML container!"),
|
|
13867
13903
|
certainty: 0
|
|
13868
13904
|
};
|
|
13869
13905
|
const signedDataValue = signedData.textContent.trim();
|
|
13870
13906
|
if (IsNullOrEmpty(signedDataValue))
|
|
13871
13907
|
return {
|
|
13872
13908
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13873
|
-
message: "The signed data value within the given XML container must not be empty!",
|
|
13909
|
+
message: this.chargy.GetMultilanguageText("The signed data value within the given XML container must not be empty!"),
|
|
13874
13910
|
certainty: 0
|
|
13875
13911
|
};
|
|
13876
13912
|
const publicKeyEncoding = publicKey?.attributes.getNamedItem("encoding")?.value.trim().toLowerCase() ?? "";
|
|
@@ -13879,7 +13915,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
13879
13915
|
else if (publicKeyEncoding !== commonPublicKeyEncoding)
|
|
13880
13916
|
return {
|
|
13881
13917
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13882
|
-
message: "Invalid mixture of different public key encodings within the given XML container!",
|
|
13918
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different public key encodings within the given XML container!"),
|
|
13883
13919
|
certainty: 0
|
|
13884
13920
|
};
|
|
13885
13921
|
const publicKeyValue = publicKey?.textContent.trim().replace(/\s+/g, "") ?? "";
|
|
@@ -13888,7 +13924,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
13888
13924
|
else if (publicKeyValue !== commonPublicKey)
|
|
13889
13925
|
return {
|
|
13890
13926
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13891
|
-
message: "Invalid mixture of different public keys within the given XML container!",
|
|
13927
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different public keys within the given XML container!"),
|
|
13892
13928
|
certainty: 0
|
|
13893
13929
|
};
|
|
13894
13930
|
switch (commonSignedDataEncoding) {
|
|
@@ -13908,7 +13944,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
13908
13944
|
default:
|
|
13909
13945
|
return {
|
|
13910
13946
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13911
|
-
message: "Unkown signed data encoding within the given SAFE XML!",
|
|
13947
|
+
message: this.chargy.GetMultilanguageText("Unkown signed data encoding within the given SAFE XML!"),
|
|
13912
13948
|
certainty: 0
|
|
13913
13949
|
};
|
|
13914
13950
|
}
|
|
@@ -13930,7 +13966,7 @@ var SAFEXML = class _SAFEXML {
|
|
|
13930
13966
|
default:
|
|
13931
13967
|
return {
|
|
13932
13968
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13933
|
-
message: this.chargy.
|
|
13969
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
13934
13970
|
certainty: 0
|
|
13935
13971
|
};
|
|
13936
13972
|
}
|
|
@@ -13939,13 +13975,13 @@ var SAFEXML = class _SAFEXML {
|
|
|
13939
13975
|
} catch (exception) {
|
|
13940
13976
|
return {
|
|
13941
13977
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13942
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
13978
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
13943
13979
|
certainty: 0
|
|
13944
13980
|
};
|
|
13945
13981
|
}
|
|
13946
13982
|
return {
|
|
13947
13983
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13948
|
-
message: this.chargy.
|
|
13984
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
13949
13985
|
certainty: 0
|
|
13950
13986
|
};
|
|
13951
13987
|
}
|
|
@@ -13994,14 +14030,14 @@ var XMLContainer = class {
|
|
|
13994
14030
|
default:
|
|
13995
14031
|
return {
|
|
13996
14032
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
13997
|
-
message: "Unkown public key encoding within the given XML container!",
|
|
14033
|
+
message: this.chargy.GetMultilanguageText("Unkown public key encoding within the given XML container!"),
|
|
13998
14034
|
certainty: 0
|
|
13999
14035
|
};
|
|
14000
14036
|
}
|
|
14001
14037
|
if (IsNullOrEmpty(publicKeyValue))
|
|
14002
14038
|
return {
|
|
14003
14039
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14004
|
-
message: "The public key within the given XML container must not be empty!",
|
|
14040
|
+
message: this.chargy.GetMultilanguageText("The public key within the given XML container must not be empty!"),
|
|
14005
14041
|
certainty: 0
|
|
14006
14042
|
};
|
|
14007
14043
|
else if (common.publicKey == "")
|
|
@@ -14009,7 +14045,7 @@ var XMLContainer = class {
|
|
|
14009
14045
|
else if (publicKeyValue != common.publicKey)
|
|
14010
14046
|
return {
|
|
14011
14047
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14012
|
-
message: "Invalid mixture of different public keys within the given XML container!",
|
|
14048
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different public keys within the given XML container!"),
|
|
14013
14049
|
certainty: 0
|
|
14014
14050
|
};
|
|
14015
14051
|
}
|
|
@@ -14034,14 +14070,14 @@ var XMLContainer = class {
|
|
|
14034
14070
|
default:
|
|
14035
14071
|
return {
|
|
14036
14072
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14037
|
-
message: "Unkown meter value signature encoding within the given XML container!",
|
|
14073
|
+
message: this.chargy.GetMultilanguageText("Unkown meter value signature encoding within the given XML container!"),
|
|
14038
14074
|
certainty: 0
|
|
14039
14075
|
};
|
|
14040
14076
|
}
|
|
14041
14077
|
if (IsNullOrEmpty(meterValueSignatureValue))
|
|
14042
14078
|
return {
|
|
14043
14079
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14044
|
-
message: "The meter value signature within the given XML container must not be empty!",
|
|
14080
|
+
message: this.chargy.GetMultilanguageText("The meter value signature within the given XML container must not be empty!"),
|
|
14045
14081
|
certainty: 0
|
|
14046
14082
|
};
|
|
14047
14083
|
common.meterValueSignatures.push(meterValueSignatureValue);
|
|
@@ -14052,7 +14088,7 @@ var XMLContainer = class {
|
|
|
14052
14088
|
else if (common.signatureMethod != signatureMethod)
|
|
14053
14089
|
return {
|
|
14054
14090
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14055
|
-
message: "Invalid mixture of different signature methods within the given XML container!",
|
|
14091
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signature methods within the given XML container!"),
|
|
14056
14092
|
certainty: 0
|
|
14057
14093
|
};
|
|
14058
14094
|
const encodingMethod = valueList[i]?.querySelector("encodingMethod")?.textContent.trim().toLowerCase() ?? "";
|
|
@@ -14061,7 +14097,7 @@ var XMLContainer = class {
|
|
|
14061
14097
|
else if (common.encodingMethod != encodingMethod)
|
|
14062
14098
|
return {
|
|
14063
14099
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14064
|
-
message: "Invalid mixture of different signed data formats within the given XML container!",
|
|
14100
|
+
message: this.chargy.GetMultilanguageText("Invalid mixture of different signed data formats within the given XML container!"),
|
|
14065
14101
|
certainty: 0
|
|
14066
14102
|
};
|
|
14067
14103
|
const encodedMeterValue = valueList[i]?.querySelector("encodedMeterValue");
|
|
@@ -14085,21 +14121,21 @@ var XMLContainer = class {
|
|
|
14085
14121
|
default:
|
|
14086
14122
|
return {
|
|
14087
14123
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14088
|
-
message: "Unkown signed data encoding within the given XML container!",
|
|
14124
|
+
message: this.chargy.GetMultilanguageText("Unkown signed data encoding within the given XML container!"),
|
|
14089
14125
|
certainty: 0
|
|
14090
14126
|
};
|
|
14091
14127
|
}
|
|
14092
14128
|
if (IsNullOrEmpty(signedDataValue))
|
|
14093
14129
|
return {
|
|
14094
14130
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14095
|
-
message: "The signed data value within the given XML container must not be empty!",
|
|
14131
|
+
message: this.chargy.GetMultilanguageText("The signed data value within the given XML container must not be empty!"),
|
|
14096
14132
|
certainty: 0
|
|
14097
14133
|
};
|
|
14098
14134
|
common.encodedMeterValues.push(signedDataValue);
|
|
14099
14135
|
} else
|
|
14100
14136
|
return {
|
|
14101
14137
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14102
|
-
message: "The signed data tag within the given XML container must not be empty!",
|
|
14138
|
+
message: this.chargy.GetMultilanguageText("The signed data tag within the given XML container must not be empty!"),
|
|
14103
14139
|
certainty: 0
|
|
14104
14140
|
};
|
|
14105
14141
|
}
|
|
@@ -14107,13 +14143,13 @@ var XMLContainer = class {
|
|
|
14107
14143
|
}
|
|
14108
14144
|
return {
|
|
14109
14145
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14110
|
-
message: this.chargy.
|
|
14146
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
14111
14147
|
certainty: 0
|
|
14112
14148
|
};
|
|
14113
14149
|
} catch (exception) {
|
|
14114
14150
|
return {
|
|
14115
14151
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14116
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
14152
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
14117
14153
|
certainty: 0
|
|
14118
14154
|
};
|
|
14119
14155
|
}
|
|
@@ -14235,7 +14271,7 @@ var ChargeIT = class {
|
|
|
14235
14271
|
if (firstMeterValue === void 0 || lastMeterValue === void 0)
|
|
14236
14272
|
return {
|
|
14237
14273
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14238
|
-
message: this.chargy.
|
|
14274
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
14239
14275
|
certainty: 0
|
|
14240
14276
|
};
|
|
14241
14277
|
CTR["@id"] = lastMeterValue["transactionId"];
|
|
@@ -14420,38 +14456,38 @@ var ChargeIT = class {
|
|
|
14420
14456
|
{
|
|
14421
14457
|
const placeInfo = asJSONObject(SomeJSON["placeInfo"]);
|
|
14422
14458
|
if (placeInfo === void 0) {
|
|
14423
|
-
errors.push(this.chargy.
|
|
14459
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPlaceInfo")));
|
|
14424
14460
|
secondaryErrors += 13;
|
|
14425
14461
|
} else {
|
|
14426
14462
|
const evseId = placeInfo["evseId"];
|
|
14427
14463
|
if (!isMandatoryString(evseId))
|
|
14428
|
-
errors.push(this.chargy.
|
|
14464
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEVSEId")));
|
|
14429
14465
|
const address = asJSONObject(placeInfo["address"]);
|
|
14430
14466
|
if (address === void 0) {
|
|
14431
|
-
errors.push(this.chargy.
|
|
14467
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddress")));
|
|
14432
14468
|
secondaryErrors += 3;
|
|
14433
14469
|
} else {
|
|
14434
14470
|
if (!isMandatoryString(address["street"]))
|
|
14435
|
-
errors.push(this.chargy.
|
|
14471
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressStreetName")));
|
|
14436
14472
|
if (!isMandatoryString(address["zipCode"]))
|
|
14437
|
-
errors.push(this.chargy.
|
|
14473
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressZIPCode")));
|
|
14438
14474
|
if (!isMandatoryString(address["town"]))
|
|
14439
|
-
errors.push(this.chargy.
|
|
14475
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCityName")));
|
|
14440
14476
|
}
|
|
14441
14477
|
const geoLocation = asJSONObject(placeInfo["geoLocation"]);
|
|
14442
14478
|
if (geoLocation === void 0) {
|
|
14443
|
-
errors.push(this.chargy.
|
|
14479
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocation")));
|
|
14444
14480
|
secondaryErrors += 2;
|
|
14445
14481
|
} else {
|
|
14446
14482
|
if (!isMandatoryNumber(geoLocation["lat"]))
|
|
14447
|
-
errors.push(this.chargy.
|
|
14483
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLatitude")));
|
|
14448
14484
|
if (!isMandatoryNumber(geoLocation["lon"]))
|
|
14449
|
-
errors.push(this.chargy.
|
|
14485
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLongitude")));
|
|
14450
14486
|
}
|
|
14451
14487
|
}
|
|
14452
14488
|
const signedMeterValues = SomeJSON["signedMeterValues"];
|
|
14453
14489
|
if (!isMandatoryJSONArray(signedMeterValues) || signedMeterValues.length < 2) {
|
|
14454
|
-
errors.push(this.chargy.
|
|
14490
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues")));
|
|
14455
14491
|
secondaryErrors += 2 * 39;
|
|
14456
14492
|
} else {
|
|
14457
14493
|
numberOfFormatChecks += 39 * (signedMeterValues.length - 2);
|
|
@@ -14460,7 +14496,7 @@ var ChargeIT = class {
|
|
|
14460
14496
|
for (const signedMeterValue of signedMeterValues.map((smv) => asJSONObject(smv))) {
|
|
14461
14497
|
if ((signedMeterValue?.["@context"] ?? oldChargeITMeterValueFormat) !== signedMeterValueContext) {
|
|
14462
14498
|
if (consistent)
|
|
14463
|
-
errors.push(this.chargy.
|
|
14499
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("InconsistentJSONContextInformation")));
|
|
14464
14500
|
consistent = false;
|
|
14465
14501
|
}
|
|
14466
14502
|
}
|
|
@@ -14473,122 +14509,122 @@ var ChargeIT = class {
|
|
|
14473
14509
|
for (const signedMeterValue of signedMeterValues) {
|
|
14474
14510
|
measurementCounter++;
|
|
14475
14511
|
if (!isMandatoryJSONObject(signedMeterValue)) {
|
|
14476
|
-
errors.push(this.chargy.
|
|
14512
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidSignedMeterValueP", measurementCounter)));
|
|
14477
14513
|
secondaryErrors += 38;
|
|
14478
14514
|
} else {
|
|
14479
14515
|
if (!isMandatoryString(signedMeterValue["measurementId"]))
|
|
14480
|
-
errors.push(this.chargy.
|
|
14516
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasurementIdP", measurementCounter)));
|
|
14481
14517
|
if (!isMandatoryNumber(signedMeterValue["timestamp"]))
|
|
14482
|
-
errors.push(this.chargy.
|
|
14518
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_TimestampP", measurementCounter)));
|
|
14483
14519
|
if (!isMandatoryString(signedMeterValue["transactionId"]))
|
|
14484
|
-
errors.push(this.chargy.
|
|
14520
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_TransactionIdP", measurementCounter)));
|
|
14485
14521
|
if (!isMandatoryString(signedMeterValue["signature"]))
|
|
14486
|
-
errors.push(this.chargy.
|
|
14522
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_SignatureP", measurementCounter)));
|
|
14487
14523
|
const meterInfo = signedMeterValue["meterInfo"];
|
|
14488
14524
|
if (!isMandatoryJSONObject(meterInfo)) {
|
|
14489
|
-
errors.push(this.chargy.
|
|
14525
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfoP", measurementCounter)));
|
|
14490
14526
|
secondaryErrors += 5;
|
|
14491
14527
|
} else {
|
|
14492
14528
|
if (!isMandatoryString(meterInfo["meterId"]))
|
|
14493
|
-
errors.push(this.chargy.
|
|
14529
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", measurementCounter)));
|
|
14494
14530
|
if (!isMandatoryString(meterInfo["type"]))
|
|
14495
|
-
errors.push(this.chargy.
|
|
14531
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_TypeP", measurementCounter)));
|
|
14496
14532
|
if (!isMandatoryString(meterInfo["firmwareVersion"]))
|
|
14497
|
-
errors.push(this.chargy.
|
|
14533
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", measurementCounter)));
|
|
14498
14534
|
if (!isMandatoryString(meterInfo["publicKey"]))
|
|
14499
|
-
errors.push(this.chargy.
|
|
14535
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", measurementCounter)));
|
|
14500
14536
|
if (!isMandatoryString(meterInfo["manufacturer"]))
|
|
14501
|
-
errors.push(this.chargy.
|
|
14537
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", measurementCounter)));
|
|
14502
14538
|
if (isOptionalJSONArrayError(meterInfo["publicKeySignatures"]))
|
|
14503
|
-
errors.push(this.chargy.
|
|
14539
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("Invalid_SignedMeterValue_MeterInfo_PublicKeySignaturesP", measurementCounter)));
|
|
14504
14540
|
}
|
|
14505
14541
|
const contract = signedMeterValue["contract"];
|
|
14506
14542
|
if (!isMandatoryJSONObject(contract)) {
|
|
14507
|
-
errors.push(this.chargy.
|
|
14543
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ContractP", measurementCounter)));
|
|
14508
14544
|
secondaryErrors += 7;
|
|
14509
14545
|
} else {
|
|
14510
14546
|
if (!isMandatoryString(contract["id"]))
|
|
14511
|
-
errors.push(this.chargy.
|
|
14547
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_IdP", measurementCounter)));
|
|
14512
14548
|
if (!isMandatoryString(contract["type"]))
|
|
14513
|
-
errors.push(this.chargy.
|
|
14549
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TypeP", measurementCounter)));
|
|
14514
14550
|
if (!isMandatoryNumber(contract["timestamp"]))
|
|
14515
|
-
errors.push(this.chargy.
|
|
14551
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampP", measurementCounter)));
|
|
14516
14552
|
const timestampLocal = contract["timestampLocal"];
|
|
14517
14553
|
if (!isMandatoryJSONObject(timestampLocal)) {
|
|
14518
|
-
errors.push(this.chargy.
|
|
14554
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocalP", measurementCounter)));
|
|
14519
14555
|
secondaryErrors += 3;
|
|
14520
14556
|
} else {
|
|
14521
14557
|
if (!isMandatoryNumber(timestampLocal["timestamp"]))
|
|
14522
|
-
errors.push(this.chargy.
|
|
14558
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocal_TimestampP", measurementCounter)));
|
|
14523
14559
|
if (!isMandatoryNumber(timestampLocal["localOffset"]))
|
|
14524
|
-
errors.push(this.chargy.
|
|
14560
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocal_LocalOffsetP", measurementCounter)));
|
|
14525
14561
|
if (!isMandatoryNumber(timestampLocal["seasonOffset"]))
|
|
14526
|
-
errors.push(this.chargy.
|
|
14562
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Contract_TimestampLocal_SeasonOffsetP", measurementCounter)));
|
|
14527
14563
|
}
|
|
14528
14564
|
}
|
|
14529
14565
|
const measuredValue = signedMeterValue["measuredValue"];
|
|
14530
14566
|
if (!isMandatoryJSONObject(measuredValue)) {
|
|
14531
|
-
errors.push(this.chargy.
|
|
14567
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValueP", measurementCounter)));
|
|
14532
14568
|
secondaryErrors += 9;
|
|
14533
14569
|
} else {
|
|
14534
14570
|
if (!isMandatoryString(measuredValue["value"]))
|
|
14535
|
-
errors.push(this.chargy.
|
|
14571
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_ValueP", measurementCounter)));
|
|
14536
14572
|
if (!isMandatoryString(measuredValue["unit"]))
|
|
14537
|
-
errors.push(this.chargy.
|
|
14573
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_UnitP", measurementCounter)));
|
|
14538
14574
|
if (!isMandatoryNumber(measuredValue["scale"]))
|
|
14539
|
-
errors.push(this.chargy.
|
|
14575
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_ScaleP", measurementCounter)));
|
|
14540
14576
|
if (!isMandatoryString(measuredValue["valueType"]))
|
|
14541
|
-
errors.push(this.chargy.
|
|
14577
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_ValueTypeP", measurementCounter)));
|
|
14542
14578
|
if (!isMandatoryNumber(measuredValue["unitEncoded"]))
|
|
14543
|
-
errors.push(this.chargy.
|
|
14579
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasuredValue_UnitEncodedP", measurementCounter)));
|
|
14544
14580
|
const timestampLocal = measuredValue["timestampLocal"];
|
|
14545
14581
|
if (!isMandatoryJSONObject(timestampLocal)) {
|
|
14546
|
-
errors.push(this.chargy.
|
|
14582
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampLocalP", measurementCounter)));
|
|
14547
14583
|
secondaryErrors += 3;
|
|
14548
14584
|
} else {
|
|
14549
14585
|
if (!isMandatoryNumber(timestampLocal["timestamp"]))
|
|
14550
|
-
errors.push(this.chargy.
|
|
14586
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampLocalTimestampP", measurementCounter)));
|
|
14551
14587
|
if (!isMandatoryNumber(timestampLocal["localOffset"]))
|
|
14552
|
-
errors.push(this.chargy.
|
|
14588
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampLocalOffsetP", measurementCounter)));
|
|
14553
14589
|
if (!isMandatoryNumber(timestampLocal["seasonOffset"]))
|
|
14554
|
-
errors.push(this.chargy.
|
|
14590
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalidMeasuredValueTimestampSeasonOffsetP", measurementCounter)));
|
|
14555
14591
|
}
|
|
14556
14592
|
}
|
|
14557
14593
|
const measurand = signedMeterValue["measurand"];
|
|
14558
14594
|
if (!isMandatoryJSONObject(measurand)) {
|
|
14559
|
-
errors.push(this.chargy.
|
|
14595
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeasurandP", measurementCounter)));
|
|
14560
14596
|
secondaryErrors += 2;
|
|
14561
14597
|
} else {
|
|
14562
14598
|
if (!isMandatoryString(measurand["id"]))
|
|
14563
|
-
errors.push(this.chargy.
|
|
14599
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Measurand_IdP", measurementCounter)));
|
|
14564
14600
|
if (!isMandatoryString(measurand["name"]))
|
|
14565
|
-
errors.push(this.chargy.
|
|
14601
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_Measurand_NameP", measurementCounter)));
|
|
14566
14602
|
}
|
|
14567
14603
|
const additionalInfo = signedMeterValue["additionalInfo"];
|
|
14568
14604
|
if (!isMandatoryJSONObject(additionalInfo)) {
|
|
14569
|
-
errors.push(this.chargy.
|
|
14605
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformationP", measurementCounter)));
|
|
14570
14606
|
secondaryErrors += 4;
|
|
14571
14607
|
} else {
|
|
14572
14608
|
if (!isMandatoryString(additionalInfo["status"]))
|
|
14573
|
-
errors.push(this.chargy.
|
|
14609
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_StatusP", measurementCounter)));
|
|
14574
14610
|
const indexes = additionalInfo["indexes"];
|
|
14575
14611
|
if (!isMandatoryJSONObject(indexes)) {
|
|
14576
|
-
errors.push(this.chargy.
|
|
14612
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_IndexesP", measurementCounter)));
|
|
14577
14613
|
secondaryErrors += 2;
|
|
14578
14614
|
} else {
|
|
14579
14615
|
if (!isMandatoryNumber(indexes["timer"]))
|
|
14580
|
-
errors.push(this.chargy.
|
|
14616
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_Indexes_TimerP", measurementCounter)));
|
|
14581
14617
|
if (!isMandatoryString(indexes["logBook"]))
|
|
14582
|
-
errors.push(this.chargy.
|
|
14618
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_AdditionalInformation_Indexes_LogBookP", measurementCounter)));
|
|
14583
14619
|
}
|
|
14584
14620
|
}
|
|
14585
14621
|
const chargePoint = signedMeterValue["chargePoint"];
|
|
14586
14622
|
if (!isMandatoryJSONObject(chargePoint)) {
|
|
14587
|
-
errors.push(this.chargy.
|
|
14623
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ChargePointInformationP", measurementCounter)));
|
|
14588
14624
|
secondaryErrors += 1;
|
|
14589
14625
|
} else {
|
|
14590
14626
|
if (!isMandatoryString(chargePoint["softwareVersion"]))
|
|
14591
|
-
errors.push(this.chargy.
|
|
14627
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_ChargePointInformation_SoftwareVersionP", measurementCounter)));
|
|
14592
14628
|
}
|
|
14593
14629
|
}
|
|
14594
14630
|
}
|
|
@@ -14766,7 +14802,7 @@ var ChargeIT = class {
|
|
|
14766
14802
|
} catch (exception) {
|
|
14767
14803
|
return {
|
|
14768
14804
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14769
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
14805
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
14770
14806
|
errors,
|
|
14771
14807
|
warnings,
|
|
14772
14808
|
certainty: (numberOfFormatChecks - errors.length - secondaryErrors) / numberOfFormatChecks
|
|
@@ -14839,101 +14875,101 @@ var ChargeIT = class {
|
|
|
14839
14875
|
const totalCosts_flat_cost = totalCosts_flat?.["cost"];
|
|
14840
14876
|
const signedMeterValues = SomeJSON["signedMeterValues"];
|
|
14841
14877
|
if (!isMandatoryString(chargingSessionId))
|
|
14842
|
-
errors.push(this.chargy.
|
|
14878
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid charge transparency record identification!")));
|
|
14843
14879
|
if (!isMandatoryJSONObject(chargePointInfo)) {
|
|
14844
|
-
errors.push(this.chargy.
|
|
14880
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargePointInfo")));
|
|
14845
14881
|
secondaryErrors += 19;
|
|
14846
14882
|
} else {
|
|
14847
14883
|
if (!isMandatoryString(evseId))
|
|
14848
|
-
errors.push(this.chargy.
|
|
14884
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidEVSEIdentification")));
|
|
14849
14885
|
if (!isMandatoryJSONObject(placeInfo)) {
|
|
14850
|
-
errors.push(this.chargy.
|
|
14886
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidPlaceInfo")));
|
|
14851
14887
|
secondaryErrors += 8;
|
|
14852
14888
|
} else {
|
|
14853
14889
|
if (!isMandatoryJSONObject(geoLocation)) {
|
|
14854
|
-
errors.push(this.chargy.
|
|
14890
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocation")));
|
|
14855
14891
|
secondaryErrors += 2;
|
|
14856
14892
|
} else {
|
|
14857
14893
|
if (!isMandatoryNumber(geoLocation_lat))
|
|
14858
|
-
errors.push(this.chargy.
|
|
14894
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLatitude")));
|
|
14859
14895
|
if (!isMandatoryNumber(geoLocation_lon))
|
|
14860
|
-
errors.push(this.chargy.
|
|
14896
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidGeoLocationLongitude")));
|
|
14861
14897
|
}
|
|
14862
14898
|
if (!isMandatoryJSONObject(address)) {
|
|
14863
|
-
errors.push(this.chargy.
|
|
14899
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddress")));
|
|
14864
14900
|
secondaryErrors += 4;
|
|
14865
14901
|
} else {
|
|
14866
14902
|
if (!isMandatoryString(address_street))
|
|
14867
|
-
errors.push(this.chargy.
|
|
14903
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressStreetName")));
|
|
14868
14904
|
if (!isMandatoryString(address_zipCode))
|
|
14869
|
-
errors.push(this.chargy.
|
|
14905
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressZIPCode")));
|
|
14870
14906
|
if (!isMandatoryString(address_town))
|
|
14871
|
-
errors.push(this.chargy.
|
|
14907
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCityName")));
|
|
14872
14908
|
if (!isMandatoryString(address_country))
|
|
14873
|
-
errors.push(this.chargy.
|
|
14909
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidAddressCountryName")));
|
|
14874
14910
|
}
|
|
14875
14911
|
}
|
|
14876
14912
|
}
|
|
14877
14913
|
if (!isMandatoryJSONObject(chargingStationInfo)) {
|
|
14878
|
-
errors.push(this.chargy.
|
|
14914
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidChargingStationInfo")));
|
|
14879
14915
|
secondaryErrors += 5;
|
|
14880
14916
|
} else {
|
|
14881
14917
|
if (!isOptionalString(chargingStation_manufacturer))
|
|
14882
|
-
errors.push(this.chargy.
|
|
14918
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station manufacturer!")));
|
|
14883
14919
|
if (!isOptionalString(chargingStation_type))
|
|
14884
|
-
errors.push(this.chargy.
|
|
14920
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station type!")));
|
|
14885
14921
|
if (!isOptionalString(chargingStation_serialNumber))
|
|
14886
|
-
errors.push(this.chargy.
|
|
14922
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station serial number!")));
|
|
14887
14923
|
if (!isOptionalString(chargingStation_controllerSoftwareVersion))
|
|
14888
|
-
errors.push(this.chargy.
|
|
14924
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station controller software version!")));
|
|
14889
14925
|
if (!isOptionalString(chargingStation_compliance))
|
|
14890
|
-
errors.push(this.chargy.
|
|
14926
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance!")));
|
|
14891
14927
|
if (!isOptionalURL(chargingStation_complianceURL))
|
|
14892
|
-
errors.push(this.chargy.
|
|
14928
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station compliance URL!")));
|
|
14893
14929
|
if (!isOptionalString(chargingStation_conformity))
|
|
14894
|
-
errors.push(this.chargy.
|
|
14930
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity!")));
|
|
14895
14931
|
if (!isOptionalURL(chargingStation_conformity_URL))
|
|
14896
|
-
errors.push(this.chargy.
|
|
14932
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity URL!")));
|
|
14897
14933
|
if (!isOptionalURL(chargingStation_conformity_certificateId))
|
|
14898
|
-
errors.push(this.chargy.
|
|
14934
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station conformity certificate identification!")));
|
|
14899
14935
|
if (!isOptionalString(chargingStation_calibration))
|
|
14900
|
-
errors.push(this.chargy.
|
|
14936
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration!")));
|
|
14901
14937
|
if (!isOptionalURL(chargingStation_calibration_URL))
|
|
14902
|
-
errors.push(this.chargy.
|
|
14938
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration URL!")));
|
|
14903
14939
|
if (!isOptionalURL(chargingStation_calibration_certificateId))
|
|
14904
|
-
errors.push(this.chargy.
|
|
14940
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Invalid charging station calibration certificate identification!")));
|
|
14905
14941
|
}
|
|
14906
14942
|
if (meterInfo) {
|
|
14907
14943
|
if (!isOptionalString(meterInfo_meterId))
|
|
14908
|
-
errors.push(this.chargy.
|
|
14944
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
14909
14945
|
if (!isOptionalString(meterInfo_manufacturer))
|
|
14910
|
-
errors.push(this.chargy.
|
|
14946
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14911
14947
|
if (!isOptionalString(meterInfo_manufacturerURL))
|
|
14912
|
-
errors.push(this.chargy.
|
|
14948
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14913
14949
|
if (!isOptionalString(meterInfo_model))
|
|
14914
|
-
errors.push(this.chargy.
|
|
14950
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14915
14951
|
if (!isOptionalString(meterInfo_modelURL))
|
|
14916
|
-
errors.push(this.chargy.
|
|
14952
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_ManufacturerP", 1)));
|
|
14917
14953
|
if (!isOptionalString(meterInfo_firmwareVersion))
|
|
14918
|
-
errors.push(this.chargy.
|
|
14954
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
14919
14955
|
if (!isOptionalString(meterInfo_hardwareVersion))
|
|
14920
|
-
errors.push(this.chargy.
|
|
14956
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_FirmwareVersionP", 1)));
|
|
14921
14957
|
if (!isOptionalString(meterInfo_publicKey))
|
|
14922
|
-
errors.push(this.chargy.
|
|
14958
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14923
14959
|
if (!isOptionalString(meterInfo_publicKeyFormat))
|
|
14924
|
-
errors.push(this.chargy.
|
|
14960
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14925
14961
|
if (!isOptionalString(meterInfo_publicKeyEncoding))
|
|
14926
|
-
errors.push(this.chargy.
|
|
14962
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14927
14963
|
if (!isOptionalString(meterInfo_signatureFormat))
|
|
14928
|
-
errors.push(this.chargy.
|
|
14964
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14929
14965
|
if (!isOptionalString(meterInfo_signatureEncoding))
|
|
14930
|
-
errors.push(this.chargy.
|
|
14966
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_PublicKeyP", 1)));
|
|
14931
14967
|
}
|
|
14932
14968
|
if (connectorInfo) {
|
|
14933
14969
|
if (!isOptionalString(connectorInfo_type))
|
|
14934
|
-
errors.push(this.chargy.
|
|
14970
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
14935
14971
|
if (!isOptionalString(connectorInfo_losses))
|
|
14936
|
-
errors.push(this.chargy.
|
|
14972
|
+
errors.push(CreateError(this.chargy.GetMultilanguageTextWithParameter("MissingOrInvalid_SignedMeterValue_MeterInfo_MeterIdP", 1)));
|
|
14937
14973
|
}
|
|
14938
14974
|
if (isMandatoryJSONArray(chargingTariffs)) {
|
|
14939
14975
|
for (let i = 0; i < chargingTariffs.length; i++) {
|
|
@@ -14941,40 +14977,40 @@ var ChargeIT = class {
|
|
|
14941
14977
|
}
|
|
14942
14978
|
if (totalCosts) {
|
|
14943
14979
|
if (!isMandatoryNumber(totalCosts_total))
|
|
14944
|
-
errors.push(this.chargy.
|
|
14980
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid total costs within the charging costs!")));
|
|
14945
14981
|
if (!isMandatoryString(totalCosts_currency))
|
|
14946
|
-
errors.push(this.chargy.
|
|
14982
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid currency within the charging costs!")));
|
|
14947
14983
|
if (totalCosts_reservation) {
|
|
14948
14984
|
if (!isMandatoryNumber(totalCosts_reservation_cost))
|
|
14949
|
-
errors.push(this.chargy.
|
|
14985
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation cost within the charging costs!")));
|
|
14950
14986
|
if (!isMandatoryString(totalCosts_reservation_unit))
|
|
14951
|
-
errors.push(this.chargy.
|
|
14987
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid reservation unit within the charging costs!")));
|
|
14952
14988
|
}
|
|
14953
14989
|
if (totalCosts_energy) {
|
|
14954
14990
|
if (!isMandatoryNumber(totalCosts_energy_cost))
|
|
14955
|
-
errors.push(this.chargy.
|
|
14991
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy cost within the charging costs!")));
|
|
14956
14992
|
if (!isMandatoryString(totalCosts_energy_unit))
|
|
14957
|
-
errors.push(this.chargy.
|
|
14993
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid energy unit within the charging costs!")));
|
|
14958
14994
|
}
|
|
14959
14995
|
if (totalCosts_time) {
|
|
14960
14996
|
if (!isMandatoryNumber(totalCosts_time_cost))
|
|
14961
|
-
errors.push(this.chargy.
|
|
14997
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time cost within the charging costs!")));
|
|
14962
14998
|
if (!isMandatoryString(totalCosts_time_unit))
|
|
14963
|
-
errors.push(this.chargy.
|
|
14999
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid time unit within the charging costs!")));
|
|
14964
15000
|
}
|
|
14965
15001
|
if (totalCosts_idle) {
|
|
14966
15002
|
if (!isMandatoryNumber(totalCosts_idle_cost))
|
|
14967
|
-
errors.push(this.chargy.
|
|
15003
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle cost within the charging costs!")));
|
|
14968
15004
|
if (!isMandatoryString(totalCosts_idle_unit))
|
|
14969
|
-
errors.push(this.chargy.
|
|
15005
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid idle unit within the charging costs!")));
|
|
14970
15006
|
}
|
|
14971
15007
|
if (totalCosts_flat) {
|
|
14972
15008
|
if (!isMandatoryNumber(totalCosts_flat_cost))
|
|
14973
|
-
errors.push(this.chargy.
|
|
15009
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("Missing or invalid flat cost within the charging costs!")));
|
|
14974
15010
|
}
|
|
14975
15011
|
}
|
|
14976
15012
|
if (!isMandatoryJSONArray(signedMeterValues) || signedMeterValues.length < 2) {
|
|
14977
|
-
errors.push(this.chargy.
|
|
15013
|
+
errors.push(CreateError(this.chargy.GetMultilanguageText("MissingOrInvalidSignedMeterValues")));
|
|
14978
15014
|
secondaryErrors += 2 * 39;
|
|
14979
15015
|
} else {
|
|
14980
15016
|
const firstSMV = asJSONObject(signedMeterValues[0]);
|
|
@@ -14984,7 +15020,7 @@ var ChargeIT = class {
|
|
|
14984
15020
|
const context = asString(currentSMV?.["@context"])?.trim() ?? asString(currentSMV?.["format"])?.trim() ?? null;
|
|
14985
15021
|
if (smvContext !== context) return {
|
|
14986
15022
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
14987
|
-
message: "Inconsistent signed meter value format!",
|
|
15023
|
+
message: this.chargy.GetMultilanguageText("Inconsistent signed meter value format!"),
|
|
14988
15024
|
certainty: 1
|
|
14989
15025
|
};
|
|
14990
15026
|
}
|
|
@@ -15133,7 +15169,7 @@ var ChargeIT = class {
|
|
|
15133
15169
|
} catch (exception) {
|
|
15134
15170
|
return {
|
|
15135
15171
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15136
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
15172
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
15137
15173
|
errors,
|
|
15138
15174
|
warnings,
|
|
15139
15175
|
certainty: (numberOfFormatChecks - errors.length - secondaryErrors) / numberOfFormatChecks
|
|
@@ -15142,7 +15178,7 @@ var ChargeIT = class {
|
|
|
15142
15178
|
}
|
|
15143
15179
|
return {
|
|
15144
15180
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15145
|
-
message: "No chargeIT charge transparency record",
|
|
15181
|
+
message: this.chargy.GetMultilanguageText("No chargeIT charge transparency record"),
|
|
15146
15182
|
errors,
|
|
15147
15183
|
warnings,
|
|
15148
15184
|
certainty: 0
|
|
@@ -15161,7 +15197,7 @@ var ChargePoint = class {
|
|
|
15161
15197
|
if (!isMandatoryJSONObject(SomeJSON))
|
|
15162
15198
|
return {
|
|
15163
15199
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15164
|
-
message: this.chargy.
|
|
15200
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
15165
15201
|
certainty: 0
|
|
15166
15202
|
};
|
|
15167
15203
|
if (SomeJSON["company_name"] !== void 0 && SomeJSON["display_unit"] !== void 0 && //SomeJSON["energy"] !== undefined &&
|
|
@@ -15484,13 +15520,13 @@ var ChargePoint = class {
|
|
|
15484
15520
|
} catch (exception) {
|
|
15485
15521
|
return {
|
|
15486
15522
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15487
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
15523
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
15488
15524
|
certainty: 0
|
|
15489
15525
|
};
|
|
15490
15526
|
}
|
|
15491
15527
|
return {
|
|
15492
15528
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
15493
|
-
message: this.chargy.
|
|
15529
|
+
message: this.chargy.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
15494
15530
|
certainty: 0
|
|
15495
15531
|
};
|
|
15496
15532
|
}
|
|
@@ -15513,7 +15549,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
15513
15549
|
if (chargingSession.ctr === void 0) {
|
|
15514
15550
|
return {
|
|
15515
15551
|
status: "InvalidSignature" /* InvalidSignature */,
|
|
15516
|
-
message: this.chargy.
|
|
15552
|
+
message: this.chargy.GetMultilanguageText("InvalidSignature"),
|
|
15517
15553
|
certainty: 0
|
|
15518
15554
|
};
|
|
15519
15555
|
}
|
|
@@ -15549,7 +15585,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
15549
15585
|
if (publicKeys.length == 0)
|
|
15550
15586
|
return {
|
|
15551
15587
|
status: "PublicKeyNotFound" /* PublicKeyNotFound */,
|
|
15552
|
-
message: this.chargy.
|
|
15588
|
+
message: this.chargy.GetMultilanguageText("Public key notFound"),
|
|
15553
15589
|
certainty: 0
|
|
15554
15590
|
};
|
|
15555
15591
|
if (plainText !== "" && chargingSession.signature != null && chargingSession.signature !== "") {
|
|
@@ -15624,7 +15660,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
15624
15660
|
if (measurementValue.result?.status !== "ValidSignature" /* ValidSignature */ && measurementValue.result?.status !== "NoOperation" /* NoOperation */) {
|
|
15625
15661
|
return {
|
|
15626
15662
|
status: "InvalidSignature" /* InvalidSignature */,
|
|
15627
|
-
message: this.chargy.
|
|
15663
|
+
message: this.chargy.GetMultilanguageText("InvalidSignature"),
|
|
15628
15664
|
certainty: 0
|
|
15629
15665
|
};
|
|
15630
15666
|
}
|
|
@@ -15681,7 +15717,7 @@ var ChargePointCrypt01 = class extends ACrypt {
|
|
|
15681
15717
|
} catch (exception) {
|
|
15682
15718
|
return {
|
|
15683
15719
|
status: "InvalidSignature" /* InvalidSignature */,
|
|
15684
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
15720
|
+
message: this.chargy.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
15685
15721
|
certainty: 0
|
|
15686
15722
|
};
|
|
15687
15723
|
}
|
|
@@ -16100,15 +16136,26 @@ async function importPdfJs() {
|
|
|
16100
16136
|
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfWorkerSrc.default;
|
|
16101
16137
|
return pdfjsLib;
|
|
16102
16138
|
}
|
|
16139
|
+
|
|
16140
|
+
// validationRules.json
|
|
16141
|
+
var validationRules_default = {
|
|
16142
|
+
chargingSession: {
|
|
16143
|
+
totalEnergy: {
|
|
16144
|
+
rule: [">", "500", "kWh"],
|
|
16145
|
+
level: "low"
|
|
16146
|
+
}
|
|
16147
|
+
}
|
|
16148
|
+
};
|
|
16103
16149
|
var Chargy = class {
|
|
16104
16150
|
//#region Data
|
|
16105
16151
|
i18n;
|
|
16106
|
-
|
|
16152
|
+
uiLanguages;
|
|
16107
16153
|
elliptic;
|
|
16108
16154
|
moment;
|
|
16109
16155
|
asn1;
|
|
16110
16156
|
base32Decode;
|
|
16111
16157
|
showPKIDetails;
|
|
16158
|
+
validationRules;
|
|
16112
16159
|
chargingStationOperators = new Array();
|
|
16113
16160
|
chargingPools = new Array();
|
|
16114
16161
|
chargingStations = new Array();
|
|
@@ -16120,17 +16167,48 @@ var Chargy = class {
|
|
|
16120
16167
|
currentCTR = {};
|
|
16121
16168
|
internalCTR = {};
|
|
16122
16169
|
//#endregion
|
|
16123
|
-
constructor(i18n,
|
|
16170
|
+
constructor(i18n, UILanguages, elliptic, moment2, asn1, base32Decode, ShowPKIDetails, validationRules = validationRules_default) {
|
|
16124
16171
|
this.i18n = i18n;
|
|
16125
|
-
this.
|
|
16172
|
+
this.uiLanguages = this.NormalizeUILanguages(UILanguages);
|
|
16126
16173
|
this.elliptic = elliptic;
|
|
16127
16174
|
this.moment = moment2;
|
|
16128
16175
|
this.asn1 = asn1;
|
|
16129
16176
|
this.base32Decode = base32Decode;
|
|
16130
16177
|
this.showPKIDetails = ShowPKIDetails;
|
|
16178
|
+
this.validationRules = validationRules;
|
|
16179
|
+
}
|
|
16180
|
+
SetUILanguages(UILanguages) {
|
|
16181
|
+
this.uiLanguages = this.NormalizeUILanguages(UILanguages);
|
|
16182
|
+
}
|
|
16183
|
+
NormalizeUILanguages(UILanguages) {
|
|
16184
|
+
const languages = new Array();
|
|
16185
|
+
for (const language of UILanguages) {
|
|
16186
|
+
const normalized = language.trim();
|
|
16187
|
+
if (normalized.length > 0 && !languages.includes(normalized)) {
|
|
16188
|
+
languages.push(normalized);
|
|
16189
|
+
}
|
|
16190
|
+
}
|
|
16191
|
+
return languages.length > 0 ? languages : ["en"];
|
|
16131
16192
|
}
|
|
16132
|
-
|
|
16133
|
-
this.
|
|
16193
|
+
FindBestMultilanguageText(Text) {
|
|
16194
|
+
for (const language of this.uiLanguages) {
|
|
16195
|
+
const localLanguage = Text[language];
|
|
16196
|
+
if (localLanguage !== void 0)
|
|
16197
|
+
return localLanguage;
|
|
16198
|
+
}
|
|
16199
|
+
const english = Text["en"];
|
|
16200
|
+
if (english !== void 0)
|
|
16201
|
+
return english;
|
|
16202
|
+
return Object.values(Text).find((value) => value !== void 0);
|
|
16203
|
+
}
|
|
16204
|
+
CompleteMultilanguageText(Text, fallbackText) {
|
|
16205
|
+
const result = {
|
|
16206
|
+
...Text ?? {}
|
|
16207
|
+
};
|
|
16208
|
+
const fallback = this.FindBestMultilanguageText(result) ?? fallbackText;
|
|
16209
|
+
for (const language of this.uiLanguages)
|
|
16210
|
+
result[language] ??= fallback;
|
|
16211
|
+
return result;
|
|
16134
16212
|
}
|
|
16135
16213
|
PublicKeyIdFromFileName(fileName) {
|
|
16136
16214
|
return (fileName.indexOf(".") > -1 ? fileName.substring(0, fileName.indexOf(".")) : fileName).replace(/[-_]?public[-_]?key/i, "");
|
|
@@ -16309,27 +16387,36 @@ var Chargy = class {
|
|
|
16309
16387
|
GetLocalizedMessage(Text) {
|
|
16310
16388
|
const multiLanguage = this.i18n[Text];
|
|
16311
16389
|
if (multiLanguage !== void 0) {
|
|
16312
|
-
const
|
|
16313
|
-
if (
|
|
16314
|
-
return
|
|
16315
|
-
const english = multiLanguage["en"];
|
|
16316
|
-
if (english !== void 0)
|
|
16317
|
-
return english;
|
|
16390
|
+
const localizedMessage = this.FindBestMultilanguageText(multiLanguage);
|
|
16391
|
+
if (localizedMessage !== void 0)
|
|
16392
|
+
return localizedMessage;
|
|
16318
16393
|
}
|
|
16319
16394
|
return Text;
|
|
16320
16395
|
}
|
|
16396
|
+
GetMultilanguageText(Text) {
|
|
16397
|
+
const multiLanguage = this.i18n[Text];
|
|
16398
|
+
return this.CompleteMultilanguageText(multiLanguage, Text);
|
|
16399
|
+
}
|
|
16321
16400
|
GetLocalizedMessageWithParameter(Text, Parameter) {
|
|
16322
16401
|
const multiLanguage = this.i18n[Text];
|
|
16323
16402
|
if (multiLanguage !== void 0) {
|
|
16324
|
-
const
|
|
16325
|
-
if (
|
|
16326
|
-
return
|
|
16327
|
-
const english = multiLanguage["en"];
|
|
16328
|
-
if (english !== void 0)
|
|
16329
|
-
return english.replace("%p", String(Parameter));
|
|
16403
|
+
const localizedMessage = this.FindBestMultilanguageText(multiLanguage);
|
|
16404
|
+
if (localizedMessage !== void 0)
|
|
16405
|
+
return localizedMessage.replace("%p", String(Parameter));
|
|
16330
16406
|
}
|
|
16331
16407
|
return Text.replace("%p", String(Parameter));
|
|
16332
16408
|
}
|
|
16409
|
+
GetMultilanguageTextWithParameter(Text, Parameter) {
|
|
16410
|
+
const multiLanguage = this.i18n[Text];
|
|
16411
|
+
const parameterizedText = {};
|
|
16412
|
+
if (multiLanguage !== void 0) {
|
|
16413
|
+
for (const [language, message] of Object.entries(multiLanguage)) {
|
|
16414
|
+
if (message !== void 0)
|
|
16415
|
+
parameterizedText[language] = message.replace("%p", String(Parameter));
|
|
16416
|
+
}
|
|
16417
|
+
}
|
|
16418
|
+
return this.CompleteMultilanguageText(parameterizedText, Text.replace("%p", String(Parameter)));
|
|
16419
|
+
}
|
|
16333
16420
|
//#endregion
|
|
16334
16421
|
//#region GetDevices...
|
|
16335
16422
|
GetChargingPool = (Id) => {
|
|
@@ -16701,7 +16788,7 @@ var Chargy = class {
|
|
|
16701
16788
|
async DetectAndConvertContentFormat(FileInfos) {
|
|
16702
16789
|
if (FileInfos.length == 0) return {
|
|
16703
16790
|
status: "NoChargeTransparencyRecordsFound" /* NoChargeTransparencyRecordsFound */,
|
|
16704
|
-
message: this.
|
|
16791
|
+
message: this.GetMultilanguageText("No charge transparency records found!"),
|
|
16705
16792
|
certainty: 0
|
|
16706
16793
|
};
|
|
16707
16794
|
let expandedFiles = new Array();
|
|
@@ -16811,7 +16898,7 @@ var Chargy = class {
|
|
|
16811
16898
|
} catch (exception) {
|
|
16812
16899
|
processedFile.result = {
|
|
16813
16900
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16814
|
-
message: this.
|
|
16901
|
+
message: this.GetMultilanguageText("UnknownOrInvalidXMLChargeTransparencyFormat"),
|
|
16815
16902
|
exception,
|
|
16816
16903
|
certainty: 0
|
|
16817
16904
|
};
|
|
@@ -16851,7 +16938,7 @@ var Chargy = class {
|
|
|
16851
16938
|
} catch (exception) {
|
|
16852
16939
|
processedFile.result = {
|
|
16853
16940
|
status: "InvalidPublicKey" /* InvalidPublicKey */,
|
|
16854
|
-
message: this.
|
|
16941
|
+
message: this.GetMultilanguageText("UnknownOrInvalidPublicKeyFormat"),
|
|
16855
16942
|
exception,
|
|
16856
16943
|
certainty: 0
|
|
16857
16944
|
};
|
|
@@ -16865,7 +16952,7 @@ var Chargy = class {
|
|
|
16865
16952
|
} catch (exception) {
|
|
16866
16953
|
processedFile.result = {
|
|
16867
16954
|
status: "InvalidPublicKey" /* InvalidPublicKey */,
|
|
16868
|
-
message: this.
|
|
16955
|
+
message: this.GetMultilanguageText("UnknownOrInvalidPublicKeyFormat"),
|
|
16869
16956
|
exception,
|
|
16870
16957
|
certainty: 0
|
|
16871
16958
|
};
|
|
@@ -16914,7 +17001,7 @@ var Chargy = class {
|
|
|
16914
17001
|
} catch (exception) {
|
|
16915
17002
|
processedFile.result = {
|
|
16916
17003
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16917
|
-
message: this.
|
|
17004
|
+
message: this.GetMultilanguageText("UnknownOrInvalidJSONChargeTransparencyFormat"),
|
|
16918
17005
|
exception,
|
|
16919
17006
|
certainty: 0
|
|
16920
17007
|
};
|
|
@@ -16932,14 +17019,14 @@ var Chargy = class {
|
|
|
16932
17019
|
if (IsAPublicKeyLookup(processedFile.result))
|
|
16933
17020
|
return {
|
|
16934
17021
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16935
|
-
message: this.
|
|
17022
|
+
message: this.GetMultilanguageText("UnknownOrInvalidChargeTransparencyRecord"),
|
|
16936
17023
|
certainty: 0
|
|
16937
17024
|
};
|
|
16938
17025
|
return processedFile.result;
|
|
16939
17026
|
}
|
|
16940
17027
|
return {
|
|
16941
17028
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
16942
|
-
message: this.
|
|
17029
|
+
message: this.GetMultilanguageText("UnknownOrInvalidChargeTransparencyRecord"),
|
|
16943
17030
|
certainty: 0
|
|
16944
17031
|
};
|
|
16945
17032
|
} else if (processedFiles.length > 1) {
|
|
@@ -17013,7 +17100,7 @@ var Chargy = class {
|
|
|
17013
17100
|
}
|
|
17014
17101
|
return {
|
|
17015
17102
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
17016
|
-
message: this.
|
|
17103
|
+
message: this.GetMultilanguageText("No charge transparency records found!"),
|
|
17017
17104
|
certainty: 0
|
|
17018
17105
|
};
|
|
17019
17106
|
}
|
|
@@ -17023,7 +17110,7 @@ var Chargy = class {
|
|
|
17023
17110
|
if (!IsAChargeTransparencyRecord(CTR))
|
|
17024
17111
|
return {
|
|
17025
17112
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
17026
|
-
message: this.
|
|
17113
|
+
message: this.GetMultilanguageText("UnknownOrInvalidJSONChargeTransparencyFormat"),
|
|
17027
17114
|
certainty: 0
|
|
17028
17115
|
};
|
|
17029
17116
|
this.chargingStationOperators = [];
|
|
@@ -17148,46 +17235,156 @@ var Chargy = class {
|
|
|
17148
17235
|
} catch (exception) {
|
|
17149
17236
|
return {
|
|
17150
17237
|
status: "InvalidSessionFormat" /* InvalidSessionFormat */,
|
|
17151
|
-
message: "Exception occured: " + (exception instanceof Error ? exception.message : String(exception)),
|
|
17238
|
+
message: this.GetMultilanguageText("Exception occured: " + (exception instanceof Error ? exception.message : String(exception))),
|
|
17152
17239
|
certainty: 0
|
|
17153
17240
|
};
|
|
17154
17241
|
}
|
|
17155
17242
|
}
|
|
17156
17243
|
//#endregion
|
|
17244
|
+
//#region (private) hasInplausibleChargingSessionTotalEnergyMeasurement(chargingSession)
|
|
17245
|
+
hasInplausibleChargingSessionTotalEnergyMeasurement(chargingSession) {
|
|
17246
|
+
for (const measurement of chargingSession.measurements) {
|
|
17247
|
+
if (measurement.name !== "ENERGY_TOTAL" || measurement.values.length < 2) {
|
|
17248
|
+
continue;
|
|
17249
|
+
}
|
|
17250
|
+
const firstValue2 = measurement.values[0];
|
|
17251
|
+
const lastValue = measurement.values[measurement.values.length - 1];
|
|
17252
|
+
if (firstValue2 == null || lastValue == null) {
|
|
17253
|
+
continue;
|
|
17254
|
+
}
|
|
17255
|
+
const firstValueKWh = this.measurementValueInKWh(measurement, firstValue2);
|
|
17256
|
+
const lastValueKWh = this.measurementValueInKWh(measurement, lastValue);
|
|
17257
|
+
if (firstValueKWh == null || lastValueKWh == null) {
|
|
17258
|
+
continue;
|
|
17259
|
+
}
|
|
17260
|
+
if (this.isInplausibleChargingSessionTotalEnergy(lastValueKWh - firstValueKWh))
|
|
17261
|
+
return true;
|
|
17262
|
+
}
|
|
17263
|
+
return false;
|
|
17264
|
+
}
|
|
17265
|
+
isInplausibleChargingSessionTotalEnergy(totalEnergyKWh) {
|
|
17266
|
+
const totalEnergyRule = this.validationRules.chargingSession?.totalEnergy?.rule;
|
|
17267
|
+
if (totalEnergyRule == null)
|
|
17268
|
+
return false;
|
|
17269
|
+
const [operator, thresholdValue, thresholdUnit] = totalEnergyRule;
|
|
17270
|
+
const thresholdKWh = this.energyValueInKWh(thresholdValue, thresholdUnit);
|
|
17271
|
+
if (thresholdKWh == null)
|
|
17272
|
+
return false;
|
|
17273
|
+
switch (operator) {
|
|
17274
|
+
case ">":
|
|
17275
|
+
return totalEnergyKWh > thresholdKWh;
|
|
17276
|
+
case ">=":
|
|
17277
|
+
return totalEnergyKWh >= thresholdKWh;
|
|
17278
|
+
case "<":
|
|
17279
|
+
return totalEnergyKWh < thresholdKWh;
|
|
17280
|
+
case "<=":
|
|
17281
|
+
return totalEnergyKWh <= thresholdKWh;
|
|
17282
|
+
case "=":
|
|
17283
|
+
case "==":
|
|
17284
|
+
return totalEnergyKWh === thresholdKWh;
|
|
17285
|
+
default:
|
|
17286
|
+
return false;
|
|
17287
|
+
}
|
|
17288
|
+
}
|
|
17289
|
+
energyValueInKWh(value, unit) {
|
|
17290
|
+
const numericValue = typeof value === "number" ? value : Number.parseFloat(value);
|
|
17291
|
+
if (!Number.isFinite(numericValue))
|
|
17292
|
+
return void 0;
|
|
17293
|
+
switch (unit.trim().toLowerCase()) {
|
|
17294
|
+
case "wh":
|
|
17295
|
+
return numericValue / 1e3;
|
|
17296
|
+
case "kwh":
|
|
17297
|
+
return numericValue;
|
|
17298
|
+
case "mwh":
|
|
17299
|
+
return numericValue * 1e3;
|
|
17300
|
+
default:
|
|
17301
|
+
return void 0;
|
|
17302
|
+
}
|
|
17303
|
+
}
|
|
17304
|
+
measurementValueInKWh(measurement, measurementValue) {
|
|
17305
|
+
const value = measurementValue.value.toNumber();
|
|
17306
|
+
if (!Number.isFinite(value))
|
|
17307
|
+
return void 0;
|
|
17308
|
+
const unit = measurement.unit?.trim().toLowerCase();
|
|
17309
|
+
if (unit === "kwh")
|
|
17310
|
+
return value;
|
|
17311
|
+
if (unit === "wh" || measurement.unitEncoded === 30) {
|
|
17312
|
+
return value / 1e3;
|
|
17313
|
+
}
|
|
17314
|
+
return void 0;
|
|
17315
|
+
}
|
|
17316
|
+
getChargingSessionTotalEnergyWarningLevel() {
|
|
17317
|
+
return this.validationRules.chargingSession?.totalEnergy?.level ?? "low" /* low */;
|
|
17318
|
+
}
|
|
17319
|
+
addChargeTransparencyRecordWarning(CTR, warning) {
|
|
17320
|
+
if (CTR == null)
|
|
17321
|
+
return;
|
|
17322
|
+
CTR.warnings ??= [];
|
|
17323
|
+
if (!CTR.warnings.some((existingWarning) => this.isSameWarning(existingWarning, warning)))
|
|
17324
|
+
CTR.warnings.push(warning);
|
|
17325
|
+
}
|
|
17326
|
+
isSameWarning(left, right) {
|
|
17327
|
+
return left.level === right.level && left.message === right.message;
|
|
17328
|
+
}
|
|
17329
|
+
//#endregion
|
|
17157
17330
|
//#region (private) processChargingSession(chargingSession)
|
|
17158
17331
|
async processChargingSession(chargingSession) {
|
|
17332
|
+
let verificationResult2;
|
|
17159
17333
|
switch (chargingSession["@context"]) {
|
|
17160
17334
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/GDFCrypt01+json":
|
|
17161
17335
|
chargingSession.method = new GDFCrypt01(this);
|
|
17162
|
-
|
|
17336
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17337
|
+
break;
|
|
17163
17338
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/EMHCrypt01+json":
|
|
17164
17339
|
chargingSession.method = new EMHCrypt01(this);
|
|
17165
|
-
|
|
17340
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17341
|
+
break;
|
|
17166
17342
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/OCMFv1.0+json":
|
|
17167
17343
|
chargingSession.method = new OCMFv1_x(this);
|
|
17168
|
-
|
|
17344
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17345
|
+
break;
|
|
17169
17346
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/ChargePointCrypt01+json":
|
|
17170
17347
|
chargingSession.method = new ChargePointCrypt01(this);
|
|
17171
|
-
|
|
17348
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17349
|
+
break;
|
|
17172
17350
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/AlfenCrypt01+json":
|
|
17173
17351
|
chargingSession.method = new AlfenCrypt01(this);
|
|
17174
|
-
|
|
17352
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17353
|
+
break;
|
|
17175
17354
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/MennekesCrypt01+json":
|
|
17176
17355
|
chargingSession.method = new MennekesCrypt01(this);
|
|
17177
|
-
|
|
17356
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17357
|
+
break;
|
|
17178
17358
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/PCDF+json":
|
|
17179
17359
|
chargingSession.method = new PCDFCrypt01(this);
|
|
17180
|
-
|
|
17360
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17361
|
+
break;
|
|
17181
17362
|
case "https://open.charging.cloud/contexts/SessionSignatureFormats/bsm-ws36a-v0+json":
|
|
17182
17363
|
chargingSession.method = new BSMCrypt01(this);
|
|
17183
|
-
|
|
17364
|
+
verificationResult2 = await chargingSession.method.VerifyChargingSession(chargingSession);
|
|
17365
|
+
break;
|
|
17184
17366
|
default:
|
|
17185
|
-
|
|
17367
|
+
verificationResult2 = {
|
|
17186
17368
|
status: "UnknownSessionFormat" /* UnknownSessionFormat */,
|
|
17187
|
-
message: this.
|
|
17369
|
+
message: this.GetMultilanguageText("UnknownOrInvalidChargingSessionFormat"),
|
|
17188
17370
|
certainty: 0
|
|
17189
17371
|
};
|
|
17372
|
+
break;
|
|
17373
|
+
}
|
|
17374
|
+
if (verificationResult2.status === "ValidSignature" /* ValidSignature */ && this.hasInplausibleChargingSessionTotalEnergyMeasurement(chargingSession)) {
|
|
17375
|
+
this.addChargeTransparencyRecordWarning(
|
|
17376
|
+
chargingSession.ctr,
|
|
17377
|
+
{
|
|
17378
|
+
level: this.getChargingSessionTotalEnergyWarningLevel(),
|
|
17379
|
+
message: this.GetMultilanguageText("InplausibleTotalEnergyMeasurementWarning")
|
|
17380
|
+
}
|
|
17381
|
+
);
|
|
17382
|
+
return {
|
|
17383
|
+
...verificationResult2,
|
|
17384
|
+
status: "InplausibleMeasurement" /* InplausibleMeasurement */
|
|
17385
|
+
};
|
|
17190
17386
|
}
|
|
17387
|
+
return verificationResult2;
|
|
17191
17388
|
}
|
|
17192
17389
|
//#endregion
|
|
17193
17390
|
MergeChargeTransparencyRecords(CTRs) {
|
|
@@ -17245,7 +17442,7 @@ var Chargy = class {
|
|
|
17245
17442
|
};
|
|
17246
17443
|
|
|
17247
17444
|
// src/verificationResults.ts
|
|
17248
|
-
function toSessionVerificationResults(CTR, noRecordsMessage = "No charge transparency records found!") {
|
|
17445
|
+
function toSessionVerificationResults(CTR, noRecordsMessage = { "en": "No charge transparency records found!" }) {
|
|
17249
17446
|
const verificationResults = (CTR.chargingSessions ?? []).map((session) => session.verificationResult).filter(isISessionCryptoResult1);
|
|
17250
17447
|
if (verificationResults.length > 0)
|
|
17251
17448
|
return verificationResults;
|
|
@@ -17256,6 +17453,6 @@ function toSessionVerificationResults(CTR, noRecordsMessage = "No charge transpa
|
|
|
17256
17453
|
};
|
|
17257
17454
|
}
|
|
17258
17455
|
|
|
17259
|
-
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 };
|
|
17456
|
+
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 };
|
|
17260
17457
|
//# sourceMappingURL=index.js.map
|
|
17261
17458
|
//# sourceMappingURL=index.js.map
|