/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type ProrationDetails = { /** * charge_amount is the charge amount for the new subscription */ chargeAmount?: string | undefined; /** * charge_description describes what the charge is for */ chargeDescription?: string | undefined; /** * credit_amount is the credit amount from the old subscription */ creditAmount?: string | undefined; /** * credit_description describes what the credit is for */ creditDescription?: string | undefined; /** * currency is the currency for all amounts */ currency?: string | undefined; /** * current_period_end is the end of the current billing period */ currentPeriodEnd?: Date | undefined; /** * current_period_start is the start of the current billing period */ currentPeriodStart?: Date | undefined; /** * days_remaining is the number of days remaining in the current period */ daysRemaining?: number | undefined; /** * days_used is the number of days used in the current period */ daysUsed?: number | undefined; /** * net_amount is the net amount (charge - credit) */ netAmount?: string | undefined; /** * proration_date is the date used for proration calculations */ prorationDate?: Date | undefined; }; /** @internal */ export const ProrationDetails$inboundSchema: z.ZodMiniType< ProrationDetails, unknown > = z.pipe( z.object({ charge_amount: types.optional(types.string()), charge_description: types.optional(types.string()), credit_amount: types.optional(types.string()), credit_description: types.optional(types.string()), currency: types.optional(types.string()), current_period_end: types.optional(types.date()), current_period_start: types.optional(types.date()), days_remaining: types.optional(types.number()), days_used: types.optional(types.number()), net_amount: types.optional(types.string()), proration_date: types.optional(types.date()), }), z.transform((v) => { return remap$(v, { "charge_amount": "chargeAmount", "charge_description": "chargeDescription", "credit_amount": "creditAmount", "credit_description": "creditDescription", "current_period_end": "currentPeriodEnd", "current_period_start": "currentPeriodStart", "days_remaining": "daysRemaining", "days_used": "daysUsed", "net_amount": "netAmount", "proration_date": "prorationDate", }); }), ); export function prorationDetailsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProrationDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProrationDetails' from JSON`, ); }