/* * 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 { DisbursementPaymentMethodType, DisbursementPaymentMethodType$inboundSchema, DisbursementPaymentMethodType$outboundSchema, } from "./disbursementpaymentmethodtype.js"; import { PayoutRecipient, PayoutRecipient$inboundSchema, PayoutRecipient$Outbound, PayoutRecipient$outboundSchema, } from "./payoutrecipient.js"; export type PaymentLinkPayoutDetails = { /** * A list of payment methods that should be supported for this payment link. */ allowedMethods: Array; /** * 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. */ recipient: PayoutRecipient; /** * Optional free-form metadata for the transfer. */ metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const PaymentLinkPayoutDetails$inboundSchema: z.ZodType< PaymentLinkPayoutDetails, z.ZodTypeDef, unknown > = z.object({ allowedMethods: z.array(DisbursementPaymentMethodType$inboundSchema), recipient: PayoutRecipient$inboundSchema, metadata: z.record(z.string()).optional(), }); /** @internal */ export type PaymentLinkPayoutDetails$Outbound = { allowedMethods: Array; recipient: PayoutRecipient$Outbound; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const PaymentLinkPayoutDetails$outboundSchema: z.ZodType< PaymentLinkPayoutDetails$Outbound, z.ZodTypeDef, PaymentLinkPayoutDetails > = z.object({ allowedMethods: z.array(DisbursementPaymentMethodType$outboundSchema), recipient: PayoutRecipient$outboundSchema, metadata: z.record(z.string()).optional(), }); export function paymentLinkPayoutDetailsToJSON( paymentLinkPayoutDetails: PaymentLinkPayoutDetails, ): string { return JSON.stringify( PaymentLinkPayoutDetails$outboundSchema.parse(paymentLinkPayoutDetails), ); } export function paymentLinkPayoutDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentLinkPayoutDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentLinkPayoutDetails' from JSON`, ); }