/* * 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 PaymentMethodKlarnaTag { Klarna = "klarna", } export type PaymentMethodKlarnaOutput = { dotTag: PaymentMethodKlarnaTag; }; export type PaymentMethodKlarna = { dotTag: PaymentMethodKlarnaTag; /** * Return URL to return to after payment completion in Klarna. */ returnUrl: string; }; /** @internal */ export const PaymentMethodKlarnaTag$inboundSchema: z.ZodNativeEnum< typeof PaymentMethodKlarnaTag > = z.nativeEnum(PaymentMethodKlarnaTag); /** @internal */ export const PaymentMethodKlarnaTag$outboundSchema: z.ZodNativeEnum< typeof PaymentMethodKlarnaTag > = PaymentMethodKlarnaTag$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PaymentMethodKlarnaTag$ { /** @deprecated use `PaymentMethodKlarnaTag$inboundSchema` instead. */ export const inboundSchema = PaymentMethodKlarnaTag$inboundSchema; /** @deprecated use `PaymentMethodKlarnaTag$outboundSchema` instead. */ export const outboundSchema = PaymentMethodKlarnaTag$outboundSchema; } /** @internal */ export const PaymentMethodKlarnaOutput$inboundSchema: z.ZodType< PaymentMethodKlarnaOutput, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentMethodKlarnaTag$inboundSchema, }).transform((v) => { return remap$(v, { ".tag": "dotTag", }); }); /** @internal */ export type PaymentMethodKlarnaOutput$Outbound = { ".tag": string; }; /** @internal */ export const PaymentMethodKlarnaOutput$outboundSchema: z.ZodType< PaymentMethodKlarnaOutput$Outbound, z.ZodTypeDef, PaymentMethodKlarnaOutput > = z.object({ dotTag: PaymentMethodKlarnaTag$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 PaymentMethodKlarnaOutput$ { /** @deprecated use `PaymentMethodKlarnaOutput$inboundSchema` instead. */ export const inboundSchema = PaymentMethodKlarnaOutput$inboundSchema; /** @deprecated use `PaymentMethodKlarnaOutput$outboundSchema` instead. */ export const outboundSchema = PaymentMethodKlarnaOutput$outboundSchema; /** @deprecated use `PaymentMethodKlarnaOutput$Outbound` instead. */ export type Outbound = PaymentMethodKlarnaOutput$Outbound; } export function paymentMethodKlarnaOutputToJSON( paymentMethodKlarnaOutput: PaymentMethodKlarnaOutput, ): string { return JSON.stringify( PaymentMethodKlarnaOutput$outboundSchema.parse(paymentMethodKlarnaOutput), ); } export function paymentMethodKlarnaOutputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodKlarnaOutput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodKlarnaOutput' from JSON`, ); } /** @internal */ export const PaymentMethodKlarna$inboundSchema: z.ZodType< PaymentMethodKlarna, z.ZodTypeDef, unknown > = z.object({ ".tag": PaymentMethodKlarnaTag$inboundSchema, return_url: z.string(), }).transform((v) => { return remap$(v, { ".tag": "dotTag", "return_url": "returnUrl", }); }); /** @internal */ export type PaymentMethodKlarna$Outbound = { ".tag": string; return_url: string; }; /** @internal */ export const PaymentMethodKlarna$outboundSchema: z.ZodType< PaymentMethodKlarna$Outbound, z.ZodTypeDef, PaymentMethodKlarna > = z.object({ dotTag: PaymentMethodKlarnaTag$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 PaymentMethodKlarna$ { /** @deprecated use `PaymentMethodKlarna$inboundSchema` instead. */ export const inboundSchema = PaymentMethodKlarna$inboundSchema; /** @deprecated use `PaymentMethodKlarna$outboundSchema` instead. */ export const outboundSchema = PaymentMethodKlarna$outboundSchema; /** @deprecated use `PaymentMethodKlarna$Outbound` instead. */ export type Outbound = PaymentMethodKlarna$Outbound; } export function paymentMethodKlarnaToJSON( paymentMethodKlarna: PaymentMethodKlarna, ): string { return JSON.stringify( PaymentMethodKlarna$outboundSchema.parse(paymentMethodKlarna), ); } export function paymentMethodKlarnaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentMethodKlarna$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentMethodKlarna' from JSON`, ); }