@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
39 lines (38 loc) • 1.41 kB
TypeScript
import { BaseEncoder } from '../base/base.encoder.js';
import type { TInvoice, TCreditNote, TDebitNote } from '../../interfaces/common.js';
import { UBLDocumentType } from './ubl.types.js';
/**
* Base encoder for UBL-based invoice formats
*/
export declare abstract class UBLBaseEncoder extends BaseEncoder {
/**
* Encodes a TInvoice object into UBL XML
* @param invoice TInvoice object to encode
* @returns UBL XML string
*/
encode(invoice: TInvoice): Promise<string>;
/**
* Encodes a TCreditNote object into UBL XML
* @param creditNote TCreditNote object to encode
* @returns UBL XML string
*/
protected abstract encodeCreditNote(creditNote: TCreditNote): Promise<string>;
/**
* Encodes a TDebitNote object into UBL XML
* @param debitNote TDebitNote object to encode
* @returns UBL XML string
*/
protected abstract encodeDebitNote(debitNote: TDebitNote): Promise<string>;
/**
* Creates the XML declaration and root element
* @param documentType UBL document type
* @returns XML string with declaration and root element
*/
protected createXmlRoot(documentType: UBLDocumentType): string;
/**
* Formats a date as an ISO string (YYYY-MM-DD)
* @param timestamp Timestamp to format
* @returns Formatted date string
*/
protected formatDate(timestamp: number): string;
}