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