en16931-parser 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +64 -2
- package/bin/cli.js +75 -0
- package/dist/einvoice-viewer.d.ts +129 -0
- package/dist/einvoice-viewer.js +651 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/collections.d.ts +62 -0
- package/dist/internal/collections.js +146 -0
- package/dist/internal/csv.d.ts +63 -0
- package/dist/internal/csv.js +209 -0
- package/dist/internal/pii-patterns.d.ts +42 -0
- package/dist/internal/pii-patterns.js +162 -0
- package/dist/internal/xml-entities.d.ts +14 -0
- package/dist/internal/xml-entities.js +50 -0
- package/dist/internal/xml-formatter-options.d.ts +190 -0
- package/dist/internal/xml-formatter-options.js +848 -0
- package/dist/internal/xml-inspect.d.ts +38 -0
- package/dist/internal/xml-inspect.js +103 -0
- package/package.json +48 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bastien Sulyan (Sunasty)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# en16931-parser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/sunasty-labs/en16931-parser/actions/workflows/ci.yml)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Zero-dependency TypeScript/ESM parser and arithmetic validator for **Factur-X / ZUGFeRD** (UN/CEFACT CrossIndustryInvoice) and **XRechnung / Peppol** (UBL 2.1 Invoice & CreditNote) electronic invoices.
|
|
8
|
+
|
|
9
|
+
> **Live zero-upload browser demo**: [sunasty.com/einvoice-viewer/](https://sunasty.com/einvoice-viewer/) (runs 100% locally in your browser with PDF embedded XML extraction).
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Dual standard support**: Parses UN/CEFACT CII (`CrossIndustryInvoice`) and OASIS UBL 2.1 (`Invoice` and `CreditNote`) regardless of XML namespace prefixes.
|
|
14
|
+
- **XXE protection**: Rejects `<!DOCTYPE>` and `<!ENTITY>` declarations (`XXE_BLOCKED`) before tree traversal.
|
|
15
|
+
- **Arithmetic & payment checks**: Verifies `lineTotal + taxTotal` vs `grandTotal` within `0.02` rounding tolerance and validates IBAN Mod-97 checksums.
|
|
16
|
+
- **Embedded PDF helper**: Selects and decodes Factur-X / ZUGFeRD / Order-X XML attachments extracted from PDF containers.
|
|
17
|
+
- **Exports & CLI**: Built-in JSON (`einvoiceToJson`), RFC 4180 CSV (`einvoiceLinesToCsv` with optional UTF-8 BOM), and standalone CLI.
|
|
18
|
+
- **Zero runtime dependencies**: Runs in Node.js 18+, Deno, Bun, Web Workers, and modern browsers.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install en16931-parser
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or via JSR:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx jsr add @sunasty/einvoice-parser
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Programmatic Usage
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import {
|
|
36
|
+
SAMPLE_FACTURX_CII_XML,
|
|
37
|
+
parseEinvoiceXml,
|
|
38
|
+
einvoiceLinesToCsv,
|
|
39
|
+
} from 'en16931-parser';
|
|
40
|
+
|
|
41
|
+
const result = parseEinvoiceXml(SAMPLE_FACTURX_CII_XML);
|
|
42
|
+
if (!result.ok) {
|
|
43
|
+
throw new Error(`${result.errorCode}: ${result.errorMessage}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log(result.invoice.profileLabel); // "Factur-X / EN 16931"
|
|
47
|
+
console.log(result.invoice.totals.grandTotal, result.invoice.currency);
|
|
48
|
+
console.log(result.invoice.arithmeticCheck.passed); // true
|
|
49
|
+
console.log(einvoiceLinesToCsv(result.invoice));
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## CLI Usage
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx en16931-parser invoice.xml
|
|
56
|
+
npx en16931-parser invoice.xml --json
|
|
57
|
+
npx en16931-parser invoice.xml --csv --bom > lines.csv
|
|
58
|
+
cat invoice.xml | npx en16931-parser --stdin --json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Security & Governance
|
|
62
|
+
|
|
63
|
+
- Zero external network calls or telemetry.
|
|
64
|
+
- Governed by [Sunasty Labs Contributing Guidelines](https://github.com/sunasty-labs/.github/blob/main/CONTRIBUTING.md) and [Security Policy](https://github.com/sunasty-labs/.github/blob/main/SECURITY.md).
|
|
65
|
+
- Licensed under the [MIT License](./LICENSE).
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {
|
|
4
|
+
SAMPLE_FACTURX_CII_XML,
|
|
5
|
+
SAMPLE_UBL_XRECHNUNG_XML,
|
|
6
|
+
einvoiceLinesToCsv,
|
|
7
|
+
einvoiceToJson,
|
|
8
|
+
parseEinvoiceXml,
|
|
9
|
+
} from '../dist/index.js';
|
|
10
|
+
|
|
11
|
+
function printHelp() {
|
|
12
|
+
process.stdout.write(`en16931-parser - Parse and validate Factur-X, ZUGFeRD, XRechnung, and EN 16931 XML invoices
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
en16931-parser <file.xml> [--json | --csv | --bom]
|
|
16
|
+
en16931-parser --stdin [--json | --csv]
|
|
17
|
+
en16931-parser --sample [cii|ubl] [--json | --csv]
|
|
18
|
+
|
|
19
|
+
Options:
|
|
20
|
+
--json Print full parsed invoice object as JSON
|
|
21
|
+
--csv Export invoice line items as CSV
|
|
22
|
+
--bom Include UTF-8 BOM when combined with --csv
|
|
23
|
+
--sample [k] Parse built-in sample (cii or ubl, default cii)
|
|
24
|
+
--stdin Read XML from standard input
|
|
25
|
+
-h, --help Show this help message
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function readInput(args) {
|
|
30
|
+
const sampleIdx = args.indexOf('--sample');
|
|
31
|
+
if (sampleIdx !== -1) {
|
|
32
|
+
const next = args[sampleIdx + 1];
|
|
33
|
+
return next && next.toLowerCase() === 'ubl' ? SAMPLE_UBL_XRECHNUNG_XML : SAMPLE_FACTURX_CII_XML;
|
|
34
|
+
}
|
|
35
|
+
if (args.includes('--stdin') || args.includes('-')) {
|
|
36
|
+
return fs.readFileSync(0, 'utf8');
|
|
37
|
+
}
|
|
38
|
+
const fileArg = args.find((a) => !a.startsWith('-'));
|
|
39
|
+
if (!fileArg) {
|
|
40
|
+
printHelp();
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
return fs.readFileSync(fileArg, 'utf8');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const args = process.argv.slice(2);
|
|
47
|
+
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
48
|
+
printHelp();
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const xml = readInput(args);
|
|
53
|
+
const result = parseEinvoiceXml(xml);
|
|
54
|
+
if (!result.ok) {
|
|
55
|
+
process.stderr.write(`Error [${result.errorCode}]: ${result.errorMessage}\n`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const { invoice } = result;
|
|
60
|
+
if (args.includes('--json')) {
|
|
61
|
+
process.stdout.write(einvoiceToJson(invoice) + '\n');
|
|
62
|
+
} else if (args.includes('--csv')) {
|
|
63
|
+
process.stdout.write(einvoiceLinesToCsv(invoice, args.includes('--bom')));
|
|
64
|
+
} else {
|
|
65
|
+
const lines = [
|
|
66
|
+
`${invoice.profileLabel} (${invoice.standard} / ${invoice.documentKind} #${invoice.typeCode || '-'})`,
|
|
67
|
+
`Invoice: ${invoice.invoiceNumber || '-'} | Issue: ${invoice.issueDate || '-'} | Due: ${invoice.dueDate || '-'}`,
|
|
68
|
+
`Seller: ${invoice.seller.name || '-'} (${invoice.seller.vatId || 'no VAT ID'})`,
|
|
69
|
+
`Buyer: ${invoice.buyer.name || '-'} (${invoice.buyer.vatId || 'no VAT ID'})`,
|
|
70
|
+
`Lines: ${invoice.lines.length} | Currency: ${invoice.currency}`,
|
|
71
|
+
`Totals: Net ${invoice.totals.lineTotal.toFixed(2)} + Tax ${invoice.totals.taxTotal.toFixed(2)} = Grand ${invoice.totals.grandTotal.toFixed(2)} | Due ${invoice.totals.duePayable.toFixed(2)}`,
|
|
72
|
+
`Math OK: ${invoice.arithmeticCheck.passed ? 'PASS' : 'MISMATCH'} | IBAN Valid: ${invoice.payment.iban ? String(invoice.payment.ibanValid) : 'N/A'}`,
|
|
73
|
+
];
|
|
74
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
75
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* einvoice-viewer.ts — Pure TypeScript parser and validator for Factur-X / ZUGFeRD
|
|
3
|
+
* (UN/CEFACT CrossIndustryInvoice) and XRechnung / Peppol (UBL 2.1 Invoice/CreditNote).
|
|
4
|
+
*
|
|
5
|
+
* Pure Node-testable module with zero DOM, network, or `pdfjs-dist` dependencies.
|
|
6
|
+
*/
|
|
7
|
+
export type EinvoiceStandard = 'CII' | 'UBL';
|
|
8
|
+
export type EinvoiceDocumentKind = 'Invoice' | 'CreditNote';
|
|
9
|
+
export type EinvoiceErrorCode = 'EMPTY_INPUT' | 'XXE_BLOCKED' | 'INVALID_XML' | 'UNSUPPORTED_SCHEMA';
|
|
10
|
+
export interface EinvoiceAddress {
|
|
11
|
+
readonly street: string;
|
|
12
|
+
readonly additionalStreet: string;
|
|
13
|
+
readonly postalCode: string;
|
|
14
|
+
readonly city: string;
|
|
15
|
+
readonly country: string;
|
|
16
|
+
}
|
|
17
|
+
export interface EinvoiceParty {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly vatId: string;
|
|
20
|
+
readonly address: EinvoiceAddress;
|
|
21
|
+
}
|
|
22
|
+
export interface EinvoicePaymentInfo {
|
|
23
|
+
readonly iban: string;
|
|
24
|
+
readonly ibanFormatted: string;
|
|
25
|
+
readonly ibanValid: boolean | null;
|
|
26
|
+
readonly bic: string;
|
|
27
|
+
readonly paymentReference: string;
|
|
28
|
+
}
|
|
29
|
+
export interface EinvoiceLineItem {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly qty: number;
|
|
33
|
+
readonly unitCode: string;
|
|
34
|
+
readonly unitPrice: number;
|
|
35
|
+
readonly lineTotal: number;
|
|
36
|
+
readonly vatRate: number | null;
|
|
37
|
+
}
|
|
38
|
+
export interface EinvoiceTotals {
|
|
39
|
+
readonly lineTotalAmount: number;
|
|
40
|
+
readonly allowanceTotal: number;
|
|
41
|
+
readonly chargeTotal: number;
|
|
42
|
+
readonly taxBasis: number;
|
|
43
|
+
readonly taxTotal: number;
|
|
44
|
+
readonly grandTotal: number;
|
|
45
|
+
readonly duePayable: number;
|
|
46
|
+
}
|
|
47
|
+
export interface EinvoiceArithmeticCheck {
|
|
48
|
+
readonly hasLines: boolean;
|
|
49
|
+
readonly linesSum: number;
|
|
50
|
+
readonly expectedTaxBasis: number;
|
|
51
|
+
readonly taxBasisDelta: number;
|
|
52
|
+
readonly linesMatchTaxBasis: boolean;
|
|
53
|
+
readonly expectedGrandTotal: number;
|
|
54
|
+
readonly grandTotalDelta: number;
|
|
55
|
+
readonly taxPlusBasisMatchGrandTotal: boolean;
|
|
56
|
+
readonly passed: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface ParsedEinvoice {
|
|
59
|
+
readonly standard: EinvoiceStandard;
|
|
60
|
+
readonly documentKind: EinvoiceDocumentKind;
|
|
61
|
+
readonly typeCode: string;
|
|
62
|
+
readonly profileGuid: string;
|
|
63
|
+
readonly profileLabel: string;
|
|
64
|
+
readonly invoiceNumber: string;
|
|
65
|
+
readonly issueDate: string;
|
|
66
|
+
readonly dueDate: string;
|
|
67
|
+
readonly currency: string;
|
|
68
|
+
readonly seller: EinvoiceParty;
|
|
69
|
+
readonly buyer: EinvoiceParty;
|
|
70
|
+
readonly payment: EinvoicePaymentInfo;
|
|
71
|
+
readonly lines: readonly EinvoiceLineItem[];
|
|
72
|
+
readonly totals: EinvoiceTotals;
|
|
73
|
+
readonly arithmeticCheck: EinvoiceArithmeticCheck;
|
|
74
|
+
}
|
|
75
|
+
export type EinvoiceParseResult = {
|
|
76
|
+
readonly ok: true;
|
|
77
|
+
readonly invoice: ParsedEinvoice;
|
|
78
|
+
readonly formattedXml: string;
|
|
79
|
+
} | {
|
|
80
|
+
readonly ok: false;
|
|
81
|
+
readonly errorCode: EinvoiceErrorCode;
|
|
82
|
+
readonly reason: string;
|
|
83
|
+
};
|
|
84
|
+
export interface PdfAttachmentEntry {
|
|
85
|
+
readonly filename?: string;
|
|
86
|
+
readonly content?: Uint8Array | null;
|
|
87
|
+
}
|
|
88
|
+
export type PdfAttachmentCollection = ReadonlyMap<string, PdfAttachmentEntry> | Readonly<Record<string, PdfAttachmentEntry>>;
|
|
89
|
+
/** Normalizes CII `YYYYMMDD` or ISO `YYYY-MM-DD` date strings to `YYYY-MM-DD`. */
|
|
90
|
+
export declare function normalizeEinvoiceDate(raw: string): string;
|
|
91
|
+
/** Formats an IBAN into 4-character groups for display. */
|
|
92
|
+
export declare function formatIbanDisplay(rawIban: string): string;
|
|
93
|
+
/**
|
|
94
|
+
* Parses a UN/CEFACT CrossIndustryInvoice (Factur-X / ZUGFeRD) or UBL 2.1
|
|
95
|
+
* Invoice/CreditNote (XRechnung / Peppol) XML document into a structured summary.
|
|
96
|
+
*/
|
|
97
|
+
export declare function parseEinvoiceXml(rawXml: string): EinvoiceParseResult;
|
|
98
|
+
/** Decodes raw UTF-8 XML bytes (stripping a leading BOM if present). */
|
|
99
|
+
export declare function decodeEmbeddedXmlBytes(bytes: Uint8Array): string;
|
|
100
|
+
/**
|
|
101
|
+
* Selects the preferred `.xml` attachment descriptor from either a `Map`
|
|
102
|
+
* (`pdfjs-dist` v5+) or a plain object map without decoding content yet.
|
|
103
|
+
*/
|
|
104
|
+
export declare function selectEmbeddedXmlAttachmentCandidate(attachments: PdfAttachmentCollection | null | undefined): {
|
|
105
|
+
readonly key: string;
|
|
106
|
+
readonly filename: string;
|
|
107
|
+
readonly content: Uint8Array | null;
|
|
108
|
+
} | null;
|
|
109
|
+
/**
|
|
110
|
+
* Selects and decodes the embedded e-invoice XML attachment from a PDF's
|
|
111
|
+
* attachment map when bytes are inline, preferring Factur-X / ZUGFeRD / XRechnung names.
|
|
112
|
+
*/
|
|
113
|
+
export declare function pickEmbeddedEinvoiceXmlAttachment(attachments: PdfAttachmentCollection | null | undefined): {
|
|
114
|
+
readonly filename: string;
|
|
115
|
+
readonly xml: string;
|
|
116
|
+
} | null;
|
|
117
|
+
/**
|
|
118
|
+
* Collects a readable text snippet from PDF page text-content items when a PDF
|
|
119
|
+
* carries no embedded Factur-X / ZUGFeRD XML attachment.
|
|
120
|
+
*/
|
|
121
|
+
export declare function extractPdfTextSnippet(items: readonly unknown[], maxLength?: number): string;
|
|
122
|
+
/** Exports extracted e-invoice line items and metadata as RFC 4180 CSV. */
|
|
123
|
+
export declare function einvoiceLinesToCsv(invoice: ParsedEinvoice, includeBom?: boolean): string;
|
|
124
|
+
/** Serializes a parsed e-invoice into formatted JSON. */
|
|
125
|
+
export declare function einvoiceToJson(invoice: ParsedEinvoice): string;
|
|
126
|
+
/** Built-in Factur-X EN 16931 (UN/CEFACT CII) sample payload (urn: URIs only). */
|
|
127
|
+
export declare const SAMPLE_FACTURX_CII_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rsm:CrossIndustryInvoice xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">\n <rsm:ExchangedDocumentContext>\n <ram:GuidelineSpecifiedDocumentContextParameter>\n <ram:ID>urn:cen.eu:en16931:2017</ram:ID>\n </ram:GuidelineSpecifiedDocumentContextParameter>\n </rsm:ExchangedDocumentContext>\n <rsm:ExchangedDocument>\n <ram:ID>FX-2026-0142</ram:ID>\n <ram:TypeCode>380</ram:TypeCode>\n <ram:IssueDateTime>\n <udt:DateTimeString format=\"102\">20260315</udt:DateTimeString>\n </ram:IssueDateTime>\n </rsm:ExchangedDocument>\n <rsm:SupplyChainTradeTransaction>\n <ram:IncludedSupplyChainTradeLineItem>\n <ram:AssociatedDocumentLineDocument>\n <ram:LineID>1</ram:LineID>\n </ram:AssociatedDocumentLineDocument>\n <ram:SpecifiedTradeProduct>\n <ram:Name>Accounting Audit Advisory (Hours)</ram:Name>\n </ram:SpecifiedTradeProduct>\n <ram:SpecifiedLineTradeAgreement>\n <ram:NetPriceProductTradePrice>\n <ram:ChargeAmount>180.00</ram:ChargeAmount>\n </ram:NetPriceProductTradePrice>\n </ram:SpecifiedLineTradeAgreement>\n <ram:SpecifiedLineTradeDelivery>\n <ram:BilledQuantity unitCode=\"HUR\">8</ram:BilledQuantity>\n </ram:SpecifiedLineTradeDelivery>\n <ram:SpecifiedLineTradeSettlement>\n <ram:ApplicableTradeTax>\n <ram:TypeCode>VAT</ram:TypeCode>\n <ram:CategoryCode>S</ram:CategoryCode>\n <ram:RateApplicablePercent>20.00</ram:RateApplicablePercent>\n </ram:ApplicableTradeTax>\n <ram:SpecifiedTradeSettlementLineMonetarySummation>\n <ram:LineTotalAmount>1440.00</ram:LineTotalAmount>\n </ram:SpecifiedTradeSettlementLineMonetarySummation>\n </ram:SpecifiedLineTradeSettlement>\n </ram:IncludedSupplyChainTradeLineItem>\n <ram:IncludedSupplyChainTradeLineItem>\n <ram:AssociatedDocumentLineDocument>\n <ram:LineID>2</ram:LineID>\n </ram:AssociatedDocumentLineDocument>\n <ram:SpecifiedTradeProduct>\n <ram:Name>Annual Compliance Archive License</ram:Name>\n </ram:SpecifiedTradeProduct>\n <ram:SpecifiedLineTradeAgreement>\n <ram:NetPriceProductTradePrice>\n <ram:ChargeAmount>360.00</ram:ChargeAmount>\n </ram:NetPriceProductTradePrice>\n </ram:SpecifiedLineTradeAgreement>\n <ram:SpecifiedLineTradeDelivery>\n <ram:BilledQuantity unitCode=\"C62\">1</ram:BilledQuantity>\n </ram:SpecifiedLineTradeDelivery>\n <ram:SpecifiedLineTradeSettlement>\n <ram:ApplicableTradeTax>\n <ram:TypeCode>VAT</ram:TypeCode>\n <ram:CategoryCode>S</ram:CategoryCode>\n <ram:RateApplicablePercent>20.00</ram:RateApplicablePercent>\n </ram:ApplicableTradeTax>\n <ram:SpecifiedTradeSettlementLineMonetarySummation>\n <ram:LineTotalAmount>360.00</ram:LineTotalAmount>\n </ram:SpecifiedTradeSettlementLineMonetarySummation>\n </ram:SpecifiedLineTradeSettlement>\n </ram:IncludedSupplyChainTradeLineItem>\n <ram:ApplicableHeaderTradeAgreement>\n <ram:SellerTradeParty>\n <ram:Name>Atelier Fiscal Lyon SAS</ram:Name>\n <ram:PostalTradeAddress>\n <ram:PostcodeCode>69002</ram:PostcodeCode>\n <ram:LineOne>18 Rue de la Republique</ram:LineOne>\n <ram:CityName>Lyon</ram:CityName>\n <ram:CountryID>FR</ram:CountryID>\n </ram:PostalTradeAddress>\n <ram:SpecifiedTaxRegistration>\n <ram:ID schemeID=\"VA\">FR40303265045</ram:ID>\n </ram:SpecifiedTaxRegistration>\n </ram:SellerTradeParty>\n <ram:BuyerTradeParty>\n <ram:Name>Nordic Logistics GmbH</ram:Name>\n <ram:PostalTradeAddress>\n <ram:PostcodeCode>20457</ram:PostcodeCode>\n <ram:LineOne>Am Sandtorkai 72</ram:LineOne>\n <ram:CityName>Hamburg</ram:CityName>\n <ram:CountryID>DE</ram:CountryID>\n </ram:PostalTradeAddress>\n <ram:SpecifiedTaxRegistration>\n <ram:ID schemeID=\"VA\">DE123456789</ram:ID>\n </ram:SpecifiedTaxRegistration>\n </ram:BuyerTradeParty>\n </ram:ApplicableHeaderTradeAgreement>\n <ram:ApplicableHeaderTradeSettlement>\n <ram:PaymentReference>FX-2026-0142</ram:PaymentReference>\n <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n <ram:SpecifiedTradeSettlementPaymentMeans>\n <ram:TypeCode>58</ram:TypeCode>\n <ram:PayeePartyCreditorFinancialAccount>\n <ram:IBANID>FR7630006000011234567890189</ram:IBANID>\n </ram:PayeePartyCreditorFinancialAccount>\n <ram:PayeeSpecifiedCreditorFinancialInstitution>\n <ram:BICID>AGRIFRPP</ram:BICID>\n </ram:PayeeSpecifiedCreditorFinancialInstitution>\n </ram:SpecifiedTradeSettlementPaymentMeans>\n <ram:SpecifiedTradePaymentTerms>\n <ram:DueDateDateTime>\n <udt:DateTimeString format=\"102\">20260414</udt:DateTimeString>\n </ram:DueDateDateTime>\n </ram:SpecifiedTradePaymentTerms>\n <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n <ram:LineTotalAmount>1800.00</ram:LineTotalAmount>\n <ram:TaxBasisTotalAmount>1800.00</ram:TaxBasisTotalAmount>\n <ram:TaxTotalAmount currencyID=\"EUR\">360.00</ram:TaxTotalAmount>\n <ram:GrandTotalAmount>2160.00</ram:GrandTotalAmount>\n <ram:DuePayableAmount>2160.00</ram:DuePayableAmount>\n </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n </ram:ApplicableHeaderTradeSettlement>\n </rsm:SupplyChainTradeTransaction>\n</rsm:CrossIndustryInvoice>";
|
|
128
|
+
/** Built-in UBL 2.1 XRechnung sample payload (urn: URIs only). */
|
|
129
|
+
export declare const SAMPLE_UBL_XRECHNUNG_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ubl:Invoice xmlns:ubl=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\">\n <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</cbc:CustomizationID>\n <cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>\n <cbc:ID>XR-2026-8804</cbc:ID>\n <cbc:IssueDate>2026-03-20</cbc:IssueDate>\n <cbc:DueDate>2026-04-19</cbc:DueDate>\n <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>\n <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>\n <cac:AccountingSupplierParty>\n <cac:Party>\n <cac:PostalAddress>\n <cbc:StreetName>Friedrichstrasse 114</cbc:StreetName>\n <cbc:CityName>Berlin</cbc:CityName>\n <cbc:PostalZone>10117</cbc:PostalZone>\n <cac:Country>\n <cbc:IdentificationCode>DE</cbc:IdentificationCode>\n </cac:Country>\n </cac:PostalAddress>\n <cac:PartyTaxScheme>\n <cbc:CompanyID>DE298765432</cbc:CompanyID>\n </cac:PartyTaxScheme>\n <cac:PartyLegalEntity>\n <cbc:RegistrationName>RheinWerk Software GmbH</cbc:RegistrationName>\n </cac:PartyLegalEntity>\n </cac:Party>\n </cac:AccountingSupplierParty>\n <cac:AccountingCustomerParty>\n <cac:Party>\n <cac:PostalAddress>\n <cbc:StreetName>Bahnhofplatz 4</cbc:StreetName>\n <cbc:CityName>Munich</cbc:CityName>\n <cbc:PostalZone>80335</cbc:PostalZone>\n <cac:Country>\n <cbc:IdentificationCode>DE</cbc:IdentificationCode>\n </cac:Country>\n </cac:PostalAddress>\n <cac:PartyTaxScheme>\n <cbc:CompanyID>DE198765431</cbc:CompanyID>\n </cac:PartyTaxScheme>\n <cac:PartyLegalEntity>\n <cbc:RegistrationName>Bavaria Cloud AG</cbc:RegistrationName>\n </cac:PartyLegalEntity>\n </cac:Party>\n </cac:AccountingCustomerParty>\n <cac:PaymentMeans>\n <cbc:PaymentID>XR-2026-8804</cbc:PaymentID>\n <cac:PayeeFinancialAccount>\n <cbc:ID>DE89370400440532013000</cbc:ID>\n <cac:FinancialInstitutionBranch>\n <cbc:ID>COBADEFFXXX</cbc:ID>\n </cac:FinancialInstitutionBranch>\n </cac:PayeeFinancialAccount>\n </cac:PaymentMeans>\n <cac:TaxTotal>\n <cbc:TaxAmount currencyID=\"EUR\">228.00</cbc:TaxAmount>\n </cac:TaxTotal>\n <cac:LegalMonetaryTotal>\n <cbc:LineExtensionAmount currencyID=\"EUR\">1200.00</cbc:LineExtensionAmount>\n <cbc:TaxExclusiveAmount currencyID=\"EUR\">1200.00</cbc:TaxExclusiveAmount>\n <cbc:TaxInclusiveAmount currencyID=\"EUR\">1428.00</cbc:TaxInclusiveAmount>\n <cbc:PayableAmount currencyID=\"EUR\">1428.00</cbc:PayableAmount>\n </cac:LegalMonetaryTotal>\n <cac:InvoiceLine>\n <cbc:ID>10</cbc:ID>\n <cbc:InvoicedQuantity unitCode=\"MON\">3</cbc:InvoicedQuantity>\n <cbc:LineExtensionAmount currencyID=\"EUR\">900.00</cbc:LineExtensionAmount>\n <cac:Item>\n <cbc:Name>Managed Hosting Cluster</cbc:Name>\n <cac:ClassifiedTaxCategory>\n <cbc:Percent>19</cbc:Percent>\n </cac:ClassifiedTaxCategory>\n </cac:Item>\n <cac:Price>\n <cbc:PriceAmount currencyID=\"EUR\">300.00</cbc:PriceAmount>\n </cac:Price>\n </cac:InvoiceLine>\n <cac:InvoiceLine>\n <cbc:ID>20</cbc:ID>\n <cbc:InvoicedQuantity unitCode=\"HUR\">2</cbc:InvoicedQuantity>\n <cbc:LineExtensionAmount currencyID=\"EUR\">300.00</cbc:LineExtensionAmount>\n <cac:Item>\n <cbc:Name>Security Onboarding Workshop</cbc:Name>\n <cac:ClassifiedTaxCategory>\n <cbc:Percent>19</cbc:Percent>\n </cac:ClassifiedTaxCategory>\n </cac:Item>\n <cac:Price>\n <cbc:PriceAmount currencyID=\"EUR\">150.00</cbc:PriceAmount>\n </cac:Price>\n </cac:InvoiceLine>\n</ubl:Invoice>";
|