/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { AllocationInput, AllocationInput$Outbound, AllocationInput$outboundSchema, } from "./allocation.js"; import { BillCreditNoteLineItemInput, BillCreditNoteLineItemInput$Outbound, BillCreditNoteLineItemInput$outboundSchema, } from "./billcreditnotelineiteminput.js"; import { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { LinkedDepartmentInput, LinkedDepartmentInput$Outbound, LinkedDepartmentInput$outboundSchema, } from "./linkeddepartmentinput.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.js"; import { LinkedLocationInput, LinkedLocationInput$Outbound, LinkedLocationInput$outboundSchema, } from "./linkedlocationinput.js"; import { LinkedSubsidiaryInput, LinkedSubsidiaryInput$Outbound, LinkedSubsidiaryInput$outboundSchema, } from "./linkedsubsidiaryinput.js"; import { LinkedSupplierInput, LinkedSupplierInput$Outbound, LinkedSupplierInput$outboundSchema, } from "./linkedsupplierinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; import { PassThroughBody, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * Status of bill credit notes */ export const BillCreditNoteCreateInputBillCreditNoteStatus = { Draft: "draft", Authorised: "authorised", Posted: "posted", PartiallyPaid: "partially_paid", Paid: "paid", Voided: "voided", Deleted: "deleted", } as const; /** * Status of bill credit notes */ export type BillCreditNoteCreateInputBillCreditNoteStatus = OpenEnum< typeof BillCreditNoteCreateInputBillCreditNoteStatus >; /** * The type of credit note. A bill credit note is always an accounts payable (supplier-side) credit. */ export const BillCreditNoteCreateInputBillCreditNoteType = { AccountsPayableCredit: "accounts_payable_credit", } as const; /** * The type of credit note. A bill credit note is always an accounts payable (supplier-side) credit. */ export type BillCreditNoteCreateInputBillCreditNoteType = OpenEnum< typeof BillCreditNoteCreateInputBillCreditNoteType >; /** * The writable shape of BillCreditNote for a batch create. Identical to [BillCreditNote](the model returned on reads) with the read-only properties removed — the same properties the single-record create endpoint rejects, so a batched record and a single-record create accept exactly the same body. */ export type BillCreditNoteCreateInput = { /** * Bill credit note number. */ number?: string | null | undefined; /** * The supplier this entity is linked to. */ supplier?: LinkedSupplierInput | null | undefined; subsidiary?: LinkedSubsidiaryInput | null | undefined; location?: LinkedLocationInput | null | undefined; department?: LinkedDepartmentInput | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Currency Exchange Rate at the time entity was recorded/generated. */ currencyRate?: number | null | undefined; /** * Amounts are including tax */ taxInclusive?: boolean | null | undefined; /** * Sub-total amount, normally before tax. */ subTotal?: number | null | undefined; /** * Amount of transaction */ totalAmount?: number | undefined; /** * Total tax amount applied to this bill credit note. */ totalTax?: number | null | undefined; /** * Applicable tax id/code override if tax is not supplied on a line item basis. */ taxCode?: string | null | undefined; /** * The balance reflecting any payments made against the transaction. */ balance?: number | null | undefined; /** * Indicates the total credit amount still available to apply towards the payment. */ remainingCredit?: number | null | undefined; /** * Status of bill credit notes */ status?: BillCreditNoteCreateInputBillCreditNoteStatus | undefined; /** * Optional reference message ie: Debit remittance detail. */ reference?: string | null | undefined; /** * Date bill credit note issued - YYYY:MM::DDThh:mm:ss.sTZD */ dateIssued?: Date | undefined; /** * Date bill credit note paid - YYYY:MM::DDThh:mm:ss.sTZD */ datePaid?: Date | null | undefined; /** * The type of credit note. A bill credit note is always an accounts payable (supplier-side) credit. */ type?: BillCreditNoteCreateInputBillCreditNoteType | undefined; account?: LinkedLedgerAccount | null | undefined; lineItems?: Array | undefined; allocations?: Array | undefined; /** * Optional note to be associated with the bill credit note. */ note?: string | null | undefined; /** * Optional terms to be associated with the bill credit note. */ terms?: string | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; customFields?: Array | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: string | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const BillCreditNoteCreateInputBillCreditNoteStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, BillCreditNoteCreateInputBillCreditNoteStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BillCreditNoteCreateInputBillCreditNoteStatus) ); /** @internal */ export const BillCreditNoteCreateInputBillCreditNoteType$outboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BillCreditNoteCreateInputBillCreditNoteType) ); /** @internal */ export type BillCreditNoteCreateInput$Outbound = { number?: string | null | undefined; supplier?: LinkedSupplierInput$Outbound | null | undefined; subsidiary?: LinkedSubsidiaryInput$Outbound | null | undefined; location?: LinkedLocationInput$Outbound | null | undefined; department?: LinkedDepartmentInput$Outbound | null | undefined; currency?: string | null | undefined; currency_rate?: number | null | undefined; tax_inclusive?: boolean | null | undefined; sub_total?: number | null | undefined; total_amount?: number | undefined; total_tax?: number | null | undefined; tax_code?: string | null | undefined; balance?: number | null | undefined; remaining_credit?: number | null | undefined; status?: string | undefined; reference?: string | null | undefined; date_issued?: string | undefined; date_paid?: string | null | undefined; type?: string | undefined; account?: LinkedLedgerAccount$Outbound | null | undefined; line_items?: Array | undefined; allocations?: Array | undefined; note?: string | null | undefined; terms?: string | null | undefined; tracking_categories?: | Array | null | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const BillCreditNoteCreateInput$outboundSchema: z.ZodType< BillCreditNoteCreateInput$Outbound, z.ZodTypeDef, BillCreditNoteCreateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ number: z.nullable(z.string()).optional(), supplier: z.nullable(LinkedSupplierInput$outboundSchema).optional(), subsidiary: z.nullable(LinkedSubsidiaryInput$outboundSchema).optional(), location: z.nullable(LinkedLocationInput$outboundSchema).optional(), department: z.nullable(LinkedDepartmentInput$outboundSchema).optional(), currency: z.nullable(Currency$outboundSchema).optional(), currencyRate: z.nullable(z.number()).optional(), taxInclusive: z.nullable(z.boolean()).optional(), subTotal: z.nullable(z.number()).optional(), totalAmount: z.number().optional(), totalTax: z.nullable(z.number()).optional(), taxCode: z.nullable(z.string()).optional(), balance: z.nullable(z.number()).optional(), remainingCredit: z.nullable(z.number()).optional(), status: BillCreditNoteCreateInputBillCreditNoteStatus$outboundSchema .optional(), reference: z.nullable(z.string()).optional(), dateIssued: z.date().transform(v => v.toISOString()).optional(), datePaid: z.nullable(z.date().transform(v => v.toISOString())).optional(), type: BillCreditNoteCreateInputBillCreditNoteType$outboundSchema.optional(), account: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), lineItems: z.array(BillCreditNoteLineItemInput$outboundSchema).optional(), allocations: z.array(AllocationInput$outboundSchema).optional(), note: z.nullable(z.string()).optional(), terms: z.nullable(z.string()).optional(), trackingCategories: z.nullable( z.array(z.nullable(LinkedTrackingCategory$outboundSchema)), ).optional(), customFields: z.array(CustomField$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { currencyRate: "currency_rate", taxInclusive: "tax_inclusive", subTotal: "sub_total", totalAmount: "total_amount", totalTax: "total_tax", taxCode: "tax_code", remainingCredit: "remaining_credit", dateIssued: "date_issued", datePaid: "date_paid", lineItems: "line_items", trackingCategories: "tracking_categories", customFields: "custom_fields", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function billCreditNoteCreateInputToJSON( billCreditNoteCreateInput: BillCreditNoteCreateInput, ): string { return JSON.stringify( BillCreditNoteCreateInput$outboundSchema.parse(billCreditNoteCreateInput), ); }