/* * 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 { FeePlanAgreementStatus, FeePlanAgreementStatus$inboundSchema, FeePlanAgreementStatus$outboundSchema, } from "./feeplanagreementstatus.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 FeePlanAgreement = { agreementID: string; planID: string; accountID?: string | undefined; /** * The name of the agreement. */ name: string; /** * The description of the agreement. */ description?: string | undefined; acceptedOn: Date; status: FeePlanAgreementStatus; /** * Specifies the card processing pricing model */ cardAcquiringModel: CardAcquiringModel; 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; }; /** @internal */ export const FeePlanAgreement$inboundSchema: z.ZodType< FeePlanAgreement, z.ZodTypeDef, unknown > = z.object({ agreementID: z.string(), planID: z.string(), accountID: z.string().optional(), name: z.string(), description: z.string().optional(), acceptedOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), status: FeePlanAgreementStatus$inboundSchema, cardAcquiringModel: CardAcquiringModel$inboundSchema, billableFees: z.array(BillableFee$inboundSchema), minimumCommitment: MinimumCommitment$inboundSchema, monthlyPlatformFee: MonthlyPlatformFee$inboundSchema, }); /** @internal */ export type FeePlanAgreement$Outbound = { agreementID: string; planID: string; accountID?: string | undefined; name: string; description?: string | undefined; acceptedOn: string; status: string; cardAcquiringModel: string; billableFees: Array; minimumCommitment: MinimumCommitment$Outbound; monthlyPlatformFee: MonthlyPlatformFee$Outbound; }; /** @internal */ export const FeePlanAgreement$outboundSchema: z.ZodType< FeePlanAgreement$Outbound, z.ZodTypeDef, FeePlanAgreement > = z.object({ agreementID: z.string(), planID: z.string(), accountID: z.string().optional(), name: z.string(), description: z.string().optional(), acceptedOn: z.date().transform(v => v.toISOString()), status: FeePlanAgreementStatus$outboundSchema, cardAcquiringModel: CardAcquiringModel$outboundSchema, billableFees: z.array(BillableFee$outboundSchema), minimumCommitment: MinimumCommitment$outboundSchema, monthlyPlatformFee: MonthlyPlatformFee$outboundSchema, }); export function feePlanAgreementToJSON( feePlanAgreement: FeePlanAgreement, ): string { return JSON.stringify( FeePlanAgreement$outboundSchema.parse(feePlanAgreement), ); } export function feePlanAgreementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeePlanAgreement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeePlanAgreement' from JSON`, ); }