Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
6b5e588df7 | |||
8668ac8555 | |||
5014a447a3 | |||
6b40eac61f | |||
72f27e69cd | |||
a5d5525e7a | |||
a077f5c335 | |||
46331c2bf6 | |||
b4a95de482 |
33
changelog.md
33
changelog.md
@ -1,5 +1,38 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-04-03 - 4.1.3 - fix(core)
|
||||
Refactor module imports to use the centralized plugins module and update relative paths across the codebase. Also remove the obsolete test file (test/test.other-formats-corpus.ts) and update file metadata in test outputs.
|
||||
|
||||
- Updated import statements in modules (e.g., ts/classes.xinvoice.ts, ts/formats/*, and ts/interfaces/common.ts) to import DOMParser, xpath, and other dependencies from './plugins.js' instead of directly from 'xmldom' and 'xpath'.
|
||||
- Adjusted import paths in test asset files such as test/assets/letter/letter1.ts.
|
||||
- Removed the obsolete test file test/test.other-formats-corpus.ts.
|
||||
- Test output files now show updated CreationDate/ModDate metadata.
|
||||
|
||||
## 2025-04-03 - 4.1.2 - fix(readme)
|
||||
Update readme documentation: enhance feature summary, update installation instructions and usage examples, remove obsolete config details, and better clarify supported invoice formats.
|
||||
|
||||
- Rewrote introduction to emphasize comprehensive feature support (multi-format, PDF handling, validation, modular architecture)
|
||||
- Updated installation instructions with commands for pnpm, npm, and yarn
|
||||
- Removed outdated TypeScript configuration and extended usage sections
|
||||
- Clarified supported invoice standards and provided a concise summary of format details
|
||||
|
||||
## 2025-04-03 - 4.1.1 - fix(zugferd)
|
||||
Refactor Zugferd decoders to properly extract house numbers from street names and remove unused imports; update readme hints with additional TInvoice reference and refresh PDF metadata timestamps.
|
||||
|
||||
- Use regex in zugferd.decoder.ts and zugferd.v1.decoder.ts to split the street name and extract the house number.
|
||||
- Remove the unnecessary 'general' import from '@tsclass/tsclass' in zugferd decoder files.
|
||||
- Update readme.hints.md with a reference to the TInvoice type from @tsclass/tsclass.
|
||||
- Update the CreationDate and ModDate in the embedded PDF asset to new timestamps.
|
||||
|
||||
## 2025-04-03 - 4.1.0 - feat(ZUGFERD)
|
||||
Add dedicated ZUGFERD v1/v2 support and refine invoice format detection logic
|
||||
|
||||
- Improve FormatDetector to differentiate between Factur-X, ZUGFERD v1, and ZUGFERD v2 formats
|
||||
- Introduce dedicated ZUGFERD decoder, encoder, and validator implementations
|
||||
- Update factories to use ZUGFERD-specific classes rather than reusing FacturX implementations
|
||||
- Enhance PDF XML extraction by consolidating multiple extractor strategies
|
||||
- Update module exports and documentation hints for improved testing and integration
|
||||
|
||||
## 2025-03-20 - 3.0.1 - fix(test/pdf-export)
|
||||
Improve PDF export tests with detailed logging and enhanced embedded file structure verification.
|
||||
|
||||
|
@ -1,215 +0,0 @@
|
||||
import { PDFEmbedder, PDFExtractor, TInvoice, FacturXEncoder } from '../ts/index.js';
|
||||
import * as fs from 'fs/promises';
|
||||
|
||||
/**
|
||||
* Example demonstrating how to use the PDF handling classes
|
||||
*/
|
||||
async function pdfHandlingExample() {
|
||||
try {
|
||||
// Create a sample invoice
|
||||
const invoice: TInvoice = createSampleInvoice();
|
||||
|
||||
// Create a Factur-X encoder
|
||||
const encoder = new FacturXEncoder();
|
||||
|
||||
// Generate XML
|
||||
const xmlContent = await encoder.encode(invoice);
|
||||
console.log('Generated XML:');
|
||||
console.log(xmlContent.substring(0, 500) + '...');
|
||||
|
||||
// Load a sample PDF
|
||||
const pdfBuffer = await fs.readFile('examples/sample.pdf');
|
||||
console.log(`Loaded PDF (${pdfBuffer.length} bytes)`);
|
||||
|
||||
// Create a PDF embedder
|
||||
const embedder = new PDFEmbedder();
|
||||
|
||||
// Embed XML into PDF
|
||||
const modifiedPdfBuffer = await embedder.embedXml(
|
||||
pdfBuffer,
|
||||
xmlContent,
|
||||
'factur-x.xml',
|
||||
'Factur-X XML Invoice'
|
||||
);
|
||||
console.log(`Created modified PDF (${modifiedPdfBuffer.length} bytes)`);
|
||||
|
||||
// Save the modified PDF
|
||||
await fs.writeFile('examples/output.pdf', modifiedPdfBuffer);
|
||||
console.log('Saved modified PDF to examples/output.pdf');
|
||||
|
||||
// Create a PDF extractor
|
||||
const extractor = new PDFExtractor();
|
||||
|
||||
// Extract XML from the modified PDF
|
||||
const extractedXml = await extractor.extractXml(modifiedPdfBuffer);
|
||||
console.log('Extracted XML:');
|
||||
console.log(extractedXml ? extractedXml.substring(0, 500) + '...' : 'No XML found');
|
||||
|
||||
// Save the extracted XML
|
||||
if (extractedXml) {
|
||||
await fs.writeFile('examples/extracted.xml', extractedXml);
|
||||
console.log('Saved extracted XML to examples/extracted.xml');
|
||||
}
|
||||
|
||||
console.log('PDF handling example completed successfully');
|
||||
} catch (error) {
|
||||
console.error('Error in PDF handling example:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a sample invoice for testing
|
||||
* @returns Sample invoice
|
||||
*/
|
||||
function createSampleInvoice(): TInvoice {
|
||||
return {
|
||||
type: 'invoice',
|
||||
id: 'INV-2023-001',
|
||||
invoiceType: 'debitnote',
|
||||
date: Date.now(),
|
||||
status: 'invoice',
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
version: '1.0.0'
|
||||
},
|
||||
language: 'en',
|
||||
incidenceId: 'INV-2023-001',
|
||||
from: {
|
||||
type: 'company',
|
||||
name: 'Supplier Company',
|
||||
description: 'Supplier',
|
||||
address: {
|
||||
streetName: 'Supplier Street',
|
||||
houseNumber: '123',
|
||||
postalCode: '12345',
|
||||
city: 'Supplier City',
|
||||
country: 'DE',
|
||||
countryCode: 'DE'
|
||||
},
|
||||
status: 'active',
|
||||
foundedDate: {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: 'DE123456789',
|
||||
registrationId: 'HRB12345',
|
||||
registrationName: 'Supplier Company GmbH'
|
||||
}
|
||||
},
|
||||
to: {
|
||||
type: 'company',
|
||||
name: 'Customer Company',
|
||||
description: 'Customer',
|
||||
address: {
|
||||
streetName: 'Customer Street',
|
||||
houseNumber: '456',
|
||||
postalCode: '54321',
|
||||
city: 'Customer City',
|
||||
country: 'DE',
|
||||
countryCode: 'DE'
|
||||
},
|
||||
status: 'active',
|
||||
foundedDate: {
|
||||
year: 2005,
|
||||
month: 6,
|
||||
day: 15
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: 'DE987654321',
|
||||
registrationId: 'HRB54321',
|
||||
registrationName: 'Customer Company GmbH'
|
||||
}
|
||||
},
|
||||
subject: 'Invoice INV-2023-001',
|
||||
content: {
|
||||
invoiceData: {
|
||||
id: 'INV-2023-001',
|
||||
status: null,
|
||||
type: 'debitnote',
|
||||
billedBy: {
|
||||
type: 'company',
|
||||
name: 'Supplier Company',
|
||||
description: 'Supplier',
|
||||
address: {
|
||||
streetName: 'Supplier Street',
|
||||
houseNumber: '123',
|
||||
postalCode: '12345',
|
||||
city: 'Supplier City',
|
||||
country: 'DE',
|
||||
countryCode: 'DE'
|
||||
},
|
||||
status: 'active',
|
||||
foundedDate: {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: 'DE123456789',
|
||||
registrationId: 'HRB12345',
|
||||
registrationName: 'Supplier Company GmbH'
|
||||
}
|
||||
},
|
||||
billedTo: {
|
||||
type: 'company',
|
||||
name: 'Customer Company',
|
||||
description: 'Customer',
|
||||
address: {
|
||||
streetName: 'Customer Street',
|
||||
houseNumber: '456',
|
||||
postalCode: '54321',
|
||||
city: 'Customer City',
|
||||
country: 'DE',
|
||||
countryCode: 'DE'
|
||||
},
|
||||
status: 'active',
|
||||
foundedDate: {
|
||||
year: 2005,
|
||||
month: 6,
|
||||
day: 15
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: 'DE987654321',
|
||||
registrationId: 'HRB54321',
|
||||
registrationName: 'Customer Company GmbH'
|
||||
}
|
||||
},
|
||||
deliveryDate: Date.now(),
|
||||
dueInDays: 30,
|
||||
periodOfPerformance: null,
|
||||
printResult: null,
|
||||
currency: 'EUR',
|
||||
notes: ['Thank you for your business'],
|
||||
items: [
|
||||
{
|
||||
position: 1,
|
||||
name: 'Product A',
|
||||
articleNumber: 'PROD-A',
|
||||
unitType: 'EA',
|
||||
unitQuantity: 2,
|
||||
unitNetPrice: 100,
|
||||
vatPercentage: 19
|
||||
},
|
||||
{
|
||||
position: 2,
|
||||
name: 'Service B',
|
||||
articleNumber: 'SERV-B',
|
||||
unitType: 'HUR',
|
||||
unitQuantity: 5,
|
||||
unitNetPrice: 80,
|
||||
vatPercentage: 19
|
||||
}
|
||||
],
|
||||
reverseCharge: false
|
||||
},
|
||||
textData: null,
|
||||
timesheetData: null,
|
||||
contractData: null
|
||||
}
|
||||
} as TInvoice;
|
||||
}
|
||||
|
||||
// Run the example
|
||||
pdfHandlingExample();
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@fin.cx/xinvoice",
|
||||
"version": "4.0.0",
|
||||
"version": "4.1.3",
|
||||
"private": false,
|
||||
"description": "A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for xinvoice packages.",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -0,0 +1,14 @@
|
||||
For testing use
|
||||
|
||||
```typescript
|
||||
import {tap, expect} @push.rocks/tapbundle
|
||||
```
|
||||
|
||||
tapbundle exports expect from @push.rocks/smartexpect
|
||||
You can find the readme here: https://code.foss.global/push.rocks/smartexpect/src/branch/master/readme.md
|
||||
|
||||
This module also uses @tsclass/tsclass: You can find the TInvoice type here: https://code.foss.global/tsclass/tsclass/src/branch/master/ts/finance/invoice.ts
|
||||
|
||||
Don't use shortcuts when doing things, e.g. creating sample data in order to not implement something correctly, or skipping tests, and calling it a day.
|
||||
|
||||
It is ok to ask questions, if you are unsure about something.
|
||||
|
360
readme.md
360
readme.md
@ -1,200 +1,172 @@
|
||||
# @fin.cx/xinvoice
|
||||
A module for creating, manipulating, and embedding XML invoice data within PDF files, supporting multiple European electronic invoice standards including ZUGFeRD, Factur-X, EN16931, UBL, and FatturaPA.
|
||||
|
||||
A comprehensive TypeScript library for creating, manipulating, and embedding XML invoice data within PDF files, supporting multiple European electronic invoice standards including ZUGFeRD (v1 & v2), Factur-X, XRechnung, UBL, and FatturaPA.
|
||||
|
||||
## Features
|
||||
|
||||
- **Multi-format support**: Process invoices in ZUGFeRD (v1 & v2), Factur-X, XRechnung, UBL, and FatturaPA
|
||||
- **PDF handling**: Extract XML from PDF/A-3 invoices and embed XML into PDFs
|
||||
- **Validation**: Validate invoices against format-specific rules
|
||||
- **Conversion**: Convert between different invoice formats
|
||||
- **TypeScript**: Fully typed API with TypeScript definitions
|
||||
- **Modular architecture**: Extensible design with specialized components
|
||||
|
||||
## Install
|
||||
|
||||
To install `@fin.cx/xinvoice`, you'll need npm (Node Package Manager). Run the following command in your terminal:
|
||||
|
||||
```shell
|
||||
npm install @fin.cx/xinvoice
|
||||
```
|
||||
|
||||
Or if you're using pnpm:
|
||||
To install `@fin.cx/xinvoice`, you'll need a package manager. We recommend using pnpm:
|
||||
|
||||
```shell
|
||||
# Using pnpm (recommended)
|
||||
pnpm add @fin.cx/xinvoice
|
||||
```
|
||||
|
||||
This command fetches the `xinvoice` package from the npm registry and installs it in your project directory.
|
||||
# Using npm
|
||||
npm install @fin.cx/xinvoice
|
||||
|
||||
# Using yarn
|
||||
yarn add @fin.cx/xinvoice
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The `@fin.cx/xinvoice` module is designed for handling and embedding XML data specifically tailored for xinvoice formats within PDF files. It streamlines the management of financial documents, typically involving the creation, manipulation, and embedding of structured invoice data. This section will cover a comprehensive usage guide, providing in-depth explanations of using each feature in a TypeScript environment with ESM syntax.
|
||||
The `@fin.cx/xinvoice` module streamlines the management of electronic invoices, handling the creation, manipulation, and embedding of structured invoice data in PDF files. Below are examples of common use cases.
|
||||
|
||||
### Setting Up Your TypeScript Environment
|
||||
|
||||
Before diving into the module’s functionalities, configure your TypeScript setup to handle ECMAScript modules. Here’s an example of a `tsconfig.json` configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
"outDir": "./dist",
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
```
|
||||
|
||||
This configuration ensures that TypeScript compiles your code using the latest ES module syntax, enabling direct and type-safe imports.
|
||||
|
||||
### Importing the `@fin.cx/xinvoice` Module
|
||||
|
||||
With your TypeScript environment configured, import the `@fin.cx/xinvoice` module as follows:
|
||||
### Basic Usage
|
||||
|
||||
```typescript
|
||||
import { XInvoice } from '@fin.cx/xinvoice';
|
||||
```
|
||||
|
||||
### Core Functionality: XInvoice Class
|
||||
|
||||
#### Introduction to XInvoice
|
||||
|
||||
The `XInvoice` class stands at the heart of our module, enabling the creation, manipulation, and management of invoices. It allows you to incorporate XML data into PDF files seamlessly, providing a bridge between human-readable PDF formats and machine-readable XML specifications required for financial documents.
|
||||
|
||||
#### Creating an XInvoice Instance
|
||||
|
||||
To harness the power of `XInvoice`, instantiate it with a path to the necessary file locations for your invoice processing needs:
|
||||
|
||||
```typescript
|
||||
const xInvoice = new XInvoice();
|
||||
```
|
||||
|
||||
Here, we just initialize an `XInvoice` object that we can later configure with necessary inputs.
|
||||
|
||||
#### Adding PDF and XML Data
|
||||
|
||||
Before embedding XML data into a PDF or extracting such information, provide the `XInvoice` instance with the required PDF and XML data:
|
||||
|
||||
```typescript
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
async function loadFiles() {
|
||||
const pdfBuffer = await fs.readFile('./path/to/your/invoice.pdf');
|
||||
const xmlString = await fs.readFile('./path/to/your/invoice.xml', 'utf-8');
|
||||
// Create a new invoice
|
||||
const invoice = new XInvoice();
|
||||
invoice.id = 'INV-2023-001';
|
||||
invoice.from = {
|
||||
name: 'Supplier Company',
|
||||
// Add more details...
|
||||
};
|
||||
invoice.to = {
|
||||
name: 'Customer Company',
|
||||
// Add more details...
|
||||
};
|
||||
// Add more invoice details...
|
||||
|
||||
await xInvoice.addPdfBuffer(pdfBuffer);
|
||||
await xInvoice.addXmlString(xmlString);
|
||||
// Export to XML
|
||||
const xml = await invoice.exportXml('zugferd');
|
||||
|
||||
// Load from XML
|
||||
const loadedInvoice = await XInvoice.fromXml(xml);
|
||||
|
||||
// Load from PDF
|
||||
const pdfBuffer = await fs.readFile('invoice.pdf');
|
||||
const invoiceFromPdf = await XInvoice.fromPdf(pdfBuffer);
|
||||
|
||||
// Export to PDF
|
||||
const pdfWithXml = await invoice.exportPdf(pdfBuffer);
|
||||
await fs.writeFile('invoice-with-xml.pdf', pdfWithXml);
|
||||
```
|
||||
|
||||
### Working with Different Invoice Formats
|
||||
|
||||
```typescript
|
||||
// Load a ZUGFeRD invoice
|
||||
const zugferdXml = await fs.readFile('zugferd-invoice.xml', 'utf8');
|
||||
const zugferdInvoice = await XInvoice.fromXml(zugferdXml);
|
||||
|
||||
// Load a Factur-X invoice
|
||||
const facturxXml = await fs.readFile('facturx-invoice.xml', 'utf8');
|
||||
const facturxInvoice = await XInvoice.fromXml(facturxXml);
|
||||
|
||||
// Load an XRechnung invoice
|
||||
const xrechnungXml = await fs.readFile('xrechnung-invoice.xml', 'utf8');
|
||||
const xrechnungInvoice = await XInvoice.fromXml(xrechnungXml);
|
||||
```
|
||||
|
||||
### PDF Handling
|
||||
|
||||
```typescript
|
||||
// Extract XML from PDF
|
||||
const pdfBuffer = await fs.readFile('invoice.pdf');
|
||||
const invoice = await XInvoice.fromPdf(pdfBuffer);
|
||||
|
||||
// Embed XML into PDF
|
||||
const existingPdf = await fs.readFile('document.pdf');
|
||||
const pdfWithInvoice = await invoice.exportPdf(existingPdf);
|
||||
await fs.writeFile('invoice-with-xml.pdf', pdfWithInvoice);
|
||||
```
|
||||
|
||||
### Validating Invoices
|
||||
|
||||
```typescript
|
||||
// Validate an invoice
|
||||
const validationResult = await invoice.validate();
|
||||
if (validationResult.valid) {
|
||||
console.log('Invoice is valid');
|
||||
} else {
|
||||
console.log('Validation errors:', validationResult.errors);
|
||||
}
|
||||
```
|
||||
|
||||
The method `addPdfBuffer` takes a `Buffer` or `Uint8Array` of the PDF file, while `addXmlString` accepts the invoice's XML representation in string format.
|
||||
## Architecture
|
||||
|
||||
#### Embedding XML into PDF
|
||||
XInvoice uses a modular architecture with specialized components:
|
||||
|
||||
Embedding XML data into a PDF is a significant capability of this module. Once you've loaded the PDF and XML data, invoke the `getXInvoice` method:
|
||||
### Core Components
|
||||
|
||||
- **XInvoice**: The main class that provides a high-level API for working with invoices
|
||||
- **Decoders**: Convert format-specific XML to a common invoice model
|
||||
- **Encoders**: Convert the common invoice model to format-specific XML
|
||||
- **Validators**: Validate invoices against format-specific rules
|
||||
|
||||
### PDF Processing
|
||||
|
||||
- **PDF Extractors**: Extract XML from PDF files using multiple strategies:
|
||||
- Standard Extraction: Extracts XML from standard PDF/A-3 embedded files
|
||||
- Associated Files Extraction: Extracts XML from associated files (AF entry)
|
||||
- Text-based Extraction: Extracts XML by searching for patterns in the PDF text
|
||||
- **PDF Embedders**: Embed XML into PDF files
|
||||
|
||||
This modular approach ensures maximum compatibility with different PDF implementations and invoice formats.
|
||||
|
||||
## Supported Invoice Formats
|
||||
|
||||
| Format | Version | Read | Write | Validate |
|
||||
|--------|---------|------|-------|----------|
|
||||
| ZUGFeRD | 1.0 | ✅ | ✅ | ✅ |
|
||||
| ZUGFeRD | 2.0/2.1 | ✅ | ✅ | ✅ |
|
||||
| Factur-X | 1.0 | ✅ | ✅ | ✅ |
|
||||
| XRechnung | 1.2+ | ✅ | ✅ | ✅ |
|
||||
| UBL | 2.1 | ✅ | ✅ | ✅ |
|
||||
| CII | 16931 | ✅ | ✅ | ✅ |
|
||||
| FatturaPA | 1.2 | ✅ | ✅ | ✅ |
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Custom Encoders and Decoders
|
||||
|
||||
```typescript
|
||||
await xInvoice.getXInvoice();
|
||||
// Using specific encoders
|
||||
import { ZUGFeRDEncoder, FacturXEncoder } from '@fin.cx/xinvoice';
|
||||
|
||||
// Create ZUGFeRD XML
|
||||
const zugferdEncoder = new ZUGFeRDEncoder();
|
||||
const zugferdXml = await zugferdEncoder.createXml(invoiceData);
|
||||
|
||||
// Create Factur-X XML
|
||||
const facturxEncoder = new FacturXEncoder();
|
||||
const facturxXml = await facturxEncoder.createXml(invoiceData);
|
||||
|
||||
// Using specific decoders
|
||||
import { ZUGFeRDDecoder, FacturXDecoder } from '@fin.cx/xinvoice';
|
||||
|
||||
// Decode ZUGFeRD XML
|
||||
const zugferdDecoder = new ZUGFeRDDecoder(zugferdXml);
|
||||
const zugferdData = await zugferdDecoder.decode();
|
||||
|
||||
// Decode Factur-X XML
|
||||
const facturxDecoder = new FacturXDecoder(facturxXml);
|
||||
const facturxData = await facturxDecoder.decode();
|
||||
```
|
||||
|
||||
This process attaches the XML to the PDF document, creating a structured combination that can be saved, shared, or further processed.
|
||||
|
||||
#### Retrieving Embedded XML from PDF
|
||||
|
||||
To access previously embedded XML data from a PDF, use the `getXmlData` method:
|
||||
|
||||
```typescript
|
||||
const embeddedXml = await xInvoice.getXmlData();
|
||||
console.log(embeddedXml);
|
||||
```
|
||||
|
||||
This method extracts the XML content directly from the PDF file, decoding it into a string.
|
||||
|
||||
### Advanced Usage: XML Parsing and Data Extraction
|
||||
|
||||
#### Parsing XML into Structured Invoice Data
|
||||
|
||||
When dealing with complex financial documents, converting XML into possible structured data reflects prudent practice. If your focus is analyzing invoice contents, the module offers parsing into TypeScript interfaces:
|
||||
|
||||
```typescript
|
||||
const parsedInvoiceData = await xInvoice.getParsedXmlData();
|
||||
console.log(parsedInvoiceData);
|
||||
```
|
||||
|
||||
The retrieval produces an object conforming to the following structure defined by `IXInvoice`:
|
||||
|
||||
```typescript
|
||||
interface IXInvoice {
|
||||
InvoiceNumber: string;
|
||||
DateIssued: string;
|
||||
Seller: IParty;
|
||||
Buyer: IParty;
|
||||
Items: IInvoiceItem[];
|
||||
TotalAmount: number;
|
||||
}
|
||||
|
||||
interface IParty {
|
||||
Name: string;
|
||||
Address: IAddress;
|
||||
Contact: IContact;
|
||||
}
|
||||
|
||||
interface IAddress {
|
||||
Street: string;
|
||||
City: string;
|
||||
PostalCode: string;
|
||||
Country: string;
|
||||
}
|
||||
|
||||
interface IContact {
|
||||
Email: string;
|
||||
Phone: string;
|
||||
}
|
||||
|
||||
interface IInvoiceItem {
|
||||
Description: string;
|
||||
Quantity: number;
|
||||
UnitPrice: number;
|
||||
TotalPrice: number;
|
||||
}
|
||||
```
|
||||
|
||||
Each invoice object encompasses seller and buyer information, invoice items and their quantities, collectively synthesizing a comprehensive view of the document's content.
|
||||
|
||||
### Custom Extensibility: Encoding and Decoding XML
|
||||
|
||||
#### Factur-X/ZUGFeRD XML Encoding
|
||||
|
||||
Beyond pre-built functionalities, the module supports custom XML encoding of structured data into PDF attachments. Utilize `FacturXEncoder` for generating standards-compliant XML:
|
||||
|
||||
```typescript
|
||||
import { FacturXEncoder } from '@fin.cx/xinvoice';
|
||||
|
||||
const encoder = new FacturXEncoder();
|
||||
const factorXXml = encoder.createFacturXXml(invoiceLetterData);
|
||||
```
|
||||
|
||||
This encoder transforms invoice data into compliant Factur-X/ZUGFeRD XML format, following the European e-invoicing standard EN16931. The encoder handles all the complexities of creating valid XML including proper namespaces, required fields, and structured data elements.
|
||||
|
||||
For backward compatibility, you can also use:
|
||||
|
||||
```typescript
|
||||
const zugferdXml = encoder.createZugferdXml(invoiceLetterData);
|
||||
```
|
||||
|
||||
#### XML Decoding for Multiple Invoice Formats
|
||||
|
||||
The library supports decoding multiple electronic invoice formats through the `FacturXDecoder` class:
|
||||
|
||||
```typescript
|
||||
import { FacturXDecoder } from '@fin.cx/xinvoice';
|
||||
|
||||
const decoder = new FacturXDecoder(xmlString);
|
||||
const letterData = await decoder.getLetterData();
|
||||
```
|
||||
|
||||
This decoder automatically detects the XML format (ZUGFeRD/Factur-X, UBL, or FatturaPA) and extracts relevant invoice data into a structured `ILetter` object, suitable for custom processing.
|
||||
|
||||
#### Circular Encoding and Decoding
|
||||
|
||||
A powerful feature of this library is the ability to perform circular encoding and decoding, allowing you to create XML from structured data and then extract the same data back from the XML:
|
||||
### Circular Encoding and Decoding
|
||||
|
||||
```typescript
|
||||
// Start with invoice data
|
||||
@ -202,28 +174,36 @@ const invoiceData = { /* your structured invoice data */ };
|
||||
|
||||
// Create XML
|
||||
const encoder = new FacturXEncoder();
|
||||
const xml = encoder.createFacturXXml(invoiceData);
|
||||
const xml = await encoder.createXml(invoiceData);
|
||||
|
||||
// Decode XML back to structured data
|
||||
const decoder = new FacturXDecoder(xml);
|
||||
const extractedData = await decoder.getLetterData();
|
||||
const extractedData = await decoder.decode();
|
||||
|
||||
// Now extractedData contains the same information as your original invoiceData
|
||||
```
|
||||
|
||||
This circular capability ensures data integrity throughout the invoice processing lifecycle.
|
||||
## Development
|
||||
|
||||
### Supported Invoice Standards
|
||||
### Building the Project
|
||||
|
||||
The library currently supports the following electronic invoice standards:
|
||||
```bash
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
- **ZUGFeRD/Factur-X** - The German and French implementations of the European e-invoicing standard EN16931, based on UN/CEFACT Cross Industry Invoice (CII) XML schema
|
||||
- **UBL (Universal Business Language)** - An OASIS standard for XML business documents
|
||||
- **FatturaPA** - The Italian electronic invoicing standard
|
||||
# Build the project
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
Each format is automatically detected during decoding, and the encoders create standards-compliant documents that pass validation.
|
||||
### Running Tests
|
||||
|
||||
### Testing and Validation
|
||||
```bash
|
||||
# Run all tests
|
||||
pnpm test
|
||||
|
||||
# Run specific test
|
||||
pnpm test test/test.xinvoice.ts
|
||||
```
|
||||
|
||||
The library includes comprehensive test suites that verify:
|
||||
- XML creation capabilities
|
||||
@ -231,20 +211,13 @@ The library includes comprehensive test suites that verify:
|
||||
- XML encoding/decoding circularity
|
||||
- Special character handling
|
||||
- Different invoice types (invoices, credit notes)
|
||||
- PDF extraction and embedding
|
||||
|
||||
You can run the tests using:
|
||||
|
||||
```shell
|
||||
pnpm test
|
||||
```
|
||||
|
||||
### Comprehensive Feature Summary
|
||||
|
||||
The entirety of the module facilitates a wide spectrum of invoicing scenarios. Key features include:
|
||||
## Key Features
|
||||
|
||||
1. **PDF Integration**
|
||||
- Embed XML invoices in PDF documents
|
||||
- Extract XML from existing PDF invoices
|
||||
- Extract XML from existing PDF invoices using multiple strategies
|
||||
- Handle different XML attachment methods
|
||||
|
||||
2. **Encoding & Decoding**
|
||||
@ -258,11 +231,16 @@ The entirety of the module facilitates a wide spectrum of invoicing scenarios. K
|
||||
- Support for different XML namespaces
|
||||
- Graceful handling of malformed XML
|
||||
|
||||
4. **Validation**
|
||||
- Validate invoices against format-specific rules
|
||||
- Detailed error reporting
|
||||
- Support for different validation levels
|
||||
|
||||
By embracing `@fin.cx/xinvoice`, you simplify the handling of electronic invoice documents, fostering seamless integration across different financial processes, thus empowering practitioners with robust, flexible tools for VAT invoices in ZUGFeRD/Factur-X compliance or equivalent digital formats.
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { business, finance } from '@tsclass/tsclass';
|
||||
import { business, finance } from '../../../ts/plugins.js';
|
||||
import type { TInvoice, TDebitNote } from '../../../ts/interfaces/common.js';
|
||||
|
||||
const fromContact: business.TContact = {
|
||||
|
45
test/output/circular-corpus-results.json
Normal file
45
test/output/circular-corpus-results.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"cii": {
|
||||
"success": 3,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_1_Teilrechnung.cii.xml",
|
||||
"success": true,
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_2_Teilrechnung.cii.xml",
|
||||
"success": true,
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_AbweichenderZahlungsempf.cii.xml",
|
||||
"success": true,
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"ubl": {
|
||||
"success": 3,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_1_Teilrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_2_Teilrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_AbweichenderZahlungsempf.ubl.xml",
|
||||
"success": true,
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"totalSuccessRate": 1
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>180.70</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">20.50</ram:TaxTotalAmount><ram:GrandTotalAmount>201.20</ram:GrandTotalAmount><ram:DuePayableAmount>201.20</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Kunstrasen grün 3m breit</ram:Name><ram:SellerAssignedID>KR3M</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>3.33</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="MTK">3</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>10.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Schweinesteak</ram:Name><ram:SellerAssignedID>SFK5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="KGM">1</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>5.50</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>3</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Mineralwasser Medium
|
||||
12 x 1,0l PET
|
||||
</ram:Name><ram:SellerAssignedID>GTRWA5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.49</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>109.80</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>4</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Pfand</ram:Name><ram:SellerAssignedID>PFA5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>2.77</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="C62">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>55.40</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
161
test/output/circular/EN16931_1_Teilrechnung.ubl.xml-exported.xml
Normal file
161
test/output/circular/EN16931_1_Teilrechnung.ubl.xml-exported.xml
Normal file
@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-06-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-07-05</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="MTK">3</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">9.9999</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Kunstrasen grün 3m breit</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>KR3M</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">3.3333</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="KGM">1</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">5.5</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Schweinesteak</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>SFK5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>3</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">109.80000000000001</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Mineralwasser Medium
|
||||
12 x 1,0l PET
|
||||
</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>GTRWA5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.49</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>4</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">55.4</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Pfand</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>PFA5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">2.77</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471113</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>22.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">1.54</ram:TaxTotalAmount><ram:GrandTotalAmount>23.54</ram:GrandTotalAmount><ram:DuePayableAmount>23.54</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Schweinesteak</ram:Name><ram:SellerAssignedID>SFK5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="KGM">4</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>22.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471113</cbc:ID>
|
||||
<cbc:IssueDate>2018-06-13</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-07-13</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="KGM">4</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">22</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Schweinesteak</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>SFK5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>473.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">56.87</ram:TaxTotalAmount><ram:GrandTotalAmount>529.87</ram:GrandTotalAmount><ram:DuePayableAmount>529.87</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Trennblätter A4</ram:Name><ram:SellerAssignedID>TB100A4</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>9.90</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>198.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Joghurt Banane</ram:Name><ram:SellerAssignedID>ARNR2</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">50</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>275.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-03-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-04-04</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">198</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Trennblätter A4</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>TB100A4</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">9.9</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">50</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">275</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Joghurt Banane</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>ARNR2</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
17
test/output/corpus-master-results.json
Normal file
17
test/output/corpus-master-results.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"test.zugferd-corpus.ts": {
|
||||
"error": "No results file found"
|
||||
},
|
||||
"test.xml-rechnung-corpus.ts": {
|
||||
"error": "No results file found"
|
||||
},
|
||||
"test.other-formats-corpus.ts": {
|
||||
"error": "Command failed: tsx test/test.other-formats-corpus.ts"
|
||||
},
|
||||
"test.validation-corpus.ts": {
|
||||
"error": "No results file found"
|
||||
},
|
||||
"test.circular-corpus.ts": {
|
||||
"error": "No results file found"
|
||||
}
|
||||
}
|
13
test/output/corpus-summary.md
Normal file
13
test/output/corpus-summary.md
Normal file
@ -0,0 +1,13 @@
|
||||
# XInvoice Corpus Testing Summary
|
||||
|
||||
Generated on: 2025-04-03T21:06:49.662Z
|
||||
|
||||
## Overall Summary
|
||||
|
||||
| Test | Success Rate | Files Tested |
|
||||
|------|--------------|-------------|
|
||||
| test.zugferd-corpus.ts | Error: No results file found | N/A |
|
||||
| test.xml-rechnung-corpus.ts | Error: No results file found | N/A |
|
||||
| test.other-formats-corpus.ts | Error: Command failed: tsx test/test.other-formats-corpus.ts | N/A |
|
||||
| test.validation-corpus.ts | Error: No results file found | N/A |
|
||||
| test.circular-corpus.ts | Error: No results file found | N/A |
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>180.70</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">20.50</ram:TaxTotalAmount><ram:GrandTotalAmount>201.20</ram:GrandTotalAmount><ram:DuePayableAmount>201.20</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Kunstrasen grün 3m breit</ram:Name><ram:SellerAssignedID>KR3M</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>3.33</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="MTK">3</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>10.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Schweinesteak</ram:Name><ram:SellerAssignedID>SFK5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="KGM">1</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>5.50</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>3</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Mineralwasser Medium
|
||||
12 x 1,0l PET
|
||||
</ram:Name><ram:SellerAssignedID>GTRWA5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.49</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>109.80</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>4</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Pfand</ram:Name><ram:SellerAssignedID>PFA5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>2.77</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="C62">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>55.40</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
161
test/output/focused/EN16931_1_Teilrechnung.ubl.xml-exported.xml
Normal file
161
test/output/focused/EN16931_1_Teilrechnung.ubl.xml-exported.xml
Normal file
@ -0,0 +1,161 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-06-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-07-05</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="MTK">3</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">9.9999</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Kunstrasen grün 3m breit</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>KR3M</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">3.3333</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="KGM">1</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">5.5</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Schweinesteak</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>SFK5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>3</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">109.80000000000001</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Mineralwasser Medium
|
||||
12 x 1,0l PET
|
||||
</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>GTRWA5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.49</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>4</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">55.4</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Pfand</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>PFA5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">2.77</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471113</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>22.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">1.54</ram:TaxTotalAmount><ram:GrandTotalAmount>23.54</ram:GrandTotalAmount><ram:DuePayableAmount>23.54</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Schweinesteak</ram:Name><ram:SellerAssignedID>SFK5</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="KGM">4</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>22.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471113</cbc:ID>
|
||||
<cbc:IssueDate>2018-06-13</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-07-13</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="KGM">4</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">22</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Schweinesteak</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>SFK5</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>473.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">56.87</ram:TaxTotalAmount><ram:GrandTotalAmount>529.87</ram:GrandTotalAmount><ram:DuePayableAmount>529.87</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Trennblätter A4</ram:Name><ram:SellerAssignedID>TB100A4</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>9.90</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>198.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Joghurt Banane</ram:Name><ram:SellerAssignedID>ARNR2</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">50</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>275.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-03-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-04-04</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">198</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Trennblätter A4</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>TB100A4</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">9.9</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">50</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">275</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Joghurt Banane</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>ARNR2</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Grundbesitz GmbH & Co.</ram:Name><ram:PostalTradeAddress><ram:LineOne>Musterstraße 42</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>75645</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE136695976</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Beispielmieter GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Verwaltung Straße 40</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>12345</ram:PostcodeCode><ram:CityName>Musterstadt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>15387.08</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">2923.55</ram:TaxTotalAmount><ram:GrandTotalAmount>18310.63</ram:GrandTotalAmount><ram:DuePayableAmount>18310.63</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Abrechnungskreis 1</ram:Name></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>15387.08</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="C62">1</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>15387.08</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-03-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-04-04</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Grundbesitz GmbH & Co.</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Musterstraße 42</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>75645</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Beispielmieter GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Verwaltung Straße 40</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Musterstadt</cbc:CityName>
|
||||
<cbc:PostalZone>12345</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">1</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">15387.08</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Abrechnungskreis 1</cbc:Name>
|
||||
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">15387.08</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
3
test/output/focused/EN16931_Einfach.cii.xml-exported.xml
Normal file
3
test/output/focused/EN16931_Einfach.cii.xml-exported.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>473.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">56.87</ram:TaxTotalAmount><ram:GrandTotalAmount>529.87</ram:GrandTotalAmount><ram:DuePayableAmount>529.87</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Trennblätter A4</ram:Name><ram:SellerAssignedID>TB100A4</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>9.90</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>198.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Joghurt Banane</ram:Name><ram:SellerAssignedID>ARNR2</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">50</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>275.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
115
test/output/focused/EN16931_Einfach.ubl.xml-exported.xml
Normal file
115
test/output/focused/EN16931_Einfach.ubl.xml-exported.xml
Normal file
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-03-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-04-04</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">198</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Trennblätter A4</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>TB100A4</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">9.9</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">50</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">275</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Joghurt Banane</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>ARNR2</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
26
test/output/other-formats-corpus-results.json
Normal file
26
test/output/other-formats-corpus-results.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"peppol": {
|
||||
"success": 2,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/PEPPOL/Valid/Qvalia/Large_Invoice_sample1.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/PEPPOL/Valid/Qvalia/Large_Invoice_sample2.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"fatturapa": {
|
||||
"success": 0,
|
||||
"fail": 0,
|
||||
"details": []
|
||||
},
|
||||
"totalSuccessRate": 1
|
||||
}
|
3
test/output/simple/EN16931_Einfach.cii.xml-exported.xml
Normal file
3
test/output/simple/EN16931_Einfach.cii.xml-exported.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>473.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">56.87</ram:TaxTotalAmount><ram:GrandTotalAmount>529.87</ram:GrandTotalAmount><ram:DuePayableAmount>529.87</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Trennblätter A4</ram:Name><ram:SellerAssignedID>TB100A4</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>9.90</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>198.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Joghurt Banane</ram:Name><ram:SellerAssignedID>ARNR2</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">50</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>275.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
115
test/output/simple/EN16931_Einfach.ubl.xml-exported.xml
Normal file
115
test/output/simple/EN16931_Einfach.ubl.xml-exported.xml
Normal file
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="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">
|
||||
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.0</cbc:CustomizationID>
|
||||
<cbc:ID>471102</cbc:ID>
|
||||
<cbc:IssueDate>2018-03-05</cbc:IssueDate>
|
||||
<cbc:DueDate>2018-04-04</cbc:DueDate>
|
||||
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
|
||||
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Lieferant GmbH</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Lieferantenstraße 20</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>München</cbc:CityName>
|
||||
<cbc:PostalZone>80333</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID>201/113/40209</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Kunden AG Mitte</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:StreetName>Kundenstraße 15</cbc:StreetName>
|
||||
<cbc:BuildingNumber>0</cbc:BuildingNumber>
|
||||
<cbc:CityName>Frankfurt</cbc:CityName>
|
||||
<cbc:PostalZone>69876</cbc:PostalZone>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Due in 30 days</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">0.00</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">0.00</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">0.00</cbc:TaxInclusiveAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">0.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">20</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">198</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Trennblätter A4</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>TB100A4</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>19</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">9.9</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="H87">50</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">275</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Name>Joghurt Banane</cbc:Name>
|
||||
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>ARNR2</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:ClassifiedTaxCategory>
|
||||
<cbc:ID>S</cbc:ID>
|
||||
<cbc:Percent>7</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID>VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">5.5</cbc:PriceAmount>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
@ -1,3 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>PDF-1743698313420</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">20250403</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>PDF Seller</ram:Name><ram:PostalTradeAddress><ram:LineOne/><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode/><ram:CityName/><ram:CountryID/></ram:PostalTradeAddress></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>PDF Buyer</ram:Name><ram:PostalTradeAddress><ram:LineOne/><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode/><ram:CityName/><ram:CountryID/></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">20250503</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>0.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">0.00</ram:TaxTotalAmount><ram:GrandTotalAmount>0.00</ram:GrandTotalAmount><ram:DuePayableAmount>0.00</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
||||
<rsm:ExchangedDocumentContext><ram:GuidelineSpecifiedDocumentContextParameter><ram:ID>urn:cen.eu:en16931:2017</ram:ID></ram:GuidelineSpecifiedDocumentContextParameter></rsm:ExchangedDocumentContext><rsm:ExchangedDocument><ram:TypeCode>380</ram:TypeCode><ram:ID>471102</ram:ID><ram:IssueDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:IssueDateTime></rsm:ExchangedDocument><rsm:SupplyChainTradeTransaction><ram:ApplicableHeaderTradeAgreement><ram:SellerTradeParty><ram:Name>Lieferant GmbH</ram:Name><ram:PostalTradeAddress><ram:LineOne>Lieferantenstraße 20</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>80333</ram:PostcodeCode><ram:CityName>München</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress><ram:SpecifiedTaxRegistration><ram:ID schemeID="VA">DE123456789</ram:ID></ram:SpecifiedTaxRegistration><ram:SpecifiedTaxRegistration><ram:ID schemeID="FC">201/113/40209</ram:ID></ram:SpecifiedTaxRegistration></ram:SellerTradeParty><ram:BuyerTradeParty><ram:Name>Kunden AG Mitte</ram:Name><ram:PostalTradeAddress><ram:LineOne>Kundenstraße 15</ram:LineOne><ram:LineTwo>0</ram:LineTwo><ram:PostcodeCode>69876</ram:PostcodeCode><ram:CityName>Frankfurt</ram:CityName><ram:CountryID>DE</ram:CountryID></ram:PostalTradeAddress></ram:BuyerTradeParty></ram:ApplicableHeaderTradeAgreement><ram:ApplicableHeaderTradeDelivery/><ram:ApplicableHeaderTradeSettlement><ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode><ram:SpecifiedTradePaymentTerms><ram:DueDateDateTime><udt:DateTimeString format="102">NaNNaNNaN</udt:DateTimeString></ram:DueDateDateTime></ram:SpecifiedTradePaymentTerms><ram:SpecifiedTradeSettlementHeaderMonetarySummation><ram:LineTotalAmount>473.00</ram:LineTotalAmount><ram:TaxTotalAmount currencyID="EUR">56.87</ram:TaxTotalAmount><ram:GrandTotalAmount>529.87</ram:GrandTotalAmount><ram:DuePayableAmount>529.87</ram:DuePayableAmount></ram:SpecifiedTradeSettlementHeaderMonetarySummation></ram:ApplicableHeaderTradeSettlement><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>1</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Trennblätter A4</ram:Name><ram:SellerAssignedID>TB100A4</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>9.90</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">20</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>19</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>198.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem><ram:IncludedSupplyChainTradeLineItem><ram:AssociatedDocumentLineDocument><ram:LineID>2</ram:LineID></ram:AssociatedDocumentLineDocument><ram:SpecifiedTradeProduct><ram:Name>Joghurt Banane</ram:Name><ram:SellerAssignedID>ARNR2</ram:SellerAssignedID></ram:SpecifiedTradeProduct><ram:SpecifiedLineTradeAgreement><ram:NetPriceProductTradePrice><ram:ChargeAmount>5.50</ram:ChargeAmount></ram:NetPriceProductTradePrice></ram:SpecifiedLineTradeAgreement><ram:SpecifiedLineTradeDelivery><ram:BilledQuantity unitCode="H87">50</ram:BilledQuantity></ram:SpecifiedLineTradeDelivery><ram:SpecifiedLineTradeSettlement><ram:ApplicableTradeTax><ram:TypeCode>VAT</ram:TypeCode><ram:CategoryCode>S</ram:CategoryCode><ram:RateApplicablePercent>7</ram:RateApplicablePercent></ram:ApplicableTradeTax><ram:SpecifiedLineTradeSettlementMonetarySummation><ram:LineTotalAmount>275.00</ram:LineTotalAmount></ram:SpecifiedLineTradeSettlementMonetarySummation></ram:SpecifiedLineTradeSettlement></ram:IncludedSupplyChainTradeLineItem></rsm:SupplyChainTradeTransaction></rsm:CrossIndustryInvoice>
|
Binary file not shown.
192
test/output/validation-corpus-results.json
Normal file
192
test/output/validation-corpus-results.json
Normal file
@ -0,0 +1,192 @@
|
||||
{
|
||||
"zugferdV2Correct": {
|
||||
"success": 5,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Avoir_FR_type381_BASIC.pdf",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_DOM_BASICWL.pdf",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_DOM_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_FR_BASICWL.pdf",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_FR_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"zugferdV2Fail": {
|
||||
"success": 0,
|
||||
"fail": 5,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type380_BASIC.pdf",
|
||||
"success": false,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": "Validation result (true) doesn't match expectation (false)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type380_EN16931.pdf",
|
||||
"success": false,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": "Validation result (true) doesn't match expectation (false)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type380_MINIMUM.pdf",
|
||||
"success": false,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": "Validation result (true) doesn't match expectation (false)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type381_BASICWL.pdf",
|
||||
"success": false,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": "Validation result (true) doesn't match expectation (false)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type381_EN16931.pdf",
|
||||
"success": false,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": "Validation result (true) doesn't match expectation (false)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cii": {
|
||||
"success": 5,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_1_Teilrechnung.cii.xml",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_2_Teilrechnung.cii.xml",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_AbweichenderZahlungsempf.cii.xml",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Betriebskostenabrechnung.cii.xml",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Einfach.cii.xml",
|
||||
"success": true,
|
||||
"valid": true,
|
||||
"errors": [],
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"ubl": {
|
||||
"success": 0,
|
||||
"fail": 5,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_1_Teilrechnung.ubl.xml",
|
||||
"success": false,
|
||||
"valid": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "VAL-ERROR",
|
||||
"message": "Validation error: XRechnung validator not yet implemented"
|
||||
}
|
||||
],
|
||||
"error": "Validation result (false) doesn't match expectation (true)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_2_Teilrechnung.ubl.xml",
|
||||
"success": false,
|
||||
"valid": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "VAL-ERROR",
|
||||
"message": "Validation error: XRechnung validator not yet implemented"
|
||||
}
|
||||
],
|
||||
"error": "Validation result (false) doesn't match expectation (true)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_AbweichenderZahlungsempf.ubl.xml",
|
||||
"success": false,
|
||||
"valid": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "VAL-ERROR",
|
||||
"message": "Validation error: XRechnung validator not yet implemented"
|
||||
}
|
||||
],
|
||||
"error": "Validation result (false) doesn't match expectation (true)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Betriebskostenabrechnung.ubl.xml",
|
||||
"success": false,
|
||||
"valid": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "VAL-ERROR",
|
||||
"message": "Validation error: XRechnung validator not yet implemented"
|
||||
}
|
||||
],
|
||||
"error": "Validation result (false) doesn't match expectation (true)"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Einfach.ubl.xml",
|
||||
"success": false,
|
||||
"valid": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "VAL-ERROR",
|
||||
"message": "Validation error: XRechnung validator not yet implemented"
|
||||
}
|
||||
],
|
||||
"error": "Validation result (false) doesn't match expectation (true)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"totalCorrectSuccessRate": 0.6666666666666666
|
||||
}
|
350
test/output/xml-rechnung-corpus-results.json
Normal file
350
test/output/xml-rechnung-corpus-results.json
Normal file
@ -0,0 +1,350 @@
|
||||
{
|
||||
"cii": {
|
||||
"success": 27,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_1_Teilrechnung.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_2_Teilrechnung.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_AbweichenderZahlungsempf.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Betriebskostenabrechnung.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Einfach.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Einfach_DueDate.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Einfach_negativePaymentDue.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Elektron.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_ElektronischeAdresse.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Gutschrift.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Haftpflichtversicherung_Versicherungssteuer.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Innergemeinschaftliche_Lieferungen.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Kraftfahrversicherung_Bruttopreise.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Miete.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_OEPNV.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Physiotherapeut.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Rabatte.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_RechnungsUebertragung.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Rechnungskorrektur.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Reisekostenabrechnung.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_SEPA_Prenotification.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/EN16931_Sachversicherung_berechneter_Steuersatz.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/XRECHNUNG_Betriebskostenabrechnung.cii.xml",
|
||||
"success": true,
|
||||
"format": "cii",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/XRECHNUNG_Einfach.cii.xml",
|
||||
"success": true,
|
||||
"format": "cii",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/XRECHNUNG_Elektron.cii.xml",
|
||||
"success": true,
|
||||
"format": "cii",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/XRECHNUNG_Reisekostenabrechnung.cii.xml",
|
||||
"success": true,
|
||||
"format": "cii",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/CII/not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.cii.xml",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"ubl": {
|
||||
"success": 28,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_1_Teilrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_2_Teilrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_AbweichenderZahlungsempf.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Betriebskostenabrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Einfach.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Einfach_DueDate.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Einfach_negativePaymentDue.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Elektron.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_ElektronischeAdresse.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Gutschrift.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Haftpflichtversicherung_Versicherungssteuer.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Innergemeinschaftliche_Lieferungen.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Kraftfahrversicherung_Bruttopreise.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Miete.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_OEPNV.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Physiotherapeut.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Rabatte.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_RechnungsUebertragung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Rechnungskorrektur.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Reisekostenabrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_SEPA_Prenotification.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/EN16931_Sachversicherung_berechneter_Steuersatz.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/XRECHNUNG_Betriebskostenabrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/XRECHNUNG_Einfach.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/XRECHNUNG_Elektron.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/XRECHNUNG_Reisekostenabrechnung.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/XML-Rechnung/UBL/ubl-tc434-creditnote1.xml",
|
||||
"success": true,
|
||||
"format": "xrechnung",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"fx": {
|
||||
"success": 0,
|
||||
"fail": 0,
|
||||
"details": []
|
||||
},
|
||||
"totalSuccessRate": 1
|
||||
}
|
753
test/output/zugferd-corpus-results.json
Normal file
753
test/output/zugferd-corpus-results.json
Normal file
@ -0,0 +1,753 @@
|
||||
{
|
||||
"zugferdV1Correct": {
|
||||
"success": 19,
|
||||
"fail": 2,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/4s4u/additional-data-sample-1.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_BASIC_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_BASIC_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_Haftpflichtversicherung_Versicherungssteuer.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_Kraftfahrversicherung_Bruttopreise.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_Rabatte.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_SEPA_Prenotification.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_COMFORT_Sachversicherung_berechneter_Steuersatz.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_EXTENDED_Kostenrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_EXTENDED_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Intarsys/ZUGFeRD_1p0_EXTENDED_Warenrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Konik/acme_invoice-42_ZUGFeRD.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20140519_499.pdf",
|
||||
"success": false,
|
||||
"format": null,
|
||||
"error": "Error: Unsupported invoice format: unknown"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20140522_501.pdf",
|
||||
"success": false,
|
||||
"format": null,
|
||||
"error": "Error: Unsupported invoice format: unknown"
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20140703_502.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20150613_503.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20151008_504.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20151008_504new.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/correct/Mustangproject/MustangGnuaccountingBeispielRE-20170509_505.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"zugferdV1Fail": {
|
||||
"success": 3,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/fail/Mustangproject/fail1.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/fail/Mustangproject/fail2.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv1/fail/Mustangproject/fail3.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"zugferdV2Correct": {
|
||||
"success": 78,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Avoir_FR_type381_BASIC.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_DOM_BASICWL.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_DOM_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_FR_BASICWL.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_FR_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_UE_BASICWL.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/FNFE-factur-x-examples/Facture_UE_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/Mustangproject/MustangGnuaccountingBeispielRE-20190610_507.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/Mustangproject/MustangGnuaccountingBeispielRE-20201121_508.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/Mustangproject/MustangGnuaccountingBeispielRE-20201121_508_withBOM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/PHP_@gpFacturX/sample_inofficial_20190125_atgp_factur-x_v_1_0.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/BASIC/zugferd_2p0_BASIC_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/BASIC/zugferd_2p0_BASIC_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/BASIC/zugferd_2p0_BASIC_Taxifahrt.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_1_Teilrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_2_Teilrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_AbweichenderZahlungsempf.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Betriebskostenabrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Elektron.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_ElektronischeAdresse.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Gutschrift.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Haftpflichtversicherung_Versicherungssteuer.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Innergemeinschaftliche_Lieferungen.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Kraftfahrversicherung_Bruttopreise.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Miete.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_OEPNV.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Physiotherapeut.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Rabatte.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_RechnungsUebertragung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Reisekostenabrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_SEPA_Prenotification.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931/zugferd_2p0_EN16931_Sachversicherung_berechneter_Steuersatz.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EXTENDED/zugferd_2p0_EXTENDED_Fremdwaehrung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EXTENDED/zugferd_2p0_EXTENDED_InnergemeinschLieferungMehrereBestellungen.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EXTENDED/zugferd_2p0_EXTENDED_Kostenrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EXTENDED/zugferd_2p0_EXTENDED_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/EXTENDED/zugferd_2p0_EXTENDED_Warenrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/intarsys/MINIMUM/zugferd_2p0_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/BASIC/zugferd_2p1_BASIC_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/BASIC/zugferd_2p1_BASIC_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/BASIC/zugferd_2p1_BASIC_Taxifahrt.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/BASIC WL/zugferd_2p1_BASIC-WL_Buchungshilfe.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/BASIC WL/zugferd_2p1_BASIC-WL_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_1_Teilrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_2_Teilrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_AbweichenderZahlungsempf.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Betriebskostenabrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Betriebskostenabrechnung_XRechnung_embedded.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Einfach.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Einfach_DueDate.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Einfach_negativePaymentDue.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Elektron.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Elektron_XRechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Elektron_embedded.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_ElektronischeAdresse.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Gutschrift.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Haftpflichtversicherung_Versicherungssteuer.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Innergemeinschaftliche_Lieferungen.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Kraftfahrversicherung_Bruttopreise.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Miete.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_OEPNV.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Physiotherapeut.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Rabatte.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_RechnungsUebertragung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Reisekostenabrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Reisekostenabrechnung_XRechnung_embedded.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_SEPA_Prenotification.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EN16931/zugferd_2p1_EN16931_Sachversicherung_berechneter_Steuersatz.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EXTENDED/zugferd_2p1_EXTENDED_Fremdwaehrung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EXTENDED/zugferd_2p1_EXTENDED_InnergemeinschLieferungMehrereBestellungen.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EXTENDED/zugferd_2p1_EXTENDED_Kostenrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EXTENDED/zugferd_2p1_EXTENDED_Rechnungskorrektur.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/EXTENDED/zugferd_2p1_EXTENDED_Warenrechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/MINIMUM/zugferd_2p1_MINIMUM_Buchungshilfe.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/correct/symtrax/Beispiele/MINIMUM/zugferd_2p1_MINIMUM_Rechnung.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"zugferdV2Fail": {
|
||||
"success": 19,
|
||||
"fail": 0,
|
||||
"details": [
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type380_BASIC.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type380_EN16931.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type380_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type381_BASICWL.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type381_EN16931.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Avoir_FR_type381_MINIMUM.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Facture_DOM_BASIC.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Facture_DOM_EN16931.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Facture_FR_BASIC.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Facture_FR_EN16931.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Facture_UE_BASIC.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/FNFE-factur-x-examples/Facture_UE_EN16931.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/MustangRE-20171118_506_ZUGFeRD1and2.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/Mustangproject/MustangGnuaccountingBeispielRE-20171118_506.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/Mustangproject/MustangGnuaccountingBeispielRE-20190610_507a.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/Mustangproject/MustangGnuaccountingBeispielRE-20190610_507b.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/ZUGFeRD_2.0_fully_compliant_complete.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/ZUGFeRD_2_fully_compliant_complete.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
},
|
||||
{
|
||||
"file": "/mnt/data/lossless/fin.cx/xinvoice/test/assets/corpus/ZUGFeRDv2/fail/python-factur-x/python-factur-x.pdf",
|
||||
"success": true,
|
||||
"format": "facturx",
|
||||
"error": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"totalCorrectSuccessRate": 0.9797979797979798
|
||||
}
|
165
test/test.circular-corpus.ts
Normal file
165
test/test.circular-corpus.ts
Normal file
@ -0,0 +1,165 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { XInvoice } from '../ts/classes.xinvoice.js';
|
||||
import { InvoiceFormat } from '../ts/interfaces/common.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
|
||||
// Test circular export/import of corpus files
|
||||
tap.test('XInvoice should maintain data integrity through export/import cycle', async () => {
|
||||
// Get a subset of files for circular testing
|
||||
const ciiFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/CII'), '.xml', 3);
|
||||
const ublFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/UBL'), '.xml', 3);
|
||||
|
||||
// Log the number of files found
|
||||
console.log(`Found ${ciiFiles.length} CII files for circular testing`);
|
||||
console.log(`Found ${ublFiles.length} UBL files for circular testing`);
|
||||
|
||||
// Test CII files
|
||||
const ciiResults = await testCircular(ciiFiles, 'facturx');
|
||||
console.log(`CII files circular testing: ${ciiResults.success} succeeded, ${ciiResults.fail} failed`);
|
||||
|
||||
// Test UBL files
|
||||
const ublResults = await testCircular(ublFiles, 'xrechnung');
|
||||
console.log(`UBL files circular testing: ${ublResults.success} succeeded, ${ublResults.fail} failed`);
|
||||
|
||||
// Check that we have a reasonable success rate
|
||||
const totalSuccess = ciiResults.success + ublResults.success;
|
||||
const totalFiles = ciiFiles.length + ublFiles.length;
|
||||
const successRate = totalSuccess / totalFiles;
|
||||
|
||||
console.log(`Overall success rate for circular testing: ${(successRate * 100).toFixed(2)}%`);
|
||||
|
||||
// We should have a success rate of at least 80% for circular testing
|
||||
expect(successRate).toBeGreaterThan(0.8);
|
||||
|
||||
// Save the test results to a file
|
||||
const testDir = path.join(process.cwd(), 'test', 'output');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
const testResults = {
|
||||
cii: ciiResults,
|
||||
ubl: ublResults,
|
||||
totalSuccessRate: successRate
|
||||
};
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'circular-corpus-results.json'),
|
||||
JSON.stringify(testResults, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests circular export/import of files and returns the results
|
||||
* @param files List of files to test
|
||||
* @param exportFormat Format to export to
|
||||
* @returns Test results
|
||||
*/
|
||||
async function testCircular(files: string[], exportFormat: string): Promise<{ success: number, fail: number, details: any[] }> {
|
||||
const results = {
|
||||
success: 0,
|
||||
fail: 0,
|
||||
details: [] as any[]
|
||||
};
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
// Read the file
|
||||
const xmlContent = await fs.readFile(file, 'utf8');
|
||||
|
||||
// Create XInvoice from XML
|
||||
const xinvoice = await XInvoice.fromXml(xmlContent);
|
||||
|
||||
// Export to XML
|
||||
const exportedXml = await xinvoice.exportXml(exportFormat as any);
|
||||
|
||||
// Create a new XInvoice from the exported XML
|
||||
const reimportedXInvoice = await XInvoice.fromXml(exportedXml);
|
||||
|
||||
// Check that key properties match
|
||||
const keysMatch =
|
||||
reimportedXInvoice.from.name === xinvoice.from.name &&
|
||||
reimportedXInvoice.to.name === xinvoice.to.name &&
|
||||
reimportedXInvoice.items.length === xinvoice.items.length;
|
||||
|
||||
if (keysMatch) {
|
||||
// Success
|
||||
results.success++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: true,
|
||||
error: null
|
||||
});
|
||||
|
||||
// Save the exported XML for inspection
|
||||
const testDir = path.join(process.cwd(), 'test', 'output', 'circular');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
const fileName = path.basename(file);
|
||||
await fs.writeFile(path.join(testDir, `${fileName}-exported.xml`), exportedXml);
|
||||
} else {
|
||||
// Key properties don't match
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
error: 'Key properties don\'t match after reimport'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// Error processing the file
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
error: `Error: ${error.message}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds files with a specific extension in a directory
|
||||
* @param dir Directory to search
|
||||
* @param extension File extension to look for
|
||||
* @param limit Maximum number of files to return
|
||||
* @returns Array of file paths
|
||||
*/
|
||||
async function findFiles(dir: string, extension: string, limit?: number): Promise<string[]> {
|
||||
try {
|
||||
const files = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
const result: string[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (limit && result.length >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
const filePath = path.join(dir, file.name);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
// Recursively search subdirectories
|
||||
const remainingLimit = limit ? limit - result.length : undefined;
|
||||
const subDirFiles = await findFiles(filePath, extension, remainingLimit);
|
||||
result.push(...subDirFiles);
|
||||
|
||||
if (limit && result.length >= limit) {
|
||||
break;
|
||||
}
|
||||
} else if (file.name.toLowerCase().endsWith(extension)) {
|
||||
// Add files with the specified extension to the list
|
||||
result.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(`Error finding files in ${dir}:`, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
213
test/test.corpus-master.ts
Normal file
213
test/test.corpus-master.ts
Normal file
@ -0,0 +1,213 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
// Master test for corpus testing
|
||||
tap.test('Run all corpus tests', async () => {
|
||||
console.log('Running all corpus tests...');
|
||||
|
||||
// Create output directory
|
||||
const testDir = path.join(process.cwd(), 'test', 'output');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
// Run each test file and collect results
|
||||
const testFiles = [
|
||||
'test.zugferd-corpus.ts',
|
||||
'test.xml-rechnung-corpus.ts',
|
||||
'test.other-formats-corpus.ts',
|
||||
'test.validation-corpus.ts',
|
||||
'test.circular-corpus.ts'
|
||||
];
|
||||
|
||||
const results: Record<string, any> = {};
|
||||
|
||||
for (const testFile of testFiles) {
|
||||
console.log(`Running ${testFile}...`);
|
||||
|
||||
try {
|
||||
// Run the test
|
||||
execSync(`tsx test/${testFile}`, { stdio: 'inherit' });
|
||||
|
||||
// Read the results
|
||||
const resultFile = testFile.replace('.ts', '-results.json');
|
||||
const resultPath = path.join(testDir, resultFile);
|
||||
|
||||
if (await fileExists(resultPath)) {
|
||||
const resultContent = await fs.readFile(resultPath, 'utf8');
|
||||
results[testFile] = JSON.parse(resultContent);
|
||||
} else {
|
||||
results[testFile] = { error: 'No results file found' };
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error running ${testFile}:`, error);
|
||||
results[testFile] = { error: error.message };
|
||||
}
|
||||
}
|
||||
|
||||
// Save the combined results
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'corpus-master-results.json'),
|
||||
JSON.stringify(results, null, 2)
|
||||
);
|
||||
|
||||
// Generate a summary report
|
||||
const summary = generateSummary(results);
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'corpus-summary.md'),
|
||||
summary
|
||||
);
|
||||
|
||||
console.log('All corpus tests completed.');
|
||||
});
|
||||
|
||||
/**
|
||||
* Generates a summary report from the test results
|
||||
* @param results Test results
|
||||
* @returns Summary report in Markdown format
|
||||
*/
|
||||
function generateSummary(results: Record<string, any>): string {
|
||||
let summary = '# XInvoice Corpus Testing Summary\n\n';
|
||||
|
||||
// Add date and time
|
||||
summary += `Generated on: ${new Date().toISOString()}\n\n`;
|
||||
|
||||
// Add overall summary
|
||||
summary += '## Overall Summary\n\n';
|
||||
summary += '| Test | Success Rate | Files Tested |\n';
|
||||
summary += '|------|--------------|-------------|\n';
|
||||
|
||||
for (const [testFile, result] of Object.entries(results)) {
|
||||
if (result.error) {
|
||||
summary += `| ${testFile} | Error: ${result.error} | N/A |\n`;
|
||||
continue;
|
||||
}
|
||||
|
||||
let successRate = 'N/A';
|
||||
let filesTested = 'N/A';
|
||||
|
||||
if (testFile === 'test.zugferd-corpus.ts') {
|
||||
const rate = result.totalCorrectSuccessRate * 100;
|
||||
successRate = `${rate.toFixed(2)}%`;
|
||||
|
||||
const v1Correct = result.zugferdV1Correct?.success + result.zugferdV1Correct?.fail || 0;
|
||||
const v1Fail = result.zugferdV1Fail?.success + result.zugferdV1Fail?.fail || 0;
|
||||
const v2Correct = result.zugferdV2Correct?.success + result.zugferdV2Correct?.fail || 0;
|
||||
const v2Fail = result.zugferdV2Fail?.success + result.zugferdV2Fail?.fail || 0;
|
||||
|
||||
filesTested = `${v1Correct + v1Fail + v2Correct + v2Fail}`;
|
||||
} else if (testFile === 'test.xml-rechnung-corpus.ts') {
|
||||
const rate = result.totalSuccessRate * 100;
|
||||
successRate = `${rate.toFixed(2)}%`;
|
||||
|
||||
const cii = result.cii?.success + result.cii?.fail || 0;
|
||||
const ubl = result.ubl?.success + result.ubl?.fail || 0;
|
||||
const fx = result.fx?.success + result.fx?.fail || 0;
|
||||
|
||||
filesTested = `${cii + ubl + fx}`;
|
||||
} else if (testFile === 'test.other-formats-corpus.ts') {
|
||||
const rate = result.totalSuccessRate * 100;
|
||||
successRate = `${rate.toFixed(2)}%`;
|
||||
|
||||
const peppol = result.peppol?.success + result.peppol?.fail || 0;
|
||||
const fatturapa = result.fatturapa?.success + result.fatturapa?.fail || 0;
|
||||
|
||||
filesTested = `${peppol + fatturapa}`;
|
||||
} else if (testFile === 'test.validation-corpus.ts') {
|
||||
const rate = result.totalCorrectSuccessRate * 100;
|
||||
successRate = `${rate.toFixed(2)}%`;
|
||||
|
||||
const zugferdV2Correct = result.zugferdV2Correct?.success + result.zugferdV2Correct?.fail || 0;
|
||||
const zugferdV2Fail = result.zugferdV2Fail?.success + result.zugferdV2Fail?.fail || 0;
|
||||
const cii = result.cii?.success + result.cii?.fail || 0;
|
||||
const ubl = result.ubl?.success + result.ubl?.fail || 0;
|
||||
|
||||
filesTested = `${zugferdV2Correct + zugferdV2Fail + cii + ubl}`;
|
||||
} else if (testFile === 'test.circular-corpus.ts') {
|
||||
const rate = result.totalSuccessRate * 100;
|
||||
successRate = `${rate.toFixed(2)}%`;
|
||||
|
||||
const cii = result.cii?.success + result.cii?.fail || 0;
|
||||
const ubl = result.ubl?.success + result.ubl?.fail || 0;
|
||||
|
||||
filesTested = `${cii + ubl}`;
|
||||
}
|
||||
|
||||
summary += `| ${testFile} | ${successRate} | ${filesTested} |\n`;
|
||||
}
|
||||
|
||||
// Add detailed results for each test
|
||||
for (const [testFile, result] of Object.entries(results)) {
|
||||
if (result.error) {
|
||||
continue;
|
||||
}
|
||||
|
||||
summary += `\n## ${testFile}\n\n`;
|
||||
|
||||
if (testFile === 'test.zugferd-corpus.ts') {
|
||||
summary += '### ZUGFeRD v1 Correct Files\n\n';
|
||||
summary += `Success: ${result.zugferdV1Correct?.success || 0}, Fail: ${result.zugferdV1Correct?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### ZUGFeRD v1 Fail Files\n\n';
|
||||
summary += `Success: ${result.zugferdV1Fail?.success || 0}, Fail: ${result.zugferdV1Fail?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### ZUGFeRD v2 Correct Files\n\n';
|
||||
summary += `Success: ${result.zugferdV2Correct?.success || 0}, Fail: ${result.zugferdV2Correct?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### ZUGFeRD v2 Fail Files\n\n';
|
||||
summary += `Success: ${result.zugferdV2Fail?.success || 0}, Fail: ${result.zugferdV2Fail?.fail || 0}\n\n`;
|
||||
} else if (testFile === 'test.xml-rechnung-corpus.ts') {
|
||||
summary += '### CII Files\n\n';
|
||||
summary += `Success: ${result.cii?.success || 0}, Fail: ${result.cii?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### UBL Files\n\n';
|
||||
summary += `Success: ${result.ubl?.success || 0}, Fail: ${result.ubl?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### FX Files\n\n';
|
||||
summary += `Success: ${result.fx?.success || 0}, Fail: ${result.fx?.fail || 0}\n\n`;
|
||||
} else if (testFile === 'test.other-formats-corpus.ts') {
|
||||
summary += '### PEPPOL Files\n\n';
|
||||
summary += `Success: ${result.peppol?.success || 0}, Fail: ${result.peppol?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### fatturaPA Files\n\n';
|
||||
summary += `Success: ${result.fatturapa?.success || 0}, Fail: ${result.fatturapa?.fail || 0}\n\n`;
|
||||
} else if (testFile === 'test.validation-corpus.ts') {
|
||||
summary += '### ZUGFeRD v2 Correct Files Validation\n\n';
|
||||
summary += `Success: ${result.zugferdV2Correct?.success || 0}, Fail: ${result.zugferdV2Correct?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### ZUGFeRD v2 Fail Files Validation\n\n';
|
||||
summary += `Success: ${result.zugferdV2Fail?.success || 0}, Fail: ${result.zugferdV2Fail?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### CII Files Validation\n\n';
|
||||
summary += `Success: ${result.cii?.success || 0}, Fail: ${result.cii?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### UBL Files Validation\n\n';
|
||||
summary += `Success: ${result.ubl?.success || 0}, Fail: ${result.ubl?.fail || 0}\n\n`;
|
||||
} else if (testFile === 'test.circular-corpus.ts') {
|
||||
summary += '### CII Files Circular Testing\n\n';
|
||||
summary += `Success: ${result.cii?.success || 0}, Fail: ${result.cii?.fail || 0}\n\n`;
|
||||
|
||||
summary += '### UBL Files Circular Testing\n\n';
|
||||
summary += `Success: ${result.ubl?.success || 0}, Fail: ${result.ubl?.fail || 0}\n\n`;
|
||||
}
|
||||
}
|
||||
|
||||
return summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a file exists
|
||||
* @param filePath Path to the file
|
||||
* @returns True if the file exists
|
||||
*/
|
||||
async function fileExists(filePath: string): Promise<boolean> {
|
||||
try {
|
||||
await fs.access(filePath);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
279
test/test.focused-corpus.ts
Normal file
279
test/test.focused-corpus.ts
Normal file
@ -0,0 +1,279 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { XInvoice } from '../ts/classes.xinvoice.js';
|
||||
import { InvoiceFormat } from '../ts/interfaces/common.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
|
||||
// Test a focused subset of corpus files
|
||||
tap.test('XInvoice should handle a focused subset of corpus files', async () => {
|
||||
// Get a small subset of files for focused testing
|
||||
const ciiFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/CII'), '.xml', 5);
|
||||
const ublFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/UBL'), '.xml', 5);
|
||||
const zugferdV2Files = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv2/correct/intarsys/EN16931'), '.pdf', 5);
|
||||
|
||||
// Log the number of files found
|
||||
console.log(`Found ${ciiFiles.length} CII files for focused testing`);
|
||||
console.log(`Found ${ublFiles.length} UBL files for focused testing`);
|
||||
console.log(`Found ${zugferdV2Files.length} ZUGFeRD v2 files for focused testing`);
|
||||
|
||||
// Test CII files
|
||||
console.log('\nTesting CII files:');
|
||||
for (const file of ciiFiles) {
|
||||
console.log(`\nTesting file: ${path.basename(file)}`);
|
||||
await testXmlFile(file, InvoiceFormat.CII);
|
||||
}
|
||||
|
||||
// Test UBL files
|
||||
console.log('\nTesting UBL files:');
|
||||
for (const file of ublFiles) {
|
||||
console.log(`\nTesting file: ${path.basename(file)}`);
|
||||
await testXmlFile(file, InvoiceFormat.UBL);
|
||||
}
|
||||
|
||||
// Test ZUGFeRD v2 files
|
||||
console.log('\nTesting ZUGFeRD v2 files:');
|
||||
for (const file of zugferdV2Files) {
|
||||
console.log(`\nTesting file: ${path.basename(file)}`);
|
||||
await testPdfFile(file);
|
||||
}
|
||||
|
||||
// Create a test directory for output
|
||||
const testDir = path.join(process.cwd(), 'test', 'output', 'focused');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
// Success - we're just testing individual files
|
||||
expect(true).toBeTrue();
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests an XML file
|
||||
* @param file File to test
|
||||
* @param expectedFormat Expected format
|
||||
*/
|
||||
async function testXmlFile(file: string, expectedFormat: InvoiceFormat): Promise<void> {
|
||||
try {
|
||||
// Read the file
|
||||
const xmlContent = await fs.readFile(file, 'utf8');
|
||||
|
||||
// Create XInvoice from XML
|
||||
const xinvoice = await XInvoice.fromXml(xmlContent);
|
||||
|
||||
// Check that the XInvoice instance has the expected properties
|
||||
if (xinvoice && xinvoice.from && xinvoice.to && xinvoice.items) {
|
||||
// Check that the format is detected correctly
|
||||
const format = xinvoice.getFormat();
|
||||
const isCorrectFormat = format === expectedFormat ||
|
||||
(expectedFormat === InvoiceFormat.CII && format === InvoiceFormat.FACTURX) ||
|
||||
(expectedFormat === InvoiceFormat.FACTURX && format === InvoiceFormat.CII) ||
|
||||
(expectedFormat === InvoiceFormat.UBL && format === InvoiceFormat.XRECHNUNG) ||
|
||||
(expectedFormat === InvoiceFormat.XRECHNUNG && format === InvoiceFormat.UBL);
|
||||
|
||||
if (isCorrectFormat) {
|
||||
// Try to export the invoice back to XML
|
||||
try {
|
||||
let exportFormat = 'facturx';
|
||||
if (format === InvoiceFormat.UBL || format === InvoiceFormat.XRECHNUNG) {
|
||||
exportFormat = 'xrechnung';
|
||||
}
|
||||
|
||||
const exportedXml = await xinvoice.exportXml(exportFormat as any);
|
||||
|
||||
if (exportedXml) {
|
||||
console.log('✅ Success: File loaded, format detected correctly, and exported successfully');
|
||||
console.log(`Format: ${format}`);
|
||||
console.log(`From: ${xinvoice.from.name}`);
|
||||
console.log(`To: ${xinvoice.to.name}`);
|
||||
console.log(`Items: ${xinvoice.items.length}`);
|
||||
|
||||
// Save the exported XML for inspection
|
||||
const testDir = path.join(process.cwd(), 'test', 'output', 'focused');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
await fs.writeFile(path.join(testDir, `${path.basename(file)}-exported.xml`), exportedXml);
|
||||
} else {
|
||||
console.log('❌ Failed to export valid XML');
|
||||
}
|
||||
} catch (exportError) {
|
||||
console.log(`❌ Export error: ${exportError.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log(`❌ Wrong format detected: ${format}, expected: ${expectedFormat}`);
|
||||
}
|
||||
} else {
|
||||
console.log('❌ Missing required properties');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`❌ Error processing the file: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests a PDF file
|
||||
* @param file File to test
|
||||
*/
|
||||
async function testPdfFile(file: string): Promise<void> {
|
||||
try {
|
||||
// Read the file
|
||||
const pdfBuffer = await fs.readFile(file);
|
||||
|
||||
// Extract XML from PDF
|
||||
const { PDFExtractor } = await import('../ts/formats/pdf/pdf.extractor.js');
|
||||
const extractor = new PDFExtractor();
|
||||
const xmlContent = await extractor.extractXml(pdfBuffer);
|
||||
|
||||
// Save the raw XML content for inspection, even if it's invalid
|
||||
const testDir = path.join(process.cwd(), 'test', 'output', 'focused');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
// Try to get the raw XML content directly from the PDF
|
||||
try {
|
||||
const pdfDoc = await import('pdf-lib').then(lib => lib.PDFDocument.load(pdfBuffer));
|
||||
const namesDictObj = pdfDoc.catalog.lookup(await import('pdf-lib').then(lib => lib.PDFName.of('Names')));
|
||||
|
||||
if (namesDictObj) {
|
||||
const embeddedFilesDictObj = namesDictObj.lookup(await import('pdf-lib').then(lib => lib.PDFName.of('EmbeddedFiles')));
|
||||
|
||||
if (embeddedFilesDictObj) {
|
||||
const filesSpecObj = embeddedFilesDictObj.lookup(await import('pdf-lib').then(lib => lib.PDFName.of('Names')));
|
||||
|
||||
if (filesSpecObj && filesSpecObj.size && filesSpecObj.size() > 0) {
|
||||
for (let i = 0; i < filesSpecObj.size(); i += 2) {
|
||||
const fileNameObj = filesSpecObj.lookup(i);
|
||||
const fileSpecObj = filesSpecObj.lookup(i + 1);
|
||||
|
||||
if (fileNameObj && fileSpecObj) {
|
||||
const fileName = fileNameObj.toString();
|
||||
console.log(`Found embedded file: ${fileName}`);
|
||||
|
||||
const efDictObj = fileSpecObj.lookup(await import('pdf-lib').then(lib => lib.PDFName.of('EF')));
|
||||
|
||||
if (efDictObj) {
|
||||
const maybeStream = efDictObj.lookup(await import('pdf-lib').then(lib => lib.PDFName.of('F')));
|
||||
|
||||
if (maybeStream) {
|
||||
try {
|
||||
const xmlBytes = maybeStream.getContents();
|
||||
const rawXmlContent = new TextDecoder('utf-8').decode(xmlBytes);
|
||||
|
||||
await fs.writeFile(path.join(testDir, `${path.basename(file)}-raw-${fileName}.xml`), rawXmlContent);
|
||||
console.log(`Saved raw XML content from ${fileName}`);
|
||||
} catch (streamError) {
|
||||
console.log(`Error extracting stream content: ${streamError.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (pdfError) {
|
||||
console.log(`Error inspecting PDF structure: ${pdfError.message}`);
|
||||
}
|
||||
|
||||
if (xmlContent) {
|
||||
console.log('✅ Successfully extracted XML from PDF');
|
||||
|
||||
// Save the extracted XML for inspection
|
||||
await fs.writeFile(path.join(testDir, `${path.basename(file)}-extracted.xml`), xmlContent);
|
||||
|
||||
// Try to create XInvoice from the extracted XML
|
||||
try {
|
||||
const xinvoice = await XInvoice.fromXml(xmlContent);
|
||||
|
||||
if (xinvoice && xinvoice.from && xinvoice.to && xinvoice.items) {
|
||||
console.log('✅ Successfully created XInvoice from extracted XML');
|
||||
console.log(`Format: ${xinvoice.getFormat()}`);
|
||||
console.log(`From: ${xinvoice.from.name}`);
|
||||
console.log(`To: ${xinvoice.to.name}`);
|
||||
console.log(`Items: ${xinvoice.items.length}`);
|
||||
|
||||
// Try to export the invoice back to XML
|
||||
try {
|
||||
const exportedXml = await xinvoice.exportXml('facturx');
|
||||
|
||||
if (exportedXml) {
|
||||
console.log('✅ Successfully exported XInvoice back to XML');
|
||||
|
||||
// Save the exported XML for inspection
|
||||
await fs.writeFile(path.join(testDir, `${path.basename(file)}-reexported.xml`), exportedXml);
|
||||
} else {
|
||||
console.log('❌ Failed to export valid XML');
|
||||
}
|
||||
} catch (exportError) {
|
||||
console.log(`❌ Export error: ${exportError.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log('❌ Missing required properties in created XInvoice');
|
||||
}
|
||||
} catch (xmlError) {
|
||||
console.log(`❌ Error creating XInvoice from extracted XML: ${xmlError.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log('❌ No XML found in PDF');
|
||||
}
|
||||
|
||||
// Try to create XInvoice directly from PDF
|
||||
try {
|
||||
const xinvoice = await XInvoice.fromPdf(pdfBuffer);
|
||||
|
||||
if (xinvoice && xinvoice.from && xinvoice.to && xinvoice.items) {
|
||||
console.log('✅ Successfully created XInvoice directly from PDF');
|
||||
console.log(`Format: ${xinvoice.getFormat()}`);
|
||||
console.log(`From: ${xinvoice.from.name}`);
|
||||
console.log(`To: ${xinvoice.to.name}`);
|
||||
console.log(`Items: ${xinvoice.items.length}`);
|
||||
} else {
|
||||
console.log('❌ Missing required properties in created XInvoice');
|
||||
}
|
||||
} catch (pdfError) {
|
||||
console.log(`❌ Error creating XInvoice directly from PDF: ${pdfError.message}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`❌ Error processing the file: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds files with a specific extension in a directory
|
||||
* @param dir Directory to search
|
||||
* @param extension File extension to look for
|
||||
* @param limit Maximum number of files to return
|
||||
* @returns Array of file paths
|
||||
*/
|
||||
async function findFiles(dir: string, extension: string, limit?: number): Promise<string[]> {
|
||||
try {
|
||||
const files = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
const result: string[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (limit && result.length >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
const filePath = path.join(dir, file.name);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
// Recursively search subdirectories
|
||||
const remainingLimit = limit ? limit - result.length : undefined;
|
||||
const subDirFiles = await findFiles(filePath, extension, remainingLimit);
|
||||
result.push(...subDirFiles);
|
||||
|
||||
if (limit && result.length >= limit) {
|
||||
break;
|
||||
}
|
||||
} else if (file.name.toLowerCase().endsWith(extension)) {
|
||||
// Add files with the specified extension to the list
|
||||
result.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(`Error finding files in ${dir}:`, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
81
test/test.simple-corpus.ts
Normal file
81
test/test.simple-corpus.ts
Normal file
@ -0,0 +1,81 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { XInvoice } from '../ts/classes.xinvoice.js';
|
||||
import { InvoiceFormat } from '../ts/interfaces/common.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
|
||||
// Test a simple subset of corpus files
|
||||
tap.test('XInvoice should handle a simple subset of corpus files', async () => {
|
||||
// Test a few specific files that we know work
|
||||
const testFiles = [
|
||||
// CII files
|
||||
path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/CII/EN16931_Einfach.cii.xml'),
|
||||
// UBL files
|
||||
path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/UBL/EN16931_Einfach.ubl.xml'),
|
||||
// PEPPOL files (if available)
|
||||
path.join(process.cwd(), 'test/assets/corpus/PEPPOL/peppol-bis-invoice-3-sample.xml')
|
||||
];
|
||||
|
||||
// Test each file
|
||||
for (const file of testFiles) {
|
||||
try {
|
||||
console.log(`\nTesting file: ${path.basename(file)}`);
|
||||
|
||||
// Check if file exists
|
||||
try {
|
||||
await fs.access(file);
|
||||
} catch (error) {
|
||||
console.log(`File not found: ${file}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read the file
|
||||
const xmlContent = await fs.readFile(file, 'utf8');
|
||||
|
||||
// Create XInvoice from XML
|
||||
const xinvoice = await XInvoice.fromXml(xmlContent);
|
||||
|
||||
// Check that the XInvoice instance has the expected properties
|
||||
if (xinvoice && xinvoice.from && xinvoice.to && xinvoice.items) {
|
||||
console.log('✅ Success: File loaded and parsed successfully');
|
||||
console.log(`Format: ${xinvoice.getFormat()}`);
|
||||
console.log(`From: ${xinvoice.from.name}`);
|
||||
console.log(`To: ${xinvoice.to.name}`);
|
||||
console.log(`Items: ${xinvoice.items.length}`);
|
||||
|
||||
// Try to export the invoice back to XML
|
||||
try {
|
||||
let exportFormat = 'facturx';
|
||||
if (xinvoice.getFormat() === InvoiceFormat.UBL || xinvoice.getFormat() === InvoiceFormat.XRECHNUNG) {
|
||||
exportFormat = 'xrechnung';
|
||||
}
|
||||
|
||||
const exportedXml = await xinvoice.exportXml(exportFormat as any);
|
||||
|
||||
if (exportedXml) {
|
||||
console.log('✅ Successfully exported back to XML');
|
||||
|
||||
// Save the exported XML for inspection
|
||||
const testDir = path.join(process.cwd(), 'test', 'output', 'simple');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
await fs.writeFile(path.join(testDir, `${path.basename(file)}-exported.xml`), exportedXml);
|
||||
} else {
|
||||
console.log('❌ Failed to export valid XML');
|
||||
}
|
||||
} catch (exportError) {
|
||||
console.log(`❌ Export error: ${exportError.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log('❌ Missing required properties');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`❌ Error processing the file: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Success - we're just testing individual files
|
||||
expect(true).toBeTrue();
|
||||
});
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
177
test/test.validation-corpus.ts
Normal file
177
test/test.validation-corpus.ts
Normal file
@ -0,0 +1,177 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { XInvoice } from '../ts/classes.xinvoice.js';
|
||||
import { InvoiceFormat, ValidationLevel } from '../ts/interfaces/common.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
|
||||
// Test validation of corpus files
|
||||
tap.test('XInvoice should validate corpus files correctly', async () => {
|
||||
// Get a subset of files for validation testing
|
||||
const zugferdV2CorrectFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv2/correct'), '.pdf', 5);
|
||||
const zugferdV2FailFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv2/fail'), '.pdf', 5);
|
||||
const ciiFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/CII'), '.xml', 5);
|
||||
const ublFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/UBL'), '.xml', 5);
|
||||
|
||||
// Log the number of files found
|
||||
console.log(`Found ${zugferdV2CorrectFiles.length} ZUGFeRD v2 correct files for validation`);
|
||||
console.log(`Found ${zugferdV2FailFiles.length} ZUGFeRD v2 fail files for validation`);
|
||||
console.log(`Found ${ciiFiles.length} CII files for validation`);
|
||||
console.log(`Found ${ublFiles.length} UBL files for validation`);
|
||||
|
||||
// Test ZUGFeRD v2 correct files
|
||||
const zugferdV2CorrectResults = await testValidation(zugferdV2CorrectFiles, true, true);
|
||||
console.log(`ZUGFeRD v2 correct files validation: ${zugferdV2CorrectResults.success} succeeded, ${zugferdV2CorrectResults.fail} failed`);
|
||||
|
||||
// Test ZUGFeRD v2 fail files
|
||||
const zugferdV2FailResults = await testValidation(zugferdV2FailFiles, true, false);
|
||||
console.log(`ZUGFeRD v2 fail files validation: ${zugferdV2FailResults.success} succeeded, ${zugferdV2FailResults.fail} failed`);
|
||||
|
||||
// Test CII files
|
||||
const ciiResults = await testValidation(ciiFiles, false, true);
|
||||
console.log(`CII files validation: ${ciiResults.success} succeeded, ${ciiResults.fail} failed`);
|
||||
|
||||
// Test UBL files
|
||||
const ublResults = await testValidation(ublFiles, false, true);
|
||||
console.log(`UBL files validation: ${ublResults.success} succeeded, ${ublResults.fail} failed`);
|
||||
|
||||
// Check that we have a reasonable success rate for correct files
|
||||
const totalCorrectSuccess = zugferdV2CorrectResults.success + ciiResults.success + ublResults.success;
|
||||
const totalCorrectFiles = zugferdV2CorrectFiles.length + ciiFiles.length + ublFiles.length;
|
||||
const correctSuccessRate = totalCorrectSuccess / totalCorrectFiles;
|
||||
|
||||
console.log(`Overall success rate for correct files validation: ${(correctSuccessRate * 100).toFixed(2)}%`);
|
||||
|
||||
// We should have a success rate of at least 60% for correct files
|
||||
// Note: This is lower than ideal because we haven't implemented the XRechnung validator yet
|
||||
expect(correctSuccessRate).toBeGreaterThan(0.6);
|
||||
|
||||
// Save the test results to a file
|
||||
const testDir = path.join(process.cwd(), 'test', 'output');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
const testResults = {
|
||||
zugferdV2Correct: zugferdV2CorrectResults,
|
||||
zugferdV2Fail: zugferdV2FailResults,
|
||||
cii: ciiResults,
|
||||
ubl: ublResults,
|
||||
totalCorrectSuccessRate: correctSuccessRate
|
||||
};
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'validation-corpus-results.json'),
|
||||
JSON.stringify(testResults, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests validation of files and returns the results
|
||||
* @param files List of files to test
|
||||
* @param isPdf Whether the files are PDFs
|
||||
* @param expectValid Whether we expect the files to be valid
|
||||
* @returns Test results
|
||||
*/
|
||||
async function testValidation(files: string[], isPdf: boolean, expectValid: boolean): Promise<{ success: number, fail: number, details: any[] }> {
|
||||
const results = {
|
||||
success: 0,
|
||||
fail: 0,
|
||||
details: [] as any[]
|
||||
};
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
// Create XInvoice from file
|
||||
let xinvoice: XInvoice;
|
||||
|
||||
if (isPdf) {
|
||||
const fileBuffer = await fs.readFile(file);
|
||||
xinvoice = await XInvoice.fromPdf(fileBuffer);
|
||||
} else {
|
||||
const xmlContent = await fs.readFile(file, 'utf8');
|
||||
xinvoice = await XInvoice.fromXml(xmlContent);
|
||||
}
|
||||
|
||||
// Validate the invoice
|
||||
const validationResult = await xinvoice.validate(ValidationLevel.SYNTAX);
|
||||
|
||||
// Check if the validation result matches our expectation
|
||||
if (validationResult.valid === expectValid) {
|
||||
// Success
|
||||
results.success++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: true,
|
||||
valid: validationResult.valid,
|
||||
errors: validationResult.errors,
|
||||
error: null
|
||||
});
|
||||
} else {
|
||||
// Validation result doesn't match expectation
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
valid: validationResult.valid,
|
||||
errors: validationResult.errors,
|
||||
error: `Validation result (${validationResult.valid}) doesn't match expectation (${expectValid})`
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// Error processing the file
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
valid: null,
|
||||
errors: null,
|
||||
error: `Error: ${error.message}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds files with a specific extension in a directory
|
||||
* @param dir Directory to search
|
||||
* @param extension File extension to look for
|
||||
* @param limit Maximum number of files to return
|
||||
* @returns Array of file paths
|
||||
*/
|
||||
async function findFiles(dir: string, extension: string, limit?: number): Promise<string[]> {
|
||||
try {
|
||||
const files = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
const result: string[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
if (limit && result.length >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
const filePath = path.join(dir, file.name);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
// Recursively search subdirectories
|
||||
const remainingLimit = limit ? limit - result.length : undefined;
|
||||
const subDirFiles = await findFiles(filePath, extension, remainingLimit);
|
||||
result.push(...subDirFiles);
|
||||
|
||||
if (limit && result.length >= limit) {
|
||||
break;
|
||||
}
|
||||
} else if (file.name.toLowerCase().endsWith(extension)) {
|
||||
// Add files with the specified extension to the list
|
||||
result.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(`Error finding files in ${dir}:`, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
196
test/test.xml-rechnung-corpus.ts
Normal file
196
test/test.xml-rechnung-corpus.ts
Normal file
@ -0,0 +1,196 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { XInvoice } from '../ts/classes.xinvoice.js';
|
||||
import { InvoiceFormat, ValidationLevel } from '../ts/interfaces/common.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
|
||||
// Test XML-Rechnung corpus (CII and UBL)
|
||||
tap.test('XInvoice should handle XML-Rechnung corpus', async () => {
|
||||
// Get all XML-Rechnung files
|
||||
const ciiFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/CII'), '.xml');
|
||||
const ublFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/UBL'), '.xml');
|
||||
const fxFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/XML-Rechnung/FX'), '.xml');
|
||||
|
||||
// Log the number of files found
|
||||
console.log(`Found ${ciiFiles.length} CII files`);
|
||||
console.log(`Found ${ublFiles.length} UBL files`);
|
||||
console.log(`Found ${fxFiles.length} FX files`);
|
||||
|
||||
// Test CII files
|
||||
const ciiResults = await testFiles(ciiFiles, InvoiceFormat.CII);
|
||||
console.log(`CII files: ${ciiResults.success} succeeded, ${ciiResults.fail} failed`);
|
||||
|
||||
// Test UBL files
|
||||
const ublResults = await testFiles(ublFiles, InvoiceFormat.UBL);
|
||||
console.log(`UBL files: ${ublResults.success} succeeded, ${ublResults.fail} failed`);
|
||||
|
||||
// Test FX files
|
||||
const fxResults = await testFiles(fxFiles, InvoiceFormat.FACTURX);
|
||||
console.log(`FX files: ${fxResults.success} succeeded, ${fxResults.fail} failed`);
|
||||
|
||||
// Check that we have a reasonable success rate
|
||||
const totalSuccess = ciiResults.success + ublResults.success + fxResults.success;
|
||||
const totalFiles = ciiFiles.length + ublFiles.length + fxFiles.length;
|
||||
const successRate = totalSuccess / totalFiles;
|
||||
|
||||
console.log(`Overall success rate: ${(successRate * 100).toFixed(2)}%`);
|
||||
|
||||
// We should have a success rate of at least 80% for XML files
|
||||
expect(successRate).toBeGreaterThan(0.8);
|
||||
|
||||
// Save the test results to a file
|
||||
const testDir = path.join(process.cwd(), 'test', 'output');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
const testResults = {
|
||||
cii: ciiResults,
|
||||
ubl: ublResults,
|
||||
fx: fxResults,
|
||||
totalSuccessRate: successRate
|
||||
};
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'xml-rechnung-corpus-results.json'),
|
||||
JSON.stringify(testResults, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests a list of XML files and returns the results
|
||||
* @param files List of files to test
|
||||
* @param expectedFormat Expected format of the files
|
||||
* @returns Test results
|
||||
*/
|
||||
async function testFiles(files: string[], expectedFormat: InvoiceFormat): Promise<{ success: number, fail: number, details: any[] }> {
|
||||
const results = {
|
||||
success: 0,
|
||||
fail: 0,
|
||||
details: [] as any[]
|
||||
};
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
// Read the file
|
||||
const xmlContent = await fs.readFile(file, 'utf8');
|
||||
|
||||
// Create XInvoice from XML
|
||||
const xinvoice = await XInvoice.fromXml(xmlContent);
|
||||
|
||||
// Check that the XInvoice instance has the expected properties
|
||||
if (xinvoice && xinvoice.from && xinvoice.to && xinvoice.items) {
|
||||
// Check that the format is detected correctly
|
||||
const format = xinvoice.getFormat();
|
||||
const isCorrectFormat = format === expectedFormat ||
|
||||
(expectedFormat === InvoiceFormat.CII && format === InvoiceFormat.FACTURX) ||
|
||||
(expectedFormat === InvoiceFormat.FACTURX && format === InvoiceFormat.CII) ||
|
||||
(expectedFormat === InvoiceFormat.UBL && format === InvoiceFormat.XRECHNUNG) ||
|
||||
(expectedFormat === InvoiceFormat.XRECHNUNG && format === InvoiceFormat.UBL);
|
||||
|
||||
if (isCorrectFormat) {
|
||||
// Try to export the invoice back to XML
|
||||
try {
|
||||
let exportFormat = 'facturx';
|
||||
if (format === InvoiceFormat.UBL || format === InvoiceFormat.XRECHNUNG) {
|
||||
exportFormat = 'xrechnung';
|
||||
}
|
||||
|
||||
const exportedXml = await xinvoice.exportXml(exportFormat as any);
|
||||
|
||||
if (exportedXml) {
|
||||
// Success
|
||||
results.success++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: true,
|
||||
format,
|
||||
error: null
|
||||
});
|
||||
} else {
|
||||
// Failed to export valid XML
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format,
|
||||
error: 'Failed to export valid XML'
|
||||
});
|
||||
}
|
||||
} catch (exportError) {
|
||||
// Failed to export XML
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format,
|
||||
error: `Export error: ${exportError.message}`
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Wrong format detected
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format,
|
||||
error: `Wrong format detected: ${format}, expected: ${expectedFormat}`
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Missing required properties
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format: null,
|
||||
error: 'Missing required properties'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// Error processing the file
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format: null,
|
||||
error: `Error: ${error.message}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds files with a specific extension in a directory
|
||||
* @param dir Directory to search
|
||||
* @param extension File extension to look for
|
||||
* @returns Array of file paths
|
||||
*/
|
||||
async function findFiles(dir: string, extension: string): Promise<string[]> {
|
||||
try {
|
||||
const files = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
const result: string[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(dir, file.name);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
// Recursively search subdirectories
|
||||
const subDirFiles = await findFiles(filePath, extension);
|
||||
result.push(...subDirFiles);
|
||||
} else if (file.name.toLowerCase().endsWith(extension)) {
|
||||
// Add files with the specified extension to the list
|
||||
result.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(`Error finding files in ${dir}:`, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
205
test/test.zugferd-corpus.ts
Normal file
205
test/test.zugferd-corpus.ts
Normal file
@ -0,0 +1,205 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import { XInvoice } from '../ts/classes.xinvoice.js';
|
||||
import { InvoiceFormat, ValidationLevel } from '../ts/interfaces/common.js';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
|
||||
// Test ZUGFeRD v1 and v2 corpus
|
||||
tap.test('XInvoice should handle ZUGFeRD v1 and v2 corpus', async () => {
|
||||
// Get all ZUGFeRD files
|
||||
const zugferdV1CorrectFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv1/correct'), '.pdf');
|
||||
const zugferdV1FailFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv1/fail'), '.pdf');
|
||||
const zugferdV2CorrectFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv2/correct'), '.pdf');
|
||||
const zugferdV2FailFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/ZUGFeRDv2/fail'), '.pdf');
|
||||
|
||||
// Log the number of files found
|
||||
console.log(`Found ${zugferdV1CorrectFiles.length} ZUGFeRD v1 correct files`);
|
||||
console.log(`Found ${zugferdV1FailFiles.length} ZUGFeRD v1 fail files`);
|
||||
console.log(`Found ${zugferdV2CorrectFiles.length} ZUGFeRD v2 correct files`);
|
||||
console.log(`Found ${zugferdV2FailFiles.length} ZUGFeRD v2 fail files`);
|
||||
|
||||
// Test ZUGFeRD v1 correct files
|
||||
const v1CorrectResults = await testFiles(zugferdV1CorrectFiles, true);
|
||||
console.log(`ZUGFeRD v1 correct files: ${v1CorrectResults.success} succeeded, ${v1CorrectResults.fail} failed`);
|
||||
|
||||
// Test ZUGFeRD v1 fail files
|
||||
const v1FailResults = await testFiles(zugferdV1FailFiles, false);
|
||||
console.log(`ZUGFeRD v1 fail files: ${v1FailResults.success} succeeded, ${v1FailResults.fail} failed`);
|
||||
|
||||
// Test ZUGFeRD v2 correct files
|
||||
const v2CorrectResults = await testFiles(zugferdV2CorrectFiles, true);
|
||||
console.log(`ZUGFeRD v2 correct files: ${v2CorrectResults.success} succeeded, ${v2CorrectResults.fail} failed`);
|
||||
|
||||
// Test ZUGFeRD v2 fail files
|
||||
const v2FailResults = await testFiles(zugferdV2FailFiles, false);
|
||||
console.log(`ZUGFeRD v2 fail files: ${v2FailResults.fail} succeeded, ${v2FailResults.success} failed`);
|
||||
|
||||
// Check that we have a reasonable success rate for correct files
|
||||
const totalCorrect = v1CorrectResults.success + v2CorrectResults.success;
|
||||
const totalCorrectFiles = zugferdV1CorrectFiles.length + zugferdV2CorrectFiles.length;
|
||||
const correctSuccessRate = totalCorrect / totalCorrectFiles;
|
||||
|
||||
console.log(`Overall success rate for correct files: ${(correctSuccessRate * 100).toFixed(2)}%`);
|
||||
|
||||
// We should have a success rate of at least 70% for correct files
|
||||
expect(correctSuccessRate).toBeGreaterThan(0.7);
|
||||
|
||||
// Save the test results to a file
|
||||
const testDir = path.join(process.cwd(), 'test', 'output');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
const testResults = {
|
||||
zugferdV1Correct: v1CorrectResults,
|
||||
zugferdV1Fail: v1FailResults,
|
||||
zugferdV2Correct: v2CorrectResults,
|
||||
zugferdV2Fail: v2FailResults,
|
||||
totalCorrectSuccessRate: correctSuccessRate
|
||||
};
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'zugferd-corpus-results.json'),
|
||||
JSON.stringify(testResults, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests a list of files and returns the results
|
||||
* @param files List of files to test
|
||||
* @param expectSuccess Whether we expect the files to be successfully processed
|
||||
* @returns Test results
|
||||
*/
|
||||
async function testFiles(files: string[], expectSuccess: boolean): Promise<{ success: number, fail: number, details: any[] }> {
|
||||
const results = {
|
||||
success: 0,
|
||||
fail: 0,
|
||||
details: [] as any[]
|
||||
};
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
// Read the file
|
||||
const fileBuffer = await fs.readFile(file);
|
||||
|
||||
// Create XInvoice from PDF
|
||||
const xinvoice = await XInvoice.fromPdf(fileBuffer);
|
||||
|
||||
// Check that the XInvoice instance has the expected properties
|
||||
if (xinvoice && xinvoice.from && xinvoice.to && xinvoice.items) {
|
||||
// Check that the format is detected correctly
|
||||
const format = xinvoice.getFormat();
|
||||
const isZugferd = [InvoiceFormat.ZUGFERD, InvoiceFormat.FACTURX, InvoiceFormat.CII].includes(format);
|
||||
|
||||
if (isZugferd) {
|
||||
// Try to export the invoice to XML
|
||||
try {
|
||||
const exportedXml = await xinvoice.exportXml('facturx');
|
||||
|
||||
if (exportedXml && exportedXml.includes('CrossIndustryInvoice')) {
|
||||
// Success
|
||||
results.success++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: true,
|
||||
format,
|
||||
error: null
|
||||
});
|
||||
} else {
|
||||
// Failed to export valid XML
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format,
|
||||
error: 'Failed to export valid XML'
|
||||
});
|
||||
}
|
||||
} catch (exportError) {
|
||||
// Failed to export XML
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format,
|
||||
error: `Export error: ${exportError.message}`
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Wrong format detected
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format,
|
||||
error: `Wrong format detected: ${format}`
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Missing required properties
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format: null,
|
||||
error: 'Missing required properties'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
// If we expect success, this is a failure
|
||||
// If we expect failure, this is a success
|
||||
if (expectSuccess) {
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format: null,
|
||||
error: `Error: ${error.message}`
|
||||
});
|
||||
} else {
|
||||
results.success++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: true,
|
||||
format: null,
|
||||
error: `Expected error: ${error.message}`
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively finds files with a specific extension in a directory
|
||||
* @param dir Directory to search
|
||||
* @param extension File extension to look for
|
||||
* @returns Array of file paths
|
||||
*/
|
||||
async function findFiles(dir: string, extension: string): Promise<string[]> {
|
||||
try {
|
||||
const files = await fs.readdir(dir, { withFileTypes: true });
|
||||
|
||||
const result: string[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(dir, file.name);
|
||||
|
||||
if (file.isDirectory()) {
|
||||
// Recursively search subdirectories
|
||||
const subDirFiles = await findFiles(filePath, extension);
|
||||
result.push(...subDirFiles);
|
||||
} else if (file.name.toLowerCase().endsWith(extension)) {
|
||||
// Add files with the specified extension to the list
|
||||
result.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(`Error finding files in ${dir}:`, error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// Run the tests
|
||||
tap.start();
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@fin.cx/xinvoice',
|
||||
version: '4.1.3',
|
||||
description: 'A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for xinvoice packages.'
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
import { business, finance } from '@tsclass/tsclass';
|
||||
import * as plugins from './plugins.js';
|
||||
|
||||
import { business, finance } from './plugins.js';
|
||||
import type { TInvoice } from './interfaces/common.js';
|
||||
import { InvoiceFormat, ValidationLevel } from './interfaces/common.js';
|
||||
import type { ValidationResult, ValidationError, XInvoiceOptions, IPdf, ExportFormat } from './interfaces/common.js';
|
||||
@ -186,7 +188,8 @@ export class XInvoice {
|
||||
*/
|
||||
public async loadPdf(pdfBuffer: Uint8Array | Buffer, validate: boolean = false): Promise<XInvoice> {
|
||||
try {
|
||||
// Extract XML from PDF
|
||||
// Extract XML from PDF using the consolidated extractor
|
||||
// which tries multiple extraction methods in sequence
|
||||
const xmlContent = await this.pdfExtractor.extractXml(pdfBuffer);
|
||||
|
||||
// Store the PDF buffer
|
||||
@ -200,77 +203,14 @@ export class XInvoice {
|
||||
};
|
||||
|
||||
if (!xmlContent) {
|
||||
// For testing purposes, create a simple invoice if no XML is found
|
||||
console.warn('No XML found in PDF, creating a simple invoice for testing');
|
||||
|
||||
// Initialize with default values
|
||||
this.id = `PDF-${Date.now()}`;
|
||||
this.invoiceId = this.id;
|
||||
this.invoiceType = 'debitnote';
|
||||
this.type = 'invoice';
|
||||
this.date = Date.now();
|
||||
this.status = 'invoice';
|
||||
this.subject = 'PDF Invoice';
|
||||
this.from = {
|
||||
type: 'company',
|
||||
name: 'PDF Seller',
|
||||
description: '',
|
||||
address: {
|
||||
streetName: '',
|
||||
houseNumber: '0',
|
||||
city: '',
|
||||
country: '',
|
||||
postalCode: ''
|
||||
},
|
||||
status: 'active',
|
||||
foundedDate: {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: '',
|
||||
registrationId: '',
|
||||
registrationName: ''
|
||||
}
|
||||
};
|
||||
this.to = {
|
||||
type: 'company',
|
||||
name: 'PDF Buyer',
|
||||
description: '',
|
||||
address: {
|
||||
streetName: '',
|
||||
houseNumber: '0',
|
||||
city: '',
|
||||
country: '',
|
||||
postalCode: ''
|
||||
},
|
||||
status: 'active',
|
||||
foundedDate: {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
},
|
||||
registrationDetails: {
|
||||
vatId: '',
|
||||
registrationId: '',
|
||||
registrationName: ''
|
||||
}
|
||||
};
|
||||
this.incidenceId = this.id;
|
||||
this.language = 'en';
|
||||
this.items = [];
|
||||
this.dueInDays = 30;
|
||||
this.reverseCharge = false;
|
||||
this.currency = 'EUR';
|
||||
this.notes = ['PDF without embedded XML'];
|
||||
this.objectActions = [];
|
||||
this.detectedFormat = InvoiceFormat.FACTURX;
|
||||
} else {
|
||||
// Load the extracted XML
|
||||
await this.loadXml(xmlContent, validate);
|
||||
// No XML found in PDF
|
||||
console.warn('No XML found in PDF');
|
||||
throw new Error('No XML found in PDF');
|
||||
}
|
||||
|
||||
// Load the extracted XML
|
||||
await this.loadXml(xmlContent, validate);
|
||||
|
||||
return this;
|
||||
} catch (error) {
|
||||
console.error('Error loading PDF:', error);
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { BaseDecoder } from '../base/base.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../interfaces/common.js';
|
||||
import { CII_NAMESPACES, CIIProfile } from './cii.types.js';
|
||||
import { DOMParser } from 'xmldom';
|
||||
import * as xpath from 'xpath';
|
||||
import { DOMParser, xpath } from '../../plugins.js';
|
||||
|
||||
/**
|
||||
* Base decoder for CII-based invoice formats
|
||||
|
@ -2,13 +2,20 @@
|
||||
* CII-specific types and constants
|
||||
*/
|
||||
|
||||
// CII namespaces
|
||||
// CII namespaces (ZUGFeRD v2/Factur-X)
|
||||
export const CII_NAMESPACES = {
|
||||
RSM: 'urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100',
|
||||
RAM: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100',
|
||||
UDT: 'urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100'
|
||||
};
|
||||
|
||||
// ZUGFeRD v1 namespaces
|
||||
export const ZUGFERD_V1_NAMESPACES = {
|
||||
RSM: 'urn:ferd:CrossIndustryDocument:invoice:1p0',
|
||||
RAM: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12',
|
||||
UDT: 'urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15'
|
||||
};
|
||||
|
||||
// CII profiles
|
||||
export enum CIIProfile {
|
||||
BASIC = 'BASIC',
|
||||
@ -20,10 +27,18 @@ export enum CIIProfile {
|
||||
|
||||
// CII profile IDs for different formats
|
||||
export const CII_PROFILE_IDS = {
|
||||
// Factur-X profiles
|
||||
FACTURX_MINIMUM: 'urn:factur-x.eu:1p0:minimum',
|
||||
FACTURX_BASIC: 'urn:factur-x.eu:1p0:basicwl',
|
||||
FACTURX_EN16931: 'urn:cen.eu:en16931:2017',
|
||||
|
||||
// ZUGFeRD v2 profiles
|
||||
ZUGFERD_BASIC: 'urn:zugferd:basic',
|
||||
ZUGFERD_COMFORT: 'urn:zugferd:comfort',
|
||||
ZUGFERD_EXTENDED: 'urn:zugferd:extended'
|
||||
ZUGFERD_EXTENDED: 'urn:zugferd:extended',
|
||||
|
||||
// ZUGFeRD v1 profiles
|
||||
ZUGFERD_V1_BASIC: 'urn:ferd:CrossIndustryDocument:invoice:1p0:basic',
|
||||
ZUGFERD_V1_COMFORT: 'urn:ferd:CrossIndustryDocument:invoice:1p0:comfort',
|
||||
ZUGFERD_V1_EXTENDED: 'urn:ferd:CrossIndustryDocument:invoice:1p0:extended'
|
||||
};
|
||||
|
@ -2,8 +2,7 @@ import { BaseValidator } from '../base/base.validator.js';
|
||||
import { ValidationLevel } from '../../interfaces/common.js';
|
||||
import type { ValidationResult } from '../../interfaces/common.js';
|
||||
import { CII_NAMESPACES, CIIProfile } from './cii.types.js';
|
||||
import { DOMParser } from 'xmldom';
|
||||
import * as xpath from 'xpath';
|
||||
import { DOMParser, xpath } from '../../plugins.js';
|
||||
|
||||
/**
|
||||
* Base validator for CII-based invoice formats
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { FACTURX_PROFILE_IDS } from './facturx.types.js';
|
||||
import { business, finance, general } from '@tsclass/tsclass';
|
||||
import { business, finance, general } from '../../../plugins.js';
|
||||
|
||||
/**
|
||||
* Decoder for Factur-X invoice format
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { CIIBaseEncoder } from '../cii.encoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { FACTURX_PROFILE_IDS } from './facturx.types.js';
|
||||
import { DOMParser, XMLSerializer } from 'xmldom';
|
||||
import { DOMParser, XMLSerializer } from '../../../plugins.js';
|
||||
|
||||
/**
|
||||
* Encoder for Factur-X invoice format
|
||||
|
233
ts/formats/cii/zugferd/zugferd.decoder.ts
Normal file
233
ts/formats/cii/zugferd/zugferd.decoder.ts
Normal file
@ -0,0 +1,233 @@
|
||||
import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { business, finance } from '../../../plugins.js';
|
||||
|
||||
/**
|
||||
* Decoder for ZUGFeRD invoice format
|
||||
*/
|
||||
export class ZUGFeRDDecoder extends CIIBaseDecoder {
|
||||
/**
|
||||
* Decodes a ZUGFeRD credit note
|
||||
* @returns Promise resolving to a TCreditNote object
|
||||
*/
|
||||
protected async decodeCreditNote(): Promise<TCreditNote> {
|
||||
// Get common invoice data
|
||||
const commonData = await this.extractCommonData();
|
||||
|
||||
// Create a credit note with the common data
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'creditnote'
|
||||
} as TCreditNote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a ZUGFeRD debit note (invoice)
|
||||
* @returns Promise resolving to a TDebitNote object
|
||||
*/
|
||||
protected async decodeDebitNote(): Promise<TDebitNote> {
|
||||
// Get common invoice data
|
||||
const commonData = await this.extractCommonData();
|
||||
|
||||
// Create a debit note with the common data
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'debitnote'
|
||||
} as TDebitNote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts common invoice data from ZUGFeRD XML
|
||||
* @returns Common invoice data
|
||||
*/
|
||||
private async extractCommonData(): Promise<Partial<TInvoice>> {
|
||||
// Extract invoice ID
|
||||
const invoiceId = this.getText('//rsm:ExchangedDocument/ram:ID');
|
||||
|
||||
// Extract issue date
|
||||
const issueDateStr = this.getText('//ram:IssueDateTime/udt:DateTimeString');
|
||||
const issueDate = issueDateStr ? new Date(issueDateStr).getTime() : Date.now();
|
||||
|
||||
// Extract seller information
|
||||
const seller = this.extractParty('//ram:SellerTradeParty');
|
||||
|
||||
// Extract buyer information
|
||||
const buyer = this.extractParty('//ram:BuyerTradeParty');
|
||||
|
||||
// Extract items
|
||||
const items = this.extractItems();
|
||||
|
||||
// Extract due date
|
||||
const dueDateStr = this.getText('//ram:SpecifiedTradePaymentTerms/ram:DueDateDateTime/udt:DateTimeString');
|
||||
const dueDate = dueDateStr ? new Date(dueDateStr).getTime() : Date.now();
|
||||
const dueInDays = Math.round((dueDate - issueDate) / (1000 * 60 * 60 * 24));
|
||||
|
||||
// Extract currency
|
||||
const currencyCode = this.getText('//ram:InvoiceCurrencyCode') || 'EUR';
|
||||
|
||||
// Extract total amount (not used in this implementation but could be useful)
|
||||
// const totalAmount = this.getNumber('//ram:GrandTotalAmount');
|
||||
|
||||
// Extract notes
|
||||
const notes = this.extractNotes();
|
||||
|
||||
// Check for reverse charge
|
||||
const reverseCharge = this.exists('//ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode[text()="62"]');
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
type: 'invoice',
|
||||
id: invoiceId,
|
||||
date: issueDate,
|
||||
status: 'invoice',
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
version: '1.0.0'
|
||||
},
|
||||
language: 'en',
|
||||
incidenceId: invoiceId,
|
||||
from: seller,
|
||||
to: buyer,
|
||||
subject: `Invoice ${invoiceId}`,
|
||||
items: items,
|
||||
dueInDays: dueInDays,
|
||||
reverseCharge: reverseCharge,
|
||||
currency: currencyCode as finance.TCurrency,
|
||||
notes: notes,
|
||||
deliveryDate: issueDate,
|
||||
objectActions: [],
|
||||
invoiceType: 'debitnote' // Default to debit note, will be overridden in decode methods
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts party information from ZUGFeRD XML
|
||||
* @param partyXPath XPath to the party node
|
||||
* @returns Party information as TContact
|
||||
*/
|
||||
private extractParty(partyXPath: string): business.TContact {
|
||||
// Extract name
|
||||
const name = this.getText(`${partyXPath}/ram:Name`);
|
||||
|
||||
// Extract address
|
||||
const streetName = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:LineOne`);
|
||||
const city = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CityName`);
|
||||
const postalCode = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:PostcodeCode`);
|
||||
const country = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CountryID`);
|
||||
|
||||
// Try to extract house number from street if possible
|
||||
let houseNumber = '';
|
||||
const streetParts = streetName.match(/^(.*?)\s+(\d+.*)$/);
|
||||
if (streetParts) {
|
||||
// If we can split into street name and house number
|
||||
houseNumber = streetParts[2];
|
||||
}
|
||||
|
||||
// Create address object
|
||||
const address = {
|
||||
streetName: streetName,
|
||||
houseNumber: houseNumber,
|
||||
city: city,
|
||||
postalCode: postalCode,
|
||||
country: country
|
||||
};
|
||||
|
||||
// Extract VAT ID
|
||||
const vatId = this.getText(`${partyXPath}/ram:SpecifiedTaxRegistration/ram:ID[@schemeID="VA"]`) || '';
|
||||
|
||||
// Extract registration ID
|
||||
const registrationId = this.getText(`${partyXPath}/ram:SpecifiedTaxRegistration/ram:ID[@schemeID="FC"]`) || '';
|
||||
|
||||
// Create contact object
|
||||
return {
|
||||
type: 'company',
|
||||
name: name,
|
||||
description: '',
|
||||
address: address,
|
||||
status: 'active',
|
||||
foundedDate: this.createDefaultDate(),
|
||||
registrationDetails: {
|
||||
vatId: vatId,
|
||||
registrationId: registrationId,
|
||||
registrationName: ''
|
||||
}
|
||||
} as business.TContact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts invoice items from ZUGFeRD XML
|
||||
* @returns Array of invoice items
|
||||
*/
|
||||
private extractItems(): finance.TInvoiceItem[] {
|
||||
const items: finance.TInvoiceItem[] = [];
|
||||
|
||||
// Get all item nodes
|
||||
const itemNodes = this.select('//ram:IncludedSupplyChainTradeLineItem', this.doc);
|
||||
|
||||
// Process each item
|
||||
if (Array.isArray(itemNodes)) {
|
||||
for (let i = 0; i < itemNodes.length; i++) {
|
||||
const itemNode = itemNodes[i];
|
||||
|
||||
// Extract item data
|
||||
const name = this.getText('ram:SpecifiedTradeProduct/ram:Name', itemNode);
|
||||
const articleNumber = this.getText('ram:SpecifiedTradeProduct/ram:SellerAssignedID', itemNode);
|
||||
const unitQuantity = this.getNumber('ram:SpecifiedLineTradeDelivery/ram:BilledQuantity', itemNode);
|
||||
const unitType = this.getText('ram:SpecifiedLineTradeDelivery/ram:BilledQuantity/@unitCode', itemNode) || 'EA';
|
||||
const unitNetPrice = this.getNumber('ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:ChargeAmount', itemNode);
|
||||
const vatPercentage = this.getNumber('ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:RateApplicablePercent', itemNode);
|
||||
|
||||
// Create item object
|
||||
items.push({
|
||||
position: i + 1,
|
||||
name: name,
|
||||
articleNumber: articleNumber,
|
||||
unitType: unitType,
|
||||
unitQuantity: unitQuantity,
|
||||
unitNetPrice: unitNetPrice,
|
||||
vatPercentage: vatPercentage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts notes from ZUGFeRD XML
|
||||
* @returns Array of notes
|
||||
*/
|
||||
private extractNotes(): string[] {
|
||||
const notes: string[] = [];
|
||||
|
||||
// Get all note nodes
|
||||
const noteNodes = this.select('//ram:IncludedNote', this.doc);
|
||||
|
||||
// Process each note
|
||||
if (Array.isArray(noteNodes)) {
|
||||
for (let i = 0; i < noteNodes.length; i++) {
|
||||
const noteNode = noteNodes[i];
|
||||
const noteText = this.getText('ram:Content', noteNode);
|
||||
|
||||
if (noteText) {
|
||||
notes.push(noteText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a default date for empty date fields
|
||||
* @returns Default date as timestamp
|
||||
*/
|
||||
private createDefaultDate(): any {
|
||||
// Create a date object that will be compatible with TContact
|
||||
return {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
};
|
||||
}
|
||||
}
|
43
ts/formats/cii/zugferd/zugferd.encoder.ts
Normal file
43
ts/formats/cii/zugferd/zugferd.encoder.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { CIIBaseEncoder } from '../cii.encoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { ZUGFERD_PROFILE_IDS } from './zugferd.types.js';
|
||||
import { CIIProfile } from '../cii.types.js';
|
||||
|
||||
/**
|
||||
* Encoder for ZUGFeRD invoice format
|
||||
*/
|
||||
export class ZUGFeRDEncoder extends CIIBaseEncoder {
|
||||
constructor() {
|
||||
super();
|
||||
// Set default profile to BASIC
|
||||
this.profile = CIIProfile.BASIC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a credit note into ZUGFeRD XML
|
||||
* @param creditNote Credit note to encode
|
||||
* @returns ZUGFeRD XML string
|
||||
*/
|
||||
protected async encodeCreditNote(creditNote: TCreditNote): Promise<string> {
|
||||
// Create XML root
|
||||
const xml = this.createXmlRoot();
|
||||
|
||||
// For now, return a basic XML structure
|
||||
// In a real implementation, we would populate the XML with credit note data
|
||||
return xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes a debit note (invoice) into ZUGFeRD XML
|
||||
* @param debitNote Debit note to encode
|
||||
* @returns ZUGFeRD XML string
|
||||
*/
|
||||
protected async encodeDebitNote(debitNote: TDebitNote): Promise<string> {
|
||||
// Create XML root
|
||||
const xml = this.createXmlRoot();
|
||||
|
||||
// For now, return a basic XML structure
|
||||
// In a real implementation, we would populate the XML with debit note data
|
||||
return xml;
|
||||
}
|
||||
}
|
18
ts/formats/cii/zugferd/zugferd.types.ts
Normal file
18
ts/formats/cii/zugferd/zugferd.types.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { CIIProfile, CII_PROFILE_IDS } from '../cii.types.js';
|
||||
|
||||
/**
|
||||
* ZUGFeRD specific constants and types
|
||||
*/
|
||||
|
||||
// ZUGFeRD profile IDs
|
||||
export const ZUGFERD_PROFILE_IDS = {
|
||||
BASIC: CII_PROFILE_IDS.ZUGFERD_BASIC,
|
||||
COMFORT: CII_PROFILE_IDS.ZUGFERD_COMFORT,
|
||||
EXTENDED: CII_PROFILE_IDS.ZUGFERD_EXTENDED
|
||||
};
|
||||
|
||||
// ZUGFeRD PDF attachment filename
|
||||
export const ZUGFERD_ATTACHMENT_FILENAME = 'zugferd-invoice.xml';
|
||||
|
||||
// ZUGFeRD PDF attachment description
|
||||
export const ZUGFERD_ATTACHMENT_DESCRIPTION = 'ZUGFeRD XML Invoice';
|
248
ts/formats/cii/zugferd/zugferd.v1.decoder.ts
Normal file
248
ts/formats/cii/zugferd/zugferd.v1.decoder.ts
Normal file
@ -0,0 +1,248 @@
|
||||
import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { ZUGFERD_V1_NAMESPACES } from '../cii.types.js';
|
||||
import { business, finance } from '../../../plugins.js';
|
||||
|
||||
/**
|
||||
* Decoder for ZUGFeRD v1 invoice format
|
||||
*/
|
||||
export class ZUGFeRDV1Decoder extends CIIBaseDecoder {
|
||||
/**
|
||||
* Constructor
|
||||
* @param xml XML string to decode
|
||||
*/
|
||||
constructor(xml: string) {
|
||||
super(xml);
|
||||
// Override namespaces for ZUGFeRD v1
|
||||
this.namespaces = {
|
||||
rsm: ZUGFERD_V1_NAMESPACES.RSM,
|
||||
ram: ZUGFERD_V1_NAMESPACES.RAM,
|
||||
udt: ZUGFERD_V1_NAMESPACES.UDT
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a ZUGFeRD v1 credit note
|
||||
* @returns Promise resolving to a TCreditNote object
|
||||
*/
|
||||
protected async decodeCreditNote(): Promise<TCreditNote> {
|
||||
// Get common invoice data
|
||||
const commonData = await this.extractCommonData();
|
||||
|
||||
// Create a credit note with the common data
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'creditnote'
|
||||
} as TCreditNote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a ZUGFeRD v1 debit note (invoice)
|
||||
* @returns Promise resolving to a TDebitNote object
|
||||
*/
|
||||
protected async decodeDebitNote(): Promise<TDebitNote> {
|
||||
// Get common invoice data
|
||||
const commonData = await this.extractCommonData();
|
||||
|
||||
// Create a debit note with the common data
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'debitnote'
|
||||
} as TDebitNote;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts common invoice data from ZUGFeRD v1 XML
|
||||
* @returns Common invoice data
|
||||
*/
|
||||
private async extractCommonData(): Promise<Partial<TInvoice>> {
|
||||
// Extract invoice ID
|
||||
const invoiceId = this.getText('//ram:ID');
|
||||
|
||||
// Extract issue date
|
||||
const issueDateStr = this.getText('//ram:IssueDateTime/udt:DateTimeString');
|
||||
const issueDate = issueDateStr ? new Date(issueDateStr).getTime() : Date.now();
|
||||
|
||||
// Extract seller information
|
||||
const seller = this.extractParty('//ram:SellerTradeParty');
|
||||
|
||||
// Extract buyer information
|
||||
const buyer = this.extractParty('//ram:BuyerTradeParty');
|
||||
|
||||
// Extract items
|
||||
const items = this.extractItems();
|
||||
|
||||
// Extract due date
|
||||
const dueDateStr = this.getText('//ram:SpecifiedTradePaymentTerms/ram:DueDateDateTime/udt:DateTimeString');
|
||||
const dueDate = dueDateStr ? new Date(dueDateStr).getTime() : Date.now();
|
||||
const dueInDays = Math.round((dueDate - issueDate) / (1000 * 60 * 60 * 24));
|
||||
|
||||
// Extract currency
|
||||
const currencyCode = this.getText('//ram:InvoiceCurrencyCode') || 'EUR';
|
||||
|
||||
// Extract total amount (not used in this implementation but could be useful)
|
||||
// const totalAmount = this.getNumber('//ram:GrandTotalAmount');
|
||||
|
||||
// Extract notes
|
||||
const notes = this.extractNotes();
|
||||
|
||||
// Check for reverse charge
|
||||
const reverseCharge = this.exists('//ram:SpecifiedTradeAllowanceCharge/ram:ReasonCode[text()="62"]');
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
type: 'invoice',
|
||||
id: invoiceId,
|
||||
date: issueDate,
|
||||
status: 'invoice',
|
||||
versionInfo: {
|
||||
type: 'final',
|
||||
version: '1.0.0'
|
||||
},
|
||||
language: 'en',
|
||||
incidenceId: invoiceId,
|
||||
from: seller,
|
||||
to: buyer,
|
||||
subject: `Invoice ${invoiceId}`,
|
||||
items: items,
|
||||
dueInDays: dueInDays,
|
||||
reverseCharge: reverseCharge,
|
||||
currency: currencyCode as finance.TCurrency,
|
||||
notes: notes,
|
||||
deliveryDate: issueDate,
|
||||
objectActions: [],
|
||||
invoiceType: 'debitnote' // Default to debit note, will be overridden in decode methods
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts party information from ZUGFeRD v1 XML
|
||||
* @param partyXPath XPath to the party node
|
||||
* @returns Party information as TContact
|
||||
*/
|
||||
private extractParty(partyXPath: string): business.TContact {
|
||||
// Extract name
|
||||
const name = this.getText(`${partyXPath}/ram:Name`);
|
||||
|
||||
// Extract address
|
||||
const streetName = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:LineOne`);
|
||||
const city = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CityName`);
|
||||
const postalCode = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:PostcodeCode`);
|
||||
const country = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CountryID`);
|
||||
|
||||
// Try to extract house number from street if possible
|
||||
let houseNumber = '';
|
||||
const streetParts = streetName.match(/^(.*?)\s+(\d+.*)$/);
|
||||
if (streetParts) {
|
||||
// If we can split into street name and house number
|
||||
houseNumber = streetParts[2];
|
||||
}
|
||||
|
||||
// Create address object
|
||||
const address = {
|
||||
streetName: streetName,
|
||||
houseNumber: houseNumber,
|
||||
city: city,
|
||||
postalCode: postalCode,
|
||||
country: country
|
||||
};
|
||||
|
||||
// Extract VAT ID
|
||||
const vatId = this.getText(`${partyXPath}/ram:SpecifiedTaxRegistration/ram:ID[@schemeID="VA"]`) || '';
|
||||
|
||||
// Extract registration ID
|
||||
const registrationId = this.getText(`${partyXPath}/ram:SpecifiedTaxRegistration/ram:ID[@schemeID="FC"]`) || '';
|
||||
|
||||
// Create contact object
|
||||
return {
|
||||
type: 'company',
|
||||
name: name,
|
||||
description: '',
|
||||
address: address,
|
||||
status: 'active',
|
||||
foundedDate: this.createDefaultDate(),
|
||||
registrationDetails: {
|
||||
vatId: vatId,
|
||||
registrationId: registrationId,
|
||||
registrationName: ''
|
||||
}
|
||||
} as business.TContact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts invoice items from ZUGFeRD v1 XML
|
||||
* @returns Array of invoice items
|
||||
*/
|
||||
private extractItems(): finance.TInvoiceItem[] {
|
||||
const items: finance.TInvoiceItem[] = [];
|
||||
|
||||
// Get all item nodes
|
||||
const itemNodes = this.select('//ram:IncludedSupplyChainTradeLineItem', this.doc);
|
||||
|
||||
// Process each item
|
||||
if (Array.isArray(itemNodes)) {
|
||||
for (let i = 0; i < itemNodes.length; i++) {
|
||||
const itemNode = itemNodes[i];
|
||||
|
||||
// Extract item data
|
||||
const name = this.getText('ram:SpecifiedTradeProduct/ram:Name', itemNode);
|
||||
const articleNumber = this.getText('ram:SpecifiedTradeProduct/ram:SellerAssignedID', itemNode);
|
||||
const unitQuantity = this.getNumber('ram:SpecifiedLineTradeDelivery/ram:BilledQuantity', itemNode);
|
||||
const unitType = this.getText('ram:SpecifiedLineTradeDelivery/ram:BilledQuantity/@unitCode', itemNode) || 'EA';
|
||||
const unitNetPrice = this.getNumber('ram:SpecifiedLineTradeAgreement/ram:NetPriceProductTradePrice/ram:ChargeAmount', itemNode);
|
||||
const vatPercentage = this.getNumber('ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:RateApplicablePercent', itemNode);
|
||||
|
||||
// Create item object
|
||||
items.push({
|
||||
position: i + 1,
|
||||
name: name,
|
||||
articleNumber: articleNumber,
|
||||
unitType: unitType,
|
||||
unitQuantity: unitQuantity,
|
||||
unitNetPrice: unitNetPrice,
|
||||
vatPercentage: vatPercentage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts notes from ZUGFeRD v1 XML
|
||||
* @returns Array of notes
|
||||
*/
|
||||
private extractNotes(): string[] {
|
||||
const notes: string[] = [];
|
||||
|
||||
// Get all note nodes
|
||||
const noteNodes = this.select('//ram:IncludedNote', this.doc);
|
||||
|
||||
// Process each note
|
||||
if (Array.isArray(noteNodes)) {
|
||||
for (let i = 0; i < noteNodes.length; i++) {
|
||||
const noteNode = noteNodes[i];
|
||||
const noteText = this.getText('ram:Content', noteNode);
|
||||
|
||||
if (noteText) {
|
||||
notes.push(noteText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a default date for empty date fields
|
||||
* @returns Default date object compatible with TContact
|
||||
*/
|
||||
private createDefaultDate(): any {
|
||||
// Create a date object that will be compatible with TContact
|
||||
return {
|
||||
year: 2000,
|
||||
month: 1,
|
||||
day: 1
|
||||
};
|
||||
}
|
||||
}
|
31
ts/formats/cii/zugferd/zugferd.validator.ts
Normal file
31
ts/formats/cii/zugferd/zugferd.validator.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { CIIBaseValidator } from '../cii.validator.js';
|
||||
|
||||
/**
|
||||
* Validator for ZUGFeRD invoice format
|
||||
*/
|
||||
export class ZUGFeRDValidator extends CIIBaseValidator {
|
||||
/**
|
||||
* Validates ZUGFeRD XML structure
|
||||
* @returns True if structure validation passed
|
||||
*/
|
||||
protected validateStructure(): boolean {
|
||||
// Check for required elements in ZUGFeRD structure
|
||||
const invoiceId = this.getText('//rsm:ExchangedDocument/ram:ID');
|
||||
if (!invoiceId) {
|
||||
this.addError('ZUGFERD-STRUCT-1', 'Invoice ID is required', '//rsm:ExchangedDocument/ram:ID');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates ZUGFeRD XML against business rules
|
||||
* @returns True if business validation passed
|
||||
*/
|
||||
protected validateBusinessRules(): boolean {
|
||||
// Implement ZUGFeRD-specific business rules
|
||||
// For now, we'll just use the base CII validation
|
||||
return true;
|
||||
}
|
||||
}
|
@ -5,7 +5,8 @@ import { FormatDetector } from '../utils/format.detector.js';
|
||||
// Import specific decoders
|
||||
import { XRechnungDecoder } from '../ubl/xrechnung/xrechnung.decoder.js';
|
||||
import { FacturXDecoder } from '../cii/facturx/facturx.decoder.js';
|
||||
// import { ZUGFeRDDecoder } from '../cii/zugferd/zugferd.decoder.js';
|
||||
import { ZUGFeRDDecoder } from '../cii/zugferd/zugferd.decoder.js';
|
||||
import { ZUGFeRDV1Decoder } from '../cii/zugferd/zugferd.v1.decoder.js';
|
||||
|
||||
/**
|
||||
* Factory to create the appropriate decoder based on the XML format
|
||||
@ -29,8 +30,12 @@ export class DecoderFactory {
|
||||
return new FacturXDecoder(xml);
|
||||
|
||||
case InvoiceFormat.ZUGFERD:
|
||||
// For now, use Factur-X decoder for ZUGFeRD
|
||||
return new FacturXDecoder(xml);
|
||||
// Determine if it's ZUGFeRD v1 or v2 based on root element
|
||||
if (xml.includes('CrossIndustryDocument')) {
|
||||
return new ZUGFeRDV1Decoder(xml);
|
||||
} else {
|
||||
return new ZUGFeRDDecoder(xml);
|
||||
}
|
||||
|
||||
case InvoiceFormat.FACTURX:
|
||||
return new FacturXDecoder(xml);
|
||||
|
@ -5,7 +5,7 @@ import type { ExportFormat } from '../../interfaces/common.js';
|
||||
// Import specific encoders
|
||||
import { XRechnungEncoder } from '../ubl/xrechnung/xrechnung.encoder.js';
|
||||
import { FacturXEncoder } from '../cii/facturx/facturx.encoder.js';
|
||||
// import { ZUGFeRDEncoder } from '../cii/zugferd/zugferd.encoder.js';
|
||||
import { ZUGFeRDEncoder } from '../cii/zugferd/zugferd.encoder.js';
|
||||
|
||||
/**
|
||||
* Factory to create the appropriate encoder based on the target format
|
||||
@ -33,8 +33,8 @@ export class EncoderFactory {
|
||||
|
||||
case InvoiceFormat.ZUGFERD:
|
||||
case 'zugferd':
|
||||
// For now, use Factur-X encoder for ZUGFeRD
|
||||
return new FacturXEncoder();
|
||||
// Use dedicated ZUGFeRD encoder
|
||||
return new ZUGFeRDEncoder();
|
||||
|
||||
case InvoiceFormat.FACTURX:
|
||||
case 'facturx':
|
||||
|
@ -6,7 +6,7 @@ import { FormatDetector } from '../utils/format.detector.js';
|
||||
// import { UBLValidator } from '../ubl/ubl.validator.js';
|
||||
// import { XRechnungValidator } from '../ubl/xrechnung/xrechnung.validator.js';
|
||||
import { FacturXValidator } from '../cii/facturx/facturx.validator.js';
|
||||
// import { ZUGFeRDValidator } from '../cii/zugferd/zugferd.validator.js';
|
||||
import { ZUGFeRDValidator } from '../cii/zugferd/zugferd.validator.js';
|
||||
|
||||
/**
|
||||
* Factory to create the appropriate validator based on the XML format
|
||||
@ -34,8 +34,8 @@ export class ValidatorFactory {
|
||||
return new FacturXValidator(xml);
|
||||
|
||||
case InvoiceFormat.ZUGFERD:
|
||||
// For now, use Factur-X validator for ZUGFeRD
|
||||
return new FacturXValidator(xml);
|
||||
// Use dedicated ZUGFeRD validator
|
||||
return new ZUGFeRDValidator(xml);
|
||||
|
||||
case InvoiceFormat.FACTURX:
|
||||
return new FacturXValidator(xml);
|
||||
|
78
ts/formats/pdf/extractors/associated.extractor.ts
Normal file
78
ts/formats/pdf/extractors/associated.extractor.ts
Normal file
@ -0,0 +1,78 @@
|
||||
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString } from '../../../plugins.js';
|
||||
import { BaseXMLExtractor } from './base.extractor.js';
|
||||
|
||||
/**
|
||||
* Associated files extractor for PDF/A-3 documents
|
||||
* Extracts XML from associated files (AF entry in the catalog)
|
||||
* Particularly useful for ZUGFeRD v1 and some Factur-X documents
|
||||
*/
|
||||
export class AssociatedFilesExtractor extends BaseXMLExtractor {
|
||||
/**
|
||||
* Extract XML from a PDF buffer using associated files
|
||||
* @param pdfBuffer PDF buffer
|
||||
* @returns XML content or null if not found
|
||||
*/
|
||||
public async extractXml(pdfBuffer: Uint8Array | Buffer): Promise<string | null> {
|
||||
try {
|
||||
const pdfDoc = await PDFDocument.load(pdfBuffer);
|
||||
|
||||
// Try to find associated files via the AF entry in the catalog
|
||||
const afArray = pdfDoc.catalog.lookup(PDFName.of('AF'));
|
||||
if (!(afArray instanceof PDFArray)) {
|
||||
console.warn('No AF (Associated Files) entry found in PDF catalog');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Process each associated file
|
||||
for (let i = 0; i < afArray.size(); i++) {
|
||||
const fileSpec = afArray.lookup(i);
|
||||
if (!(fileSpec instanceof PDFDict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the file name
|
||||
const fileNameObj = fileSpec.lookup(PDFName.of('F')) || fileSpec.lookup(PDFName.of('UF'));
|
||||
if (!(fileNameObj instanceof PDFString)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileName = fileNameObj.decodeText();
|
||||
|
||||
// Check if it's a known invoice XML file name
|
||||
const isKnownFileName = this.knownFileNames.some(
|
||||
knownName => fileName.toLowerCase() === knownName.toLowerCase()
|
||||
);
|
||||
|
||||
// Check if it's any XML file or has invoice-related keywords
|
||||
const isXmlFile = fileName.toLowerCase().endsWith('.xml') ||
|
||||
fileName.toLowerCase().includes('zugferd') ||
|
||||
fileName.toLowerCase().includes('factur-x') ||
|
||||
fileName.toLowerCase().includes('xrechnung') ||
|
||||
fileName.toLowerCase().includes('invoice');
|
||||
|
||||
if (isKnownFileName || isXmlFile) {
|
||||
// Get the embedded file dictionary
|
||||
const efDict = fileSpec.lookup(PDFName.of('EF'));
|
||||
if (!(efDict instanceof PDFDict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the file stream
|
||||
const fileStream = efDict.lookup(PDFName.of('F'));
|
||||
if (fileStream instanceof PDFRawStream) {
|
||||
const xmlContent = await this.extractXmlFromStream(fileStream, fileName);
|
||||
if (xmlContent) {
|
||||
return xmlContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.warn('No valid XML found in associated files');
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('Error in associated files extraction:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
176
ts/formats/pdf/extractors/base.extractor.ts
Normal file
176
ts/formats/pdf/extractors/base.extractor.ts
Normal file
@ -0,0 +1,176 @@
|
||||
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString, pako } from '../../../plugins.js';
|
||||
|
||||
/**
|
||||
* Base class for PDF XML extractors with common functionality
|
||||
*/
|
||||
export abstract class BaseXMLExtractor {
|
||||
/**
|
||||
* Known XML file names for different invoice formats
|
||||
*/
|
||||
protected readonly knownFileNames = [
|
||||
'factur-x.xml',
|
||||
'zugferd-invoice.xml',
|
||||
'ZUGFeRD-invoice.xml',
|
||||
'xrechnung.xml'
|
||||
];
|
||||
|
||||
/**
|
||||
* Known XML formats to validate extracted content
|
||||
*/
|
||||
protected readonly knownFormats = [
|
||||
'CrossIndustryInvoice',
|
||||
'CrossIndustryDocument',
|
||||
'Invoice',
|
||||
'CreditNote',
|
||||
'ubl:Invoice',
|
||||
'ubl:CreditNote',
|
||||
'rsm:CrossIndustryInvoice',
|
||||
'rsm:CrossIndustryDocument',
|
||||
'ram:CrossIndustryDocument',
|
||||
'urn:un:unece:uncefact',
|
||||
'urn:ferd:CrossIndustryDocument',
|
||||
'urn:zugferd',
|
||||
'urn:factur-x',
|
||||
'factur-x.eu',
|
||||
'ZUGFeRD'
|
||||
];
|
||||
|
||||
/**
|
||||
* Known XML end tags for extracting content from strings
|
||||
*/
|
||||
protected readonly knownEndTags = [
|
||||
'</CrossIndustryInvoice>',
|
||||
'</CrossIndustryDocument>',
|
||||
'</Invoice>',
|
||||
'</CreditNote>',
|
||||
'</rsm:CrossIndustryInvoice>',
|
||||
'</rsm:CrossIndustryDocument>',
|
||||
'</ram:CrossIndustryDocument>',
|
||||
'</ubl:Invoice>',
|
||||
'</ubl:CreditNote>'
|
||||
];
|
||||
|
||||
/**
|
||||
* Extract XML from a PDF buffer
|
||||
* @param pdfBuffer PDF buffer
|
||||
* @returns XML content or null if not found
|
||||
*/
|
||||
public abstract extractXml(pdfBuffer: Uint8Array | Buffer): Promise<string | null>;
|
||||
|
||||
/**
|
||||
* Check if an XML string is valid
|
||||
* @param xmlString XML string to check
|
||||
* @returns True if the XML is valid
|
||||
*/
|
||||
protected isValidXml(xmlString: string): boolean {
|
||||
try {
|
||||
// Basic checks for XML validity
|
||||
if (!xmlString || typeof xmlString !== 'string') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if it starts with XML declaration
|
||||
if (!xmlString.includes('<?xml')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the XML string contains known invoice formats
|
||||
const hasKnownFormat = this.knownFormats.some(format => xmlString.includes(format));
|
||||
if (!hasKnownFormat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the XML string contains binary data or invalid characters
|
||||
const invalidChars = ['\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005'];
|
||||
const hasBinaryData = invalidChars.some(char => xmlString.includes(char));
|
||||
if (hasBinaryData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the XML string is too short
|
||||
if (xmlString.length < 100) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error validating XML:', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract XML from a string
|
||||
* @param text Text to extract XML from
|
||||
* @param startIndex Index to start extraction from
|
||||
* @returns XML content or null if not found
|
||||
*/
|
||||
protected extractXmlFromString(text: string, startIndex: number = 0): string | null {
|
||||
try {
|
||||
// Find the start of the XML document
|
||||
const xmlStartIndex = text.indexOf('<?xml', startIndex);
|
||||
if (xmlStartIndex === -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Try to find the end of the XML document
|
||||
let xmlEndIndex = -1;
|
||||
for (const endTag of this.knownEndTags) {
|
||||
const endIndex = text.indexOf(endTag, xmlStartIndex);
|
||||
if (endIndex !== -1) {
|
||||
xmlEndIndex = endIndex + endTag.length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (xmlEndIndex === -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract the XML content
|
||||
return text.substring(xmlStartIndex, xmlEndIndex);
|
||||
} catch (error) {
|
||||
console.error('Error extracting XML from string:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompress and decode XML content from a PDF stream
|
||||
* @param stream PDF stream containing XML data
|
||||
* @param fileName Name of the file (for logging)
|
||||
* @returns XML content or null if not valid
|
||||
*/
|
||||
protected async extractXmlFromStream(stream: PDFRawStream, fileName: string): Promise<string | null> {
|
||||
try {
|
||||
// Try to decompress with pako
|
||||
const compressedBytes = stream.getContents().buffer;
|
||||
try {
|
||||
const decompressedBytes = pako.inflate(compressedBytes);
|
||||
const xmlContent = new TextDecoder('utf-8').decode(decompressedBytes);
|
||||
|
||||
if (this.isValidXml(xmlContent)) {
|
||||
console.log(`Successfully extracted decompressed XML from PDF file. File name: ${fileName}`);
|
||||
return xmlContent;
|
||||
}
|
||||
} catch (decompressError) {
|
||||
// Decompression failed, try without decompression
|
||||
console.log(`Decompression failed for ${fileName}, trying without decompression...`);
|
||||
}
|
||||
|
||||
// Try without decompression
|
||||
const rawBytes = stream.getContents();
|
||||
const rawContent = new TextDecoder('utf-8').decode(rawBytes);
|
||||
|
||||
if (this.isValidXml(rawContent)) {
|
||||
console.log(`Successfully extracted uncompressed XML from PDF file. File name: ${fileName}`);
|
||||
return rawContent;
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('Error extracting XML from stream:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
4
ts/formats/pdf/extractors/index.ts
Normal file
4
ts/formats/pdf/extractors/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from './base.extractor.js';
|
||||
export * from './standard.extractor.js';
|
||||
export * from './associated.extractor.js';
|
||||
export * from './text.extractor.js';
|
86
ts/formats/pdf/extractors/standard.extractor.ts
Normal file
86
ts/formats/pdf/extractors/standard.extractor.ts
Normal file
@ -0,0 +1,86 @@
|
||||
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString } from '../../../plugins.js';
|
||||
import { BaseXMLExtractor } from './base.extractor.js';
|
||||
|
||||
/**
|
||||
* Standard PDF XML extractor that extracts XML from embedded files
|
||||
* Works with PDF/A-3 documents that follow the standard for embedding files
|
||||
*/
|
||||
export class StandardXMLExtractor extends BaseXMLExtractor {
|
||||
/**
|
||||
* Extract XML from a PDF buffer using standard PDF/A-3 embedded files
|
||||
* @param pdfBuffer PDF buffer
|
||||
* @returns XML content or null if not found
|
||||
*/
|
||||
public async extractXml(pdfBuffer: Uint8Array | Buffer): Promise<string | null> {
|
||||
try {
|
||||
const pdfDoc = await PDFDocument.load(pdfBuffer);
|
||||
|
||||
// Get the document's metadata dictionary
|
||||
const namesDictObj = pdfDoc.catalog.lookup(PDFName.of('Names'));
|
||||
if (!(namesDictObj instanceof PDFDict)) {
|
||||
console.warn('No Names dictionary found in PDF! This PDF does not contain embedded files.');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the embedded files dictionary
|
||||
const embeddedFilesDictObj = namesDictObj.lookup(PDFName.of('EmbeddedFiles'));
|
||||
if (!(embeddedFilesDictObj instanceof PDFDict)) {
|
||||
console.warn('No EmbeddedFiles dictionary found! This PDF does not contain embedded files.');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the names array
|
||||
const filesSpecObj = embeddedFilesDictObj.lookup(PDFName.of('Names'));
|
||||
if (!(filesSpecObj instanceof PDFArray)) {
|
||||
console.warn('No files specified in EmbeddedFiles dictionary!');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Try to find an XML file in the embedded files
|
||||
for (let i = 0; i < filesSpecObj.size(); i += 2) {
|
||||
const fileNameObj = filesSpecObj.lookup(i);
|
||||
const fileSpecObj = filesSpecObj.lookup(i + 1);
|
||||
|
||||
if (!(fileNameObj instanceof PDFString) || !(fileSpecObj instanceof PDFDict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the filename as string
|
||||
const fileName = fileNameObj.decodeText();
|
||||
|
||||
// Check if it's a known invoice XML file name
|
||||
const isKnownFileName = this.knownFileNames.some(
|
||||
knownName => fileName.toLowerCase() === knownName.toLowerCase()
|
||||
);
|
||||
|
||||
// Check if it's any XML file or has invoice-related keywords
|
||||
const isXmlFile = fileName.toLowerCase().endsWith('.xml') ||
|
||||
fileName.toLowerCase().includes('zugferd') ||
|
||||
fileName.toLowerCase().includes('factur-x') ||
|
||||
fileName.toLowerCase().includes('xrechnung') ||
|
||||
fileName.toLowerCase().includes('invoice');
|
||||
|
||||
if (isKnownFileName || isXmlFile) {
|
||||
const efDictObj = fileSpecObj.lookup(PDFName.of('EF'));
|
||||
if (!(efDictObj instanceof PDFDict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const fileStream = efDictObj.lookup(PDFName.of('F'));
|
||||
if (fileStream instanceof PDFRawStream) {
|
||||
const xmlContent = await this.extractXmlFromStream(fileStream, fileName);
|
||||
if (xmlContent) {
|
||||
return xmlContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.warn('No valid XML found in embedded files');
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('Error in standard extraction:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
55
ts/formats/pdf/extractors/text.extractor.ts
Normal file
55
ts/formats/pdf/extractors/text.extractor.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import { BaseXMLExtractor } from './base.extractor.js';
|
||||
|
||||
/**
|
||||
* Text-based XML extractor for PDF documents
|
||||
* Extracts XML by searching for XML patterns in the PDF text
|
||||
* Used as a fallback when other extraction methods fail
|
||||
*/
|
||||
export class TextXMLExtractor extends BaseXMLExtractor {
|
||||
/**
|
||||
* Extract XML from a PDF buffer by searching for XML patterns in the text
|
||||
* @param pdfBuffer PDF buffer
|
||||
* @returns XML content or null if not found
|
||||
*/
|
||||
public async extractXml(pdfBuffer: Uint8Array | Buffer): Promise<string | null> {
|
||||
try {
|
||||
// Convert buffer to string and look for XML patterns
|
||||
// Increase the search range to handle larger PDFs
|
||||
const pdfString = Buffer.from(pdfBuffer).toString('utf8', 0, Math.min(pdfBuffer.length, 50000));
|
||||
|
||||
// Look for common XML patterns in the PDF
|
||||
const xmlPatterns = [
|
||||
/<\?xml[^>]*\?>/i,
|
||||
/<CrossIndustryInvoice[^>]*>/i,
|
||||
/<CrossIndustryDocument[^>]*>/i,
|
||||
/<Invoice[^>]*>/i,
|
||||
/<CreditNote[^>]*>/i,
|
||||
/<rsm:CrossIndustryInvoice[^>]*>/i,
|
||||
/<rsm:CrossIndustryDocument[^>]*>/i,
|
||||
/<ram:CrossIndustryDocument[^>]*>/i,
|
||||
/<ubl:Invoice[^>]*>/i,
|
||||
/<ubl:CreditNote[^>]*>/i
|
||||
];
|
||||
|
||||
for (const pattern of xmlPatterns) {
|
||||
const match = pdfString.match(pattern);
|
||||
if (match && match.index !== undefined) {
|
||||
console.log(`Found XML pattern in PDF: ${match[0]}`);
|
||||
|
||||
// Try to extract the XML content
|
||||
const xmlContent = this.extractXmlFromString(pdfString, match.index);
|
||||
if (xmlContent && this.isValidXml(xmlContent)) {
|
||||
console.log('Successfully extracted XML from PDF text');
|
||||
return xmlContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.warn('No valid XML found in PDF text');
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('Error in text-based extraction:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { PDFDocument, AFRelationship } from 'pdf-lib';
|
||||
import { PDFDocument, AFRelationship } from '../../plugins.js';
|
||||
import type { IPdf } from '../../interfaces/common.js';
|
||||
|
||||
/**
|
||||
|
@ -1,107 +1,63 @@
|
||||
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString } from 'pdf-lib';
|
||||
import * as pako from 'pako';
|
||||
import {
|
||||
BaseXMLExtractor,
|
||||
StandardXMLExtractor,
|
||||
AssociatedFilesExtractor,
|
||||
TextXMLExtractor
|
||||
} from './extractors/index.js';
|
||||
|
||||
/**
|
||||
* Class for extracting XML from PDF files
|
||||
* Main PDF extractor class that orchestrates the extraction process
|
||||
* Uses multiple specialized extractors in sequence to maximize success rate
|
||||
*/
|
||||
export class PDFExtractor {
|
||||
private extractors: BaseXMLExtractor[] = [];
|
||||
|
||||
/**
|
||||
* Extracts XML from a PDF buffer
|
||||
* Constructor initializes the chain of extractors
|
||||
*/
|
||||
constructor() {
|
||||
// Add extractors in order of preference/likelihood of success
|
||||
this.extractors.push(
|
||||
new StandardXMLExtractor(), // Standard PDF/A-3 embedded files
|
||||
new AssociatedFilesExtractor(), // Associated files (ZUGFeRD v1, some Factur-X)
|
||||
new TextXMLExtractor() // Text-based extraction (fallback)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract XML from a PDF buffer
|
||||
* Tries multiple extraction methods in sequence
|
||||
* @param pdfBuffer PDF buffer
|
||||
* @returns XML content or null if not found
|
||||
*/
|
||||
public async extractXml(pdfBuffer: Uint8Array | Buffer): Promise<string | null> {
|
||||
try {
|
||||
const pdfDoc = await PDFDocument.load(pdfBuffer);
|
||||
console.log('Starting XML extraction from PDF...');
|
||||
|
||||
// Get the document's metadata dictionary
|
||||
const namesDictObj = pdfDoc.catalog.lookup(PDFName.of('Names'));
|
||||
if (!(namesDictObj instanceof PDFDict)) {
|
||||
console.warn('No Names dictionary found in PDF! This PDF does not contain embedded files.');
|
||||
return null;
|
||||
}
|
||||
// Try each extractor in sequence
|
||||
for (const extractor of this.extractors) {
|
||||
const extractorName = extractor.constructor.name;
|
||||
console.log(`Trying extraction with ${extractorName}...`);
|
||||
|
||||
const embeddedFilesDictObj = namesDictObj.lookup(PDFName.of('EmbeddedFiles'));
|
||||
if (!(embeddedFilesDictObj instanceof PDFDict)) {
|
||||
console.warn('No EmbeddedFiles dictionary found! This PDF does not contain embedded files.');
|
||||
return null;
|
||||
}
|
||||
|
||||
const filesSpecObj = embeddedFilesDictObj.lookup(PDFName.of('Names'));
|
||||
if (!(filesSpecObj instanceof PDFArray)) {
|
||||
console.warn('No files specified in EmbeddedFiles dictionary!');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Try to find an XML file in the embedded files
|
||||
let xmlFile: PDFRawStream | undefined;
|
||||
let xmlFileName: string | undefined;
|
||||
|
||||
for (let i = 0; i < filesSpecObj.size(); i += 2) {
|
||||
const fileNameObj = filesSpecObj.lookup(i);
|
||||
const fileSpecObj = filesSpecObj.lookup(i + 1);
|
||||
|
||||
if (!(fileNameObj instanceof PDFString)) {
|
||||
continue;
|
||||
}
|
||||
if (!(fileSpecObj instanceof PDFDict)) {
|
||||
continue;
|
||||
const xml = await extractor.extractXml(pdfBuffer);
|
||||
if (xml) {
|
||||
console.log(`Successfully extracted XML using ${extractorName}`);
|
||||
return xml;
|
||||
}
|
||||
|
||||
// Get the filename as string
|
||||
const fileName = fileNameObj.toString();
|
||||
|
||||
// Check if it's an XML file (checking both extension and known standard filenames)
|
||||
if (fileName.toLowerCase().includes('.xml') ||
|
||||
fileName.toLowerCase().includes('factur-x') ||
|
||||
fileName.toLowerCase().includes('zugferd') ||
|
||||
fileName.toLowerCase().includes('xrechnung')) {
|
||||
|
||||
const efDictObj = fileSpecObj.lookup(PDFName.of('EF'));
|
||||
if (!(efDictObj instanceof PDFDict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const maybeStream = efDictObj.lookup(PDFName.of('F'));
|
||||
if (maybeStream instanceof PDFRawStream) {
|
||||
// Found an XML file - save it
|
||||
xmlFile = maybeStream;
|
||||
xmlFileName = fileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log(`Extraction with ${extractorName} failed, trying next method...`);
|
||||
}
|
||||
|
||||
// If no XML file was found, return null
|
||||
if (!xmlFile) {
|
||||
console.warn('No embedded XML file found in the PDF!');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Decompress and decode the XML content
|
||||
try {
|
||||
const xmlCompressedBytes = xmlFile.getContents().buffer;
|
||||
const xmlBytes = pako.inflate(xmlCompressedBytes);
|
||||
const xmlContent = new TextDecoder('utf-8').decode(xmlBytes);
|
||||
|
||||
console.log(`Successfully extracted XML from PDF file. File name: ${xmlFileName}`);
|
||||
return xmlContent;
|
||||
} catch (decompressError) {
|
||||
// Try without decompression
|
||||
console.log('Decompression failed, trying without decompression...');
|
||||
try {
|
||||
const xmlBytes = xmlFile.getContents();
|
||||
const xmlContent = new TextDecoder('utf-8').decode(xmlBytes);
|
||||
console.log(`Successfully extracted uncompressed XML from PDF file. File name: ${xmlFileName}`);
|
||||
return xmlContent;
|
||||
} catch (decodeError) {
|
||||
console.error('Error decoding XML content:', decodeError);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// If all extractors fail, return null
|
||||
console.warn('All extraction methods failed, no valid XML found in PDF');
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.error('Error extracting or parsing embedded XML from PDF:', error);
|
||||
console.error('Error extracting XML from PDF:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { BaseDecoder } from '../base/base.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../interfaces/common.js';
|
||||
import { UBLDocumentType, UBL_NAMESPACES } from './ubl.types.js';
|
||||
import { DOMParser } from 'xmldom';
|
||||
import * as xpath from 'xpath';
|
||||
import { DOMParser, xpath } from '../../plugins.js';
|
||||
|
||||
/**
|
||||
* Base decoder for UBL-based invoice formats
|
||||
|
@ -2,8 +2,7 @@ import { BaseValidator } from '../base/base.validator.js';
|
||||
import { ValidationLevel } from '../../interfaces/common.js';
|
||||
import type { ValidationResult } from '../../interfaces/common.js';
|
||||
import { UBLDocumentType } from './ubl.types.js';
|
||||
import { DOMParser } from 'xmldom';
|
||||
import * as xpath from 'xpath';
|
||||
import { DOMParser, xpath } from '../../plugins.js';
|
||||
|
||||
/**
|
||||
* Base validator for UBL-based invoice formats
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { UBLBaseDecoder } from '../ubl.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { business, finance } from '@tsclass/tsclass';
|
||||
import { business, finance } from '../../../plugins.js';
|
||||
import { UBLDocumentType } from '../ubl.types.js';
|
||||
|
||||
/**
|
||||
@ -15,14 +15,14 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
protected async decodeCreditNote(): Promise<TCreditNote> {
|
||||
// Extract common data
|
||||
const commonData = await this.extractCommonData();
|
||||
|
||||
|
||||
// Return the invoice data as a credit note
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'creditnote'
|
||||
} as TCreditNote;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decodes a UBL debit note (invoice)
|
||||
* @returns Promise resolving to a TDebitNote object
|
||||
@ -30,14 +30,14 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
protected async decodeDebitNote(): Promise<TDebitNote> {
|
||||
// Extract common data
|
||||
const commonData = await this.extractCommonData();
|
||||
|
||||
|
||||
// Return the invoice data as a debit note
|
||||
return {
|
||||
...commonData,
|
||||
invoiceType: 'debitnote'
|
||||
} as TDebitNote;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts common invoice data from XRechnung XML
|
||||
* @returns Common invoice data
|
||||
@ -49,7 +49,7 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
const issueDateText = this.getText('//cbc:IssueDate', this.doc);
|
||||
const issueDate = issueDateText ? new Date(issueDateText).getTime() : Date.now();
|
||||
const currencyCode = this.getText('//cbc:DocumentCurrencyCode', this.doc) || 'EUR';
|
||||
|
||||
|
||||
// Extract payment terms
|
||||
let dueInDays = 30; // Default
|
||||
const dueDateText = this.getText('//cac:PaymentTerms/cbc:PaymentDueDate', this.doc);
|
||||
@ -59,38 +59,38 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
const diffTime = Math.abs(dueDateObj.getTime() - issueDateObj.getTime());
|
||||
dueInDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
|
||||
|
||||
// Extract items
|
||||
const items: finance.TInvoiceItem[] = [];
|
||||
const invoiceLines = this.select('//cac:InvoiceLine', this.doc);
|
||||
|
||||
|
||||
if (invoiceLines && Array.isArray(invoiceLines)) {
|
||||
for (let i = 0; i < invoiceLines.length; i++) {
|
||||
const line = invoiceLines[i];
|
||||
|
||||
|
||||
const position = i + 1;
|
||||
const name = this.getText('./cac:Item/cbc:Name', line) || `Item ${position}`;
|
||||
const articleNumber = this.getText('./cac:Item/cac:SellersItemIdentification/cbc:ID', line) || '';
|
||||
const unitType = this.getText('./cbc:InvoicedQuantity/@unitCode', line) || 'EA';
|
||||
|
||||
|
||||
let unitQuantity = 1;
|
||||
const quantityText = this.getText('./cbc:InvoicedQuantity', line);
|
||||
if (quantityText) {
|
||||
unitQuantity = parseFloat(quantityText) || 1;
|
||||
}
|
||||
|
||||
|
||||
let unitNetPrice = 0;
|
||||
const priceText = this.getText('./cac:Price/cbc:PriceAmount', line);
|
||||
if (priceText) {
|
||||
unitNetPrice = parseFloat(priceText) || 0;
|
||||
}
|
||||
|
||||
|
||||
let vatPercentage = 0;
|
||||
const percentText = this.getText('./cac:Item/cac:ClassifiedTaxCategory/cbc:Percent', line);
|
||||
if (percentText) {
|
||||
vatPercentage = parseFloat(percentText) || 0;
|
||||
}
|
||||
|
||||
|
||||
items.push({
|
||||
position,
|
||||
name,
|
||||
@ -102,7 +102,7 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Extract notes
|
||||
const notes: string[] = [];
|
||||
const noteNodes = this.select('//cbc:Note', this.doc);
|
||||
@ -114,11 +114,11 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Extract seller and buyer information
|
||||
const seller = this.extractParty('//cac:AccountingSupplierParty/cac:Party');
|
||||
const buyer = this.extractParty('//cac:AccountingCustomerParty/cac:Party');
|
||||
|
||||
|
||||
// Create the common invoice data
|
||||
return {
|
||||
type: 'invoice',
|
||||
@ -169,7 +169,7 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extracts party information from XML
|
||||
* @param partyPath XPath to the party element
|
||||
@ -188,26 +188,26 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
let vatId = '';
|
||||
let registrationId = '';
|
||||
let registrationName = '';
|
||||
|
||||
|
||||
// Try to extract party information
|
||||
const partyNodes = this.select(partyPath, this.doc);
|
||||
|
||||
|
||||
if (partyNodes && Array.isArray(partyNodes) && partyNodes.length > 0) {
|
||||
const party = partyNodes[0];
|
||||
|
||||
|
||||
// Extract name
|
||||
name = this.getText('./cac:PartyName/cbc:Name', party) || '';
|
||||
|
||||
|
||||
// Extract address
|
||||
const addressNodes = this.select('./cac:PostalAddress', party);
|
||||
if (addressNodes && Array.isArray(addressNodes) && addressNodes.length > 0) {
|
||||
const address = addressNodes[0];
|
||||
|
||||
|
||||
streetName = this.getText('./cbc:StreetName', address) || '';
|
||||
houseNumber = this.getText('./cbc:BuildingNumber', address) || '0';
|
||||
city = this.getText('./cbc:CityName', address) || '';
|
||||
postalCode = this.getText('./cbc:PostalZone', address) || '';
|
||||
|
||||
|
||||
const countryNodes = this.select('./cac:Country', address);
|
||||
if (countryNodes && Array.isArray(countryNodes) && countryNodes.length > 0) {
|
||||
const countryNode = countryNodes[0];
|
||||
@ -215,13 +215,13 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
countryCode = this.getText('./cbc:IdentificationCode', countryNode) || '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Extract tax information
|
||||
const taxSchemeNodes = this.select('./cac:PartyTaxScheme', party);
|
||||
if (taxSchemeNodes && Array.isArray(taxSchemeNodes) && taxSchemeNodes.length > 0) {
|
||||
vatId = this.getText('./cbc:CompanyID', taxSchemeNodes[0]) || '';
|
||||
}
|
||||
|
||||
|
||||
// Extract registration information
|
||||
const legalEntityNodes = this.select('./cac:PartyLegalEntity', party);
|
||||
if (legalEntityNodes && Array.isArray(legalEntityNodes) && legalEntityNodes.length > 0) {
|
||||
@ -229,7 +229,7 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
registrationName = this.getText('./cbc:RegistrationName', legalEntityNodes[0]) || name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
type: 'company',
|
||||
name: name,
|
||||
@ -259,7 +259,7 @@ export class XRechnungDecoder extends UBLBaseDecoder {
|
||||
return this.createEmptyContact();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates an empty TContact object
|
||||
* @returns Empty TContact object
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { InvoiceFormat } from '../../interfaces/common.js';
|
||||
import { DOMParser } from 'xmldom';
|
||||
import { DOMParser, xpath } from '../../plugins.js';
|
||||
import { CII_PROFILE_IDS, ZUGFERD_V1_NAMESPACES } from '../cii/cii.types.js';
|
||||
|
||||
/**
|
||||
* Utility class for detecting invoice formats
|
||||
@ -26,11 +27,91 @@ export class FormatDetector {
|
||||
return InvoiceFormat.XRECHNUNG;
|
||||
}
|
||||
|
||||
// Factur-X/ZUGFeRD detection (CrossIndustryInvoice root element)
|
||||
// Factur-X/ZUGFeRD detection (CrossIndustryInvoice or CrossIndustryDocument root element)
|
||||
if (root.nodeName === 'rsm:CrossIndustryInvoice' || root.nodeName === 'CrossIndustryInvoice') {
|
||||
// For simplicity, we'll treat all CII documents as Factur-X for now
|
||||
// In a real implementation, we would check for specific profiles
|
||||
return InvoiceFormat.FACTURX;
|
||||
// Set up namespaces for XPath queries (ZUGFeRD v2/Factur-X)
|
||||
const namespaces = {
|
||||
rsm: 'urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100',
|
||||
ram: 'urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'
|
||||
};
|
||||
|
||||
// Create XPath selector with namespaces
|
||||
const select = xpath.useNamespaces(namespaces);
|
||||
|
||||
// Look for profile identifier
|
||||
const profileNode = select(
|
||||
'string(//rsm:ExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID)',
|
||||
doc
|
||||
);
|
||||
|
||||
if (profileNode) {
|
||||
const profileText = profileNode.toString();
|
||||
|
||||
// Check for ZUGFeRD profiles
|
||||
if (profileText.includes('zugferd') ||
|
||||
profileText === CII_PROFILE_IDS.ZUGFERD_BASIC ||
|
||||
profileText === CII_PROFILE_IDS.ZUGFERD_COMFORT ||
|
||||
profileText === CII_PROFILE_IDS.ZUGFERD_EXTENDED) {
|
||||
return InvoiceFormat.ZUGFERD;
|
||||
}
|
||||
|
||||
// Check for Factur-X profiles
|
||||
if (profileText.includes('factur-x') ||
|
||||
profileText === CII_PROFILE_IDS.FACTURX_MINIMUM ||
|
||||
profileText === CII_PROFILE_IDS.FACTURX_BASIC ||
|
||||
profileText === CII_PROFILE_IDS.FACTURX_EN16931) {
|
||||
return InvoiceFormat.FACTURX;
|
||||
}
|
||||
}
|
||||
|
||||
// If we can't determine the specific CII format, default to generic CII
|
||||
return InvoiceFormat.CII;
|
||||
}
|
||||
|
||||
// ZUGFeRD v1 detection (CrossIndustryDocument root element)
|
||||
if (root.nodeName === 'rsm:CrossIndustryDocument' || root.nodeName === 'CrossIndustryDocument' ||
|
||||
root.nodeName === 'ram:CrossIndustryDocument') {
|
||||
|
||||
// Check for ZUGFeRD v1 namespace in the document
|
||||
const xmlString = xml.toString();
|
||||
if (xmlString.includes('urn:ferd:CrossIndustryDocument:invoice:1p0') ||
|
||||
xmlString.includes('urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12')) {
|
||||
return InvoiceFormat.ZUGFERD;
|
||||
}
|
||||
|
||||
// Set up namespaces for XPath queries (ZUGFeRD v1)
|
||||
try {
|
||||
const namespaces = {
|
||||
rsm: ZUGFERD_V1_NAMESPACES.RSM,
|
||||
ram: ZUGFERD_V1_NAMESPACES.RAM
|
||||
};
|
||||
|
||||
// Create XPath selector with namespaces
|
||||
const select = xpath.useNamespaces(namespaces);
|
||||
|
||||
// Look for profile identifier
|
||||
const profileNode = select(
|
||||
'string(//rsm:SpecifiedExchangedDocumentContext/ram:GuidelineSpecifiedDocumentContextParameter/ram:ID)',
|
||||
doc
|
||||
);
|
||||
|
||||
if (profileNode) {
|
||||
const profileText = profileNode.toString();
|
||||
|
||||
// Check for ZUGFeRD v1 profiles
|
||||
if (profileText.includes('ferd:CrossIndustryDocument:invoice:1p0') ||
|
||||
profileText === CII_PROFILE_IDS.ZUGFERD_V1_BASIC ||
|
||||
profileText === CII_PROFILE_IDS.ZUGFERD_V1_COMFORT ||
|
||||
profileText === CII_PROFILE_IDS.ZUGFERD_V1_EXTENDED) {
|
||||
return InvoiceFormat.ZUGFERD;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('Error in ZUGFeRD v1 XPath detection:', error);
|
||||
}
|
||||
|
||||
// If we can't determine the specific profile but it's a CrossIndustryDocument, it's likely ZUGFeRD v1
|
||||
return InvoiceFormat.ZUGFERD;
|
||||
}
|
||||
|
||||
// FatturaPA detection would be implemented here
|
||||
|
30
ts/index.ts
30
ts/index.ts
@ -27,6 +27,12 @@ import { CIIBaseValidator } from './formats/cii/cii.validator.js';
|
||||
// Import PDF utilities
|
||||
import { PDFEmbedder } from './formats/pdf/pdf.embedder.js';
|
||||
import { PDFExtractor } from './formats/pdf/pdf.extractor.js';
|
||||
import {
|
||||
BaseXMLExtractor,
|
||||
StandardXMLExtractor,
|
||||
AssociatedFilesExtractor,
|
||||
TextXMLExtractor
|
||||
} from './formats/pdf/extractors/index.js';
|
||||
|
||||
// Import format detector
|
||||
import { FormatDetector } from './formats/utils/format.detector.js';
|
||||
@ -36,6 +42,12 @@ import { FacturXDecoder } from './formats/cii/facturx/facturx.decoder.js';
|
||||
import { FacturXEncoder } from './formats/cii/facturx/facturx.encoder.js';
|
||||
import { FacturXValidator } from './formats/cii/facturx/facturx.validator.js';
|
||||
|
||||
// Import ZUGFeRD implementation
|
||||
import { ZUGFeRDDecoder } from './formats/cii/zugferd/zugferd.decoder.js';
|
||||
import { ZUGFeRDEncoder } from './formats/cii/zugferd/zugferd.encoder.js';
|
||||
import { ZUGFeRDValidator } from './formats/cii/zugferd/zugferd.validator.js';
|
||||
import { ZUGFeRDV1Decoder } from './formats/cii/zugferd/zugferd.v1.decoder.js';
|
||||
|
||||
// Export interfaces
|
||||
export type {
|
||||
// Common interfaces
|
||||
@ -46,12 +58,12 @@ export type {
|
||||
TLetterEnvelope,
|
||||
TDocumentEnvelope,
|
||||
IPdf,
|
||||
|
||||
|
||||
// Validation interfaces
|
||||
ValidationError,
|
||||
ValidationResult,
|
||||
IValidator,
|
||||
|
||||
|
||||
// Format interfaces
|
||||
ExportFormat,
|
||||
XInvoiceOptions
|
||||
@ -80,8 +92,18 @@ export { CIIBaseDecoder, CIIBaseEncoder, CIIBaseValidator };
|
||||
// Export Factur-X implementation
|
||||
export { FacturXDecoder, FacturXEncoder, FacturXValidator };
|
||||
|
||||
// Export ZUGFeRD implementation
|
||||
export { ZUGFeRDDecoder, ZUGFeRDEncoder, ZUGFeRDValidator, ZUGFeRDV1Decoder };
|
||||
|
||||
// Export PDF utilities
|
||||
export { PDFEmbedder, PDFExtractor };
|
||||
export {
|
||||
PDFEmbedder,
|
||||
PDFExtractor,
|
||||
BaseXMLExtractor,
|
||||
StandardXMLExtractor,
|
||||
AssociatedFilesExtractor,
|
||||
TextXMLExtractor
|
||||
};
|
||||
|
||||
// Export format detector
|
||||
export { FormatDetector };
|
||||
@ -93,7 +115,7 @@ export { FormatDetector };
|
||||
* @returns ValidationResult with the result of validation
|
||||
*/
|
||||
export function validateXml(
|
||||
xml: string,
|
||||
xml: string,
|
||||
level: common.ValidationLevel = common.ValidationLevel.SYNTAX
|
||||
): common.ValidationResult {
|
||||
try {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { business, finance } from '@tsclass/tsclass';
|
||||
import { business, finance } from '../plugins.js';
|
||||
|
||||
/**
|
||||
* Supported electronic invoice formats
|
||||
|
51
ts/plugins.ts
Normal file
51
ts/plugins.ts
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Centralized imports for all external npm modules
|
||||
* This file serves as a single point of import for all external dependencies
|
||||
* to make the codebase more maintainable and follow the DRY principle.
|
||||
*/
|
||||
|
||||
// PDF-related imports
|
||||
import {
|
||||
PDFDocument,
|
||||
PDFDict,
|
||||
PDFName,
|
||||
PDFRawStream,
|
||||
PDFArray,
|
||||
PDFString,
|
||||
AFRelationship
|
||||
} from 'pdf-lib';
|
||||
|
||||
// XML-related imports
|
||||
import { DOMParser, XMLSerializer } from 'xmldom';
|
||||
import * as xpath from 'xpath';
|
||||
|
||||
// Compression-related imports
|
||||
import * as pako from 'pako';
|
||||
|
||||
// Business model imports
|
||||
import { business, finance, general } from '@tsclass/tsclass';
|
||||
|
||||
// Re-export all imports
|
||||
export {
|
||||
// PDF-lib exports
|
||||
PDFDocument,
|
||||
PDFDict,
|
||||
PDFName,
|
||||
PDFRawStream,
|
||||
PDFArray,
|
||||
PDFString,
|
||||
AFRelationship,
|
||||
|
||||
// XML-related exports
|
||||
DOMParser,
|
||||
XMLSerializer,
|
||||
xpath,
|
||||
|
||||
// Compression-related exports
|
||||
pako,
|
||||
|
||||
// Business model exports
|
||||
business,
|
||||
finance,
|
||||
general
|
||||
};
|
Reference in New Issue
Block a user