/* * 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 { CustomerResponse, CustomerResponse$inboundSchema, } from "./customer-response.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { Status, Status$inboundSchema } from "./status.js"; import { TransactionReason, TransactionReason$inboundSchema, } from "./transaction-reason.js"; import { TransactionStatus, TransactionStatus$inboundSchema, } from "./transaction-status.js"; import { TransactionType, TransactionType$inboundSchema, } from "./transaction-type.js"; import { UserResponse, UserResponse$inboundSchema } from "./user-response.js"; import { WalletResponse, WalletResponse$inboundSchema, } from "./wallet-response.js"; import { WalletTxReferenceType, WalletTxReferenceType$inboundSchema, } from "./wallet-tx-reference-type.js"; export type WalletTransactionResponse = { amount?: string | undefined; /** * conversion_rate is the conversion rate for the transaction to the currency */ conversionRate?: string | undefined; createdAt?: Date | undefined; createdBy?: string | undefined; createdByUser?: UserResponse | undefined; creditAmount?: string | undefined; creditBalanceAfter?: string | undefined; creditBalanceBefore?: string | undefined; creditsAvailable?: string | undefined; currency?: string | undefined; /** * Customer response object containing all customer information */ customer?: CustomerResponse | undefined; customerId?: string | undefined; description?: string | undefined; environmentId?: string | undefined; expiryDate?: Date | undefined; id?: string | undefined; idempotencyKey?: string | undefined; metadata?: { [k: string]: string } | undefined; /** * ParentTransactionID is the ID of the parent wallet_transaction this row was earned from * * @remarks * (the purchase tx, for a bonus grant). Empty for ordinary transactions. */ parentTransactionId?: string | undefined; priority?: number | undefined; referenceId?: string | undefined; referenceType?: WalletTxReferenceType | undefined; status?: Status | undefined; tenantId?: string | undefined; /** * topup_conversion_rate is the conversion rate for the topup to the currency */ topupConversionRate?: string | undefined; transactionReason?: TransactionReason | undefined; transactionStatus?: TransactionStatus | undefined; type?: TransactionType | undefined; updatedAt?: Date | undefined; updatedBy?: string | undefined; wallet?: WalletResponse | undefined; walletId?: string | undefined; }; /** @internal */ export const WalletTransactionResponse$inboundSchema: z.ZodMiniType< WalletTransactionResponse, unknown > = z.pipe( z.object({ amount: types.optional(types.string()), conversion_rate: types.optional(types.string()), created_at: types.optional(types.date()), created_by: types.optional(types.string()), created_by_user: types.optional(UserResponse$inboundSchema), credit_amount: types.optional(types.string()), credit_balance_after: types.optional(types.string()), credit_balance_before: types.optional(types.string()), credits_available: types.optional(types.string()), currency: types.optional(types.string()), customer: types.optional(CustomerResponse$inboundSchema), customer_id: types.optional(types.string()), description: types.optional(types.string()), environment_id: types.optional(types.string()), expiry_date: types.optional(types.date()), id: types.optional(types.string()), idempotency_key: types.optional(types.string()), metadata: types.optional(z.record(z.string(), types.string())), parent_transaction_id: types.optional(types.string()), priority: types.optional(types.number()), reference_id: types.optional(types.string()), reference_type: types.optional(WalletTxReferenceType$inboundSchema), status: types.optional(Status$inboundSchema), tenant_id: types.optional(types.string()), topup_conversion_rate: types.optional(types.string()), transaction_reason: types.optional(TransactionReason$inboundSchema), transaction_status: types.optional(TransactionStatus$inboundSchema), type: types.optional(TransactionType$inboundSchema), updated_at: types.optional(types.date()), updated_by: types.optional(types.string()), wallet: types.optional(WalletResponse$inboundSchema), wallet_id: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "conversion_rate": "conversionRate", "created_at": "createdAt", "created_by": "createdBy", "created_by_user": "createdByUser", "credit_amount": "creditAmount", "credit_balance_after": "creditBalanceAfter", "credit_balance_before": "creditBalanceBefore", "credits_available": "creditsAvailable", "customer_id": "customerId", "environment_id": "environmentId", "expiry_date": "expiryDate", "idempotency_key": "idempotencyKey", "parent_transaction_id": "parentTransactionId", "reference_id": "referenceId", "reference_type": "referenceType", "tenant_id": "tenantId", "topup_conversion_rate": "topupConversionRate", "transaction_reason": "transactionReason", "transaction_status": "transactionStatus", "updated_at": "updatedAt", "updated_by": "updatedBy", "wallet_id": "walletId", }); }), ); export function walletTransactionResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WalletTransactionResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WalletTransactionResponse' from JSON`, ); }