44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { CIIBaseEncoder } from '../cii.encoder.js';
|
|
import type { TInvoice, TCreditNote, TDebitNote } from '../../../interfaces/common.js';
|
|
import { ZUGFERD_PROFILE_IDS } from './zugferd.types.js';
|
|
import { CIIProfile } from '../cii.types.js';
|
|
|
|
/**
|
|
* Encoder for ZUGFeRD invoice format
|
|
*/
|
|
export class ZUGFeRDEncoder extends CIIBaseEncoder {
|
|
constructor() {
|
|
super();
|
|
// Set default profile to BASIC
|
|
this.profile = CIIProfile.BASIC;
|
|
}
|
|
|
|
/**
|
|
* Encodes a credit note into ZUGFeRD XML
|
|
* @param creditNote Credit note to encode
|
|
* @returns ZUGFeRD XML string
|
|
*/
|
|
protected async encodeCreditNote(creditNote: TCreditNote): Promise<string> {
|
|
// Create XML root
|
|
const xml = this.createXmlRoot();
|
|
|
|
// For now, return a basic XML structure
|
|
// In a real implementation, we would populate the XML with credit note data
|
|
return xml;
|
|
}
|
|
|
|
/**
|
|
* Encodes a debit note (invoice) into ZUGFeRD XML
|
|
* @param debitNote Debit note to encode
|
|
* @returns ZUGFeRD XML string
|
|
*/
|
|
protected async encodeDebitNote(debitNote: TDebitNote): Promise<string> {
|
|
// Create XML root
|
|
const xml = this.createXmlRoot();
|
|
|
|
// For now, return a basic XML structure
|
|
// In a real implementation, we would populate the XML with debit note data
|
|
return xml;
|
|
}
|
|
}
|