/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Monetary amount associated with the fee */ export type FeeAmount = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * The type of fee being assessed */ export enum FeeType { FeeTypeUnspecified = "FEE_TYPE_UNSPECIFIED", ClientClearing = "CLIENT_CLEARING", Liquidity = "LIQUIDITY", GeneralPurpose = "GENERAL_PURPOSE", Commission = "COMMISSION", Taf = "TAF", Sec = "SEC", AccountClosing = "ACCOUNT_CLOSING", AccountIra = "ACCOUNT_IRA", AchReturn = "ACH_RETURN", Advisory = "ADVISORY", CheckFee = "CHECK_FEE", Exchange = "EXCHANGE", Management = "MANAGEMENT", Overnight = "OVERNIGHT", Platform = "PLATFORM", Statement = "STATEMENT", StopPayment = "STOP_PAYMENT", WireFee = "WIRE_FEE", Inactivity = "INACTIVITY", AmaService = "AMA_SERVICE", NoticeOfChange = "NOTICE_OF_CHANGE", AccountTransfer = "ACCOUNT_TRANSFER", AgencyProcessing = "AGENCY_PROCESSING", RtpFee = "RTP_FEE", DomesticWireDepositFee = "DOMESTIC_WIRE_DEPOSIT_FEE", DomesticWireWithdrawalFee = "DOMESTIC_WIRE_WITHDRAWAL_FEE", InternationalWireDepositFee = "INTERNATIONAL_WIRE_DEPOSIT_FEE", InternationalWireWithdrawalFee = "INTERNATIONAL_WIRE_WITHDRAWAL_FEE", BrokerFee = "BROKER_FEE", OccFee = "OCC_FEE", ContractFee = "CONTRACT_FEE", OptionsRegulatory = "OPTIONS_REGULATORY", FinancialTransactionTax = "FINANCIAL_TRANSACTION_TAX", RegularCheckDelivery = "REGULAR_CHECK_DELIVERY", OvernightCheckDelivery = "OVERNIGHT_CHECK_DELIVERY", SaturdayCheckDelivery = "SATURDAY_CHECK_DELIVERY", OvernightCheckToBroker = "OVERNIGHT_CHECK_TO_BROKER", InternationalCheckOvernightDelivery = "INTERNATIONAL_CHECK_OVERNIGHT_DELIVERY", InternationalCheckRegularDelivery = "INTERNATIONAL_CHECK_REGULAR_DELIVERY", PrintCheckAtFirm = "PRINT_CHECK_AT_FIRM", VoidedCheck = "VOIDED_CHECK", StopPaymentAfter180Days = "STOP_PAYMENT_AFTER_180_DAYS", Confirm = "CONFIRM", Clearing = "CLEARING", PromotionalCreditClawback = "PROMOTIONAL_CREDIT_CLAWBACK", } /** * The type of fee being assessed */ export type FeeTypeOpen = OpenEnum; export type Fee = { /** * Monetary amount associated with the fee */ amount?: FeeAmount | null | undefined; /** * The type of fee being assessed */ type?: FeeTypeOpen | undefined; }; /** @internal */ export const FeeAmount$inboundSchema: z.ZodType< FeeAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type FeeAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const FeeAmount$outboundSchema: z.ZodType< FeeAmount$Outbound, z.ZodTypeDef, FeeAmount > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FeeAmount$ { /** @deprecated use `FeeAmount$inboundSchema` instead. */ export const inboundSchema = FeeAmount$inboundSchema; /** @deprecated use `FeeAmount$outboundSchema` instead. */ export const outboundSchema = FeeAmount$outboundSchema; /** @deprecated use `FeeAmount$Outbound` instead. */ export type Outbound = FeeAmount$Outbound; } export function feeAmountToJSON(feeAmount: FeeAmount): string { return JSON.stringify(FeeAmount$outboundSchema.parse(feeAmount)); } export function feeAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeeAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeeAmount' from JSON`, ); } /** @internal */ export const FeeType$inboundSchema: z.ZodType< FeeTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(FeeType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const FeeType$outboundSchema: z.ZodType< FeeTypeOpen, z.ZodTypeDef, FeeTypeOpen > = z.union([ z.nativeEnum(FeeType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FeeType$ { /** @deprecated use `FeeType$inboundSchema` instead. */ export const inboundSchema = FeeType$inboundSchema; /** @deprecated use `FeeType$outboundSchema` instead. */ export const outboundSchema = FeeType$outboundSchema; } /** @internal */ export const Fee$inboundSchema: z.ZodType = z .object({ amount: z.nullable(z.lazy(() => FeeAmount$inboundSchema)).optional(), type: FeeType$inboundSchema.optional(), }); /** @internal */ export type Fee$Outbound = { amount?: FeeAmount$Outbound | null | undefined; type?: string | undefined; }; /** @internal */ export const Fee$outboundSchema: z.ZodType = z .object({ amount: z.nullable(z.lazy(() => FeeAmount$outboundSchema)).optional(), type: FeeType$outboundSchema.optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Fee$ { /** @deprecated use `Fee$inboundSchema` instead. */ export const inboundSchema = Fee$inboundSchema; /** @deprecated use `Fee$outboundSchema` instead. */ export const outboundSchema = Fee$outboundSchema; /** @deprecated use `Fee$Outbound` instead. */ export type Outbound = Fee$Outbound; } export function feeToJSON(fee: Fee): string { return JSON.stringify(Fee$outboundSchema.parse(fee)); } export function feeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Fee$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Fee' from JSON`, ); }