/* * 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"; 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 { WalletTxReferenceType, WalletTxReferenceType$inboundSchema, } from "./wallet-tx-reference-type.js"; export type WebhookDtoWalletTransaction = { amount?: string | undefined; creditAmount?: string | undefined; creditBalanceAfter?: string | undefined; creditBalanceBefore?: string | undefined; currency?: string | undefined; customerId?: string | undefined; description?: string | undefined; expiryDate?: Date | undefined; id?: string | undefined; metadata?: { [k: string]: string } | undefined; referenceId?: string | undefined; referenceType?: WalletTxReferenceType | undefined; transactionReason?: TransactionReason | undefined; transactionStatus?: TransactionStatus | undefined; type?: TransactionType | undefined; walletId?: string | undefined; }; /** @internal */ export const WebhookDtoWalletTransaction$inboundSchema: z.ZodMiniType< WebhookDtoWalletTransaction, unknown > = z.pipe( z.object({ amount: types.optional(types.string()), credit_amount: types.optional(types.string()), credit_balance_after: types.optional(types.string()), credit_balance_before: types.optional(types.string()), currency: types.optional(types.string()), customer_id: types.optional(types.string()), description: types.optional(types.string()), expiry_date: types.optional(types.date()), id: types.optional(types.string()), metadata: types.optional(z.record(z.string(), types.string())), reference_id: types.optional(types.string()), reference_type: types.optional(WalletTxReferenceType$inboundSchema), transaction_reason: types.optional(TransactionReason$inboundSchema), transaction_status: types.optional(TransactionStatus$inboundSchema), type: types.optional(TransactionType$inboundSchema), wallet_id: types.optional(types.string()), }), z.transform((v) => { return remap$(v, { "credit_amount": "creditAmount", "credit_balance_after": "creditBalanceAfter", "credit_balance_before": "creditBalanceBefore", "customer_id": "customerId", "expiry_date": "expiryDate", "reference_id": "referenceId", "reference_type": "referenceType", "transaction_reason": "transactionReason", "transaction_status": "transactionStatus", "wallet_id": "walletId", }); }), ); export function webhookDtoWalletTransactionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookDtoWalletTransaction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookDtoWalletTransaction' from JSON`, ); }