/* * 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 { BillableFee, BillableFee$inboundSchema, BillableFee$Outbound, BillableFee$outboundSchema, } from "./billablefee.js"; import { CardAcquiringModel, CardAcquiringModel$inboundSchema, CardAcquiringModel$outboundSchema, } from "./cardacquiringmodel.js"; import { MinimumCommitment, MinimumCommitment$inboundSchema, MinimumCommitment$Outbound, MinimumCommitment$outboundSchema, } from "./minimumcommitment.js"; import { MonthlyPlatformFee, MonthlyPlatformFee$inboundSchema, MonthlyPlatformFee$Outbound, MonthlyPlatformFee$outboundSchema, } from "./monthlyplatformfee.js"; export type FeePlan = { planID: string; /** * The name of the fee plan. */ name: string; /** * A description of the fee plan. */ description?: string | undefined; /** * Specifies the card processing pricing model */ cardAcquiringModel: CardAcquiringModel; /** * Additional usage-based fees for this plan. */ billableFees: Array; /** * The minimum spending amount that must be met in the billing period. If actual usage is below the minimum amount, account is charged the difference. */ minimumCommitment: MinimumCommitment; /** * Fixed recurring amount paid in the billing period regardless of usage. */ monthlyPlatformFee: MonthlyPlatformFee; createdAt: Date; }; /** @internal */ export const FeePlan$inboundSchema: z.ZodType = z.object({ planID: z.string(), name: z.string(), description: z.string().optional(), cardAcquiringModel: CardAcquiringModel$inboundSchema, billableFees: z.array(BillableFee$inboundSchema), minimumCommitment: MinimumCommitment$inboundSchema, monthlyPlatformFee: MonthlyPlatformFee$inboundSchema, createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v) ), }); /** @internal */ export type FeePlan$Outbound = { planID: string; name: string; description?: string | undefined; cardAcquiringModel: string; billableFees: Array; minimumCommitment: MinimumCommitment$Outbound; monthlyPlatformFee: MonthlyPlatformFee$Outbound; createdAt: string; }; /** @internal */ export const FeePlan$outboundSchema: z.ZodType< FeePlan$Outbound, z.ZodTypeDef, FeePlan > = z.object({ planID: z.string(), name: z.string(), description: z.string().optional(), cardAcquiringModel: CardAcquiringModel$outboundSchema, billableFees: z.array(BillableFee$outboundSchema), minimumCommitment: MinimumCommitment$outboundSchema, monthlyPlatformFee: MonthlyPlatformFee$outboundSchema, createdAt: z.date().transform(v => v.toISOString()), }); export function feePlanToJSON(feePlan: FeePlan): string { return JSON.stringify(FeePlan$outboundSchema.parse(feePlan)); } export function feePlanFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeePlan$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeePlan' from JSON`, ); }