/* * 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 { AchCreditSameDayPaymentMethod, AchCreditSameDayPaymentMethod$inboundSchema, AchCreditSameDayPaymentMethod$Outbound, AchCreditSameDayPaymentMethod$outboundSchema, } from "./achcreditsamedaypaymentmethod.js"; import { AchCreditStandardPaymentMethod, AchCreditStandardPaymentMethod$inboundSchema, AchCreditStandardPaymentMethod$Outbound, AchCreditStandardPaymentMethod$outboundSchema, } from "./achcreditstandardpaymentmethod.js"; import { AchDebitCollectPaymentMethod, AchDebitCollectPaymentMethod$inboundSchema, AchDebitCollectPaymentMethod$Outbound, AchDebitCollectPaymentMethod$outboundSchema, } from "./achdebitcollectpaymentmethod.js"; import { AchDebitFundPaymentMethod, AchDebitFundPaymentMethod$inboundSchema, AchDebitFundPaymentMethod$Outbound, AchDebitFundPaymentMethod$outboundSchema, } from "./achdebitfundpaymentmethod.js"; import { ApplePayPaymentMethod, ApplePayPaymentMethod$inboundSchema, ApplePayPaymentMethod$Outbound, ApplePayPaymentMethod$outboundSchema, } from "./applepaypaymentmethod.js"; import { CardPaymentPaymentMethod, CardPaymentPaymentMethod$inboundSchema, CardPaymentPaymentMethod$Outbound, CardPaymentPaymentMethod$outboundSchema, } from "./cardpaymentpaymentmethod.js"; import { CardPresentPaymentPaymentMethod, CardPresentPaymentPaymentMethod$inboundSchema, CardPresentPaymentPaymentMethod$Outbound, CardPresentPaymentPaymentMethod$outboundSchema, } from "./cardpresentpaymentpaymentmethod.js"; import { MoovWalletPaymentMethod, MoovWalletPaymentMethod$inboundSchema, MoovWalletPaymentMethod$Outbound, MoovWalletPaymentMethod$outboundSchema, } from "./moovwalletpaymentmethod.js"; import { PullFromCardPaymentMethod, PullFromCardPaymentMethod$inboundSchema, PullFromCardPaymentMethod$Outbound, PullFromCardPaymentMethod$outboundSchema, } from "./pullfromcardpaymentmethod.js"; import { PushToCardPaymentMethod, PushToCardPaymentMethod$inboundSchema, PushToCardPaymentMethod$Outbound, PushToCardPaymentMethod$outboundSchema, } from "./pushtocardpaymentmethod.js"; import { RtpCreditPaymentMethod, RtpCreditPaymentMethod$inboundSchema, RtpCreditPaymentMethod$Outbound, RtpCreditPaymentMethod$outboundSchema, } from "./rtpcreditpaymentmethod.js"; /** * A method of moving money */ export type PaymentMethod = | MoovWalletPaymentMethod | AchDebitFundPaymentMethod | AchDebitCollectPaymentMethod | AchCreditStandardPaymentMethod | AchCreditSameDayPaymentMethod | RtpCreditPaymentMethod | CardPaymentPaymentMethod | PushToCardPaymentMethod | PullFromCardPaymentMethod | ApplePayPaymentMethod | CardPresentPaymentPaymentMethod; /** @internal */ export const PaymentMethod$inboundSchema: z.ZodType< PaymentMethod, z.ZodTypeDef, unknown > = z.union([ MoovWalletPaymentMethod$inboundSchema, AchDebitFundPaymentMethod$inboundSchema, AchDebitCollectPaymentMethod$inboundSchema, AchCreditStandardPaymentMethod$inboundSchema, AchCreditSameDayPaymentMethod$inboundSchema, RtpCreditPaymentMethod$inboundSchema, CardPaymentPaymentMethod$inboundSchema, PushToCardPaymentMethod$inboundSchema, PullFromCardPaymentMethod$inboundSchema, ApplePayPaymentMethod$inboundSchema, CardPresentPaymentPaymentMethod$inboundSchema, ]); /** @internal */ export type PaymentMethod$Outbound = | MoovWalletPaymentMethod$Outbound | AchDebitFundPaymentMethod$Outbound | AchDebitCollectPaymentMethod$Outbound | AchCreditStandardPaymentMethod$Outbound | AchCreditSameDayPaymentMethod$Outbound | RtpCreditPaymentMethod$Outbound | CardPaymentPaymentMethod$Outbound | PushToCardPaymentMethod$Outbound | PullFromCardPaymentMethod$Outbound | ApplePayPaymentMethod$Outbound | CardPresentPaymentPaymentMethod$Outbound; /** @internal */ export const PaymentMethod$outboundSchema: z.ZodType< PaymentMethod$Outbound, z.ZodTypeDef, PaymentMethod > = z.union([ MoovWalletPaymentMethod$outboundSchema, AchDebitFundPaymentMethod$outboundSchema, AchDebitCollectPaymentMethod$outboundSchema, AchCreditStandardPaymentMethod$outboundSchema, AchCreditSameDayPaymentMethod$outboundSchema, RtpCreditPaymentMethod$outboundSchema, CardPaymentPaymentMethod$outboundSchema, PushToCardPaymentMethod$outboundSchema, PullFromCardPaymentMethod$outboundSchema, ApplePayPaymentMethod$outboundSchema, CardPresentPaymentPaymentMethod$outboundSchema, ]); export function paymentMethodToJSON(paymentMethod: PaymentMethod): string { return JSON.stringify(PaymentMethod$outboundSchema.parse(paymentMethod)); } export function paymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethod' from JSON`, ); }