/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; import { ApprovalTarget, ApprovalTarget$inboundSchema, } from "./approvaltarget.js"; export type PaymentServiceConfiguration = { approvalUiTarget: ApprovalTarget; /** * Height of the approval interface in either pixels or view height (vh). */ approvalUiHeight: string; /** * Width of the approval interface in either pixels or view width (vw). */ approvalUiWidth: string; /** * The maximum number of cart items supported by this connector before we will truncate the list. */ cartItemsLimit: number; /** * Defines if cart items are required by this connector. */ cartItemsRequired: boolean; /** * Defines if the cart items sum value should match the transaction amount. */ cartItemsShouldMatchAmount: boolean; }; /** @internal */ export const PaymentServiceConfiguration$inboundSchema: z.ZodType< PaymentServiceConfiguration, z.ZodTypeDef, unknown > = z.object({ approval_ui_target: ApprovalTarget$inboundSchema, approval_ui_height: z.string(), approval_ui_width: z.string(), cart_items_limit: z.number().int(), cart_items_required: z.boolean(), cart_items_should_match_amount: z.boolean(), }).transform((v) => { return remap$(v, { "approval_ui_target": "approvalUiTarget", "approval_ui_height": "approvalUiHeight", "approval_ui_width": "approvalUiWidth", "cart_items_limit": "cartItemsLimit", "cart_items_required": "cartItemsRequired", "cart_items_should_match_amount": "cartItemsShouldMatchAmount", }); }); export function paymentServiceConfigurationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentServiceConfiguration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentServiceConfiguration' from JSON`, ); }