/* * 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 { AccountFees, AccountFees$inboundSchema, AccountFees$Outbound, AccountFees$outboundSchema, } from "./accountfees.js"; import { ACHFees, ACHFees$inboundSchema, ACHFees$Outbound, ACHFees$outboundSchema, } from "./achfees.js"; import { BillingSummary, BillingSummary$inboundSchema, BillingSummary$Outbound, BillingSummary$outboundSchema, } from "./billingsummary.js"; import { CardAcquiringFees, CardAcquiringFees$inboundSchema, CardAcquiringFees$Outbound, CardAcquiringFees$outboundSchema, } from "./cardacquiringfees.js"; import { InstantPaymentFees, InstantPaymentFees$inboundSchema, InstantPaymentFees$Outbound, InstantPaymentFees$outboundSchema, } from "./instantpaymentfees.js"; import { OtherCardFees, OtherCardFees$inboundSchema, OtherCardFees$Outbound, OtherCardFees$outboundSchema, } from "./othercardfees.js"; import { PartnerFees, PartnerFees$inboundSchema, PartnerFees$Outbound, PartnerFees$outboundSchema, } from "./partnerfees.js"; import { PlatformFees, PlatformFees$inboundSchema, PlatformFees$Outbound, PlatformFees$outboundSchema, } from "./platformfees.js"; /** * A billing statement for a Moov account. */ export type Statement = { /** * The unique identifier for the statement. */ statementID: string; /** * The name of the statement. */ statementName: string; /** * The name of the statement file. */ fileName: string; /** * The size of the statement file in bytes. */ fileSize: number; /** * The start date and time of the billing period. */ billingPeriodStartDateTime: Date; /** * The end date and time of the billing period. */ billingPeriodEndDateTime: Date; /** * List of subscription IDs associated with this statement. */ subscriptionIDs: Array; /** * A summary of all fees included in a statement. */ summary: BillingSummary; /** * A detailed breakdown of card acquiring fees by card brand. */ cardAcquiringFees?: CardAcquiringFees | undefined; /** * A detailed breakdown of ACH fees. */ achFees?: ACHFees | undefined; /** * A detailed breakdown of instant payment fees. */ instantPaymentFees?: InstantPaymentFees | undefined; /** * A detailed breakdown of platform fees. This field is deprecated and will be removed in a future release. Use accountFees. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ platformFees?: PlatformFees | undefined; /** * A detailed breakdown of account fees. */ accountFees?: AccountFees | undefined; /** * A detailed breakdown of other card-related fees. */ otherCardFees?: OtherCardFees | undefined; /** * Monthly partner costs that are charged separately and not included in residual subtotal (e.g. platform fees, minimums). */ partnerFees?: PartnerFees | undefined; /** * The date and time the statement was created. */ createdOn: Date; /** * The date and time the statement was last updated. */ updatedOn: Date; }; /** @internal */ export const Statement$inboundSchema: z.ZodType< Statement, z.ZodTypeDef, unknown > = z.object({ statementID: z.string(), statementName: z.string(), fileName: z.string(), fileSize: z.number().int(), billingPeriodStartDateTime: z.string().datetime({ offset: true }).transform( v => new Date(v) ), billingPeriodEndDateTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ), subscriptionIDs: z.array(z.string()), summary: BillingSummary$inboundSchema, cardAcquiringFees: CardAcquiringFees$inboundSchema.optional(), achFees: ACHFees$inboundSchema.optional(), instantPaymentFees: InstantPaymentFees$inboundSchema.optional(), platformFees: PlatformFees$inboundSchema.optional(), accountFees: AccountFees$inboundSchema.optional(), otherCardFees: OtherCardFees$inboundSchema.optional(), partnerFees: PartnerFees$inboundSchema.optional(), createdOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), updatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), }); /** @internal */ export type Statement$Outbound = { statementID: string; statementName: string; fileName: string; fileSize: number; billingPeriodStartDateTime: string; billingPeriodEndDateTime: string; subscriptionIDs: Array; summary: BillingSummary$Outbound; cardAcquiringFees?: CardAcquiringFees$Outbound | undefined; achFees?: ACHFees$Outbound | undefined; instantPaymentFees?: InstantPaymentFees$Outbound | undefined; platformFees?: PlatformFees$Outbound | undefined; accountFees?: AccountFees$Outbound | undefined; otherCardFees?: OtherCardFees$Outbound | undefined; partnerFees?: PartnerFees$Outbound | undefined; createdOn: string; updatedOn: string; }; /** @internal */ export const Statement$outboundSchema: z.ZodType< Statement$Outbound, z.ZodTypeDef, Statement > = z.object({ statementID: z.string(), statementName: z.string(), fileName: z.string(), fileSize: z.number().int(), billingPeriodStartDateTime: z.date().transform(v => v.toISOString()), billingPeriodEndDateTime: z.date().transform(v => v.toISOString()), subscriptionIDs: z.array(z.string()), summary: BillingSummary$outboundSchema, cardAcquiringFees: CardAcquiringFees$outboundSchema.optional(), achFees: ACHFees$outboundSchema.optional(), instantPaymentFees: InstantPaymentFees$outboundSchema.optional(), platformFees: PlatformFees$outboundSchema.optional(), accountFees: AccountFees$outboundSchema.optional(), otherCardFees: OtherCardFees$outboundSchema.optional(), partnerFees: PartnerFees$outboundSchema.optional(), createdOn: z.date().transform(v => v.toISOString()), updatedOn: z.date().transform(v => v.toISOString()), }); export function statementToJSON(statement: Statement): string { return JSON.stringify(Statement$outboundSchema.parse(statement)); } export function statementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Statement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Statement' from JSON`, ); }