/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { CreditCardError, CreditCardError$inboundSchema, CreditCardError$Outbound, CreditCardError$outboundSchema, } from "./creditcarderror.js"; import { ErrorT, ErrorT$inboundSchema, ErrorT$Outbound, ErrorT$outboundSchema, } from "./error.js"; import { FieldError, FieldError$inboundSchema, FieldError$Outbound, FieldError$outboundSchema, } from "./fielderror.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * The payment method is invalid and cannot be added, or some other error has occurred */ export type AccountAddPaymentMethodResponseBody = | ErrorT | FieldError | CreditCardError; /** @internal */ export const AccountAddPaymentMethodResponseBody$inboundSchema: z.ZodType< AccountAddPaymentMethodResponseBody, z.ZodTypeDef, unknown > = z.union([ ErrorT$inboundSchema, FieldError$inboundSchema, CreditCardError$inboundSchema, ]); /** @internal */ export type AccountAddPaymentMethodResponseBody$Outbound = | ErrorT$Outbound | FieldError$Outbound | CreditCardError$Outbound; /** @internal */ export const AccountAddPaymentMethodResponseBody$outboundSchema: z.ZodType< AccountAddPaymentMethodResponseBody$Outbound, z.ZodTypeDef, AccountAddPaymentMethodResponseBody > = z.union([ ErrorT$outboundSchema, FieldError$outboundSchema, CreditCardError$outboundSchema, ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountAddPaymentMethodResponseBody$ { /** @deprecated use `AccountAddPaymentMethodResponseBody$inboundSchema` instead. */ export const inboundSchema = AccountAddPaymentMethodResponseBody$inboundSchema; /** @deprecated use `AccountAddPaymentMethodResponseBody$outboundSchema` instead. */ export const outboundSchema = AccountAddPaymentMethodResponseBody$outboundSchema; /** @deprecated use `AccountAddPaymentMethodResponseBody$Outbound` instead. */ export type Outbound = AccountAddPaymentMethodResponseBody$Outbound; } export function accountAddPaymentMethodResponseBodyToJSON( accountAddPaymentMethodResponseBody: AccountAddPaymentMethodResponseBody, ): string { return JSON.stringify( AccountAddPaymentMethodResponseBody$outboundSchema.parse( accountAddPaymentMethodResponseBody, ), ); } export function accountAddPaymentMethodResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountAddPaymentMethodResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountAddPaymentMethodResponseBody' from JSON`, ); }