/* * 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 { MXAuthorizationCode, MXAuthorizationCode$inboundSchema, MXAuthorizationCode$Outbound, MXAuthorizationCode$outboundSchema, } from "./mxauthorizationcode.js"; /** * Describes the account to link to the Moov account using a MX processor token. * * @remarks * * `sandbox` - When linking a bank account to a `sandbox` account using an MX authorization token a default bank account routing number will * be used. The following default data will be used to generate the bank account in this flow: * * ``` * RoutingNumber: "123456780", * BankName: "Gringotts Bank" * ``` */ export type MxPayload = { /** * The authorization code of a MX account which allows a processor to retrieve a linked payment account. * * @remarks * * `sandbox` - When linking a bank account to a `sandbox` account using a MX authorization code it will utilize MX's sandbox environment. * The MX authorization code provided must be generated from MX's sandbox environment. */ mx: MXAuthorizationCode; }; /** @internal */ export const MxPayload$inboundSchema: z.ZodType< MxPayload, z.ZodTypeDef, unknown > = z.object({ mx: MXAuthorizationCode$inboundSchema, }); /** @internal */ export type MxPayload$Outbound = { mx: MXAuthorizationCode$Outbound; }; /** @internal */ export const MxPayload$outboundSchema: z.ZodType< MxPayload$Outbound, z.ZodTypeDef, MxPayload > = z.object({ mx: MXAuthorizationCode$outboundSchema, }); export function mxPayloadToJSON(mxPayload: MxPayload): string { return JSON.stringify(MxPayload$outboundSchema.parse(mxPayload)); } export function mxPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MxPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MxPayload' from JSON`, ); }