/* * 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 { AppleBillingContact, AppleBillingContact$inboundSchema, AppleBillingContact$Outbound, AppleBillingContact$outboundSchema, } from "./applebillingcontact.js"; import { LinkApplePayToken, LinkApplePayToken$inboundSchema, LinkApplePayToken$Outbound, LinkApplePayToken$outboundSchema, } from "./linkapplepaytoken.js"; /** * The JSON structure returned from Apple Pay when authorizing a payment session. * * @remarks * * Refer to [Apple's documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment) * for more information. */ export type LinkApplePay = { /** * 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. */ token: LinkApplePayToken; /** * Billing contact information as returned from Apple Pay. * * @remarks * * Refer to [Apple's documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentcontact) * for more information. */ billingContact?: AppleBillingContact | undefined; }; /** @internal */ export const LinkApplePay$inboundSchema: z.ZodType< LinkApplePay, z.ZodTypeDef, unknown > = z.object({ token: LinkApplePayToken$inboundSchema, billingContact: AppleBillingContact$inboundSchema.optional(), }); /** @internal */ export type LinkApplePay$Outbound = { token: LinkApplePayToken$Outbound; billingContact?: AppleBillingContact$Outbound | undefined; }; /** @internal */ export const LinkApplePay$outboundSchema: z.ZodType< LinkApplePay$Outbound, z.ZodTypeDef, LinkApplePay > = z.object({ token: LinkApplePayToken$outboundSchema, billingContact: AppleBillingContact$outboundSchema.optional(), }); export function linkApplePayToJSON(linkApplePay: LinkApplePay): string { return JSON.stringify(LinkApplePay$outboundSchema.parse(linkApplePay)); } export function linkApplePayFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkApplePay$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkApplePay' from JSON`, ); }