UNPKG

@weiliang79/ubl-builder

Version:

Tool to create xml documents with UBL 2.1 standard

405 lines 14.8 kB
import { InvoiceLine, InvoiceLineParams, TaxTotal, TaxTotalTypeParams, LegalMonetaryTotal, MonetaryTotalParams, PrepaidPayment, PaymentTypeParams, PaymentExchangeRate, ExchangeRateParams, DeliveryTerms, DeliveryTermsParams, PaymentMeans, PaymentMeansParams, Delivery, DeliveryTypeParams, TaxRepresentativeParty, PartyParams, AccountingCustomerParty, AccountingSupplierParty, Signature, SignatureParams, ProjectReference, ProjectReferenceParams, AdditionalDocumentReference, AdditionalDocumentReferenceParams, ContractDocumentReference, ContractDocumentReferenceParams, OriginatorDocumentReference, OriginatorDocumentReferenceParams, StatementDocumentReference, StatementDocumentReferenceParams, ReceiptDocumentReference, ReceiptDocumentReferenceParams, DespatchDocumentReference, DespatchDocumentReferenceParams, BillingReference, BillingReferenceParams, PeriodTypeParams, PeriodType, OrderReference, OrderReferenceParams, AllowanceCharge } from '../CommonAggregateComponents'; import { UBLExtensions } from '../extensionComponents'; import { UdtIdentifier, UdtCode, UdtCodeAttributes, UdtText, UdtTextAttributes, UdtDate, UdtIdentifierAttributes, UBLVersionID, UBLVersionIDAttributes, UdtNumeric, UdtNumericAttributes } from '../types/UnqualifiedDataTypes'; interface Issuer { /** resolution number */ resolutionNumber?: string; /** Issuer technical Id */ technicalKey?: string; /** Assigned prefix to issuer */ prefix?: string; /** Authorized start number eg. 990000000 */ startRange?: string; /** Authorized end number eg. 950000000 */ endRange?: string; /** Authorization start Date with format yyyy-mm-dd eg. 2019-01-19 */ startDate?: string; /** Authorization end Date with format yyyy-mm-dd eg. 2030-01-19 */ endDate?: string; } interface Software { /** Software Id */ id?: string; /** Software Pin */ pin?: string; /** Technology provider's NIT */ providerNit?: string; } export interface InvoiceOptions { /** Issue time to create issues field like issuetime, issue date. Current Date by default . */ timestamp?: number; /** DIAN enviroment. "1" for production: "2" for testing */ enviroment?: string; /** object with configuration of Invoice issuer */ issuer?: Issuer; /** object with configuration of software provider */ software?: Software; } export default class Invoice { private options; private xmlRef; private children; /** * * @param id Invoice id * @param options Invoice options */ constructor(id?: string, options?: InvoiceOptions); addProperty(key: string, value: string): Invoice; removeProperty(key: string, value: string): this; setDefaultProperties(): void; /** * An identifier for the Extension assigned by the creator of the extension. * @param value */ setUBLExtensions(value: UBLExtensions): Invoice; /** * 2. Identifies the earliest version of the UBL 2 schema for this document type that defines * all of the elements that might be encountered in the current instance. * @param value * @param attributes */ setUBLVersionID(value: string | UBLVersionID, attributes?: UBLVersionIDAttributes): this; /** * 3. Identifies a user-defined customization of UBL for a specific use. * @param value * @param attributes */ setCustomizationID(value: string | UdtIdentifier, attributes?: UdtIdentifierAttributes): Invoice; /** * 4. Identifies a user-defined profile of the customization of UBL being used. * @param value value * @param attributes attributes */ setProfileID(value: string | UdtIdentifier, attributes?: UdtIdentifierAttributes): Invoice; /** * 5. Identifies an instance of executing a profile, to associate all transactions in a collaboration. * @param value value * @param attributes attributes */ setProfileExecutionID(value: string | UdtIdentifier, attributes?: UdtIdentifierAttributes): this; /** * 6. An identifier for this document, assigned by the sender. * @param value value * @param attributes options */ setID(value: string | UdtIdentifier, attributes?: {}): Invoice; /** * * @param raw if true returns strin value, or else Udt identifier object */ getID(raw?: boolean): string | UdtIdentifier; /** * 7. Indicates whether this document is a copy (true) or not (false). * @param { Boolean } value * @returns {Invoice} */ setCopyIndicator(value: boolean): Invoice; /** * 8. A universally unique identifier for an instance of this document. * @param { String } value * @param { UdtIdentifierAttributes } attributes * @returns {Invoice} */ setUUID(value: string | UdtIdentifier, attributes?: UdtIdentifierAttributes): Invoice; /** * 9. The date, assigned by the sender, on which this document was issued. * @param value */ setIssueDate(value: string): Invoice; /** * 10. The time, assigned by the sender, at which this document was issued. * @param value */ setIssueTime(value: string): Invoice; /** * 11. A code signifying the type of the Invoice. * @param value */ setDueDate(value: string): Invoice; /** * 12. A code signifying the type of the Invoice. * @param { String } value * @param { UdtCodeAttributes } attributes * @returns {Invoice} */ setInvoiceTypeCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 13. Free-form text pertinent to this document, * conveying information that is not contained explicitly in other structures. * @param value * @param attributes */ addNote(value: string, attributes?: UdtTextAttributes): Invoice; /** * 14. The date of the Invoice, used to indicate the point at which tax becomes applicable. * @param value */ setTaxPointDate(value: string | UdtDate): Invoice; /** * 15. A code signifying the default currency for this document * @param value * @param attributes */ setDocumentCurrencyCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 16. A code signifying the currency used for tax amounts in the Invoice * @param value * @param attributes */ setTaxCurrencyCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 17. A code signifying the currency used for prices in the Invoice * @param value exmaples: COP | USD | AED ... * @param attributes */ setPricingCurrencyCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 18. A code signifying the currency used for payment in the Invoice * @param value exmaples: COP | USD | AED ... * @param attributes */ setPaymentCurrencyCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 19. A code signifying the alternative currency used for payment in the Invoice. * @param value exmaples: COP | USD | AED ... * @param attributes */ setPaymentAlternativeCurrencyCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 20. The buyer's accounting code, applied to the Invoice as a whole. * @param value exmaples: COP | USD | AED ... * @param attributes */ setAccountingCostCode(value: string | UdtCode, attributes?: UdtCodeAttributes): Invoice; /** * 21. The buyer's accounting code, applied to the Invoice as a whole, expressed as text. * @param { String } value * @param { UdtTextAttributes } attributes options * @returns {Invoice} */ setAccountingCost(value: string | UdtText, attributes?: UdtTextAttributes): Invoice; /** * 22. The number of lines in the document * @param value * @param attributes */ setLineCountNumeric(value: string | UdtNumeric, attributes?: UdtNumericAttributes): Invoice; /** * 23. A reference provided by the buyer used for internal routing of the document * @param value * @param attributes */ setBuyerReference(value: string | UdtText, attributes?: UdtTextAttributes): this; /** * 24. A period to which the Invoice applies. * @param value */ addInvoicePeriod(value: PeriodType | PeriodTypeParams): Invoice; clearInvoicePeriods(): void; /** * 25. A reference to the Order with which this Invoice is associated * @param value */ setOrderReference(value: OrderReference | OrderReferenceParams): Invoice; /** * 26. A reference to a billing document associated with this document. * @param value */ addBillingReference(value: BillingReference | BillingReferenceParams): Invoice; /** * 27. A reference to a Despatch Advice associated with this document. * @param input */ addDespatchDocumentReference(input: DespatchDocumentReference | DespatchDocumentReferenceParams): Invoice; /** * * @param { ReceiptDocumentReferenceParams } input * @returns {Invoice} */ /** * 28. A reference to a Receipt Advice associated with this document. * @param input */ addReceiptDocumentReference(input: ReceiptDocumentReference | ReceiptDocumentReferenceParams): Invoice; /** * 29. A reference to a Receipt Advice associated with this document. * @param { StatementDocumentReferenceParams } input * @returns {Invoice} */ addStatementDocumentReference(input: StatementDocumentReference | StatementDocumentReferenceParams): Invoice; /** * 30. A reference to an originator document associated with this document. * @param input */ addOriginatorDocumentReference(input: OriginatorDocumentReference | OriginatorDocumentReferenceParams): Invoice; /** * 31. A reference to a contract associated with this document. * @param input */ addContractDocumentReference(input: ContractDocumentReference | ContractDocumentReferenceParams): Invoice; /** * 32. A reference to an additional document associated with this document. * @param input */ addAdditionalDocumentReference(input: AdditionalDocumentReference | AdditionalDocumentReferenceParams): Invoice; /** * * @param input */ addProjectReference(input: ProjectReference | ProjectReferenceParams): Invoice; /** * 34. A signature applied to this document. * @param { SignatureParams } input * @returns {Invoice} */ addSignature(value: Signature | SignatureParams): Invoice; /** * 35. The accounting supplier party. * @param { SupplierPartyTypeParams } input * @returns {Invoice} */ setAccountingSupplierParty(value: AccountingSupplierParty): Invoice; /** * * @param { AccountingCustomerParty } input * @returns {Invoice} */ /** * 36. [required] The accounting customer party. * @param input */ setAccountingCustomerParty(value: AccountingCustomerParty): Invoice; /** * 37. The payee. * @param { any } input * @returns {Invoice} */ setPayeeParty(input: any): void; /** * 38. The buyer * @param { any } input * @returns {Invoice} */ setBuyerCustomerParty(input: any): void; /** * 39. The seller * @param { any } input * @returns {Invoice} */ setSellerSupplierParty(input: any): void; /** * 40. The tax representative. * @param { TaxRepresentativeParty | PartyParams } input * @returns {Invoice} */ setTaxRepresentativeParty(input: TaxRepresentativeParty | PartyParams): void; /** * * @param value */ addDelivery(value: Delivery | DeliveryTypeParams): this; /** * 42 * @param value */ setDeliveryTerms(value: DeliveryTerms | DeliveryTermsParams): Invoice; /** * * @param value */ addPaymentMeans(value: PaymentMeans | PaymentMeansParams): Invoice; /** * 44 PrepaidPayment, PaymentTypeParams * @param value */ addPaymentTerm(value: any): void; /** * 45 A prepaid payment. * @param value */ addPrepaidPayment(value: PrepaidPayment | PaymentTypeParams): Invoice; /** * 46 A discount or charge that applies to a price component.. * @param value */ addAllowanceCharge(value: AllowanceCharge): Invoice; /** * 47 A discount or charge that applies to a price component.. * @param value */ setTaxExchangeRate(value: any): void; /** * 48 The exchange rate between the document currency and the pricing currency.. * @param value */ setPricingExchangeRate(value: any): void; /** * 49 The exchange rate between the document currency and the payment currency. * @param { } value */ setPaymentExchangeRate(value: PaymentExchangeRate | ExchangeRateParams): Invoice; /** * 50 The exchange rate between the document currency and the payment alternative currency. * @param { any } value */ setPaymentAlternativeExchangeRate(value: any): void; /** * 51 The total amount of a specific type of tax * @param value */ addTaxTotal(value: TaxTotal | TaxTotalTypeParams): this; /** * 52 the total withholding tax * @param { any } value */ addWithholdingTaxTotal(value: any): void; /** * 53 The total amount payable on the Invoice, including Allowances, Charges, and Taxes * @param value */ setLegalMonetaryTotal(value: LegalMonetaryTotal | MonetaryTotalParams): Invoice; /** * * * @param {InvoiceLine | InvoiceLineParams} value */ /** * 54. A line describing an invoice item * TODO: verify the use of custom mathTools class * @param value */ addInvoiceLine(value: InvoiceLine | InvoiceLineParams): Invoice; /** * @param {String} taxId Tax's id to search * @param {Boolean} [asString=true] resturns as String * @returns { String | Number } Tax Total amount */ /** * * @param taxId * @param asString */ /** * (COLOMBIA) DIAN rule to apply cufe value * @returns {Invoice} */ /** * @returns {Invoice} */ /** * * @param attribute attribute name * @param value value * @param classRefs list of allowed classes */ private validateInstanceOf; /** * * @param pretty Pretty format * @param headless result without headers */ getXml(pretty?: boolean, headless?: boolean): string; } export {}; //# sourceMappingURL=Invoice.d.ts.map