/* * 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 { BillingSummaryDetails, BillingSummaryDetails$inboundSchema, BillingSummaryDetails$Outbound, BillingSummaryDetails$outboundSchema, } from "./billingsummarydetails.js"; import { BillingSummaryInterchange, BillingSummaryInterchange$inboundSchema, BillingSummaryInterchange$Outbound, BillingSummaryInterchange$outboundSchema, } from "./billingsummaryinterchange.js"; import { PartnerFees, PartnerFees$inboundSchema, PartnerFees$Outbound, PartnerFees$outboundSchema, } from "./partnerfees.js"; /** * The total transaction volume amount. This field is deprecated and will be removed in a future release. * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ export type BillingSummaryVolumeAmount = { /** * A 3-letter ISO 4217 currency code. */ currency: string; /** * A decimal-formatted numerical string that represents up to 9 decimal place precision. * * @remarks * * For example, $12.987654321 is '12.987654321'. */ valueDecimal: string; }; /** * A summary of card acquiring fees. */ export type CardAcquiring = { /** * The total transaction volume amount. This field is deprecated and will be removed in a future release. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ volumeAmount?: BillingSummaryVolumeAmount | undefined; /** * The total number of transactions. This field is deprecated and will be removed in a future release. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ volumeCount?: number | undefined; /** * The total fee amount. */ feeAmount?: AmountDecimal | undefined; /** * Total fee revenue collected from merchants. */ merchantFeesCollected?: AmountDecimal | undefined; /** * Total fee costs incurred by the partner. */ partnerFeesAssessed?: AmountDecimal | undefined; /** * Net revenue after deducting partner fee costs. */ netIncome?: AmountDecimal | undefined; /** * A summary of interchange fees by card brand. */ interchangeFees?: BillingSummaryInterchange | undefined; }; /** * The total amount of platform fees. This field is deprecated and will be removed in a future release. Use summary.accountFees. * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ export type BillingSummaryPlatformFees = { /** * A 3-letter ISO 4217 currency code. */ currency: string; /** * A decimal-formatted numerical string that represents up to 9 decimal place precision. * * @remarks * * For example, $12.987654321 is '12.987654321'. */ valueDecimal: string; }; /** * The total amount of adjustment fees. This field is deprecated and will be removed in a future release. * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ export type AdjustmentFees = { /** * A 3-letter ISO 4217 currency code. */ currency: string; /** * A decimal-formatted numerical string that represents up to 9 decimal place precision. * * @remarks * * For example, $12.987654321 is '12.987654321'. */ valueDecimal: string; }; /** * The total amount of other card fees. This field is deprecated and will be removed in a future release. Use summary.otherCardFees. * * @deprecated class: This will be removed in a future release, please migrate away from it as soon as possible. */ export type OtherFees = { /** * A 3-letter ISO 4217 currency code. */ currency: string; /** * A decimal-formatted numerical string that represents up to 9 decimal place precision. * * @remarks * * For example, $12.987654321 is '12.987654321'. */ valueDecimal: string; }; /** * A summary of all fees included in a statement. */ export type BillingSummary = { /** * A summary of card acquiring fees. */ cardAcquiring?: CardAcquiring | undefined; /** * A summary of ACH fees. */ ach?: BillingSummaryDetails | undefined; /** * A summary of instant payment fees. */ instantPayments?: BillingSummaryDetails | undefined; /** * The total amount of platform fees. This field is deprecated and will be removed in a future release. Use summary.accountFees. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ platformFees?: BillingSummaryPlatformFees | undefined; /** * A summary of account fees. */ accountFees?: BillingSummaryDetails | undefined; /** * The total amount of adjustment fees. This field is deprecated and will be removed in a future release. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ adjustmentFees?: AdjustmentFees | undefined; /** * The total amount of other card fees. This field is deprecated and will be removed in a future release. Use summary.otherCardFees. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ otherFees?: OtherFees | undefined; /** * A summary of other card fees. */ otherCardFees?: BillingSummaryDetails | undefined; /** * The total amount of all fees. */ total?: AmountDecimal | undefined; /** * Total net revenue after deducting total partner fees. */ netIncomeSubtotal?: BillingSummaryDetails | undefined; /** * Partner’s share of the net income, expressed as a percentage. */ revenueShare?: string | undefined; /** * The portion of net income allocated to the partner before monthly partner costs. */ residualSubtotal?: AmountDecimal | undefined; /** * Monthly partner costs that are charged separately and not included in residual subtotal (e.g. platform fees, minimums). */ monthlyPartnerCosts?: PartnerFees | undefined; /** * Final partner payment after deducting monthlyPartnerCosts. */ netPartnerPayment?: AmountDecimal | undefined; }; /** @internal */ export const BillingSummaryVolumeAmount$inboundSchema: z.ZodType< BillingSummaryVolumeAmount, z.ZodTypeDef, unknown > = z.object({ currency: z.string(), valueDecimal: z.string(), }); /** @internal */ export type BillingSummaryVolumeAmount$Outbound = { currency: string; valueDecimal: string; }; /** @internal */ export const BillingSummaryVolumeAmount$outboundSchema: z.ZodType< BillingSummaryVolumeAmount$Outbound, z.ZodTypeDef, BillingSummaryVolumeAmount > = z.object({ currency: z.string(), valueDecimal: z.string(), }); export function billingSummaryVolumeAmountToJSON( billingSummaryVolumeAmount: BillingSummaryVolumeAmount, ): string { return JSON.stringify( BillingSummaryVolumeAmount$outboundSchema.parse(billingSummaryVolumeAmount), ); } export function billingSummaryVolumeAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillingSummaryVolumeAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillingSummaryVolumeAmount' from JSON`, ); } /** @internal */ export const CardAcquiring$inboundSchema: z.ZodType< CardAcquiring, z.ZodTypeDef, unknown > = z.object({ volumeAmount: z.lazy(() => BillingSummaryVolumeAmount$inboundSchema) .optional(), volumeCount: z.number().int().optional(), feeAmount: AmountDecimal$inboundSchema.optional(), merchantFeesCollected: AmountDecimal$inboundSchema.optional(), partnerFeesAssessed: AmountDecimal$inboundSchema.optional(), netIncome: AmountDecimal$inboundSchema.optional(), interchangeFees: BillingSummaryInterchange$inboundSchema.optional(), }); /** @internal */ export type CardAcquiring$Outbound = { volumeAmount?: BillingSummaryVolumeAmount$Outbound | undefined; volumeCount?: number | undefined; feeAmount?: AmountDecimal$Outbound | undefined; merchantFeesCollected?: AmountDecimal$Outbound | undefined; partnerFeesAssessed?: AmountDecimal$Outbound | undefined; netIncome?: AmountDecimal$Outbound | undefined; interchangeFees?: BillingSummaryInterchange$Outbound | undefined; }; /** @internal */ export const CardAcquiring$outboundSchema: z.ZodType< CardAcquiring$Outbound, z.ZodTypeDef, CardAcquiring > = z.object({ volumeAmount: z.lazy(() => BillingSummaryVolumeAmount$outboundSchema) .optional(), volumeCount: z.number().int().optional(), feeAmount: AmountDecimal$outboundSchema.optional(), merchantFeesCollected: AmountDecimal$outboundSchema.optional(), partnerFeesAssessed: AmountDecimal$outboundSchema.optional(), netIncome: AmountDecimal$outboundSchema.optional(), interchangeFees: BillingSummaryInterchange$outboundSchema.optional(), }); export function cardAcquiringToJSON(cardAcquiring: CardAcquiring): string { return JSON.stringify(CardAcquiring$outboundSchema.parse(cardAcquiring)); } export function cardAcquiringFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CardAcquiring$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CardAcquiring' from JSON`, ); } /** @internal */ export const BillingSummaryPlatformFees$inboundSchema: z.ZodType< BillingSummaryPlatformFees, z.ZodTypeDef, unknown > = z.object({ currency: z.string(), valueDecimal: z.string(), }); /** @internal */ export type BillingSummaryPlatformFees$Outbound = { currency: string; valueDecimal: string; }; /** @internal */ export const BillingSummaryPlatformFees$outboundSchema: z.ZodType< BillingSummaryPlatformFees$Outbound, z.ZodTypeDef, BillingSummaryPlatformFees > = z.object({ currency: z.string(), valueDecimal: z.string(), }); export function billingSummaryPlatformFeesToJSON( billingSummaryPlatformFees: BillingSummaryPlatformFees, ): string { return JSON.stringify( BillingSummaryPlatformFees$outboundSchema.parse(billingSummaryPlatformFees), ); } export function billingSummaryPlatformFeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillingSummaryPlatformFees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillingSummaryPlatformFees' from JSON`, ); } /** @internal */ export const AdjustmentFees$inboundSchema: z.ZodType< AdjustmentFees, z.ZodTypeDef, unknown > = z.object({ currency: z.string(), valueDecimal: z.string(), }); /** @internal */ export type AdjustmentFees$Outbound = { currency: string; valueDecimal: string; }; /** @internal */ export const AdjustmentFees$outboundSchema: z.ZodType< AdjustmentFees$Outbound, z.ZodTypeDef, AdjustmentFees > = z.object({ currency: z.string(), valueDecimal: z.string(), }); export function adjustmentFeesToJSON(adjustmentFees: AdjustmentFees): string { return JSON.stringify(AdjustmentFees$outboundSchema.parse(adjustmentFees)); } export function adjustmentFeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AdjustmentFees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AdjustmentFees' from JSON`, ); } /** @internal */ export const OtherFees$inboundSchema: z.ZodType< OtherFees, z.ZodTypeDef, unknown > = z.object({ currency: z.string(), valueDecimal: z.string(), }); /** @internal */ export type OtherFees$Outbound = { currency: string; valueDecimal: string; }; /** @internal */ export const OtherFees$outboundSchema: z.ZodType< OtherFees$Outbound, z.ZodTypeDef, OtherFees > = z.object({ currency: z.string(), valueDecimal: z.string(), }); export function otherFeesToJSON(otherFees: OtherFees): string { return JSON.stringify(OtherFees$outboundSchema.parse(otherFees)); } export function otherFeesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OtherFees$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OtherFees' from JSON`, ); } /** @internal */ export const BillingSummary$inboundSchema: z.ZodType< BillingSummary, z.ZodTypeDef, unknown > = z.object({ cardAcquiring: z.lazy(() => CardAcquiring$inboundSchema).optional(), ach: BillingSummaryDetails$inboundSchema.optional(), instantPayments: BillingSummaryDetails$inboundSchema.optional(), platformFees: z.lazy(() => BillingSummaryPlatformFees$inboundSchema) .optional(), accountFees: BillingSummaryDetails$inboundSchema.optional(), adjustmentFees: z.lazy(() => AdjustmentFees$inboundSchema).optional(), otherFees: z.lazy(() => OtherFees$inboundSchema).optional(), otherCardFees: BillingSummaryDetails$inboundSchema.optional(), total: AmountDecimal$inboundSchema.optional(), netIncomeSubtotal: BillingSummaryDetails$inboundSchema.optional(), revenueShare: z.string().optional(), residualSubtotal: AmountDecimal$inboundSchema.optional(), monthlyPartnerCosts: PartnerFees$inboundSchema.optional(), netPartnerPayment: AmountDecimal$inboundSchema.optional(), }); /** @internal */ export type BillingSummary$Outbound = { cardAcquiring?: CardAcquiring$Outbound | undefined; ach?: BillingSummaryDetails$Outbound | undefined; instantPayments?: BillingSummaryDetails$Outbound | undefined; platformFees?: BillingSummaryPlatformFees$Outbound | undefined; accountFees?: BillingSummaryDetails$Outbound | undefined; adjustmentFees?: AdjustmentFees$Outbound | undefined; otherFees?: OtherFees$Outbound | undefined; otherCardFees?: BillingSummaryDetails$Outbound | undefined; total?: AmountDecimal$Outbound | undefined; netIncomeSubtotal?: BillingSummaryDetails$Outbound | undefined; revenueShare?: string | undefined; residualSubtotal?: AmountDecimal$Outbound | undefined; monthlyPartnerCosts?: PartnerFees$Outbound | undefined; netPartnerPayment?: AmountDecimal$Outbound | undefined; }; /** @internal */ export const BillingSummary$outboundSchema: z.ZodType< BillingSummary$Outbound, z.ZodTypeDef, BillingSummary > = z.object({ cardAcquiring: z.lazy(() => CardAcquiring$outboundSchema).optional(), ach: BillingSummaryDetails$outboundSchema.optional(), instantPayments: BillingSummaryDetails$outboundSchema.optional(), platformFees: z.lazy(() => BillingSummaryPlatformFees$outboundSchema) .optional(), accountFees: BillingSummaryDetails$outboundSchema.optional(), adjustmentFees: z.lazy(() => AdjustmentFees$outboundSchema).optional(), otherFees: z.lazy(() => OtherFees$outboundSchema).optional(), otherCardFees: BillingSummaryDetails$outboundSchema.optional(), total: AmountDecimal$outboundSchema.optional(), netIncomeSubtotal: BillingSummaryDetails$outboundSchema.optional(), revenueShare: z.string().optional(), residualSubtotal: AmountDecimal$outboundSchema.optional(), monthlyPartnerCosts: PartnerFees$outboundSchema.optional(), netPartnerPayment: AmountDecimal$outboundSchema.optional(), }); export function billingSummaryToJSON(billingSummary: BillingSummary): string { return JSON.stringify(BillingSummary$outboundSchema.parse(billingSummary)); } export function billingSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillingSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillingSummary' from JSON`, ); }