/* * 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 { AddressUpdate, AddressUpdate$inboundSchema, AddressUpdate$Outbound, AddressUpdate$outboundSchema, } from "./addressupdate.js"; import { CreateAccountSettings, CreateAccountSettings$inboundSchema, CreateAccountSettings$Outbound, CreateAccountSettings$outboundSchema, } from "./createaccountsettings.js"; import { PatchProfile, PatchProfile$inboundSchema, PatchProfile$Outbound, PatchProfile$outboundSchema, } from "./patchprofile.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; import { TermsOfServicePayloadUpdate, TermsOfServicePayloadUpdate$inboundSchema, TermsOfServicePayloadUpdate$Outbound, TermsOfServicePayloadUpdate$outboundSchema, } from "./termsofservicepayloadupdate.js"; /** * User-provided information that can be displayed on credit card transactions for customers to use when * * @remarks * contacting a customer support team. This data is only allowed on a business account. */ export type PatchAccountCustomerSupport = { phone?: PhoneNumber | undefined; email?: string | undefined; address?: AddressUpdate | undefined; website?: string | undefined; }; /** * Describes the fields available when patching a Moov account. */ export type PatchAccount = { /** * Describes the fields available when patching a profile. * * @remarks * Each object can be patched independent of patching the other fields. */ profile?: PatchProfile | undefined; metadata?: { [k: string]: string } | null | undefined; termsOfService?: TermsOfServicePayloadUpdate | undefined; foreignID?: string | undefined; customerSupport?: PatchAccountCustomerSupport | null | undefined; settings?: CreateAccountSettings | undefined; }; /** @internal */ export const PatchAccountCustomerSupport$inboundSchema: z.ZodType< PatchAccountCustomerSupport, z.ZodTypeDef, unknown > = z.object({ phone: PhoneNumber$inboundSchema.optional(), email: z.string().optional(), address: AddressUpdate$inboundSchema.optional(), website: z.string().optional(), }); /** @internal */ export type PatchAccountCustomerSupport$Outbound = { phone?: PhoneNumber$Outbound | undefined; email?: string | undefined; address?: AddressUpdate$Outbound | undefined; website?: string | undefined; }; /** @internal */ export const PatchAccountCustomerSupport$outboundSchema: z.ZodType< PatchAccountCustomerSupport$Outbound, z.ZodTypeDef, PatchAccountCustomerSupport > = z.object({ phone: PhoneNumber$outboundSchema.optional(), email: z.string().optional(), address: AddressUpdate$outboundSchema.optional(), website: z.string().optional(), }); export function patchAccountCustomerSupportToJSON( patchAccountCustomerSupport: PatchAccountCustomerSupport, ): string { return JSON.stringify( PatchAccountCustomerSupport$outboundSchema.parse( patchAccountCustomerSupport, ), ); } export function patchAccountCustomerSupportFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PatchAccountCustomerSupport$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PatchAccountCustomerSupport' from JSON`, ); } /** @internal */ export const PatchAccount$inboundSchema: z.ZodType< PatchAccount, z.ZodTypeDef, unknown > = z.object({ profile: PatchProfile$inboundSchema.optional(), metadata: z.nullable(z.record(z.string())).optional(), termsOfService: TermsOfServicePayloadUpdate$inboundSchema.optional(), foreignID: z.string().optional(), customerSupport: z.nullable( z.lazy(() => PatchAccountCustomerSupport$inboundSchema), ).optional(), settings: CreateAccountSettings$inboundSchema.optional(), }); /** @internal */ export type PatchAccount$Outbound = { profile?: PatchProfile$Outbound | undefined; metadata?: { [k: string]: string } | null | undefined; termsOfService?: TermsOfServicePayloadUpdate$Outbound | undefined; foreignID?: string | undefined; customerSupport?: PatchAccountCustomerSupport$Outbound | null | undefined; settings?: CreateAccountSettings$Outbound | undefined; }; /** @internal */ export const PatchAccount$outboundSchema: z.ZodType< PatchAccount$Outbound, z.ZodTypeDef, PatchAccount > = z.object({ profile: PatchProfile$outboundSchema.optional(), metadata: z.nullable(z.record(z.string())).optional(), termsOfService: TermsOfServicePayloadUpdate$outboundSchema.optional(), foreignID: z.string().optional(), customerSupport: z.nullable( z.lazy(() => PatchAccountCustomerSupport$outboundSchema), ).optional(), settings: CreateAccountSettings$outboundSchema.optional(), }); export function patchAccountToJSON(patchAccount: PatchAccount): string { return JSON.stringify(PatchAccount$outboundSchema.parse(patchAccount)); } export function patchAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PatchAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PatchAccount' from JSON`, ); }