/* * 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 { CheckoutParams, CheckoutParams$Outbound, CheckoutParams$outboundSchema, } from "./checkout-params.js"; import { TransactionReason, TransactionReason$outboundSchema, } from "./transaction-reason.js"; export type TopUpWalletRequest = { /** * amount is the amount in the currency of the wallet to be added * * @remarks * NOTE: this is not the number of credits to add, but the amount in the currency * amount = credits_to_add * conversion_rate * if both amount and credits_to_add are provided, amount will be ignored * ex if the wallet has a conversion_rate of 2 then adding an amount of * 10 USD in the wallet wil add 5 credits in the wallet */ amount?: string | undefined; /** * bonus_credits_expiry_date_utc is the expiry (UTC, full precision) applied to the bonus * * @remarks * credits transaction. Independent of expiry_date_utc, which governs the purchase credits. * Only honored when bonus credits are actually granted (explicit BonusCreditsToAdd or slab). */ bonusCreditsExpiryDateUtc?: string | undefined; /** * bonus_credits_to_add is an explicit override for the bonus credits granted alongside this * * @remarks * purchase. When nil/omitted, the bonus is resolved from the tenant's * bonus_credits_topup_config slabs (if enabled). When set, it must be greater than 0 and is * used as-is, skipping slab resolution. To grant no bonus, omit this field entirely. */ bonusCreditsToAdd?: string | undefined; checkout?: CheckoutParams | undefined; /** * credits_to_add is the number of credits to add to the wallet */ creditsToAdd?: string | undefined; /** * description to add any specific details about the transaction */ description?: string | undefined; /** * expiry_date_utc is the expiry date in UTC timezone * * @remarks * ex 2025-01-01 00:00:00 UTC */ expiryDateUtc?: string | undefined; forceSyncInvoice?: boolean | undefined; /** * idempotency_key is a unique key for the transaction */ idempotencyKey?: string | undefined; metadata?: { [k: string]: string } | undefined; /** * priority is the priority of the transaction * * @remarks * lower number means higher priority * default is nil which means no priority at all */ priority?: number | undefined; transactionReason: TransactionReason; }; /** @internal */ export type TopUpWalletRequest$Outbound = { amount?: string | undefined; bonus_credits_expiry_date_utc?: string | undefined; bonus_credits_to_add?: string | undefined; checkout?: CheckoutParams$Outbound | undefined; credits_to_add?: string | undefined; description?: string | undefined; expiry_date_utc?: string | undefined; force_sync_invoice?: boolean | undefined; idempotency_key?: string | undefined; metadata?: { [k: string]: string } | undefined; priority?: number | undefined; transaction_reason: string; }; /** @internal */ export const TopUpWalletRequest$outboundSchema: z.ZodMiniType< TopUpWalletRequest$Outbound, TopUpWalletRequest > = z.pipe( z.object({ amount: z.optional(z.string()), bonusCreditsExpiryDateUtc: z.optional(z.string()), bonusCreditsToAdd: z.optional(z.string()), checkout: z.optional(CheckoutParams$outboundSchema), creditsToAdd: z.optional(z.string()), description: z.optional(z.string()), expiryDateUtc: z.optional(z.string()), forceSyncInvoice: z.optional(z.boolean()), idempotencyKey: z.optional(z.string()), metadata: z.optional(z.record(z.string(), z.string())), priority: z.optional(z.int()), transactionReason: TransactionReason$outboundSchema, }), z.transform((v) => { return remap$(v, { bonusCreditsExpiryDateUtc: "bonus_credits_expiry_date_utc", bonusCreditsToAdd: "bonus_credits_to_add", creditsToAdd: "credits_to_add", expiryDateUtc: "expiry_date_utc", forceSyncInvoice: "force_sync_invoice", idempotencyKey: "idempotency_key", transactionReason: "transaction_reason", }); }), ); export function topUpWalletRequestToJSON( topUpWalletRequest: TopUpWalletRequest, ): string { return JSON.stringify( TopUpWalletRequest$outboundSchema.parse(topUpWalletRequest), ); }