/* * 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 { ScheduledTransferLineItems, ScheduledTransferLineItems$inboundSchema, ScheduledTransferLineItems$Outbound, ScheduledTransferLineItems$outboundSchema, } from "./scheduledtransferlineitems.js"; import { SchedulePaymentMethod, SchedulePaymentMethod$inboundSchema, SchedulePaymentMethod$Outbound, SchedulePaymentMethod$outboundSchema, } from "./schedulepaymentmethod.js"; export type RunTransfer = { 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; /** * Line items for a scheduled transfer. */ lineItems?: ScheduledTransferLineItems | undefined; }; /** @internal */ export const RunTransfer$inboundSchema: z.ZodType< RunTransfer, 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: ScheduledTransferLineItems$inboundSchema.optional(), }); /** @internal */ export type RunTransfer$Outbound = { amount: Amount$Outbound; salesTaxAmount?: Amount$Outbound | undefined; destination: SchedulePaymentMethod$Outbound; partnerAccountID: string; source: SchedulePaymentMethod$Outbound; description: string; lineItems?: ScheduledTransferLineItems$Outbound | undefined; }; /** @internal */ export const RunTransfer$outboundSchema: z.ZodType< RunTransfer$Outbound, z.ZodTypeDef, RunTransfer > = z.object({ amount: Amount$outboundSchema, salesTaxAmount: Amount$outboundSchema.optional(), destination: SchedulePaymentMethod$outboundSchema, partnerAccountID: z.string(), source: SchedulePaymentMethod$outboundSchema, description: z.string(), lineItems: ScheduledTransferLineItems$outboundSchema.optional(), }); export function runTransferToJSON(runTransfer: RunTransfer): string { return JSON.stringify(RunTransfer$outboundSchema.parse(runTransfer)); } export function runTransferFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RunTransfer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RunTransfer' from JSON`, ); }