/* * 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 { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.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"; import { PaymentStatus, PaymentStatus$outboundSchema, } from "./paymentstatus.js"; /** * Type of payment */ export const BillPaymentCreateInputBillPaymentType = { AccountsPayableCredit: "accounts_payable_credit", AccountsPayableOverpayment: "accounts_payable_overpayment", AccountsPayablePrepayment: "accounts_payable_prepayment", AccountsPayable: "accounts_payable", } as const; /** * Type of payment */ export type BillPaymentCreateInputBillPaymentType = OpenEnum< typeof BillPaymentCreateInputBillPaymentType >; /** * Type of entity this payment should be attributed to. */ export const BillPaymentCreateInputAllocationType = { Bill: "bill", Expense: "expense", CreditMemo: "credit_memo", OverPayment: "over_payment", PrePayment: "pre_payment", JournalEntry: "journal_entry", Other: "other", } as const; /** * Type of entity this payment should be attributed to. */ export type BillPaymentCreateInputAllocationType = OpenEnum< typeof BillPaymentCreateInputAllocationType >; export type BillPaymentCreateInputAllocations = { /** * A unique identifier for an object. */ id?: string | null | undefined; /** * Type of entity this payment should be attributed to. */ type?: BillPaymentCreateInputAllocationType | undefined; /** * Amount of payment that should be attributed to this allocation. If null, the total_amount will be used. */ amount?: number | null | undefined; /** * Unique identifier of the allocation */ allocationId?: string | undefined; }; /** * The writable shape of BillPayment for a batch create. Identical to [BillPayment](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 BillPaymentCreateInput = { /** * 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; /** * The total amount of the transaction or record */ totalAmount: number | null; /** * Optional transaction reference message ie: Debit remittance detail. */ reference?: string | null | undefined; /** * Payment method used for the transaction, such as cash, credit card, bank transfer, or check */ paymentMethod?: string | null | undefined; /** * Optional reference message returned by payment method on processing */ paymentMethodReference?: string | null | undefined; /** * A unique identifier for an object. */ paymentMethodId?: string | null | undefined; account?: LinkedLedgerAccount | null | undefined; /** * The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD */ transactionDate: Date | null; /** * The supplier this entity is linked to. */ supplier?: LinkedSupplierInput | null | undefined; /** * The company ID the transaction belongs to */ companyId?: string | null | undefined; subsidiary?: LinkedSubsidiaryInput | null | undefined; /** * Indicates if the transaction has been reconciled. */ reconciled?: boolean | null | undefined; /** * Status of payment */ status?: PaymentStatus | undefined; /** * Type of payment */ type?: BillPaymentCreateInputBillPaymentType | undefined; allocations?: Array | undefined; /** * Note associated with the transaction */ note?: string | null | undefined; /** * Number associated with the transaction */ number?: 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; /** * Id to be displayed. */ displayId?: 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 BillPaymentCreateInputBillPaymentType$outboundSchema: z.ZodType< string, z.ZodTypeDef, BillPaymentCreateInputBillPaymentType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BillPaymentCreateInputBillPaymentType) ); /** @internal */ export const BillPaymentCreateInputAllocationType$outboundSchema: z.ZodType< string, z.ZodTypeDef, BillPaymentCreateInputAllocationType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BillPaymentCreateInputAllocationType) ); /** @internal */ export type BillPaymentCreateInputAllocations$Outbound = { id?: string | null | undefined; type?: string | undefined; amount?: number | null | undefined; allocation_id?: string | undefined; }; /** @internal */ export const BillPaymentCreateInputAllocations$outboundSchema: z.ZodType< BillPaymentCreateInputAllocations$Outbound, z.ZodTypeDef, BillPaymentCreateInputAllocations > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(z.string()).optional(), type: BillPaymentCreateInputAllocationType$outboundSchema.optional(), amount: z.nullable(z.number()).optional(), allocationId: z.string().optional(), }).transform((v) => { return remap$(v, { allocationId: "allocation_id", }); }) ); export function billPaymentCreateInputAllocationsToJSON( billPaymentCreateInputAllocations: BillPaymentCreateInputAllocations, ): string { return JSON.stringify( BillPaymentCreateInputAllocations$outboundSchema.parse( billPaymentCreateInputAllocations, ), ); } /** @internal */ export type BillPaymentCreateInput$Outbound = { currency?: string | null | undefined; currency_rate?: number | null | undefined; total_amount: number | null; reference?: string | null | undefined; payment_method?: string | null | undefined; payment_method_reference?: string | null | undefined; payment_method_id?: string | null | undefined; account?: LinkedLedgerAccount$Outbound | null | undefined; transaction_date: string | null; supplier?: LinkedSupplierInput$Outbound | null | undefined; company_id?: string | null | undefined; subsidiary?: LinkedSubsidiaryInput$Outbound | null | undefined; reconciled?: boolean | null | undefined; status?: string | undefined; type?: string | undefined; allocations?: Array | undefined; note?: string | null | undefined; number?: string | null | undefined; tracking_categories?: | Array | null | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; display_id?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const BillPaymentCreateInput$outboundSchema: z.ZodType< BillPaymentCreateInput$Outbound, z.ZodTypeDef, BillPaymentCreateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ currency: z.nullable(Currency$outboundSchema).optional(), currencyRate: z.nullable(z.number()).optional(), totalAmount: z.nullable(z.number()), reference: z.nullable(z.string()).optional(), paymentMethod: z.nullable(z.string()).optional(), paymentMethodReference: z.nullable(z.string()).optional(), paymentMethodId: z.nullable(z.string()).optional(), account: z.nullable(LinkedLedgerAccount$outboundSchema).optional(), transactionDate: z.nullable(z.date().transform(v => v.toISOString())), supplier: z.nullable(LinkedSupplierInput$outboundSchema).optional(), companyId: z.nullable(z.string()).optional(), subsidiary: z.nullable(LinkedSubsidiaryInput$outboundSchema).optional(), reconciled: z.nullable(z.boolean()).optional(), status: PaymentStatus$outboundSchema.optional(), type: BillPaymentCreateInputBillPaymentType$outboundSchema.optional(), allocations: z.array( z.lazy(() => BillPaymentCreateInputAllocations$outboundSchema), ).optional(), note: z.nullable(z.string()).optional(), number: 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(), displayId: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { currencyRate: "currency_rate", totalAmount: "total_amount", paymentMethod: "payment_method", paymentMethodReference: "payment_method_reference", paymentMethodId: "payment_method_id", transactionDate: "transaction_date", companyId: "company_id", trackingCategories: "tracking_categories", customFields: "custom_fields", rowVersion: "row_version", displayId: "display_id", passThrough: "pass_through", }); }) ); export function billPaymentCreateInputToJSON( billPaymentCreateInput: BillPaymentCreateInput, ): string { return JSON.stringify( BillPaymentCreateInput$outboundSchema.parse(billPaymentCreateInput), ); }