/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export enum PaymentMethodAfterpayTag { Afterpay = "afterpay", } export type PaymentMethodAfterpayOutput = { dotTag: PaymentMethodAfterpayTag; }; export type PaymentMethodAfterpay = { dotTag: PaymentMethodAfterpayTag; /** * Return URL to return to after payment completion in Afterpay. */ returnUrl: string; }; /** @internal */ export const PaymentMethodAfterpayTag$inboundSchema: z.ZodNativeEnum< typeof PaymentMethodAfterpayTag > = z.nativeEnum(PaymentMethodAfterpayTag); /** @internal */ export const PaymentMethodAfterpayTag$outboundSchema: z.ZodNativeEnum< typeof PaymentMethodAfterpayTag > = PaymentMethodAfterpayTag$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentMethodAfterpayTag$ { /** @deprecated use `PaymentMethodAfterpayTag$inboundSchema` instead. */ export const inboundSchema = PaymentMethodAfterpayTag$inboundSchema; /** @deprecated use `PaymentMethodAfterpayTag$outboundSchema` instead. */ export const outboundSchema = PaymentMethodAfterpayTag$outboundSchema; } /** @internal */ export const PaymentMethodAfterpayOutput$inboundSchema: z.ZodType< PaymentMethodAfterpayOutput, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentMethodAfterpayTag$inboundSchema, }).transform((v) => { return remap$(v, { ".tag": "dotTag", }); }); /** @internal */ export type PaymentMethodAfterpayOutput$Outbound = { ".tag": string; }; /** @internal */ export const PaymentMethodAfterpayOutput$outboundSchema: z.ZodType< PaymentMethodAfterpayOutput$Outbound, z.ZodTypeDef, PaymentMethodAfterpayOutput > = z.object({ dotTag: PaymentMethodAfterpayTag$outboundSchema, }).transform((v) => { return remap$(v, { dotTag: ".tag", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentMethodAfterpayOutput$ { /** @deprecated use `PaymentMethodAfterpayOutput$inboundSchema` instead. */ export const inboundSchema = PaymentMethodAfterpayOutput$inboundSchema; /** @deprecated use `PaymentMethodAfterpayOutput$outboundSchema` instead. */ export const outboundSchema = PaymentMethodAfterpayOutput$outboundSchema; /** @deprecated use `PaymentMethodAfterpayOutput$Outbound` instead. */ export type Outbound = PaymentMethodAfterpayOutput$Outbound; } export function paymentMethodAfterpayOutputToJSON( paymentMethodAfterpayOutput: PaymentMethodAfterpayOutput, ): string { return JSON.stringify( PaymentMethodAfterpayOutput$outboundSchema.parse( paymentMethodAfterpayOutput, ), ); } export function paymentMethodAfterpayOutputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodAfterpayOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodAfterpayOutput' from JSON`, ); } /** @internal */ export const PaymentMethodAfterpay$inboundSchema: z.ZodType< PaymentMethodAfterpay, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentMethodAfterpayTag$inboundSchema, return_url: z.string(), }).transform((v) => { return remap$(v, { ".tag": "dotTag", "return_url": "returnUrl", }); }); /** @internal */ export type PaymentMethodAfterpay$Outbound = { ".tag": string; return_url: string; }; /** @internal */ export const PaymentMethodAfterpay$outboundSchema: z.ZodType< PaymentMethodAfterpay$Outbound, z.ZodTypeDef, PaymentMethodAfterpay > = z.object({ dotTag: PaymentMethodAfterpayTag$outboundSchema, returnUrl: z.string(), }).transform((v) => { return remap$(v, { dotTag: ".tag", returnUrl: "return_url", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentMethodAfterpay$ { /** @deprecated use `PaymentMethodAfterpay$inboundSchema` instead. */ export const inboundSchema = PaymentMethodAfterpay$inboundSchema; /** @deprecated use `PaymentMethodAfterpay$outboundSchema` instead. */ export const outboundSchema = PaymentMethodAfterpay$outboundSchema; /** @deprecated use `PaymentMethodAfterpay$Outbound` instead. */ export type Outbound = PaymentMethodAfterpay$Outbound; } export function paymentMethodAfterpayToJSON( paymentMethodAfterpay: PaymentMethodAfterpay, ): string { return JSON.stringify( PaymentMethodAfterpay$outboundSchema.parse(paymentMethodAfterpay), ); } export function paymentMethodAfterpayFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodAfterpay$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodAfterpay' from JSON`, ); }