/* * 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 { LinkApplePaymentData, LinkApplePaymentData$inboundSchema, LinkApplePaymentData$Outbound, LinkApplePaymentData$outboundSchema, } from "./linkapplepaymentdata.js"; import { LinkApplePaymentMethod, LinkApplePaymentMethod$inboundSchema, LinkApplePaymentMethod$Outbound, LinkApplePaymentMethod$outboundSchema, } from "./linkapplepaymentmethod.js"; /** * Contains the user's payment information as returned from Apple Pay. * * @remarks * * Refer to [Apple's documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymenttoken) * for more information. */ export type LinkApplePayToken = { /** * Contains the encrypted payment data. * * @remarks * * Refer to [Apple's documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymenttoken/1916115-paymentdata) * for more information. */ paymentData: LinkApplePaymentData; /** * Provides information about the underlying card. * * @remarks * * Refer to [Apple's documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymenttoken/1916113-paymentmethod) * for more information. */ paymentMethod: LinkApplePaymentMethod; /** * A unique identifier provided by Apple Pay for this payment. */ transactionIdentifier: string; }; /** @internal */ export const LinkApplePayToken$inboundSchema: z.ZodType< LinkApplePayToken, z.ZodTypeDef, unknown > = z.object({ paymentData: LinkApplePaymentData$inboundSchema, paymentMethod: LinkApplePaymentMethod$inboundSchema, transactionIdentifier: z.string(), }); /** @internal */ export type LinkApplePayToken$Outbound = { paymentData: LinkApplePaymentData$Outbound; paymentMethod: LinkApplePaymentMethod$Outbound; transactionIdentifier: string; }; /** @internal */ export const LinkApplePayToken$outboundSchema: z.ZodType< LinkApplePayToken$Outbound, z.ZodTypeDef, LinkApplePayToken > = z.object({ paymentData: LinkApplePaymentData$outboundSchema, paymentMethod: LinkApplePaymentMethod$outboundSchema, transactionIdentifier: z.string(), }); export function linkApplePayTokenToJSON( linkApplePayToken: LinkApplePayToken, ): string { return JSON.stringify( LinkApplePayToken$outboundSchema.parse(linkApplePayToken), ); } export function linkApplePayTokenFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkApplePayToken$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkApplePayToken' from JSON`, ); }