import { Attachment } from '././attachment'; import { Contact } from '././contact'; import { CreditNote } from '././creditNote'; import { CurrencyCode } from '././currencyCode'; import { InvoiceAddress } from '././invoiceAddress'; import { LineAmountTypes } from '././lineAmountTypes'; import { LineItem } from '././lineItem'; import { Overpayment } from '././overpayment'; import { Payment } from '././payment'; import { Prepayment } from '././prepayment'; import { ValidationError } from '././validationError'; export class Invoice { /** * See Invoice Types */ 'type'?: Invoice.TypeEnum; 'contact'?: Contact; /** * See LineItems */ 'lineItems'?: Array; /** * Date invoice was issued – YYYY-MM-DD. If the Date element is not specified it will default to the current date based on the timezone setting of the organisation */ 'date'?: string; /** * Date invoice is due – YYYY-MM-DD */ 'dueDate'?: string; 'lineAmountTypes'?: LineAmountTypes; /** * ACCREC – Unique alpha numeric code identifying invoice (when missing will auto-generate from your Organisation Invoice Settings) (max length = 255) */ 'invoiceNumber'?: string; /** * ACCREC only – additional reference number */ 'reference'?: string; /** * See BrandingThemes */ 'brandingThemeID'?: string; /** * URL link to a source document – shown as “Go to [appName]” in the Xero app */ 'url'?: string; 'currencyCode'?: CurrencyCode; /** * The currency rate for a multicurrency invoice. If no rate is specified, the XE.com day rate is used. (max length = [18].[6]) */ 'currencyRate'?: number; /** * See Invoice Status Codes */ 'status'?: Invoice.StatusEnum; /** * Boolean to set whether the invoice in the Xero app should be marked as “sent”. This can be set only on invoices that have been approved */ 'sentToContact'?: boolean; /** * Shown on sales invoices (Accounts Receivable) when this has been set */ 'expectedPaymentDate'?: string; /** * Shown on bills (Accounts Payable) when this has been set */ 'plannedPaymentDate'?: string; /** * CIS deduction for UK contractors */ 'cISDeduction'?: number; /** * CIS Deduction rate for the organisation */ 'cISRate'?: number; /** * Total of invoice excluding taxes. Calculated automatically by Xero from the invoice\'s line items. Only for ACCPAY and ACCREC invoices, where this opt-in capability is enabled for your organisation, can SubTotal be supplied on write – on a SUBMITTED or AUTHORISED invoice supplied together with TotalTax and Total, it is validated against the calculated line item totals (see RoundingAmount); it is ignored in all other cases. This write behaviour, and the returned value reflecting it, only applies to the Create and Update endpoints (POST/PUT) and to retrieving a single invoice by ID (GET by ID) – it does not apply when listing invoices (GET) */ 'subTotal'?: number; /** * Total tax on invoice. Calculated automatically by Xero from the invoice\'s line items. Only for ACCPAY and ACCREC invoices, where this opt-in capability is enabled for your organisation, can TotalTax be supplied on write – on a SUBMITTED or AUTHORISED invoice supplied together with SubTotal and Total, it is validated against the calculated line item totals (see RoundingAmount); it is ignored in all other cases. This write behaviour, and the returned value reflecting it, only applies to the Create and Update endpoints (POST/PUT) and to retrieving a single invoice by ID (GET by ID) – it does not apply when listing invoices (GET) */ 'totalTax'?: number; /** * Total of Invoice tax inclusive (i.e. SubTotal + TotalTax + RoundingAmount). Calculated automatically by Xero from the invoice\'s line items. Only for ACCPAY and ACCREC invoices, where this opt-in capability is enabled for your organisation, can Total be supplied on write – on a SUBMITTED or AUTHORISED invoice supplied together with SubTotal and TotalTax, it is validated against the calculated line item totals plus RoundingAmount; in all other cases this will be ignored if it does not equal the sum of the LineAmounts. This write behaviour, and the returned value reflecting it, only applies to the Create and Update endpoints (POST/PUT) and to retrieving a single invoice by ID (GET by ID) – it does not apply when listing invoices (GET) */ 'total'?: number; /** * Total of discounts applied on the invoice line items */ 'totalDiscount'?: number; /** * An optional rounding adjustment added to SubTotal + TotalTax to give Total (i.e. Total = SubTotal + TotalTax + RoundingAmount). Only applies to ACCPAY and ACCREC invoices, and only if this opt-in capability has been enabled for your organisation. Not validated while the invoice is DRAFT. For SUBMITTED and AUTHORISED invoices, RoundingAmount is only applied when SubTotal, TotalTax and Total are all supplied together, and must be between -0.10 and 0.10 – values outside this range are rejected with a validation error (on DRAFT invoices, an out-of-range value is ignored instead). This field is only settable and only returned via the Create and Update endpoints (POST/PUT) and when retrieving a single invoice by ID (GET by ID) – it is not returned when listing invoices (GET) */ 'roundingAmount'?: number; /** * The total amount as originally entered for the invoice, before any RoundingAmount adjustment is applied. Only applies to ACCPAY and ACCREC invoices, and only if this opt-in capability has been enabled for your organisation. Can only be set while the invoice is DRAFT; once the invoice is no longer DRAFT this reflects Total. This field is only settable and only returned via the Create and Update endpoints (POST/PUT) and when retrieving a single invoice by ID (GET by ID) – it is not returned when listing invoices (GET) */ 'enteredTotal'?: number; /** * Xero generated unique identifier for invoice */ 'invoiceID'?: string; /** * Xero generated unique identifier for repeating invoices */ 'repeatingInvoiceID'?: string; /** * boolean to indicate if an invoice has an attachment */ 'hasAttachments'?: boolean; /** * boolean to indicate if an invoice has a discount */ 'isDiscounted'?: boolean; /** * See Payments */ 'payments'?: Array; /** * See Prepayments */ 'prepayments'?: Array; /** * See Overpayments */ 'overpayments'?: Array; /** * Amount remaining to be paid on invoice */ 'amountDue'?: number; /** * Sum of payments received for invoice */ 'amountPaid'?: number; /** * The date the invoice was fully paid. Only returned on fully paid invoices */ 'fullyPaidOnDate'?: string; /** * Sum of all credit notes, over-payments and pre-payments applied to invoice */ 'amountCredited'?: number; /** * UTC timestamp of last update to the invoice */ 'updatedDateUTC'?: Date; /** * UTC ISO-8601 formatted timestamp of last update to the invoice */ 'updatedDateUTCString'?: string; /** * Details of credit notes that have been applied to an invoice */ 'creditNotes'?: Array; /** * Displays array of attachments from the API */ 'attachments'?: Array; /** * A boolean to indicate if a invoice has an validation errors */ 'hasErrors'?: boolean; /** * A string to indicate if a invoice status */ 'statusAttributeString'?: string; /** * Displays array of validation error messages from the API */ 'validationErrors'?: Array; /** * Displays array of warning messages from the API */ 'warnings'?: Array; /** * An array of addresses used to auto calculate sales tax */ 'invoiceAddresses'?: Array; static discriminator: string | undefined = undefined; static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ { "name": "type", "baseName": "Type", "type": "Invoice.TypeEnum" }, { "name": "contact", "baseName": "Contact", "type": "Contact" }, { "name": "lineItems", "baseName": "LineItems", "type": "Array" }, { "name": "date", "baseName": "Date", "type": "string" }, { "name": "dueDate", "baseName": "DueDate", "type": "string" }, { "name": "lineAmountTypes", "baseName": "LineAmountTypes", "type": "LineAmountTypes" }, { "name": "invoiceNumber", "baseName": "InvoiceNumber", "type": "string" }, { "name": "reference", "baseName": "Reference", "type": "string" }, { "name": "brandingThemeID", "baseName": "BrandingThemeID", "type": "string" }, { "name": "url", "baseName": "Url", "type": "string" }, { "name": "currencyCode", "baseName": "CurrencyCode", "type": "CurrencyCode" }, { "name": "currencyRate", "baseName": "CurrencyRate", "type": "number" }, { "name": "status", "baseName": "Status", "type": "Invoice.StatusEnum" }, { "name": "sentToContact", "baseName": "SentToContact", "type": "boolean" }, { "name": "expectedPaymentDate", "baseName": "ExpectedPaymentDate", "type": "string" }, { "name": "plannedPaymentDate", "baseName": "PlannedPaymentDate", "type": "string" }, { "name": "cISDeduction", "baseName": "CISDeduction", "type": "number" }, { "name": "cISRate", "baseName": "CISRate", "type": "number" }, { "name": "subTotal", "baseName": "SubTotal", "type": "number" }, { "name": "totalTax", "baseName": "TotalTax", "type": "number" }, { "name": "total", "baseName": "Total", "type": "number" }, { "name": "totalDiscount", "baseName": "TotalDiscount", "type": "number" }, { "name": "roundingAmount", "baseName": "RoundingAmount", "type": "number" }, { "name": "enteredTotal", "baseName": "EnteredTotal", "type": "number" }, { "name": "invoiceID", "baseName": "InvoiceID", "type": "string" }, { "name": "repeatingInvoiceID", "baseName": "RepeatingInvoiceID", "type": "string" }, { "name": "hasAttachments", "baseName": "HasAttachments", "type": "boolean" }, { "name": "isDiscounted", "baseName": "IsDiscounted", "type": "boolean" }, { "name": "payments", "baseName": "Payments", "type": "Array" }, { "name": "prepayments", "baseName": "Prepayments", "type": "Array" }, { "name": "overpayments", "baseName": "Overpayments", "type": "Array" }, { "name": "amountDue", "baseName": "AmountDue", "type": "number" }, { "name": "amountPaid", "baseName": "AmountPaid", "type": "number" }, { "name": "fullyPaidOnDate", "baseName": "FullyPaidOnDate", "type": "string" }, { "name": "amountCredited", "baseName": "AmountCredited", "type": "number" }, { "name": "updatedDateUTC", "baseName": "UpdatedDateUTC", "type": "Date" }, { "name": "updatedDateUTCString", "baseName": "UpdatedDateUTCString", "type": "string" }, { "name": "creditNotes", "baseName": "CreditNotes", "type": "Array" }, { "name": "attachments", "baseName": "Attachments", "type": "Array" }, { "name": "hasErrors", "baseName": "HasErrors", "type": "boolean" }, { "name": "statusAttributeString", "baseName": "StatusAttributeString", "type": "string" }, { "name": "validationErrors", "baseName": "ValidationErrors", "type": "Array" }, { "name": "warnings", "baseName": "Warnings", "type": "Array" }, { "name": "invoiceAddresses", "baseName": "InvoiceAddresses", "type": "Array" } ]; static getAttributeTypeMap() { return Invoice.attributeTypeMap; } } export namespace Invoice { export enum TypeEnum { ACCPAY = 'ACCPAY', ACCPAYCREDIT = 'ACCPAYCREDIT', APOVERPAYMENT = 'APOVERPAYMENT', APPREPAYMENT = 'APPREPAYMENT', ACCREC = 'ACCREC', ACCRECCREDIT = 'ACCRECCREDIT', AROVERPAYMENT = 'AROVERPAYMENT', ARPREPAYMENT = 'ARPREPAYMENT' } export enum StatusEnum { DRAFT = 'DRAFT', SUBMITTED = 'SUBMITTED', DELETED = 'DELETED', AUTHORISED = 'AUTHORISED', PAID = 'PAID', VOIDED = 'VOIDED' } }