/* * 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 { Address, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { InvoiceLineItemInput, InvoiceLineItemInput$Outbound, InvoiceLineItemInput$outboundSchema, } from "./invoicelineitem.js"; import { LinkedCustomerInput, LinkedCustomerInput$Outbound, LinkedCustomerInput$outboundSchema, } from "./linkedcustomerinput.js"; import { LinkedDepartmentInput, LinkedDepartmentInput$Outbound, LinkedDepartmentInput$outboundSchema, } from "./linkeddepartmentinput.js"; import { LinkedLedgerAccount, LinkedLedgerAccount$Outbound, LinkedLedgerAccount$outboundSchema, } from "./linkedledgeraccount.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; import { PassThroughBody, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export type SalesReceiptInput = { /** * Reference number for the sales receipt. */ number?: string | null | undefined; /** * The customer this entity is linked to. */ customer?: LinkedCustomerInput | 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; /** * Subtotal amount, normally before tax. */ subTotal?: number | null | undefined; /** * The total amount of the transaction or record */ totalAmount: number | null; /** * Total tax amount applied to this transaction. */ totalTax?: number | null | undefined; /** * The date of the sales receipt transaction - YYYY-MM-DDThh:mm:ss.sTZD */ transactionDate?: Date | 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; /** * Line items for itemized sales receipts. Used when the sales receipt includes product/service details with quantities and pricing. */ lineItems?: Array | undefined; /** * Applicable tax id/code override if tax is not supplied on a line item basis. */ taxCode?: string | null | undefined; /** * Discount percentage applied to this sales receipt. */ discountPercentage?: number | null | undefined; /** * Discount amount applied to this sales receipt. */ discountAmount?: number | null | undefined; /** * Optional note to be associated with the sales receipt. */ note?: string | null | undefined; /** * Customer memo */ customerMemo?: string | null | undefined; /** * Optional reference message for the sales receipt. */ reference?: string | null | undefined; billingAddress?: Address | undefined; shippingAddress?: Address | undefined; department?: LinkedDepartmentInput | 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 type SalesReceiptInput$Outbound = { number?: string | null | undefined; customer?: LinkedCustomerInput$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 | null; total_tax?: number | null | undefined; transaction_date?: 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; line_items?: Array | undefined; tax_code?: string | null | undefined; discount_percentage?: number | null | undefined; discount_amount?: number | null | undefined; note?: string | null | undefined; customer_memo?: string | null | undefined; reference?: string | null | undefined; billing_address?: Address$Outbound | undefined; shipping_address?: Address$Outbound | undefined; department?: LinkedDepartmentInput$Outbound | null | undefined; tracking_categories?: | Array | null | undefined; custom_fields?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const SalesReceiptInput$outboundSchema: z.ZodType< SalesReceiptInput$Outbound, z.ZodTypeDef, SalesReceiptInput > = /* @__PURE__ */ lazySchema$(() => z.object({ number: z.nullable(z.string()).optional(), customer: z.nullable(LinkedCustomerInput$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.nullable(z.number()), totalTax: z.nullable(z.number()).optional(), transactionDate: z.nullable(z.date().transform(v => v.toISOString())) .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(), lineItems: z.array(InvoiceLineItemInput$outboundSchema).optional(), taxCode: z.nullable(z.string()).optional(), discountPercentage: z.nullable(z.number()).optional(), discountAmount: z.nullable(z.number()).optional(), note: z.nullable(z.string()).optional(), customerMemo: z.nullable(z.string()).optional(), reference: z.nullable(z.string()).optional(), billingAddress: Address$outboundSchema.optional(), shippingAddress: Address$outboundSchema.optional(), department: z.nullable(LinkedDepartmentInput$outboundSchema).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", transactionDate: "transaction_date", paymentMethod: "payment_method", paymentMethodReference: "payment_method_reference", paymentMethodId: "payment_method_id", lineItems: "line_items", taxCode: "tax_code", discountPercentage: "discount_percentage", discountAmount: "discount_amount", customerMemo: "customer_memo", billingAddress: "billing_address", shippingAddress: "shipping_address", trackingCategories: "tracking_categories", customFields: "custom_fields", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function salesReceiptInputToJSON( salesReceiptInput: SalesReceiptInput, ): string { return JSON.stringify( SalesReceiptInput$outboundSchema.parse(salesReceiptInput), ); }