This commit is contained in:
2025-04-03 13:26:27 +00:00
parent 05a2edc70c
commit 3e8b5c2869
13 changed files with 704 additions and 131 deletions

View File

@ -9,7 +9,7 @@ import {
PDFString,
} from 'pdf-lib';
import { FacturXEncoder } from './formats/facturx.encoder.js';
import { XInvoiceEncoder } from './formats/xinvoice.encoder.js';
import { XInvoiceEncoder } from './formats/xrechnung.encoder.js';
import { DecoderFactory } from './formats/decoder.factory.js';
import { BaseDecoder } from './formats/base.decoder.js';
import { ValidatorFactory } from './formats/validator.factory.js';
@ -450,18 +450,10 @@ export class XInvoice implements plugins.tsclass.business.ILetter {
filename = 'factur-x.xml';
description = 'Factur-X XML Invoice';
break;
case 'zugferd':
filename = 'zugferd.xml';
description = 'ZUGFeRD XML Invoice';
break;
case 'xrechnung':
filename = 'xrechnung.xml';
description = 'XRechnung XML Invoice';
break;
case 'ubl':
filename = 'ubl.xml';
description = 'UBL XML Invoice';
break;
}
// Make sure filename is lowercase (as required by documentation)

View File

@ -1,6 +1,6 @@
import { BaseDecoder } from './base.decoder.js';
import { FacturXDecoder } from './facturx.decoder.js';
import { XInvoiceDecoder } from './xinvoice.decoder.js';
import { XInvoiceDecoder } from './xrechnung.decoder.js';
/**
* Factory class for creating the appropriate decoder based on XML format.

View File

@ -7,7 +7,7 @@ import { BaseDecoder } from './base.decoder.js';
* XRechnung is the German implementation of the European standard EN16931
* for electronic invoices to the German public sector.
*/
export class XInvoiceDecoder extends BaseDecoder {
export class XRechnungDecoder extends BaseDecoder {
private xmlDoc: Document | null = null;
private namespaces: { [key: string]: string } = {
cbc: 'urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2',

View File

@ -2,19 +2,19 @@ import * as plugins from '../plugins.js';
/**
* A class to convert a given ILetter with invoice data
* into an XInvoice/XRechnung compliant XML (based on UBL).
* into an XRechnung compliant XML (based on UBL).
*
* XRechnung is the German implementation of the European standard EN16931
* for electronic invoices to the German public sector.
*/
export class XInvoiceEncoder {
export class XRechnungEncoder {
constructor() {}
/**
* Creates an XInvoice compliant XML based on the provided letter data.
* Creates an XRechnung compliant XML based on the provided letter data.
*/
public createXInvoiceXml(letterArg: plugins.tsclass.business.ILetter): string {
public createXRechnungXml(letterArg: plugins.tsclass.business.ILetter): string {
// Use SmartXml for XML creation
const smartxmlInstance = new plugins.smartxml.SmartXml();

View File

@ -4,8 +4,8 @@ import { XInvoice } from './classes.xinvoice.js';
// Import format-specific encoder/decoder classes
import { FacturXEncoder } from './formats/facturx.encoder.js';
import { FacturXDecoder } from './formats/facturx.decoder.js';
import { XInvoiceEncoder } from './formats/xinvoice.encoder.js';
import { XInvoiceDecoder } from './formats/xinvoice.decoder.js';
import { XInvoiceEncoder } from './formats/xrechnung.encoder.js';
import { XInvoiceDecoder } from './formats/xrechnung.decoder.js';
import { DecoderFactory } from './formats/decoder.factory.js';
import { BaseDecoder } from './formats/base.decoder.js';

View File

@ -11,6 +11,7 @@ export interface IParty {
Name: string;
Address: IAddress;
Contact: IContact;
TaxRegistration?: string;
}
export interface IAddress {