@dwast/verifactu-lib 0.1.0-beta.0 → 0.1.0-beta.2
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/cjs/aeat/client.d.ts +162 -0
- package/dist/cjs/aeat/client.d.ts.map +1 -0
- package/dist/cjs/aeat/client.js +267 -0
- package/dist/cjs/aeat/client.js.map +1 -0
- package/dist/cjs/aeat/index.d.ts +3 -0
- package/dist/cjs/aeat/index.d.ts.map +1 -0
- package/dist/cjs/aeat/index.js +19 -0
- package/dist/cjs/aeat/index.js.map +1 -0
- package/dist/cjs/aeat/response.d.ts +78 -0
- package/dist/cjs/aeat/response.d.ts.map +1 -0
- package/dist/cjs/aeat/response.js +117 -0
- package/dist/cjs/aeat/response.js.map +1 -0
- package/dist/{core → cjs/core}/hash/chain.d.ts +42 -0
- package/dist/cjs/core/hash/chain.d.ts.map +1 -0
- package/dist/cjs/core/hash/chain.js +167 -0
- package/dist/cjs/core/hash/chain.js.map +1 -0
- package/dist/cjs/core/hash/index.d.ts.map +1 -0
- package/dist/cjs/core/hash/index.js +18 -0
- package/dist/cjs/core/hash/index.js.map +1 -0
- package/dist/{core → cjs/core}/index.d.ts +2 -0
- package/dist/cjs/core/index.d.ts.map +1 -0
- package/dist/cjs/core/index.js +23 -0
- package/dist/cjs/core/index.js.map +1 -0
- package/dist/cjs/core/models/event.d.ts.map +1 -0
- package/dist/cjs/core/models/event.js +3 -0
- package/dist/{core → cjs/core}/models/event.js.map +1 -1
- package/dist/cjs/core/models/index.d.ts.map +1 -0
- package/dist/cjs/core/models/index.js +19 -0
- package/dist/cjs/core/models/index.js.map +1 -0
- package/dist/{core → cjs/core}/models/invoice.d.ts +42 -17
- package/dist/cjs/core/models/invoice.d.ts.map +1 -0
- package/dist/cjs/core/models/invoice.js +3 -0
- package/dist/{core → cjs/core}/models/invoice.js.map +1 -1
- package/dist/cjs/core/qr/index.d.ts.map +1 -0
- package/dist/cjs/core/qr/index.js +18 -0
- package/dist/cjs/core/qr/index.js.map +1 -0
- package/dist/cjs/core/qr/qr.d.ts.map +1 -0
- package/dist/cjs/core/qr/qr.js +19 -0
- package/dist/cjs/core/qr/qr.js.map +1 -0
- package/dist/cjs/core/utils/date.d.ts +16 -0
- package/dist/cjs/core/utils/date.d.ts.map +1 -0
- package/dist/cjs/core/utils/date.js +27 -0
- package/dist/cjs/core/utils/date.js.map +1 -0
- package/dist/cjs/core/utils/index.d.ts +2 -0
- package/dist/cjs/core/utils/index.d.ts.map +1 -0
- package/dist/cjs/core/utils/index.js +18 -0
- package/dist/cjs/core/utils/index.js.map +1 -0
- package/dist/cjs/core/validation/index.d.ts +2 -0
- package/dist/cjs/core/validation/index.d.ts.map +1 -0
- package/dist/cjs/core/validation/index.js +18 -0
- package/dist/cjs/core/validation/index.js.map +1 -0
- package/dist/cjs/core/validation/validate.d.ts +18 -0
- package/dist/cjs/core/validation/validate.d.ts.map +1 -0
- package/dist/cjs/core/validation/validate.js +65 -0
- package/dist/cjs/core/validation/validate.js.map +1 -0
- package/dist/cjs/core/xml/generator.d.ts +140 -0
- package/dist/cjs/core/xml/generator.d.ts.map +1 -0
- package/dist/cjs/core/xml/generator.js +269 -0
- package/dist/cjs/core/xml/generator.js.map +1 -0
- package/dist/cjs/core/xml/index.d.ts.map +1 -0
- package/dist/cjs/core/xml/index.js +18 -0
- package/dist/cjs/core/xml/index.js.map +1 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/integration/accountability.d.ts +41 -0
- package/dist/cjs/integration/accountability.d.ts.map +1 -0
- package/dist/cjs/integration/accountability.js +92 -0
- package/dist/cjs/integration/accountability.js.map +1 -0
- package/dist/cjs/integration/index.d.ts +5 -0
- package/dist/cjs/integration/index.d.ts.map +1 -0
- package/dist/cjs/integration/index.js +21 -0
- package/dist/cjs/integration/index.js.map +1 -0
- package/dist/cjs/integration/p12.d.ts +58 -0
- package/dist/cjs/integration/p12.d.ts.map +1 -0
- package/dist/cjs/integration/p12.js +127 -0
- package/dist/cjs/integration/p12.js.map +1 -0
- package/dist/{integration → cjs/integration}/repository.d.ts +2 -0
- package/dist/cjs/integration/repository.d.ts.map +1 -0
- package/dist/cjs/integration/repository.js +3 -0
- package/dist/cjs/integration/repository.js.map +1 -0
- package/dist/{integration → cjs/integration}/service.d.ts +11 -2
- package/dist/cjs/integration/service.d.ts.map +1 -0
- package/dist/cjs/integration/service.js +230 -0
- package/dist/cjs/integration/service.js.map +1 -0
- package/dist/cjs/integration/tenant-credentials.d.ts +44 -0
- package/dist/cjs/integration/tenant-credentials.d.ts.map +1 -0
- package/dist/cjs/integration/tenant-credentials.js +62 -0
- package/dist/cjs/integration/tenant-credentials.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/esm/aeat/client.d.ts +162 -0
- package/dist/esm/aeat/client.d.ts.map +1 -0
- package/dist/esm/aeat/client.js +259 -0
- package/dist/esm/aeat/client.js.map +1 -0
- package/dist/esm/aeat/index.d.ts +3 -0
- package/dist/esm/aeat/index.d.ts.map +1 -0
- package/dist/esm/aeat/index.js +3 -0
- package/dist/esm/aeat/index.js.map +1 -0
- package/dist/esm/aeat/response.d.ts +78 -0
- package/dist/esm/aeat/response.d.ts.map +1 -0
- package/dist/esm/aeat/response.js +114 -0
- package/dist/esm/aeat/response.js.map +1 -0
- package/dist/esm/core/hash/chain.d.ts +139 -0
- package/dist/esm/core/hash/chain.d.ts.map +1 -0
- package/dist/{core → esm/core}/hash/chain.js +37 -0
- package/dist/esm/core/hash/chain.js.map +1 -0
- package/dist/esm/core/hash/index.d.ts +2 -0
- package/dist/esm/core/hash/index.d.ts.map +1 -0
- package/dist/esm/core/hash/index.js.map +1 -0
- package/dist/esm/core/index.d.ts +7 -0
- package/dist/esm/core/index.d.ts.map +1 -0
- package/dist/{core → esm/core}/index.js +2 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/models/event.d.ts +25 -0
- package/dist/esm/core/models/event.d.ts.map +1 -0
- package/dist/esm/core/models/event.js.map +1 -0
- package/dist/esm/core/models/index.d.ts +3 -0
- package/dist/esm/core/models/index.d.ts.map +1 -0
- package/dist/esm/core/models/index.js.map +1 -0
- package/dist/esm/core/models/invoice.d.ts +115 -0
- package/dist/esm/core/models/invoice.d.ts.map +1 -0
- package/dist/esm/core/models/invoice.js.map +1 -0
- package/dist/esm/core/qr/index.d.ts +2 -0
- package/dist/esm/core/qr/index.d.ts.map +1 -0
- package/dist/esm/core/qr/index.js.map +1 -0
- package/dist/esm/core/qr/qr.d.ts +13 -0
- package/dist/esm/core/qr/qr.d.ts.map +1 -0
- package/dist/esm/core/qr/qr.js.map +1 -0
- package/dist/esm/core/utils/date.d.ts +16 -0
- package/dist/esm/core/utils/date.d.ts.map +1 -0
- package/dist/esm/core/utils/date.js +24 -0
- package/dist/esm/core/utils/date.js.map +1 -0
- package/dist/esm/core/utils/index.d.ts +2 -0
- package/dist/esm/core/utils/index.d.ts.map +1 -0
- package/dist/esm/core/utils/index.js +2 -0
- package/dist/esm/core/utils/index.js.map +1 -0
- package/dist/esm/core/validation/index.d.ts +2 -0
- package/dist/esm/core/validation/index.d.ts.map +1 -0
- package/dist/esm/core/validation/index.js +2 -0
- package/dist/esm/core/validation/index.js.map +1 -0
- package/dist/esm/core/validation/validate.d.ts +18 -0
- package/dist/esm/core/validation/validate.d.ts.map +1 -0
- package/dist/esm/core/validation/validate.js +62 -0
- package/dist/esm/core/validation/validate.js.map +1 -0
- package/dist/esm/core/xml/generator.d.ts +140 -0
- package/dist/esm/core/xml/generator.d.ts.map +1 -0
- package/dist/esm/core/xml/generator.js +259 -0
- package/dist/esm/core/xml/generator.js.map +1 -0
- package/dist/esm/core/xml/index.d.ts +2 -0
- package/dist/esm/core/xml/index.d.ts.map +1 -0
- package/dist/esm/core/xml/index.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/integration/accountability.d.ts +41 -0
- package/dist/esm/integration/accountability.d.ts.map +1 -0
- package/dist/esm/integration/accountability.js +88 -0
- package/dist/esm/integration/accountability.js.map +1 -0
- package/dist/esm/integration/index.d.ts +5 -0
- package/dist/esm/integration/index.d.ts.map +1 -0
- package/dist/esm/integration/index.js +5 -0
- package/dist/esm/integration/index.js.map +1 -0
- package/dist/esm/integration/p12.d.ts +58 -0
- package/dist/esm/integration/p12.d.ts.map +1 -0
- package/dist/esm/integration/p12.js +119 -0
- package/dist/esm/integration/p12.js.map +1 -0
- package/dist/esm/integration/repository.d.ts +79 -0
- package/dist/esm/integration/repository.d.ts.map +1 -0
- package/dist/esm/integration/repository.js.map +1 -0
- package/dist/esm/integration/service.d.ts +45 -0
- package/dist/esm/integration/service.d.ts.map +1 -0
- package/dist/{integration → esm/integration}/service.js +101 -15
- package/dist/esm/integration/service.js.map +1 -0
- package/dist/esm/integration/tenant-credentials.d.ts +44 -0
- package/dist/esm/integration/tenant-credentials.d.ts.map +1 -0
- package/dist/esm/integration/tenant-credentials.js +58 -0
- package/dist/esm/integration/tenant-credentials.js.map +1 -0
- package/package.json +45 -13
- package/readme.md +566 -42
- package/src/aeat/client.ts +296 -55
- package/src/aeat/index.ts +1 -0
- package/src/aeat/response.ts +195 -0
- package/src/core/hash/chain.ts +68 -0
- package/src/core/index.ts +2 -0
- package/src/core/models/invoice.ts +40 -18
- package/src/core/utils/date.ts +27 -0
- package/src/core/utils/index.ts +1 -0
- package/src/core/validation/index.ts +1 -0
- package/src/core/validation/validate.ts +71 -0
- package/src/core/xml/generator.ts +306 -73
- package/src/integration/accountability.ts +125 -0
- package/src/integration/index.ts +2 -0
- package/src/integration/p12.ts +155 -0
- package/src/integration/repository.ts +2 -0
- package/src/integration/service.ts +113 -14
- package/dist/aeat/client.d.ts +0 -57
- package/dist/aeat/client.d.ts.map +0 -1
- package/dist/aeat/client.js +0 -87
- package/dist/aeat/client.js.map +0 -1
- package/dist/aeat/index.d.ts +0 -2
- package/dist/aeat/index.d.ts.map +0 -1
- package/dist/aeat/index.js +0 -2
- package/dist/aeat/index.js.map +0 -1
- package/dist/core/hash/chain.d.ts.map +0 -1
- package/dist/core/hash/chain.js.map +0 -1
- package/dist/core/hash/index.d.ts.map +0 -1
- package/dist/core/hash/index.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/models/event.d.ts.map +0 -1
- package/dist/core/models/index.d.ts.map +0 -1
- package/dist/core/models/index.js.map +0 -1
- package/dist/core/models/invoice.d.ts.map +0 -1
- package/dist/core/qr/index.d.ts.map +0 -1
- package/dist/core/qr/index.js.map +0 -1
- package/dist/core/qr/qr.d.ts.map +0 -1
- package/dist/core/qr/qr.js.map +0 -1
- package/dist/core/xml/generator.d.ts +0 -32
- package/dist/core/xml/generator.d.ts.map +0 -1
- package/dist/core/xml/generator.js +0 -103
- package/dist/core/xml/generator.js.map +0 -1
- package/dist/core/xml/index.d.ts.map +0 -1
- package/dist/core/xml/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integration/index.d.ts +0 -3
- package/dist/integration/index.d.ts.map +0 -1
- package/dist/integration/index.js +0 -3
- package/dist/integration/index.js.map +0 -1
- package/dist/integration/repository.d.ts.map +0 -1
- package/dist/integration/repository.js.map +0 -1
- package/dist/integration/service.d.ts.map +0 -1
- package/dist/integration/service.js.map +0 -1
- /package/dist/{core → cjs/core}/hash/index.d.ts +0 -0
- /package/dist/{core → cjs/core}/models/event.d.ts +0 -0
- /package/dist/{core → cjs/core}/models/index.d.ts +0 -0
- /package/dist/{core → cjs/core}/qr/index.d.ts +0 -0
- /package/dist/{core → cjs/core}/qr/qr.d.ts +0 -0
- /package/dist/{core → cjs/core}/xml/index.d.ts +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{core → esm/core}/hash/index.js +0 -0
- /package/dist/{core → esm/core}/models/event.js +0 -0
- /package/dist/{core → esm/core}/models/index.js +0 -0
- /package/dist/{core → esm/core}/models/invoice.js +0 -0
- /package/dist/{core → esm/core}/qr/index.js +0 -0
- /package/dist/{core → esm/core}/qr/qr.js +0 -0
- /package/dist/{core → esm/core}/xml/index.js +0 -0
- /package/dist/{index.js → esm/index.js} +0 -0
- /package/dist/{integration → esm/integration}/repository.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/date.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAShE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utilidades de fecha/hora para Verifactu.
|
|
4
|
+
*
|
|
5
|
+
* AEAT exige que `FechaHoraHusoGenRegistro` sea la fecha/hora actual del
|
|
6
|
+
* sistema con su huso horario (margen de 240 segundos). Este helper genera
|
|
7
|
+
* ese valor detectando automáticamente el offset de zona, sin asumir un
|
|
8
|
+
* huso fijo (p. ej. `+02:00`).
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.nowIsoWithOffset = nowIsoWithOffset;
|
|
12
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
13
|
+
/**
|
|
14
|
+
* Devuelve la fecha/hora actual en formato ISO 8601 con el offset de zona
|
|
15
|
+
* detectado automáticamente, p. ej. `2026-09-07T10:12:41+02:00`.
|
|
16
|
+
*
|
|
17
|
+
* @param date Fecha a formatear (por defecto, ahora).
|
|
18
|
+
*/
|
|
19
|
+
function nowIsoWithOffset(date = new Date()) {
|
|
20
|
+
const off = -date.getTimezoneOffset();
|
|
21
|
+
const sign = off >= 0 ? '+' : '-';
|
|
22
|
+
const abs = Math.abs(off);
|
|
23
|
+
return (`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}` +
|
|
24
|
+
`T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}` +
|
|
25
|
+
`${sign}${pad(Math.floor(abs / 60))}:${pad(abs % 60)}`);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../src/core/utils/date.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAUH,4CASC;AAjBD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAa,IAAI,IAAI,EAAE;IACtD,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACtC,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAClC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,CACL,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;QAC1E,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE;QAC9E,GAAG,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,CACvD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./date.js"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./validate.js"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/validation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Invoice } from '../models/invoice.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resultado de la validación de una factura.
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationResult {
|
|
6
|
+
/** `true` si la factura es válida. */
|
|
7
|
+
valid: boolean;
|
|
8
|
+
/** Lista de errores (campos obligatorios o con formato incorrecto). */
|
|
9
|
+
errors: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Valida una factura antes de enviarla a AEAT.
|
|
13
|
+
*
|
|
14
|
+
* Comprueba los campos obligatorios y el formato de las fechas (el XSD
|
|
15
|
+
* `fecha` de AEAT usa `DD-MM-YYYY`). Devuelve `{ valid, errors }`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateInvoice(invoice: Invoice): ValidationResult;
|
|
18
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/core/validation/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sCAAsC;IACtC,KAAK,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,CAoDlE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateInvoice = validateInvoice;
|
|
4
|
+
/**
|
|
5
|
+
* Valida una factura antes de enviarla a AEAT.
|
|
6
|
+
*
|
|
7
|
+
* Comprueba los campos obligatorios y el formato de las fechas (el XSD
|
|
8
|
+
* `fecha` de AEAT usa `DD-MM-YYYY`). Devuelve `{ valid, errors }`.
|
|
9
|
+
*/
|
|
10
|
+
function validateInvoice(invoice) {
|
|
11
|
+
const errors = [];
|
|
12
|
+
// Identificación de la factura.
|
|
13
|
+
if (!invoice.id?.numero)
|
|
14
|
+
errors.push('id.numero es obligatorio');
|
|
15
|
+
if (!invoice.id?.fechaExpedicion) {
|
|
16
|
+
errors.push('id.fechaExpedicion es obligatorio');
|
|
17
|
+
}
|
|
18
|
+
else if (!/^\d{2}-\d{2}-\d{4}$/.test(invoice.id.fechaExpedicion)) {
|
|
19
|
+
errors.push('id.fechaExpedicion debe tener formato DD-MM-YYYY');
|
|
20
|
+
}
|
|
21
|
+
// Emisor.
|
|
22
|
+
if (!invoice.emisor?.nif)
|
|
23
|
+
errors.push('emisor.nif es obligatorio');
|
|
24
|
+
if (!invoice.emisor?.nombreRazon)
|
|
25
|
+
errors.push('emisor.nombreRazon es obligatorio');
|
|
26
|
+
// Tipo de factura.
|
|
27
|
+
if (!invoice.tipoFactura)
|
|
28
|
+
errors.push('tipoFactura es obligatorio');
|
|
29
|
+
// Desglose.
|
|
30
|
+
if (!invoice.desglose?.detalles?.length) {
|
|
31
|
+
errors.push('desglose.detalles debe tener al menos un detalle');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
invoice.desglose.detalles.forEach((d, i) => {
|
|
35
|
+
if (!d.calificacionOperacion)
|
|
36
|
+
errors.push(`desglose.detalles[${i}].calificacionOperacion es obligatorio`);
|
|
37
|
+
if (d.baseImponible === undefined || d.baseImponible === null) {
|
|
38
|
+
errors.push(`desglose.detalles[${i}].baseImponible es obligatorio`);
|
|
39
|
+
}
|
|
40
|
+
if (d.tipoImpositivo !== undefined && !d.claveRegimen) {
|
|
41
|
+
errors.push(`desglose.detalles[${i}].claveRegimen es obligatorio si hay tipoImpositivo`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (invoice.desglose?.cuotaTotal === undefined)
|
|
46
|
+
errors.push('desglose.cuotaTotal es obligatorio');
|
|
47
|
+
if (invoice.desglose?.importeTotal === undefined)
|
|
48
|
+
errors.push('desglose.importeTotal es obligatorio');
|
|
49
|
+
// Destinatarios obligatorios para F1/F3 (según AEAT).
|
|
50
|
+
if (['F1', 'F3'].includes(invoice.tipoFactura) && !invoice.destinatarios?.length) {
|
|
51
|
+
errors.push('destinatarios es obligatorio para tipoFactura F1/F3');
|
|
52
|
+
}
|
|
53
|
+
// Sistema informático.
|
|
54
|
+
if (!invoice.sistemaInformatico?.nif)
|
|
55
|
+
errors.push('sistemaInformatico.nif es obligatorio');
|
|
56
|
+
if (!invoice.sistemaInformatico?.idSistemaInformatico) {
|
|
57
|
+
errors.push('sistemaInformatico.idSistemaInformatico es obligatorio');
|
|
58
|
+
}
|
|
59
|
+
// Fecha/hora de generación.
|
|
60
|
+
if (!invoice.fechaHoraHusoGenRegistro) {
|
|
61
|
+
errors.push('fechaHoraHusoGenRegistro es obligatorio');
|
|
62
|
+
}
|
|
63
|
+
return { valid: errors.length === 0, errors };
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/core/validation/validate.ts"],"names":[],"mappings":";;AAkBA,0CAoDC;AA1DD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,OAAgB;IAC9C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,gCAAgC;IAChC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM;QAAE,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACjE,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;SAAM,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;QACnE,MAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IAED,UAAU;IACV,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG;QAAE,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACnE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW;QAAE,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAEnF,mBAAmB;IACnB,IAAI,CAAC,OAAO,CAAC,WAAW;QAAE,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAEpE,YAAY;IACZ,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN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AED,4BAA4B;IAC5B,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Invoice, SistemaInformatico } from '../models/invoice.js';
|
|
2
|
+
/**
|
|
3
|
+
* Datos de un registro de anulación (RegistroFacturacionAnulacionType).
|
|
4
|
+
*/
|
|
5
|
+
export interface AnulacionInput {
|
|
6
|
+
/** NIF del emisor de la factura anulada. */
|
|
7
|
+
idEmisorFacturaAnulada: string;
|
|
8
|
+
/** Número y serie de la factura anulada. */
|
|
9
|
+
numSerieFacturaAnulada: string;
|
|
10
|
+
/** Fecha de expedición de la factura anulada (DD-MM-YYYY). */
|
|
11
|
+
fechaExpedicionFacturaAnulada: string;
|
|
12
|
+
/** Huella (hash) de la factura anulada. */
|
|
13
|
+
huellaFacturaAnulada: string;
|
|
14
|
+
/** Sistema informático que genera el registro. */
|
|
15
|
+
sistemaInformatico: SistemaInformatico;
|
|
16
|
+
/** Fecha/hora de generación con huso horario. */
|
|
17
|
+
fechaHoraHusoGenRegistro: string;
|
|
18
|
+
/** Huella (hash) del propio registro de anulación. */
|
|
19
|
+
huella: string;
|
|
20
|
+
/** Versión del esquema (por defecto '1.0'). */
|
|
21
|
+
idVersion?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Genera el elemento `<RegistroAlta>` de una factura (registro de alta).
|
|
25
|
+
*
|
|
26
|
+
* Estructura según el XSD `SuministroInformacion.xsd` de la AEAT
|
|
27
|
+
* (`RegistroFacturacionAltaType`). NOTA: validar contra el XSD oficial
|
|
28
|
+
* antes de producción.
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateRegistroAltaXml(invoice: Invoice, previousHash: string | null): string;
|
|
31
|
+
/**
|
|
32
|
+
* Cabecera del suministro (CabeceraType del XSD).
|
|
33
|
+
*/
|
|
34
|
+
export interface Cabecera {
|
|
35
|
+
/** Nombre o razón social del obligado a emitir. */
|
|
36
|
+
nombreRazon: string;
|
|
37
|
+
/** NIF del obligado a emitir. */
|
|
38
|
+
nif: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Namespace del esquema `SuministroLR.xsd` de la AEAT.
|
|
42
|
+
*/
|
|
43
|
+
export declare const AEAT_SUMINISTRO_NAMESPACE = "https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd";
|
|
44
|
+
/**
|
|
45
|
+
* Namespace del esquema `SuministroInformacion.xsd` de la AEAT.
|
|
46
|
+
*/
|
|
47
|
+
export declare const AEAT_INFORMACION_NAMESPACE = "https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd";
|
|
48
|
+
/**
|
|
49
|
+
* Namespace del esquema `EventosSIF.xsd` de la AEAT (registro de eventos).
|
|
50
|
+
*/
|
|
51
|
+
export declare const AEAT_EVENTO_NAMESPACE = "https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/EventosSIF.xsd";
|
|
52
|
+
/**
|
|
53
|
+
* Cabecera del suministro (CabeceraType del XSD).
|
|
54
|
+
*/
|
|
55
|
+
export interface Cabecera {
|
|
56
|
+
/** Nombre o razón social del obligado a emitir. */
|
|
57
|
+
nombreRazon: string;
|
|
58
|
+
/** NIF del obligado a emitir. */
|
|
59
|
+
nif: string;
|
|
60
|
+
/** Representante del obligado (solo si el envío lo hace un representante). */
|
|
61
|
+
representante?: {
|
|
62
|
+
/** Nombre o razón social del representante. */
|
|
63
|
+
nombreRazon: string;
|
|
64
|
+
/** NIF del representante. */
|
|
65
|
+
nif: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Genera el elemento `<RegFactuSistemaFacturacion>` completo (operación SOAP),
|
|
70
|
+
* con la `Cabecera` y el `RegistroFactura` que envuelve el registro.
|
|
71
|
+
*/
|
|
72
|
+
export declare function generateSuministroXml(registroXml: string, cabecera: Cabecera): string;
|
|
73
|
+
/**
|
|
74
|
+
* Construye la `Cabecera` del suministro, detectando si el certificado es de
|
|
75
|
+
* un representante.
|
|
76
|
+
*
|
|
77
|
+
* Si se proporciona el certificado en PEM y su NIF difiere del NIF del
|
|
78
|
+
* obligado, se añade el bloque `Representante` (el certificado actúa como
|
|
79
|
+
* representante del obligado), usando el nombre del titular del certificado.
|
|
80
|
+
*/
|
|
81
|
+
export declare function buildCabecera(obligado: {
|
|
82
|
+
nombreRazon: string;
|
|
83
|
+
nif: string;
|
|
84
|
+
}, certificatePem?: string, extractInfo?: (pem: string) => {
|
|
85
|
+
nif: string;
|
|
86
|
+
nombreRazon: string;
|
|
87
|
+
} | null): Cabecera;
|
|
88
|
+
/**
|
|
89
|
+
* Genera el XML Verifactu de una factura (registro de alta).
|
|
90
|
+
*
|
|
91
|
+
* Alias de `generateRegistroAltaXml` por compatibilidad.
|
|
92
|
+
*/
|
|
93
|
+
export declare function generateInvoiceXml(invoice: Invoice, previousHash: string | null): string;
|
|
94
|
+
/**
|
|
95
|
+
* Genera el XML Verifactu de un registro de anulación (`<sf:RegistroAnulacion>`).
|
|
96
|
+
*
|
|
97
|
+
* Referencia la factura anulada (IDFactura) y encadena con el hash anterior.
|
|
98
|
+
* Estructura según el XSD `SuministroInformacion.xsd` (`RegistroFacturacionAnulacionType`).
|
|
99
|
+
*/
|
|
100
|
+
export declare function generateAnulacionXml(anulacion: AnulacionInput, previousHash: string | null): string;
|
|
101
|
+
/**
|
|
102
|
+
* Datos de un registro de evento (RegistroEvento).
|
|
103
|
+
*
|
|
104
|
+
* Nota: el `NIF` aparece dos veces: `nifSistemaInformatico` (del sistema
|
|
105
|
+
* informático) y `nifObligado` (del obligado a emitir).
|
|
106
|
+
*/
|
|
107
|
+
/**
|
|
108
|
+
* Datos de un registro de evento (RegistroEvento, EventosSIF.xsd).
|
|
109
|
+
*/
|
|
110
|
+
export interface EventoInput {
|
|
111
|
+
/** Sistema informático que genera el evento. */
|
|
112
|
+
sistemaInformatico: SistemaInformatico;
|
|
113
|
+
/** Obligado a emitir (persona física o jurídica española). */
|
|
114
|
+
obligadoEmision: {
|
|
115
|
+
nombreRazon: string;
|
|
116
|
+
nif: string;
|
|
117
|
+
};
|
|
118
|
+
/** Fecha/hora de generación con huso horario (ISO 8601). */
|
|
119
|
+
fechaHoraHusoGenEvento: string;
|
|
120
|
+
/** Tipo de evento (01–10, 90). */
|
|
121
|
+
tipoEvento: string;
|
|
122
|
+
/** Huella (hash) del evento. */
|
|
123
|
+
huellaEvento: string;
|
|
124
|
+
/** Versión del esquema (por defecto '1.0'). */
|
|
125
|
+
idVersion?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Genera el XML Verifactu de un registro de evento (RegistroEvento).
|
|
129
|
+
*
|
|
130
|
+
* Estructura basada en `EventosSIF.xsd` (namespace `sf`). El evento se envía
|
|
131
|
+
* como un suministro independiente (no dentro de `RegFactuSistemaFacturacion`).
|
|
132
|
+
*/
|
|
133
|
+
export declare function generateEventoXml(evento: EventoInput): string;
|
|
134
|
+
/**
|
|
135
|
+
* Envuelve un elemento de operación Verifactu en el sobre SOAP que la AEAT
|
|
136
|
+
* espera en el envío. El XML de entrada DEBE ser ya el elemento de operación
|
|
137
|
+
* (p. ej. `<RegFactuSistemaFacturacion>` o `<ConsultaFactuSistemaFacturacion>`).
|
|
138
|
+
*/
|
|
139
|
+
export declare function buildRemisionEnvelope(operationXml: string): string;
|
|
140
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/core/xml/generator.ts"],"names":[],"mappings":"AAAA,OAA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{ value: true });
|
|
3
|
+
exports.AEAT_EVENTO_NAMESPACE = exports.AEAT_INFORMACION_NAMESPACE = exports.AEAT_SUMINISTRO_NAMESPACE = void 0;
|
|
4
|
+
exports.generateRegistroAltaXml = generateRegistroAltaXml;
|
|
5
|
+
exports.generateSuministroXml = generateSuministroXml;
|
|
6
|
+
exports.buildCabecera = buildCabecera;
|
|
7
|
+
exports.generateInvoiceXml = generateInvoiceXml;
|
|
8
|
+
exports.generateAnulacionXml = generateAnulacionXml;
|
|
9
|
+
exports.generateEventoXml = generateEventoXml;
|
|
10
|
+
exports.buildRemisionEnvelope = buildRemisionEnvelope;
|
|
11
|
+
/**
|
|
12
|
+
* Escapa caracteres especiales para XML.
|
|
13
|
+
*/
|
|
14
|
+
function escapeXml(value) {
|
|
15
|
+
return value
|
|
16
|
+
.replace(/&/g, '&')
|
|
17
|
+
.replace(/</g, '<')
|
|
18
|
+
.replace(/>/g, '>')
|
|
19
|
+
.replace(/"/g, '"')
|
|
20
|
+
.replace(/'/g, ''');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Formatea un número con 2 decimales (formato Verifactu).
|
|
24
|
+
*/
|
|
25
|
+
function formatAmount(value) {
|
|
26
|
+
return value.toFixed(2);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Genera el elemento `<RegistroAlta>` de una factura (registro de alta).
|
|
30
|
+
*
|
|
31
|
+
* Estructura según el XSD `SuministroInformacion.xsd` de la AEAT
|
|
32
|
+
* (`RegistroFacturacionAltaType`). NOTA: validar contra el XSD oficial
|
|
33
|
+
* antes de producción.
|
|
34
|
+
*/
|
|
35
|
+
function generateRegistroAltaXml(invoice, previousHash) {
|
|
36
|
+
const { id, emisor, desglose, tipoFactura, sistemaInformatico } = invoice;
|
|
37
|
+
const idVersion = invoice.idVersion ?? '1.0';
|
|
38
|
+
const descripcion = invoice.descripcion ?? '';
|
|
39
|
+
const detalles = desglose.detalles
|
|
40
|
+
.map((d) => ` <sf:DetalleDesglose>` +
|
|
41
|
+
(d.claveRegimen !== undefined
|
|
42
|
+
? `<sf:ClaveRegimen>${escapeXml(d.claveRegimen)}</sf:ClaveRegimen>`
|
|
43
|
+
: '') +
|
|
44
|
+
`<sf:CalificacionOperacion>${escapeXml(d.calificacionOperacion)}</sf:CalificacionOperacion>` +
|
|
45
|
+
(d.tipoImpositivo !== undefined
|
|
46
|
+
? `<sf:TipoImpositivo>${formatAmount(d.tipoImpositivo)}</sf:TipoImpositivo>`
|
|
47
|
+
: '') +
|
|
48
|
+
`<sf:BaseImponibleOimporteNoSujeto>${formatAmount(d.baseImponible)}</sf:BaseImponibleOimporteNoSujeto>` +
|
|
49
|
+
(d.cuotaRepercutida !== undefined
|
|
50
|
+
? `<sf:CuotaRepercutida>${formatAmount(d.cuotaRepercutida)}</sf:CuotaRepercutida>`
|
|
51
|
+
: '') +
|
|
52
|
+
`</sf:DetalleDesglose>`)
|
|
53
|
+
.join('\n');
|
|
54
|
+
const encadenamiento = previousHash
|
|
55
|
+
? ` <sf:RegistroAnterior><sf:IDEmisorFactura>${escapeXml(emisor.nif)}</sf:IDEmisorFactura><sf:NumSerieFactura>${escapeXml(id.serie ?? '')}${escapeXml(id.numero)}</sf:NumSerieFactura><sf:FechaExpedicionFactura>${id.fechaExpedicion}</sf:FechaExpedicionFactura><sf:Huella>${previousHash}</sf:Huella></sf:RegistroAnterior>`
|
|
56
|
+
: ` <sf:PrimerRegistro>S</sf:PrimerRegistro>`;
|
|
57
|
+
const xml = [
|
|
58
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
59
|
+
`<sf:RegistroAlta xmlns:sf="${exports.AEAT_INFORMACION_NAMESPACE}">`,
|
|
60
|
+
` <sf:IDVersion>${idVersion}</sf:IDVersion>`,
|
|
61
|
+
' <sf:IDFactura>',
|
|
62
|
+
` <sf:IDEmisorFactura>${escapeXml(emisor.nif)}</sf:IDEmisorFactura>`,
|
|
63
|
+
` <sf:NumSerieFactura>${escapeXml(id.serie ?? '')}${escapeXml(id.numero)}</sf:NumSerieFactura>`,
|
|
64
|
+
` <sf:FechaExpedicionFactura>${id.fechaExpedicion}</sf:FechaExpedicionFactura>`,
|
|
65
|
+
' </sf:IDFactura>',
|
|
66
|
+
` <sf:NombreRazonEmisor>${escapeXml(emisor.nombreRazon)}</sf:NombreRazonEmisor>`,
|
|
67
|
+
` <sf:TipoFactura>${tipoFactura}</sf:TipoFactura>`,
|
|
68
|
+
` <sf:DescripcionOperacion>${escapeXml(descripcion)}</sf:DescripcionOperacion>`,
|
|
69
|
+
...(invoice.destinatarios && invoice.destinatarios.length
|
|
70
|
+
? [
|
|
71
|
+
' <sf:Destinatarios>',
|
|
72
|
+
...invoice.destinatarios.map((d) => ` <sf:IDDestinatario><sf:NombreRazon>${escapeXml(d.nombreRazon)}</sf:NombreRazon><sf:NIF>${escapeXml(d.nif)}</sf:NIF></sf:IDDestinatario>`),
|
|
73
|
+
' </sf:Destinatarios>',
|
|
74
|
+
]
|
|
75
|
+
: []),
|
|
76
|
+
' <sf:Desglose>',
|
|
77
|
+
detalles,
|
|
78
|
+
' </sf:Desglose>',
|
|
79
|
+
` <sf:CuotaTotal>${formatAmount(desglose.cuotaTotal)}</sf:CuotaTotal>`,
|
|
80
|
+
` <sf:ImporteTotal>${formatAmount(desglose.importeTotal)}</sf:ImporteTotal>`,
|
|
81
|
+
' <sf:Encadenamiento>',
|
|
82
|
+
encadenamiento,
|
|
83
|
+
' </sf:Encadenamiento>',
|
|
84
|
+
' <sf:SistemaInformatico>',
|
|
85
|
+
` <sf:NombreRazon>${escapeXml(sistemaInformatico.nombreRazon)}</sf:NombreRazon>`,
|
|
86
|
+
` <sf:NIF>${escapeXml(sistemaInformatico.nif)}</sf:NIF>`,
|
|
87
|
+
` <sf:NombreSistemaInformatico>${escapeXml(sistemaInformatico.nombreSistemaInformatico)}</sf:NombreSistemaInformatico>`,
|
|
88
|
+
` <sf:IdSistemaInformatico>${escapeXml(sistemaInformatico.idSistemaInformatico)}</sf:IdSistemaInformatico>`,
|
|
89
|
+
` <sf:Version>${escapeXml(sistemaInformatico.version)}</sf:Version>`,
|
|
90
|
+
` <sf:NumeroInstalacion>${escapeXml(sistemaInformatico.numeroInstalacion)}</sf:NumeroInstalacion>`,
|
|
91
|
+
' <sf:TipoUsoPosibleSoloVerifactu>S</sf:TipoUsoPosibleSoloVerifactu>',
|
|
92
|
+
' <sf:TipoUsoPosibleMultiOT>N</sf:TipoUsoPosibleMultiOT>',
|
|
93
|
+
' <sf:IndicadorMultiplesOT>N</sf:IndicadorMultiplesOT>',
|
|
94
|
+
' </sf:SistemaInformatico>',
|
|
95
|
+
` <sf:FechaHoraHusoGenRegistro>${invoice.fechaHoraHusoGenRegistro}</sf:FechaHoraHusoGenRegistro>`,
|
|
96
|
+
' <sf:TipoHuella>01</sf:TipoHuella>',
|
|
97
|
+
` <sf:Huella>${invoice.huella}</sf:Huella>`,
|
|
98
|
+
'</sf:RegistroAlta>',
|
|
99
|
+
]
|
|
100
|
+
.filter((line) => line !== '')
|
|
101
|
+
.join('\n');
|
|
102
|
+
return xml;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Namespace del esquema `SuministroLR.xsd` de la AEAT.
|
|
106
|
+
*/
|
|
107
|
+
exports.AEAT_SUMINISTRO_NAMESPACE = 'https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd';
|
|
108
|
+
/**
|
|
109
|
+
* Namespace del esquema `SuministroInformacion.xsd` de la AEAT.
|
|
110
|
+
*/
|
|
111
|
+
exports.AEAT_INFORMACION_NAMESPACE = 'https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd';
|
|
112
|
+
/**
|
|
113
|
+
* Namespace del esquema `EventosSIF.xsd` de la AEAT (registro de eventos).
|
|
114
|
+
*/
|
|
115
|
+
exports.AEAT_EVENTO_NAMESPACE = 'https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/EventosSIF.xsd';
|
|
116
|
+
/**
|
|
117
|
+
* Genera el elemento `<RegFactuSistemaFacturacion>` completo (operación SOAP),
|
|
118
|
+
* con la `Cabecera` y el `RegistroFactura` que envuelve el registro.
|
|
119
|
+
*/
|
|
120
|
+
function generateSuministroXml(registroXml, cabecera) {
|
|
121
|
+
const body = registroXml.replace(/^<\?xml[^>]*\?>\s*/, '');
|
|
122
|
+
const representante = cabecera.representante
|
|
123
|
+
? [
|
|
124
|
+
' <sf:Representante>',
|
|
125
|
+
` <sf:NombreRazon>${escapeXml(cabecera.representante.nombreRazon)}</sf:NombreRazon>`,
|
|
126
|
+
` <sf:NIF>${escapeXml(cabecera.representante.nif)}</sf:NIF>`,
|
|
127
|
+
' </sf:Representante>',
|
|
128
|
+
].join('\n')
|
|
129
|
+
: '';
|
|
130
|
+
return [
|
|
131
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
132
|
+
`<sfLR:RegFactuSistemaFacturacion xmlns:sfLR="${exports.AEAT_SUMINISTRO_NAMESPACE}" xmlns:sf="${exports.AEAT_INFORMACION_NAMESPACE}">`,
|
|
133
|
+
' <sfLR:Cabecera>',
|
|
134
|
+
' <sf:ObligadoEmision>',
|
|
135
|
+
` <sf:NombreRazon>${escapeXml(cabecera.nombreRazon)}</sf:NombreRazon>`,
|
|
136
|
+
` <sf:NIF>${escapeXml(cabecera.nif)}</sf:NIF>`,
|
|
137
|
+
' </sf:ObligadoEmision>',
|
|
138
|
+
representante,
|
|
139
|
+
' </sfLR:Cabecera>',
|
|
140
|
+
' <sfLR:RegistroFactura>',
|
|
141
|
+
body,
|
|
142
|
+
' </sfLR:RegistroFactura>',
|
|
143
|
+
'</sfLR:RegFactuSistemaFacturacion>',
|
|
144
|
+
].join('\n');
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Construye la `Cabecera` del suministro, detectando si el certificado es de
|
|
148
|
+
* un representante.
|
|
149
|
+
*
|
|
150
|
+
* Si se proporciona el certificado en PEM y su NIF difiere del NIF del
|
|
151
|
+
* obligado, se añade el bloque `Representante` (el certificado actúa como
|
|
152
|
+
* representante del obligado), usando el nombre del titular del certificado.
|
|
153
|
+
*/
|
|
154
|
+
function buildCabecera(obligado, certificatePem, extractInfo) {
|
|
155
|
+
const cabecera = { nombreRazon: obligado.nombreRazon, nif: obligado.nif };
|
|
156
|
+
if (certificatePem && extractInfo) {
|
|
157
|
+
const info = extractInfo(certificatePem);
|
|
158
|
+
if (info && info.nif !== obligado.nif) {
|
|
159
|
+
cabecera.representante = { nombreRazon: info.nombreRazon, nif: info.nif };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return cabecera;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Genera el XML Verifactu de una factura (registro de alta).
|
|
166
|
+
*
|
|
167
|
+
* Alias de `generateRegistroAltaXml` por compatibilidad.
|
|
168
|
+
*/
|
|
169
|
+
function generateInvoiceXml(invoice, previousHash) {
|
|
170
|
+
return generateRegistroAltaXml(invoice, previousHash);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Genera el XML Verifactu de un registro de anulación (`<sf:RegistroAnulacion>`).
|
|
174
|
+
*
|
|
175
|
+
* Referencia la factura anulada (IDFactura) y encadena con el hash anterior.
|
|
176
|
+
* Estructura según el XSD `SuministroInformacion.xsd` (`RegistroFacturacionAnulacionType`).
|
|
177
|
+
*/
|
|
178
|
+
function generateAnulacionXml(anulacion, previousHash) {
|
|
179
|
+
const idVersion = anulacion.idVersion ?? '1.0';
|
|
180
|
+
const si = anulacion.sistemaInformatico;
|
|
181
|
+
const encadenamiento = previousHash
|
|
182
|
+
? ` <sf:RegistroAnterior><sf:IDEmisorFactura>${escapeXml(anulacion.idEmisorFacturaAnulada)}</sf:IDEmisorFactura><sf:NumSerieFactura>${escapeXml(anulacion.numSerieFacturaAnulada)}</sf:NumSerieFactura><sf:FechaExpedicionFactura>${anulacion.fechaExpedicionFacturaAnulada}</sf:FechaExpedicionFactura><sf:Huella>${previousHash}</sf:Huella></sf:RegistroAnterior>`
|
|
183
|
+
: ` <sf:PrimerRegistro>S</sf:PrimerRegistro>`;
|
|
184
|
+
return [
|
|
185
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
186
|
+
`<sf:RegistroAnulacion xmlns:sf="${exports.AEAT_INFORMACION_NAMESPACE}">`,
|
|
187
|
+
` <sf:IDVersion>${idVersion}</sf:IDVersion>`,
|
|
188
|
+
' <sf:IDFactura>',
|
|
189
|
+
` <sf:IDEmisorFacturaAnulada>${escapeXml(anulacion.idEmisorFacturaAnulada)}</sf:IDEmisorFacturaAnulada>`,
|
|
190
|
+
` <sf:NumSerieFacturaAnulada>${escapeXml(anulacion.numSerieFacturaAnulada)}</sf:NumSerieFacturaAnulada>`,
|
|
191
|
+
` <sf:FechaExpedicionFacturaAnulada>${anulacion.fechaExpedicionFacturaAnulada}</sf:FechaExpedicionFacturaAnulada>`,
|
|
192
|
+
' </sf:IDFactura>',
|
|
193
|
+
' <sf:Encadenamiento>',
|
|
194
|
+
encadenamiento,
|
|
195
|
+
' </sf:Encadenamiento>',
|
|
196
|
+
' <sf:SistemaInformatico>',
|
|
197
|
+
` <sf:NombreRazon>${escapeXml(si.nombreRazon)}</sf:NombreRazon>`,
|
|
198
|
+
` <sf:NIF>${escapeXml(si.nif)}</sf:NIF>`,
|
|
199
|
+
` <sf:NombreSistemaInformatico>${escapeXml(si.nombreSistemaInformatico)}</sf:NombreSistemaInformatico>`,
|
|
200
|
+
` <sf:IdSistemaInformatico>${escapeXml(si.idSistemaInformatico)}</sf:IdSistemaInformatico>`,
|
|
201
|
+
` <sf:Version>${escapeXml(si.version)}</sf:Version>`,
|
|
202
|
+
` <sf:NumeroInstalacion>${escapeXml(si.numeroInstalacion)}</sf:NumeroInstalacion>`,
|
|
203
|
+
' <sf:TipoUsoPosibleSoloVerifactu>S</sf:TipoUsoPosibleSoloVerifactu>',
|
|
204
|
+
' <sf:TipoUsoPosibleMultiOT>N</sf:TipoUsoPosibleMultiOT>',
|
|
205
|
+
' <sf:IndicadorMultiplesOT>N</sf:IndicadorMultiplesOT>',
|
|
206
|
+
' </sf:SistemaInformatico>',
|
|
207
|
+
` <sf:FechaHoraHusoGenRegistro>${anulacion.fechaHoraHusoGenRegistro}</sf:FechaHoraHusoGenRegistro>`,
|
|
208
|
+
' <sf:TipoHuella>01</sf:TipoHuella>',
|
|
209
|
+
` <sf:Huella>${anulacion.huella}</sf:Huella>`,
|
|
210
|
+
'</sf:RegistroAnulacion>',
|
|
211
|
+
].join('\n');
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Genera el XML Verifactu de un registro de evento (RegistroEvento).
|
|
215
|
+
*
|
|
216
|
+
* Estructura basada en `EventosSIF.xsd` (namespace `sf`). El evento se envía
|
|
217
|
+
* como un suministro independiente (no dentro de `RegFactuSistemaFacturacion`).
|
|
218
|
+
*/
|
|
219
|
+
function generateEventoXml(evento) {
|
|
220
|
+
const si = evento.sistemaInformatico;
|
|
221
|
+
const xml = [
|
|
222
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
223
|
+
`<sf:RegistroEvento xmlns:sf="${exports.AEAT_EVENTO_NAMESPACE}">`,
|
|
224
|
+
` <sf:IDVersion>${escapeXml(evento.idVersion ?? '1.0')}</sf:IDVersion>`,
|
|
225
|
+
' <sf:Evento>',
|
|
226
|
+
' <sf:SistemaInformatico>',
|
|
227
|
+
` <sf:NombreRazon>${escapeXml(si.nombreRazon)}</sf:NombreRazon>`,
|
|
228
|
+
` <sf:NIF>${escapeXml(si.nif)}</sf:NIF>`,
|
|
229
|
+
` <sf:NombreSistemaInformatico>${escapeXml(si.nombreSistemaInformatico)}</sf:NombreSistemaInformatico>`,
|
|
230
|
+
` <sf:IdSistemaInformatico>${escapeXml(si.idSistemaInformatico)}</sf:IdSistemaInformatico>`,
|
|
231
|
+
` <sf:Version>${escapeXml(si.version)}</sf:Version>`,
|
|
232
|
+
` <sf:NumeroInstalacion>${escapeXml(si.numeroInstalacion)}</sf:NumeroInstalacion>`,
|
|
233
|
+
' <sf:TipoUsoPosibleSoloVerifactu>S</sf:TipoUsoPosibleSoloVerifactu>',
|
|
234
|
+
' <sf:TipoUsoPosibleMultiOT>N</sf:TipoUsoPosibleMultiOT>',
|
|
235
|
+
' <sf:IndicadorMultiplesOT>N</sf:IndicadorMultiplesOT>',
|
|
236
|
+
' </sf:SistemaInformatico>',
|
|
237
|
+
' <sf:ObligadoEmision>',
|
|
238
|
+
` <sf:NombreRazon>${escapeXml(evento.obligadoEmision.nombreRazon)}</sf:NombreRazon>`,
|
|
239
|
+
` <sf:NIF>${escapeXml(evento.obligadoEmision.nif)}</sf:NIF>`,
|
|
240
|
+
' </sf:ObligadoEmision>',
|
|
241
|
+
` <sf:FechaHoraHusoGenEvento>${evento.fechaHoraHusoGenEvento}</sf:FechaHoraHusoGenEvento>`,
|
|
242
|
+
` <sf:TipoEvento>${escapeXml(evento.tipoEvento)}</sf:TipoEvento>`,
|
|
243
|
+
' <sf:Encadenamiento>',
|
|
244
|
+
' <sf:PrimerEvento>S</sf:PrimerEvento>',
|
|
245
|
+
' </sf:Encadenamiento>',
|
|
246
|
+
' <sf:TipoHuella>01</sf:TipoHuella>',
|
|
247
|
+
` <sf:HuellaEvento>${evento.huellaEvento}</sf:HuellaEvento>`,
|
|
248
|
+
' </sf:Evento>',
|
|
249
|
+
'</sf:RegistroEvento>',
|
|
250
|
+
].join('\n');
|
|
251
|
+
return xml;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Envuelve un elemento de operación Verifactu en el sobre SOAP que la AEAT
|
|
255
|
+
* espera en el envío. El XML de entrada DEBE ser ya el elemento de operación
|
|
256
|
+
* (p. ej. `<RegFactuSistemaFacturacion>` o `<ConsultaFactuSistemaFacturacion>`).
|
|
257
|
+
*/
|
|
258
|
+
function buildRemisionEnvelope(operationXml) {
|
|
259
|
+
const body = operationXml.replace(/^<\?xml[^>]*\?>\s*/, '');
|
|
260
|
+
return [
|
|
261
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
262
|
+
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">',
|
|
263
|
+
' <soap:Body>',
|
|
264
|
+
body,
|
|
265
|
+
' </soap:Body>',
|
|
266
|
+
'</soap:Envelope>',
|
|
267
|
+
].join('\n');
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/core/xml/generator.ts"],"names":[],"mappings":";;;AAkDA,0DA8EC;AAmDD,sDAyBC;AAUD,sCAaC;AAOD,gDAEC;AAQD,oDAsCC;AAgCD,8CAkCC;AAOD,sDAUC;AArVD;;GAEG;AACH,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,OAAgB,EAAE,YAA2B;IACnF,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC;IAC1E,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;IAE9C,MAAM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