feat(ZUGFERD): Add dedicated ZUGFERD v1/v2 support and refine invoice format detection logic
This commit is contained in:
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user