/* * 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 { ChangedInvoiceAction, ChangedInvoiceAction$inboundSchema, } from "./changed-invoice-action.js"; import { ChangedInvoiceStatus, ChangedInvoiceStatus$inboundSchema, } from "./changed-invoice-status.js"; import { InvoiceResponse, InvoiceResponse$inboundSchema, } from "./invoice-response.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { WalletTransactionResponse, WalletTransactionResponse$inboundSchema, } from "./wallet-transaction-response.js"; export type ChangedInvoice = { /** * created (proration invoice) | wallet_credit (downgrade credit) */ action?: ChangedInvoiceAction | undefined; id?: string | undefined; invoice?: InvoiceResponse | undefined; /** * preview | issued | INITIATED | PENDING | PROCESSING | SUCCEEDED | OVERPAID | FAILED | REFUNDED | PARTIALLY_REFUNDED */ status?: ChangedInvoiceStatus | undefined; walletTransaction?: WalletTransactionResponse | undefined; }; /** @internal */ export const ChangedInvoice$inboundSchema: z.ZodMiniType< ChangedInvoice, unknown > = z.pipe( z.object({ action: types.optional(ChangedInvoiceAction$inboundSchema), id: types.optional(types.string()), invoice: types.optional(InvoiceResponse$inboundSchema), status: types.optional(ChangedInvoiceStatus$inboundSchema), wallet_transaction: types.optional(WalletTransactionResponse$inboundSchema), }), z.transform((v) => { return remap$(v, { "wallet_transaction": "walletTransaction", }); }), ); export function changedInvoiceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChangedInvoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChangedInvoice' from JSON`, ); }