/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BankAccountException, BankAccountException$inboundSchema, BankAccountException$Outbound, BankAccountException$outboundSchema, } from "./bankaccountexception.js"; import { BankAccountStatus, BankAccountStatus$inboundSchema, BankAccountStatus$outboundSchema, } from "./bankaccountstatus.js"; import { BankAccountStatusReason, BankAccountStatusReason$inboundSchema, BankAccountStatusReason$outboundSchema, } from "./bankaccountstatusreason.js"; export type WebhookDataBankAccountUpdated = { bankAccountID: string; accountID: string; status: BankAccountStatus; /** * The reason the bank account status changed to the current value. */ statusReason: BankAccountStatusReason; /** * Reason for, and details related to, an `errored` or `verificationFailed` bank account status. */ exceptionDetails?: BankAccountException | undefined; }; /** @internal */ export const WebhookDataBankAccountUpdated$inboundSchema: z.ZodType< WebhookDataBankAccountUpdated, z.ZodTypeDef, unknown > = z.object({ bankAccountID: z.string(), accountID: z.string(), status: BankAccountStatus$inboundSchema, statusReason: BankAccountStatusReason$inboundSchema, exceptionDetails: BankAccountException$inboundSchema.optional(), }); /** @internal */ export type WebhookDataBankAccountUpdated$Outbound = { bankAccountID: string; accountID: string; status: string; statusReason: string; exceptionDetails?: BankAccountException$Outbound | undefined; }; /** @internal */ export const WebhookDataBankAccountUpdated$outboundSchema: z.ZodType< WebhookDataBankAccountUpdated$Outbound, z.ZodTypeDef, WebhookDataBankAccountUpdated > = z.object({ bankAccountID: z.string(), accountID: z.string(), status: BankAccountStatus$outboundSchema, statusReason: BankAccountStatusReason$outboundSchema, exceptionDetails: BankAccountException$outboundSchema.optional(), }); export function webhookDataBankAccountUpdatedToJSON( webhookDataBankAccountUpdated: WebhookDataBankAccountUpdated, ): string { return JSON.stringify( WebhookDataBankAccountUpdated$outboundSchema.parse( webhookDataBankAccountUpdated, ), ); } export function webhookDataBankAccountUpdatedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookDataBankAccountUpdated$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookDataBankAccountUpdated' from JSON`, ); }