/* * 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 { CardBrand, CardBrand$inboundSchema, CardBrand$outboundSchema, } from "./cardbrand.js"; import { CardExpiration, CardExpiration$inboundSchema, CardExpiration$Outbound, CardExpiration$outboundSchema, } from "./cardexpiration.js"; import { CardType, CardType$inboundSchema, CardType$outboundSchema, } from "./cardtype.js"; /** * Describes an Apple Pay token on a Moov account. */ export type ApplePayResponse = { /** * The card brand. */ brand: CardBrand; /** * The type of the card. */ cardType: CardType; /** * User-friendly name of the tokenized card returned by Apple. * * @remarks * * It usually contains the brand and the last four digits of the underlying card. * There is no standard format. */ cardDisplayName: string; /** * Uniquely identifies a linked payment card or token. * * @remarks * For Apple Pay, the fingerprint is based on the tokenized card number and may vary based on the user's device. * This field can be used to identify specific payment methods across multiple accounts on your platform. */ fingerprint: string; /** * The expiration date of the card or token. */ expiration: CardExpiration; /** * The last four digits of the Apple Pay token, which may differ from the tokenized card's last four digits. */ dynamicLastFour: string; /** * Country where the underlying card was issued. */ issuerCountry?: string | undefined; }; /** @internal */ export const ApplePayResponse$inboundSchema: z.ZodType< ApplePayResponse, z.ZodTypeDef, unknown > = z.object({ brand: CardBrand$inboundSchema, cardType: CardType$inboundSchema, cardDisplayName: z.string(), fingerprint: z.string(), expiration: CardExpiration$inboundSchema, dynamicLastFour: z.string(), issuerCountry: z.string().optional(), }); /** @internal */ export type ApplePayResponse$Outbound = { brand: string; cardType: string; cardDisplayName: string; fingerprint: string; expiration: CardExpiration$Outbound; dynamicLastFour: string; issuerCountry?: string | undefined; }; /** @internal */ export const ApplePayResponse$outboundSchema: z.ZodType< ApplePayResponse$Outbound, z.ZodTypeDef, ApplePayResponse > = z.object({ brand: CardBrand$outboundSchema, cardType: CardType$outboundSchema, cardDisplayName: z.string(), fingerprint: z.string(), expiration: CardExpiration$outboundSchema, dynamicLastFour: z.string(), issuerCountry: z.string().optional(), }); export function applePayResponseToJSON( applePayResponse: ApplePayResponse, ): string { return JSON.stringify( ApplePayResponse$outboundSchema.parse(applePayResponse), ); } export function applePayResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApplePayResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApplePayResponse' from JSON`, ); }