/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type BankAccountValidationInteractiveValidateResponseItem = { /** * Indicates whether the account number and sortcode are valid. */ isCorrect?: boolean | undefined; /** * Indicates whether the branch associated with this account can accept direct debits. */ isDirectDebitCapable?: boolean | undefined; /** * More detail about the outcome of the validation process. Describes reasons validation failed or changes made to pass validation. DetailsChanged indicates that the account and sortcode should be changed for BACs submission (check CorrectedAccountNumber and CorrectedSortCode). CautiousOK is set where the sortcode exists but no validation rules are set for the bank (very rare). */ statusInformation?: string | undefined; /** * The correct version of the SortCode. This will be 6 digits long with no hyphens. It may differ from the original sortcode. */ correctedSortCode?: string | undefined; /** * The correct version of the AccountNumber. This will be 8 digits long and in the form expected for BACs submission. */ correctedAccountNumber?: string | undefined; /** * The correctly formatted IBAN for the account. */ iban?: string | undefined; /** * The name of the banking institution. */ bank?: string | undefined; /** * The banking institution's BIC, also know as the SWIFT BIC. */ bankBIC?: string | undefined; /** * The name of the account holding branch. */ branch?: string | undefined; /** * The branch's BIC. */ branchBIC?: string | undefined; /** * Line 1 of the branch's contact address. NB: This is the address to be used for BACs enquiries and may be a contact centre rather than the branch's address. */ contactAddressLine1?: string | undefined; /** * Line 2 of the branch's contact address. */ contactAddressLine2?: string | undefined; /** * The branch's contact post town. */ contactPostTown?: string | undefined; /** * The branch's contact postcode. */ contactPostcode?: string | undefined; /** * The branch's contact phone number. */ contactPhone?: string | undefined; /** * The branch's contact fax number. */ contactFax?: string | undefined; /** * Indicates that the account supports the faster payments service. */ fasterPaymentsSupported?: boolean | undefined; /** * Indicates that the account supports the CHAPS service. */ chapsSupported?: boolean | undefined; }; export type BankAccountValidationInteractiveValidateResponse = { items?: | Array | undefined; }; /** @internal */ export const BankAccountValidationInteractiveValidateResponseItem$inboundSchema: z.ZodType< BankAccountValidationInteractiveValidateResponseItem, z.ZodTypeDef, unknown > = z.object({ IsCorrect: z.boolean().optional(), IsDirectDebitCapable: z.boolean().optional(), StatusInformation: z.string().optional(), CorrectedSortCode: z.string().optional(), CorrectedAccountNumber: z.string().optional(), IBAN: z.string().optional(), Bank: z.string().optional(), BankBIC: z.string().optional(), Branch: z.string().optional(), BranchBIC: z.string().optional(), ContactAddressLine1: z.string().optional(), ContactAddressLine2: z.string().optional(), ContactPostTown: z.string().optional(), ContactPostcode: z.string().optional(), ContactPhone: z.string().optional(), ContactFax: z.string().optional(), FasterPaymentsSupported: z.boolean().optional(), CHAPSSupported: z.boolean().optional(), }).transform((v) => { return remap$(v, { "IsCorrect": "isCorrect", "IsDirectDebitCapable": "isDirectDebitCapable", "StatusInformation": "statusInformation", "CorrectedSortCode": "correctedSortCode", "CorrectedAccountNumber": "correctedAccountNumber", "IBAN": "iban", "Bank": "bank", "BankBIC": "bankBIC", "Branch": "branch", "BranchBIC": "branchBIC", "ContactAddressLine1": "contactAddressLine1", "ContactAddressLine2": "contactAddressLine2", "ContactPostTown": "contactPostTown", "ContactPostcode": "contactPostcode", "ContactPhone": "contactPhone", "ContactFax": "contactFax", "FasterPaymentsSupported": "fasterPaymentsSupported", "CHAPSSupported": "chapsSupported", }); }); export function bankAccountValidationInteractiveValidateResponseItemFromJSON( jsonString: string, ): SafeParseResult< BankAccountValidationInteractiveValidateResponseItem, SDKValidationError > { return safeParse( jsonString, (x) => BankAccountValidationInteractiveValidateResponseItem$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'BankAccountValidationInteractiveValidateResponseItem' from JSON`, ); } /** @internal */ export const BankAccountValidationInteractiveValidateResponse$inboundSchema: z.ZodType< BankAccountValidationInteractiveValidateResponse, z.ZodTypeDef, unknown > = z.object({ Items: z.array( z.lazy(() => BankAccountValidationInteractiveValidateResponseItem$inboundSchema ), ).optional(), }).transform((v) => { return remap$(v, { "Items": "items", }); }); export function bankAccountValidationInteractiveValidateResponseFromJSON( jsonString: string, ): SafeParseResult< BankAccountValidationInteractiveValidateResponse, SDKValidationError > { return safeParse( jsonString, (x) => BankAccountValidationInteractiveValidateResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'BankAccountValidationInteractiveValidateResponse' from JSON`, ); }