/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Amount, Amount$inboundSchema, Amount$Outbound, Amount$outboundSchema, } from "./amount.js"; import { CreateScheduledTransferLineItems, CreateScheduledTransferLineItems$inboundSchema, CreateScheduledTransferLineItems$Outbound, CreateScheduledTransferLineItems$outboundSchema, } from "./createscheduledtransferlineitems.js"; import { SchedulePaymentMethod, SchedulePaymentMethod$inboundSchema, SchedulePaymentMethod$Outbound, SchedulePaymentMethod$outboundSchema, } from "./schedulepaymentmethod.js"; /** * Defines the attributes of a transfer. */ export type CreateRunTransfer = { amount: Amount; /** * Optional sales tax amount. This amount is included in the total transfer amount. */ salesTaxAmount?: Amount | undefined; destination: SchedulePaymentMethod; partnerAccountID: string; source: SchedulePaymentMethod; /** * Simple description to place on the transfer. */ description: string; /** * An optional collection of line items for a scheduled transfer. * * @remarks * When line items are provided their total must equal `amount` minus `salesTaxAmount`. */ lineItems?: CreateScheduledTransferLineItems | undefined; }; /** @internal */ export const CreateRunTransfer$inboundSchema: z.ZodType< CreateRunTransfer, z.ZodTypeDef, unknown > = z.object({ amount: Amount$inboundSchema, salesTaxAmount: Amount$inboundSchema.optional(), destination: SchedulePaymentMethod$inboundSchema, partnerAccountID: z.string(), source: SchedulePaymentMethod$inboundSchema, description: z.string(), lineItems: CreateScheduledTransferLineItems$inboundSchema.optional(), }); /** @internal */ export type CreateRunTransfer$Outbound = { amount: Amount$Outbound; salesTaxAmount?: Amount$Outbound | undefined; destination: SchedulePaymentMethod$Outbound; partnerAccountID: string; source: SchedulePaymentMethod$Outbound; description: string; lineItems?: CreateScheduledTransferLineItems$Outbound | undefined; }; /** @internal */ export const CreateRunTransfer$outboundSchema: z.ZodType< CreateRunTransfer$Outbound, z.ZodTypeDef, CreateRunTransfer > = z.object({ amount: Amount$outboundSchema, salesTaxAmount: Amount$outboundSchema.optional(), destination: SchedulePaymentMethod$outboundSchema, partnerAccountID: z.string(), source: SchedulePaymentMethod$outboundSchema, description: z.string(), lineItems: CreateScheduledTransferLineItems$outboundSchema.optional(), }); export function createRunTransferToJSON( createRunTransfer: CreateRunTransfer, ): string { return JSON.stringify( CreateRunTransfer$outboundSchema.parse(createRunTransfer), ); } export function createRunTransferFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateRunTransfer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRunTransfer' from JSON`, ); }