/* * 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 { DefinitionField, DefinitionField$inboundSchema, } from "./definitionfield.js"; import { IntegrationClient, IntegrationClient$inboundSchema, } from "./integrationclient.js"; import { Method, Method$inboundSchema } from "./method.js"; import { Mode, Mode$inboundSchema } from "./mode.js"; import { PaymentServiceConfiguration, PaymentServiceConfiguration$inboundSchema, } from "./paymentserviceconfiguration.js"; import { RequiredCheckoutFields, RequiredCheckoutFields$inboundSchema, } from "./requiredcheckoutfields.js"; export type PaymentServiceDefinition = { /** * The definition ID of the payment service that can be configured. This is the underlying provider followed by a dash followed by the method. */ id: string; /** * Always `payment-service-definition`. */ type: "payment-service-definition"; /** * A human friendly name for this service. */ displayName: string; method: Method; /** * A list of credentials and related fields which can be configured for this service. */ fields: Array; /** * A list of reporting fields which can be configured for this service. */ reportingFields: Array; /** * A list of three-letter ISO currency codes that this service supports. */ supportedCurrencies: Array; /** * A list of two-letter ISO country codes that this service supports. */ supportedCountries: Array; mode: Mode; /** * An icon to display for the payment service. */ iconUrl?: string | null | undefined; /** * Features supported by the payment service. */ supportedFeatures: { [k: string]: boolean }; /** * A list of condition that define when some fields must be provided with a transaction request. */ requiredCheckoutFields: Array; configuration: PaymentServiceConfiguration; /** * List of supported integration clients. Defaults to redirect for most redirect connectors. */ supportedIntegrationClients: Array | null; }; /** @internal */ export const PaymentServiceDefinition$inboundSchema: z.ZodType< PaymentServiceDefinition, z.ZodTypeDef, unknown > = z.object({ id: z.string(), type: z.literal("payment-service-definition").default( "payment-service-definition", ), display_name: z.string(), method: Method$inboundSchema, fields: z.array(DefinitionField$inboundSchema), reporting_fields: z.array(DefinitionField$inboundSchema), supported_currencies: z.array(z.string()), supported_countries: z.array(z.string()), mode: Mode$inboundSchema, icon_url: z.nullable(z.string()).optional(), supported_features: z.record(z.boolean()), required_checkout_fields: z.array(RequiredCheckoutFields$inboundSchema), configuration: PaymentServiceConfiguration$inboundSchema, supported_integration_clients: z.nullable( z.array(IntegrationClient$inboundSchema), ), }).transform((v) => { return remap$(v, { "display_name": "displayName", "reporting_fields": "reportingFields", "supported_currencies": "supportedCurrencies", "supported_countries": "supportedCountries", "icon_url": "iconUrl", "supported_features": "supportedFeatures", "required_checkout_fields": "requiredCheckoutFields", "supported_integration_clients": "supportedIntegrationClients", }); }); export function paymentServiceDefinitionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PaymentServiceDefinition$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentServiceDefinition' from JSON`, ); }