/* * 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 { ApplePayResponse, ApplePayResponse$inboundSchema, ApplePayResponse$Outbound, ApplePayResponse$outboundSchema, } from "./applepayresponse.js"; export type ApplePayPaymentMethod = { /** * ID of the payment method. */ paymentMethodID: string; paymentMethodType: "apple-pay"; /** * Describes an Apple Pay token on a Moov account. */ applePay: ApplePayResponse; }; /** @internal */ export const ApplePayPaymentMethod$inboundSchema: z.ZodType< ApplePayPaymentMethod, z.ZodTypeDef, unknown > = z.object({ paymentMethodID: z.string(), paymentMethodType: z.literal("apple-pay"), applePay: ApplePayResponse$inboundSchema, }); /** @internal */ export type ApplePayPaymentMethod$Outbound = { paymentMethodID: string; paymentMethodType: "apple-pay"; applePay: ApplePayResponse$Outbound; }; /** @internal */ export const ApplePayPaymentMethod$outboundSchema: z.ZodType< ApplePayPaymentMethod$Outbound, z.ZodTypeDef, ApplePayPaymentMethod > = z.object({ paymentMethodID: z.string(), paymentMethodType: z.literal("apple-pay"), applePay: ApplePayResponse$outboundSchema, }); export function applePayPaymentMethodToJSON( applePayPaymentMethod: ApplePayPaymentMethod, ): string { return JSON.stringify( ApplePayPaymentMethod$outboundSchema.parse(applePayPaymentMethod), ); } export function applePayPaymentMethodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApplePayPaymentMethod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApplePayPaymentMethod' from JSON`, ); }