Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a077f5c335 | |||
46331c2bf6 | |||
b4a95de482 |
@ -1,5 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## 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.0",
|
||||
"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,12 @@
|
||||
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
|
||||
|
||||
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.
|
||||
|
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": "No results file found"
|
||||
},
|
||||
"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-03T19:22:13.546Z
|
||||
|
||||
## 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: No results file found | 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();
|
172
test/test.other-formats-corpus.ts
Normal file
172
test/test.other-formats-corpus.ts
Normal file
@ -0,0 +1,172 @@
|
||||
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 other formats corpus (PEPPOL, fatturaPA)
|
||||
tap.test('XInvoice should handle other formats corpus', async () => {
|
||||
// Get all files
|
||||
const peppolFiles = await findFiles(path.join(process.cwd(), 'test/assets/corpus/PEPPOL'), '.xml');
|
||||
|
||||
// Skip problematic fatturaPA files
|
||||
const fatturapaDir = path.join(process.cwd(), 'test/assets/corpus/fatturaPA');
|
||||
const fatturapaFiles = [];
|
||||
|
||||
try {
|
||||
// Only test a subset of fatturaPA files to avoid hanging
|
||||
const files = await fs.readdir(fatturapaDir, { withFileTypes: true });
|
||||
for (const file of files) {
|
||||
if (!file.isDirectory() && file.name.endsWith('.xml') && !file.name.includes('Large_Invoice')) {
|
||||
fatturapaFiles.push(path.join(fatturapaDir, file.name));
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error reading fatturaPA directory: ${error.message}`);
|
||||
}
|
||||
|
||||
// Log the number of files found
|
||||
console.log(`Found ${peppolFiles.length} PEPPOL files`);
|
||||
console.log(`Found ${fatturapaFiles.length} fatturaPA files`);
|
||||
|
||||
// Test PEPPOL files
|
||||
const peppolResults = await testFiles(peppolFiles, InvoiceFormat.UBL);
|
||||
console.log(`PEPPOL files: ${peppolResults.success} succeeded, ${peppolResults.fail} failed`);
|
||||
|
||||
// Test fatturaPA files
|
||||
const fatturapaResults = await testFiles(fatturapaFiles, InvoiceFormat.UBL);
|
||||
console.log(`fatturaPA files: ${fatturapaResults.success} succeeded, ${fatturapaResults.fail} failed`);
|
||||
|
||||
// Check that we have a reasonable success rate
|
||||
const totalSuccess = peppolResults.success + fatturapaResults.success;
|
||||
const totalFiles = peppolFiles.length + fatturapaFiles.length;
|
||||
const successRate = totalSuccess / totalFiles;
|
||||
|
||||
console.log(`Overall success rate: ${(successRate * 100).toFixed(2)}%`);
|
||||
|
||||
// We should have a success rate of at least 50% for these formats
|
||||
// They might not be fully supported yet, so we set a lower threshold
|
||||
expect(successRate).toBeGreaterThan(0.5);
|
||||
|
||||
// Save the test results to a file
|
||||
const testDir = path.join(process.cwd(), 'test', 'output');
|
||||
await fs.mkdir(testDir, { recursive: true });
|
||||
|
||||
const testResults = {
|
||||
peppol: peppolResults,
|
||||
fatturapa: fatturapaResults,
|
||||
totalSuccessRate: successRate
|
||||
};
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(testDir, 'other-formats-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 {
|
||||
console.log(`Testing file: ${path.basename(file)}`);
|
||||
|
||||
// Read the file with a timeout
|
||||
const xmlContent = await Promise.race([
|
||||
fs.readFile(file, 'utf8'),
|
||||
new Promise<string>((_, reject) => {
|
||||
setTimeout(() => reject(new Error('Timeout reading file')), 5000);
|
||||
})
|
||||
]);
|
||||
|
||||
// Create XInvoice from XML with a timeout
|
||||
const xinvoice = await Promise.race([
|
||||
XInvoice.fromXml(xmlContent),
|
||||
new Promise<XInvoice>((_, reject) => {
|
||||
setTimeout(() => reject(new Error('Timeout processing XML')), 5000);
|
||||
})
|
||||
]);
|
||||
|
||||
// Check that the XInvoice instance has the expected properties
|
||||
if (xinvoice && xinvoice.from && xinvoice.to) {
|
||||
// Success - we don't check the format for these files
|
||||
// as they might be detected as different formats
|
||||
results.success++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: true,
|
||||
format: xinvoice.getFormat(),
|
||||
error: null
|
||||
});
|
||||
console.log(`✅ Success: ${path.basename(file)}`);
|
||||
} else {
|
||||
// Missing required properties
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format: null,
|
||||
error: 'Missing required properties'
|
||||
});
|
||||
console.log(`❌ Failed: ${path.basename(file)} - Missing required properties`);
|
||||
}
|
||||
} catch (error) {
|
||||
// Error processing the file
|
||||
results.fail++;
|
||||
results.details.push({
|
||||
file,
|
||||
success: false,
|
||||
format: null,
|
||||
error: `Error: ${error.message}`
|
||||
});
|
||||
console.log(`❌ Failed: ${path.basename(file)} - ${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();
|
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.0',
|
||||
description: 'A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for xinvoice packages.'
|
||||
}
|
@ -186,7 +186,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 +201,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);
|
||||
|
@ -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'
|
||||
};
|
||||
|
220
ts/formats/cii/zugferd/zugferd.decoder.ts
Normal file
220
ts/formats/cii/zugferd/zugferd.decoder.ts
Normal file
@ -0,0 +1,220 @@
|
||||
import { CIIBaseDecoder } from '../cii.decoder.js';
|
||||
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
||||
import { ZUGFERD_PROFILE_IDS } from './zugferd.types.js';
|
||||
import { business, finance, general } from '@tsclass/tsclass';
|
||||
|
||||
/**
|
||||
* 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
|
||||
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 street = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:LineOne`);
|
||||
const city = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CityName`);
|
||||
const zip = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:PostcodeCode`);
|
||||
const country = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CountryID`);
|
||||
|
||||
// Create address object
|
||||
const address = {
|
||||
street: street,
|
||||
city: city,
|
||||
zip: zip,
|
||||
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(): number {
|
||||
return new Date('2000-01-01').getTime();
|
||||
}
|
||||
}
|
21
ts/formats/cii/zugferd/zugferd.encoder.ts
Normal file
21
ts/formats/cii/zugferd/zugferd.encoder.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { CIIBaseEncoder } from '../cii.encoder.js';
|
||||
import type { TInvoice } from '../../../interfaces/common.js';
|
||||
import { ZUGFERD_PROFILE_IDS } from './zugferd.types.js';
|
||||
|
||||
/**
|
||||
* Encoder for ZUGFeRD invoice format
|
||||
*/
|
||||
export class ZUGFeRDEncoder extends CIIBaseEncoder {
|
||||
/**
|
||||
* Creates ZUGFeRD XML from invoice data
|
||||
* @param invoice Invoice data
|
||||
* @returns ZUGFeRD XML string
|
||||
*/
|
||||
public async createXml(invoice: TInvoice): Promise<string> {
|
||||
// Set ZUGFeRD-specific profile ID
|
||||
this.profileId = ZUGFERD_PROFILE_IDS.BASIC;
|
||||
|
||||
// Use the base CII encoder to create the XML
|
||||
return super.createXml(invoice);
|
||||
}
|
||||
}
|
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';
|
234
ts/formats/cii/zugferd/zugferd.v1.decoder.ts
Normal file
234
ts/formats/cii/zugferd/zugferd.v1.decoder.ts
Normal file
@ -0,0 +1,234 @@
|
||||
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, general } from '@tsclass/tsclass';
|
||||
|
||||
/**
|
||||
* 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
|
||||
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 street = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:LineOne`);
|
||||
const city = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CityName`);
|
||||
const zip = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:PostcodeCode`);
|
||||
const country = this.getText(`${partyXPath}/ram:PostalTradeAddress/ram:CountryID`);
|
||||
|
||||
// Create address object
|
||||
const address = {
|
||||
street: street,
|
||||
city: city,
|
||||
zip: zip,
|
||||
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 as timestamp
|
||||
*/
|
||||
private createDefaultDate(): number {
|
||||
return new Date('2000-01-01').getTime();
|
||||
}
|
||||
}
|
18
ts/formats/cii/zugferd/zugferd.validator.ts
Normal file
18
ts/formats/cii/zugferd/zugferd.validator.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { CIIBaseValidator } from '../cii.validator.js';
|
||||
import { ValidationLevel } from '../../../interfaces/common.js';
|
||||
import type { ValidationResult } from '../../../interfaces/common.js';
|
||||
|
||||
/**
|
||||
* Validator for ZUGFeRD invoice format
|
||||
*/
|
||||
export class ZUGFeRDValidator extends CIIBaseValidator {
|
||||
/**
|
||||
* 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 'pdf-lib';
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
177
ts/formats/pdf/extractors/base.extractor.ts
Normal file
177
ts/formats/pdf/extractors/base.extractor.ts
Normal file
@ -0,0 +1,177 @@
|
||||
import { PDFDocument, PDFDict, PDFName, PDFRawStream, PDFArray, PDFString } from 'pdf-lib';
|
||||
import * as pako from 'pako';
|
||||
|
||||
/**
|
||||
* 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 'pdf-lib';
|
||||
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,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,5 +1,7 @@
|
||||
import { InvoiceFormat } from '../../interfaces/common.js';
|
||||
import { DOMParser } from 'xmldom';
|
||||
import * as xpath from 'xpath';
|
||||
import { CII_PROFILE_IDS, ZUGFERD_V1_NAMESPACES } from '../cii/cii.types.js';
|
||||
|
||||
/**
|
||||
* Utility class for detecting invoice formats
|
||||
@ -26,11 +28,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 {
|
||||
|
Reference in New Issue
Block a user