@fin.cx/einvoice
Version:
A TypeScript module for creating, manipulating, and embedding XML data within PDF files specifically tailored for electronic invoice (einvoice) packages.
83 lines (82 loc) • 2.6 kB
TypeScript
import { CIIBaseEncoder } from '../cii.encoder.js';
import type { TCreditNote, TDebitNote } from '../../../interfaces/common.js';
/**
* Encoder for Factur-X invoice format
*/
export declare class FacturXEncoder extends CIIBaseEncoder {
/**
* Encodes a TCreditNote object into Factur-X XML
* @param creditNote TCreditNote object to encode
* @returns Factur-X XML string
*/
protected encodeCreditNote(creditNote: TCreditNote): Promise<string>;
/**
* Encodes a TDebitNote object into Factur-X XML
* @param debitNote TDebitNote object to encode
* @returns Factur-X XML string
*/
protected encodeDebitNote(debitNote: TDebitNote): Promise<string>;
/**
* Creates a base Factur-X XML document
* @returns XML document with basic structure
*/
private createBaseXml;
/**
* Adds Factur-X profile information to the XML document
* @param doc XML document
*/
private addProfile;
/**
* Sets the document type code in the XML document
* @param doc XML document
* @param typeCode Document type code (380 for invoice, 381 for credit note)
*/
private setDocumentTypeCode;
/**
* Adds common invoice data to the XML document
* @param doc XML document
* @param invoice Invoice data
*/
private addCommonInvoiceData;
/**
* Adds agreement section with seller and buyer information
* @param doc XML document
* @param transactionElement Transaction element
* @param invoice Invoice data
*/
private addAgreementSection;
/**
* Adds party information to an element
* @param doc XML document
* @param partyElement Party element
* @param party Party data
*/
private addPartyInfo;
/**
* Adds delivery section with delivery information
* @param doc XML document
* @param transactionElement Transaction element
* @param invoice Invoice data
*/
private addDeliverySection;
/**
* Adds settlement section with payment terms and totals
* @param doc XML document
* @param transactionElement Transaction element
* @param invoice Invoice data
*/
private addSettlementSection;
/**
* Adds line items to the XML document
* @param doc XML document
* @param transactionElement Transaction element
* @param invoice Invoice data
*/
private addLineItems;
/**
* Formats a date as YYYYMMDD
* @param timestamp Timestamp to format
* @returns Formatted date string
*/
private formatDateYYYYMMDD;
}