/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AmountDecimal, AmountDecimal$inboundSchema, AmountDecimal$Outbound, AmountDecimal$outboundSchema, } from "./amountdecimal.js"; import { VolumeRange, VolumeRange$inboundSchema, VolumeRange$Outbound, VolumeRange$outboundSchema, } from "./volumerange.js"; /** * Defines the specific parameters used for fee calculation. */ export type FeeProperties = { /** * A fixed fee that is applied to the amount of each transaction in the `fixed` and `blended` fee models. */ fixedAmount?: AmountDecimal | undefined; /** * A percentage fee that is applied to the amount of each transaction in the `blended` fee model, expressed as a decimal. * * @remarks * * For example, 0.05% is '0.05'. */ variableRate?: string | undefined; /** * Specifies the minimum allowable spending for a single transaction, working as a transaction floor. */ minPerTransaction?: AmountDecimal | undefined; /** * Specifies the maximum allowable spending for a single transaction, working as a transaction ceiling. */ maxPerTransaction?: AmountDecimal | undefined; /** * Defines the volume ranges for tiered pricing models. */ volumeRanges: Array; }; /** @internal */ export const FeeProperties$inboundSchema: z.ZodType< FeeProperties, z.ZodTypeDef, unknown > = z.object({ fixedAmount: AmountDecimal$inboundSchema.optional(), variableRate: z.string().optional(), minPerTransaction: AmountDecimal$inboundSchema.optional(), maxPerTransaction: AmountDecimal$inboundSchema.optional(), volumeRanges: z.array(VolumeRange$inboundSchema), }); /** @internal */ export type FeeProperties$Outbound = { fixedAmount?: AmountDecimal$Outbound | undefined; variableRate?: string | undefined; minPerTransaction?: AmountDecimal$Outbound | undefined; maxPerTransaction?: AmountDecimal$Outbound | undefined; volumeRanges: Array; }; /** @internal */ export const FeeProperties$outboundSchema: z.ZodType< FeeProperties$Outbound, z.ZodTypeDef, FeeProperties > = z.object({ fixedAmount: AmountDecimal$outboundSchema.optional(), variableRate: z.string().optional(), minPerTransaction: AmountDecimal$outboundSchema.optional(), maxPerTransaction: AmountDecimal$outboundSchema.optional(), volumeRanges: z.array(VolumeRange$outboundSchema), }); export function feePropertiesToJSON(feeProperties: FeeProperties): string { return JSON.stringify(FeeProperties$outboundSchema.parse(feeProperties)); } export function feePropertiesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeeProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeeProperties' from JSON`, ); }