/* * 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 { ACHTransactionDetails, ACHTransactionDetails$inboundSchema, ACHTransactionDetails$Outbound, ACHTransactionDetails$outboundSchema, } from "./achtransactiondetails.js"; import { ApplePayResponse, ApplePayResponse$inboundSchema, ApplePayResponse$Outbound, ApplePayResponse$outboundSchema, } from "./applepayresponse.js"; import { CardTransactionDetails, CardTransactionDetails$inboundSchema, CardTransactionDetails$Outbound, CardTransactionDetails$outboundSchema, } from "./cardtransactiondetails.js"; import { PaymentMethodsBankAccount, PaymentMethodsBankAccount$inboundSchema, PaymentMethodsBankAccount$Outbound, PaymentMethodsBankAccount$outboundSchema, } from "./paymentmethodsbankaccount.js"; import { PaymentMethodsCard, PaymentMethodsCard$inboundSchema, PaymentMethodsCard$Outbound, PaymentMethodsCard$outboundSchema, } from "./paymentmethodscard.js"; import { PaymentMethodsWallet, PaymentMethodsWallet$inboundSchema, PaymentMethodsWallet$Outbound, PaymentMethodsWallet$outboundSchema, } from "./paymentmethodswallet.js"; import { PaymentMethodType, PaymentMethodType$inboundSchema, PaymentMethodType$outboundSchema, } from "./paymentmethodtype.js"; import { TerminalCard, TerminalCard$inboundSchema, TerminalCard$Outbound, TerminalCard$outboundSchema, } from "./terminalcard.js"; import { TransferAccount, TransferAccount$inboundSchema, TransferAccount$Outbound, TransferAccount$outboundSchema, } from "./transferaccount.js"; export type TransferSource = { /** * UUID present only if the transfer is part of a transfer group. */ transferID?: string | undefined; paymentMethodID: string; /** * The payment method type that represents a payment rail and directionality */ paymentMethodType: PaymentMethodType; account: TransferAccount; /** * A bank account as contained within a payment method. */ bankAccount?: PaymentMethodsBankAccount | undefined; wallet?: PaymentMethodsWallet | undefined; /** * A card as contained within a payment method. */ card?: PaymentMethodsCard | undefined; /** * Describes an Apple Pay token on a Moov account. */ applePay?: ApplePayResponse | undefined; /** * Describes payment card details captured with tap or in-person payment. */ terminalCard?: TerminalCard | undefined; /** * Card-specific details about the transaction. */ cardDetails?: CardTransactionDetails | undefined; /** * ACH specific details about the transaction. */ achDetails?: ACHTransactionDetails | undefined; }; /** @internal */ export const TransferSource$inboundSchema: z.ZodType< TransferSource, z.ZodTypeDef, unknown > = z.object({ transferID: z.string().optional(), paymentMethodID: z.string(), paymentMethodType: PaymentMethodType$inboundSchema, account: TransferAccount$inboundSchema, bankAccount: PaymentMethodsBankAccount$inboundSchema.optional(), wallet: PaymentMethodsWallet$inboundSchema.optional(), card: PaymentMethodsCard$inboundSchema.optional(), applePay: ApplePayResponse$inboundSchema.optional(), terminalCard: TerminalCard$inboundSchema.optional(), cardDetails: CardTransactionDetails$inboundSchema.optional(), achDetails: ACHTransactionDetails$inboundSchema.optional(), }); /** @internal */ export type TransferSource$Outbound = { transferID?: string | undefined; paymentMethodID: string; paymentMethodType: string; account: TransferAccount$Outbound; bankAccount?: PaymentMethodsBankAccount$Outbound | undefined; wallet?: PaymentMethodsWallet$Outbound | undefined; card?: PaymentMethodsCard$Outbound | undefined; applePay?: ApplePayResponse$Outbound | undefined; terminalCard?: TerminalCard$Outbound | undefined; cardDetails?: CardTransactionDetails$Outbound | undefined; achDetails?: ACHTransactionDetails$Outbound | undefined; }; /** @internal */ export const TransferSource$outboundSchema: z.ZodType< TransferSource$Outbound, z.ZodTypeDef, TransferSource > = z.object({ transferID: z.string().optional(), paymentMethodID: z.string(), paymentMethodType: PaymentMethodType$outboundSchema, account: TransferAccount$outboundSchema, bankAccount: PaymentMethodsBankAccount$outboundSchema.optional(), wallet: PaymentMethodsWallet$outboundSchema.optional(), card: PaymentMethodsCard$outboundSchema.optional(), applePay: ApplePayResponse$outboundSchema.optional(), terminalCard: TerminalCard$outboundSchema.optional(), cardDetails: CardTransactionDetails$outboundSchema.optional(), achDetails: ACHTransactionDetails$outboundSchema.optional(), }); export function transferSourceToJSON(transferSource: TransferSource): string { return JSON.stringify(TransferSource$outboundSchema.parse(transferSource)); } export function transferSourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TransferSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TransferSource' from JSON`, ); }