/* * 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"; /** * The payment method used to push or pull funds to a bank account. * * @remarks * The push payment method can only be ach-credit-standard, ach-credit-same-day, or rtp-credit. The pull payment method can only be ach-debit-fund. */ export type SweepConfigPaymentMethod = { /** * ID of the payment method. */ paymentMethodID: string; disabledOn?: Date | undefined; }; /** @internal */ export const SweepConfigPaymentMethod$inboundSchema: z.ZodType< SweepConfigPaymentMethod, z.ZodTypeDef, unknown > = z.object({ paymentMethodID: z.string(), disabledOn: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), }); /** @internal */ export type SweepConfigPaymentMethod$Outbound = { paymentMethodID: string; disabledOn?: string | undefined; }; /** @internal */ export const SweepConfigPaymentMethod$outboundSchema: z.ZodType< SweepConfigPaymentMethod$Outbound, z.ZodTypeDef, SweepConfigPaymentMethod > = z.object({ paymentMethodID: z.string(), disabledOn: z.date().transform(v => v.toISOString()).optional(), }); export function sweepConfigPaymentMethodToJSON( sweepConfigPaymentMethod: SweepConfigPaymentMethod, ): string { return JSON.stringify( SweepConfigPaymentMethod$outboundSchema.parse(sweepConfigPaymentMethod), ); } export function sweepConfigPaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SweepConfigPaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SweepConfigPaymentMethod' from JSON`, ); }