/** * This file was auto-generated by Fern from our API Definition. */ import * as environments from "../../../../environments.js"; import * as core from "../../../../core/index.js"; import * as Mercoa from "../../../index.js"; import { LineItem } from "../resources/lineItem/client/Client.js"; import { Approval } from "../resources/approval/client/Client.js"; import { Bnpl } from "../resources/bnpl/client/Client.js"; import { Bulk } from "../resources/bulk/client/Client.js"; import { Collection } from "../resources/collection/client/Client.js"; import { Comment } from "../resources/comment/client/Client.js"; import { Document } from "../resources/document/client/Client.js"; import { PaymentLinks } from "../resources/paymentLinks/client/Client.js"; export declare namespace Invoice { interface Options { environment?: core.Supplier; /** Specify a custom URL to connect the client to. */ baseUrl?: core.Supplier; token: core.Supplier; /** Override the X-API-Version header */ xApiVersion?: "2024-08-01"; /** Additional headers to include in requests. */ headers?: Record | undefined>; } interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Additional query string parameters to include in the request. */ queryParams?: Record; /** Additional headers to include in the request. */ headers?: Record | undefined>; /** Override the X-API-Version header */ xApiVersion?: "2024-08-01"; } } export declare class Invoice { protected readonly _options: Invoice.Options; protected _lineItem: LineItem | undefined; protected _approval: Approval | undefined; protected _bnpl: Bnpl | undefined; protected _bulk: Bulk | undefined; protected _collection: Collection | undefined; protected _comment: Comment | undefined; protected _document: Document | undefined; protected _paymentLinks: PaymentLinks | undefined; constructor(_options: Invoice.Options); get lineItem(): LineItem; get approval(): Approval; get bnpl(): Bnpl; get bulk(): Bulk; get collection(): Collection; get comment(): Comment; get document(): Document; get paymentLinks(): PaymentLinks; /** * Search invoices for all entities in the organization * * @param {Mercoa.invoice.GetAllInvoicesRequest} request * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.invoice.find({ * entityId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c" * }) */ find(request?: Mercoa.invoice.GetAllInvoicesRequest, requestOptions?: Invoice.RequestOptions): core.HttpResponsePromise; private __find; /** * @param {Mercoa.InvoiceCreationRequest} request * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.invoice.create({ * status: "NEW", * amount: 100, * currency: "USD", * invoiceDate: new Date("2021-01-01T00:00:00.000Z"), * dueDate: new Date("2021-01-31T00:00:00.000Z"), * invoiceNumber: "INV-123", * noteToSelf: "For the month of January", * payerId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * paymentSourceId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769", * vendorId: "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", * paymentDestinationId: "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", * paymentDestinationOptions: { * type: "check", * delivery: "MAIL", * printDescription: true * }, * lineItems: [{ * amount: 100, * currency: "USD", * description: "Product A", * name: "Product A", * quantity: 1, * unitPrice: 100, * category: "EXPENSE", * serviceStartDate: new Date("2021-01-01T00:00:00.000Z"), * serviceEndDate: new Date("2021-01-31T00:00:00.000Z"), * metadata: { * "key1": "value1", * "key2": "value2" * }, * glAccountId: "600394" * }], * creatorEntityId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * creatorUserId: "user_e24fc81c-c5ee-47e8-af42-4fe29d895506" * }) * * @example * await client.invoice.create({ * status: "DRAFT", * payerId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * creatorEntityId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c" * }) * * @example * await client.invoice.create({ * status: "NEW", * payerId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * creatorEntityId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * vendorId: "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", * currency: "USD", * amount: 100, * invoiceDate: new Date("2021-01-01T00:00:00.000Z"), * dueDate: new Date("2021-01-31T00:00:00.000Z"), * paymentSourceId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769", * paymentDestinationId: "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", * deductionDate: new Date("2021-01-29T00:00:00.000Z") * }) * * @example * await client.invoice.create({ * status: "SCHEDULED", * payerId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * creatorEntityId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * vendorId: "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", * currency: "USD", * amount: 100, * invoiceDate: new Date("2021-01-01T00:00:00.000Z"), * dueDate: new Date("2021-01-31T00:00:00.000Z"), * paymentSourceId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769", * paymentDestinationId: "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", * deductionDate: new Date("2021-01-29T00:00:00.000Z") * }) */ create(request: Mercoa.InvoiceCreationRequest, requestOptions?: Invoice.RequestOptions): core.HttpResponsePromise; private __create; /** * @param {Mercoa.InvoiceId} invoiceId - Invoice ID or Invoice ForeignID * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.invoice.get("in_8545a84e-a45f-41bf-bdf1-33b42a55812c") */ get(invoiceId: Mercoa.InvoiceId, requestOptions?: Invoice.RequestOptions): core.HttpResponsePromise; private __get; /** * @param {Mercoa.InvoiceId} invoiceId - Invoice ID or Invoice ForeignID * @param {Mercoa.InvoiceUpdateRequest} request * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.invoice.update("in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9", { * status: "NEW", * amount: 100, * currency: "USD", * invoiceDate: new Date("2021-01-01T00:00:00.000Z"), * dueDate: new Date("2021-01-31T00:00:00.000Z"), * invoiceNumber: "INV-123", * noteToSelf: "For the month of January", * payerId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * paymentSourceId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769", * vendorId: "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", * paymentDestinationId: "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", * paymentDestinationOptions: { * type: "check", * delivery: "MAIL", * printDescription: true * }, * lineItems: [{ * id: "inli_26672f38-eb9a-48f1-a7a0-f1b855e38cd7", * amount: 100, * currency: "USD", * description: "Product A", * name: "Product A", * quantity: 1, * unitPrice: 100, * category: "EXPENSE", * serviceStartDate: new Date("2021-01-01T00:00:00.000Z"), * serviceEndDate: new Date("2021-01-31T00:00:00.000Z"), * metadata: { * "key1": "value1", * "key2": "value2" * }, * glAccountId: "600394" * }], * creatorEntityId: "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", * creatorUserId: "user_e24fc81c-c5ee-47e8-af42-4fe29d895506" * }) * * @example * await client.invoice.update("in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9", { * status: "NEW", * vendorId: "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d", * currency: "USD", * amount: 100, * invoiceDate: new Date("2021-01-01T00:00:00.000Z"), * dueDate: new Date("2021-01-31T00:00:00.000Z"), * paymentSourceId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769" * }) * * @example * await client.invoice.update("in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9", { * status: "SCHEDULED", * paymentDestinationId: "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18", * deductionDate: new Date("2021-01-29T00:00:00.000Z") * }) * * @example * await client.invoice.update("in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9", { * batchPayment: true * }) * * @example * await client.invoice.update("in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9", { * vendorCreditIds: ["vcr_c3f4c87d-794d-4543-9562-575cdddfc0d7"] * }) * * @example * await client.invoice.update("in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9", { * status: "FAILED" * }) */ update(invoiceId: Mercoa.InvoiceId, request: Mercoa.InvoiceUpdateRequest, requestOptions?: Invoice.RequestOptions): core.HttpResponsePromise; private __update; /** * Only invoices in the UNASSIGNED and DRAFT statuses can be deleted. * * @param {Mercoa.InvoiceId} invoiceId - Invoice ID or Invoice ForeignID * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.invoice.delete("in_8545a84e-a45f-41bf-bdf1-33b42a55812c") */ delete(invoiceId: Mercoa.InvoiceId, requestOptions?: Invoice.RequestOptions): core.HttpResponsePromise; private __delete; /** * Get all events for an invoice * * @param {Mercoa.InvoiceId} invoiceId - Invoice ID or Invoice ForeignID * @param {Mercoa.invoice.InvoiceInvoiceGetEventsRequest} request * @param {Invoice.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.invoice.events("in_8545a84e-a45f-41bf-bdf1-33b42a55812c") */ events(invoiceId: Mercoa.InvoiceId, request?: Mercoa.invoice.InvoiceInvoiceGetEventsRequest, requestOptions?: Invoice.RequestOptions): core.HttpResponsePromise; private __events; protected _getAuthorizationHeader(): Promise; }