/* * 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 { BillingCountAndAmount, BillingCountAndAmount$inboundSchema, BillingCountAndAmount$Outbound, BillingCountAndAmount$outboundSchema, } from "./billingcountandamount.js"; import { BillingInterchangeProgramFee, BillingInterchangeProgramFee$inboundSchema, BillingInterchangeProgramFee$Outbound, BillingInterchangeProgramFee$outboundSchema, } from "./billinginterchangeprogramfee.js"; export type CardBrandFees = { /** * Details of interchange fees. */ interchange?: BillingCountAndAmount | undefined; /** * A list of interchange program fees. */ interchangePrograms?: Array | undefined; /** * Details of network passthrough fees. */ networkPassthrough?: BillingCountAndAmount | undefined; /** * Details of completed domestic online transactions. */ completedDomesticOnline?: BillingCountAndAmount | undefined; /** * Details of completed domestic in-person transactions. */ completedDomesticInPerson?: BillingCountAndAmount | undefined; /** * Details of completed international online transactions. */ completedInternationalOnline?: BillingCountAndAmount | undefined; /** * Details of completed international in-person transactions. */ completedInternationalInPerson?: BillingCountAndAmount | undefined; /** * Details of declined transactions. */ declines?: BillingCountAndAmount | undefined; /** * Details of refunded transactions. */ refunds?: BillingCountAndAmount | undefined; /** * Total fees for this card brand. */ total: BillingCountAndAmount; }; /** @internal */ export const CardBrandFees$inboundSchema: z.ZodType< CardBrandFees, z.ZodTypeDef, unknown > = z.object({ interchange: BillingCountAndAmount$inboundSchema.optional(), interchangePrograms: z.array(BillingInterchangeProgramFee$inboundSchema) .optional(), networkPassthrough: BillingCountAndAmount$inboundSchema.optional(), completedDomesticOnline: BillingCountAndAmount$inboundSchema.optional(), completedDomesticInPerson: BillingCountAndAmount$inboundSchema.optional(), completedInternationalOnline: BillingCountAndAmount$inboundSchema.optional(), completedInternationalInPerson: BillingCountAndAmount$inboundSchema .optional(), declines: BillingCountAndAmount$inboundSchema.optional(), refunds: BillingCountAndAmount$inboundSchema.optional(), total: BillingCountAndAmount$inboundSchema, }); /** @internal */ export type CardBrandFees$Outbound = { interchange?: BillingCountAndAmount$Outbound | undefined; interchangePrograms?: | Array | undefined; networkPassthrough?: BillingCountAndAmount$Outbound | undefined; completedDomesticOnline?: BillingCountAndAmount$Outbound | undefined; completedDomesticInPerson?: BillingCountAndAmount$Outbound | undefined; completedInternationalOnline?: BillingCountAndAmount$Outbound | undefined; completedInternationalInPerson?: BillingCountAndAmount$Outbound | undefined; declines?: BillingCountAndAmount$Outbound | undefined; refunds?: BillingCountAndAmount$Outbound | undefined; total: BillingCountAndAmount$Outbound; }; /** @internal */ export const CardBrandFees$outboundSchema: z.ZodType< CardBrandFees$Outbound, z.ZodTypeDef, CardBrandFees > = z.object({ interchange: BillingCountAndAmount$outboundSchema.optional(), interchangePrograms: z.array(BillingInterchangeProgramFee$outboundSchema) .optional(), networkPassthrough: BillingCountAndAmount$outboundSchema.optional(), completedDomesticOnline: BillingCountAndAmount$outboundSchema.optional(), completedDomesticInPerson: BillingCountAndAmount$outboundSchema.optional(), completedInternationalOnline: BillingCountAndAmount$outboundSchema.optional(), completedInternationalInPerson: BillingCountAndAmount$outboundSchema .optional(), declines: BillingCountAndAmount$outboundSchema.optional(), refunds: BillingCountAndAmount$outboundSchema.optional(), total: BillingCountAndAmount$outboundSchema, }); export function cardBrandFeesToJSON(cardBrandFees: CardBrandFees): string { return JSON.stringify(CardBrandFees$outboundSchema.parse(cardBrandFees)); } export function cardBrandFeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CardBrandFees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CardBrandFees' from JSON`, ); }