/* * 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 { GeneratedBy, GeneratedBy$inboundSchema, GeneratedBy$Outbound, GeneratedBy$outboundSchema, } from "./generatedby.js"; /** * A fee incurred by a user. */ export type IncurredFee = { feeID?: string | undefined; /** * Account ID the fee belongs to. */ accountID?: string | undefined; /** * Wallet ID associated with the fee. */ walletID?: string | undefined; /** * Timestamp when the fee was created. */ createdOn?: Date | undefined; /** * Name of the fee. */ feeName?: string | undefined; /** * The fee amount. */ amount?: AmountDecimal | undefined; /** * Object indicating what generated the fee (TransferID, CardID, DisputeID, AccountID, or BankAccountID). */ generatedBy?: GeneratedBy | undefined; /** * Describes the source of the fee, such as a Moov-set processing fee, a network pass-through fee, or an interchange or discount fee. */ feeGroup?: string | undefined; /** * Unique identifier for this residual payment calculation. */ residualID?: string | undefined; }; /** @internal */ export const IncurredFee$inboundSchema: z.ZodType< IncurredFee, z.ZodTypeDef, unknown > = z.object({ feeID: z.string().optional(), accountID: z.string().optional(), walletID: z.string().optional(), createdOn: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), feeName: z.string().optional(), amount: AmountDecimal$inboundSchema.optional(), generatedBy: GeneratedBy$inboundSchema.optional(), feeGroup: z.string().optional(), residualID: z.string().optional(), }); /** @internal */ export type IncurredFee$Outbound = { feeID?: string | undefined; accountID?: string | undefined; walletID?: string | undefined; createdOn?: string | undefined; feeName?: string | undefined; amount?: AmountDecimal$Outbound | undefined; generatedBy?: GeneratedBy$Outbound | undefined; feeGroup?: string | undefined; residualID?: string | undefined; }; /** @internal */ export const IncurredFee$outboundSchema: z.ZodType< IncurredFee$Outbound, z.ZodTypeDef, IncurredFee > = z.object({ feeID: z.string().optional(), accountID: z.string().optional(), walletID: z.string().optional(), createdOn: z.date().transform(v => v.toISOString()).optional(), feeName: z.string().optional(), amount: AmountDecimal$outboundSchema.optional(), generatedBy: GeneratedBy$outboundSchema.optional(), feeGroup: z.string().optional(), residualID: z.string().optional(), }); export function incurredFeeToJSON(incurredFee: IncurredFee): string { return JSON.stringify(IncurredFee$outboundSchema.parse(incurredFee)); } export function incurredFeeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IncurredFee$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IncurredFee' from JSON`, ); }