lbx-invoice
Version:
Provides functionality around generating invoices.
33 lines (32 loc) • 1.51 kB
TypeScript
import { XMLBuilder, XMLBuilderCreateOptions } from 'xmlbuilder2/lib/interfaces';
import { BaseCompanyInfo, BaseInvoice } from '../models';
/**
* Represents a wrapper around XML nodes to implement easy to use and chainable document builder methods.
*/
export type XML = XMLBuilder;
/**
* Utility class for handling xml files.
*/
export declare abstract class XmlUtilities {
/**
* Creates an XML document without any child nodes with the given options.
* @param options - Builder options.
* @returns Document node.
*/
static create(options?: XMLBuilderCreateOptions): XML;
/**
* Creates an cross industry invoice compliant xml file.
* @param invoice - The invoice data to generate the xml from.
* @param currency - The currency code, eg. 'USD'.
* @param companyInfo - Info about the seller.
* @param tradeContact - The trade contact. Defaults to companyInfo.ceo.
* @param documentContextId - The identifier for the GuidelineSpecifiedDocumentContextParameter ID.
* @returns The finished xml.
* @throws When the provided invoice data cannot be transformed to an valid xml.
*/
static createCrossIndustryInvoiceXml<Invoice extends BaseInvoice>(invoice: Invoice, currency: string, companyInfo: BaseCompanyInfo, tradeContact?: string | undefined, documentContextId?: string): XML;
private static buildBuyerParty;
private static buildSellerParty;
private static buildTradeLineItems;
private static getTaxGroups;
}