@getpeppr/cli 0.5.4 → 0.6.0
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/dist/index.js +20 -23
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1161,7 +1161,7 @@ function statusFamily(status) {
|
|
|
1161
1161
|
var TERMINAL_FAILURE_STATUSES = STATUS_PRECEDENCE.filter((e) => e.family === "terminal-failure").map((e) => e.status);
|
|
1162
1162
|
|
|
1163
1163
|
// ../sdk/dist/version.js
|
|
1164
|
-
var SDK_VERSION = "2.
|
|
1164
|
+
var SDK_VERSION = "3.2.0";
|
|
1165
1165
|
|
|
1166
1166
|
// ../sdk/dist/core/client.js
|
|
1167
1167
|
function findHeaderCaseInsensitive(headers, name) {
|
|
@@ -2811,7 +2811,9 @@ function getKnownUnitCodes() {
|
|
|
2811
2811
|
}
|
|
2812
2812
|
return _knownUnitCodes;
|
|
2813
2813
|
}
|
|
2814
|
-
var VALID_VAT_CATEGORIES = /* @__PURE__ */ new Set(["S", "Z", "E", "AE", "K", "G", "O", "L", "M"]);
|
|
2814
|
+
var VALID_VAT_CATEGORIES = /* @__PURE__ */ new Set(["S", "Z", "E", "AE", "K", "G", "O", "L", "M", "B"]);
|
|
2815
|
+
var SENDABLE_VAT_CATEGORIES = ["S", "Z", "E", "AE", "K", "G", "O"];
|
|
2816
|
+
var UNROUTABLE_VAT_CATEGORIES = /* @__PURE__ */ new Set(["L", "M", "B"]);
|
|
2815
2817
|
function computeLineNet(line) {
|
|
2816
2818
|
const baseQty = line.baseQuantity ?? 1;
|
|
2817
2819
|
if (baseQty === 0)
|
|
@@ -3041,29 +3043,24 @@ var peppolR004 = (input) => {
|
|
|
3041
3043
|
}
|
|
3042
3044
|
return [];
|
|
3043
3045
|
};
|
|
3044
|
-
var
|
|
3046
|
+
var vatCategoryCodes = (input) => {
|
|
3045
3047
|
const violations = [];
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
if (
|
|
3052
|
-
violations.push(violation("
|
|
3048
|
+
const sendable = SENDABLE_VAT_CATEGORIES.join(", ");
|
|
3049
|
+
const echo = (v) => v.length <= 16 ? v : `${v.slice(0, 16)}\u2026`;
|
|
3050
|
+
const check = (cat, field, label) => {
|
|
3051
|
+
if (cat === void 0 || cat === null)
|
|
3052
|
+
return;
|
|
3053
|
+
if (!VALID_VAT_CATEGORIES.has(cat)) {
|
|
3054
|
+
violations.push(violation("BR-CL-17", "error", `${label}: "${echo(cat)}" is not a VAT category code. Use one of: ${sendable}. Codes are case-sensitive \u2014 "AE" is reverse charge, "ae" is not a category.`, field));
|
|
3055
|
+
return;
|
|
3053
3056
|
}
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
const cat = input.allowances[i].vatCategory;
|
|
3057
|
-
if (cat !== void 0 && !VALID_VAT_CATEGORIES.has(cat)) {
|
|
3058
|
-
violations.push(violation("PEPPOL-EN16931-R006", "error", `Allowance ${i}: invalid VAT category "${cat}".`, `allowances[${i}].vatCategory`));
|
|
3057
|
+
if (UNROUTABLE_VAT_CATEGORIES.has(cat)) {
|
|
3058
|
+
violations.push(violation("unsupported_vat_category", "error", `${label}: VAT category "${echo(cat)}" is valid under EN 16931 but getpeppr cannot route it \u2014 our provider has no vocabulary for it. Sendable categories: ${sendable}.`, field));
|
|
3059
3059
|
}
|
|
3060
|
-
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
violations.push(violation("PEPPOL-EN16931-R006", "error", `Charge ${i}: invalid VAT category "${cat}".`, `charges[${i}].vatCategory`));
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3060
|
+
};
|
|
3061
|
+
(input.lines ?? []).forEach((line, i) => check(line.vatCategory, `lines[${i}].vatCategory`, `Line ${i}`));
|
|
3062
|
+
(input.allowances ?? []).forEach((a, i) => check(a.vatCategory, `allowances[${i}].vatCategory`, `Allowance ${i}`));
|
|
3063
|
+
(input.charges ?? []).forEach((c, i) => check(c.vatCategory, `charges[${i}].vatCategory`, `Charge ${i}`));
|
|
3067
3064
|
return violations;
|
|
3068
3065
|
};
|
|
3069
3066
|
var peppolR080 = (input) => {
|
|
@@ -3103,7 +3100,7 @@ var ALL_RULES = [
|
|
|
3103
3100
|
brS08,
|
|
3104
3101
|
// Peppol-specific
|
|
3105
3102
|
peppolR004,
|
|
3106
|
-
|
|
3103
|
+
vatCategoryCodes,
|
|
3107
3104
|
peppolR080
|
|
3108
3105
|
];
|
|
3109
3106
|
function validateSchematron(input) {
|