/* * 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 { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; /** * Specify the intended recipient of the payout. * * @remarks * Either `email` or `phone` must be specified, but not both. * * This information will be used to authenticate the end user when they follow the payment link. */ export type PayoutRecipient = { email?: string | undefined; phone?: PhoneNumber | undefined; }; /** @internal */ export const PayoutRecipient$inboundSchema: z.ZodType< PayoutRecipient, z.ZodTypeDef, unknown > = z.object({ email: z.string().optional(), phone: PhoneNumber$inboundSchema.optional(), }); /** @internal */ export type PayoutRecipient$Outbound = { email?: string | undefined; phone?: PhoneNumber$Outbound | undefined; }; /** @internal */ export const PayoutRecipient$outboundSchema: z.ZodType< PayoutRecipient$Outbound, z.ZodTypeDef, PayoutRecipient > = z.object({ email: z.string().optional(), phone: PhoneNumber$outboundSchema.optional(), }); export function payoutRecipientToJSON( payoutRecipient: PayoutRecipient, ): string { return JSON.stringify(PayoutRecipient$outboundSchema.parse(payoutRecipient)); } export function payoutRecipientFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PayoutRecipient$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PayoutRecipient' from JSON`, ); }