feat(ZUGFERD): Add dedicated ZUGFERD v1/v2 support and refine invoice format detection logic

This commit is contained in:
2025-04-03 20:08:02 +00:00
parent b4a95de482
commit 46331c2bf6
28 changed files with 1191 additions and 294 deletions

View 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);
}
}