import {z} from 'zod' export type TransliteratedAddressDto = {addressLine1?: string | undefined, addressLine2?: string | undefined, city?: string | undefined, state?: string | undefined}; export type AddressDto = {addressLine1: string, addressLine2?: string | undefined, city: string, state?: string | undefined, postalCode: string, country: string, transliterated?: TransliteratedAddressDto | undefined}; export type VerificationAssociatedEntityGovernmentIdDto = {type?: ('PASSPORT' | 'DRIVERS_LICENSE' | 'NATIONAL_ID' | 'MILITARY_ID' | 'PERMANENT_RESIDENCY_ID' | 'STATE_OR_PROVINCIAL_ID') | undefined, countryCode?: string | undefined, number?: string | undefined, issuanceDate?: string | undefined, expirationDate?: (string | null) | undefined, frontImage?: string | undefined, backImage?: string | undefined, selfie?: string | undefined}; export type ProofOfAddressDto = {type: 'UTILITY_BILL' | 'BANK_STATEMENT' | 'LEASE_AGREEMENT' | 'GOVERNMENT_LETTER' | 'OTHER', countryCode: 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AO' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BR' | 'BS' | 'BT' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'EU' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW', issueDate: string, file: string}; export type DocumentUploadDto = {requirementId?: string | undefined, type?: ('IDENTITY' | 'LIVENESS_CHECK' | 'PROOF_OF_ADDRESS' | 'INVOICE' | 'CONTRACT' | 'BANK_STATEMENT' | 'BUSINESS_LICENSE' | 'ARTICLES_OF_INCORPORATION' | 'ARTICLES_OF_ASSOCIATION' | 'CERTIFICATE_OF_FORMATION' | 'CERTIFICATE_OF_INCUMBENCY' | 'OPERATING_AGREEMENT' | 'PARTNERSHIP_AGREEMENT' | 'OWNERSHIP_STRUCTURE' | 'SHAREHOLDER_AGREEMENT' | 'STOCK_CERTIFICATE' | 'TAX_RETURN' | 'FINANCIAL_STATEMENT' | 'MARKETING_MATERIALS' | 'DOMAIN_OWNERSHIP_PROOF' | 'BUSINESS_PLAN' | 'BILL_OF_LADING' | 'AML_POLICY' | 'AML_COMFORT_LETTER' | 'FUNDS_FLOW_DIAGRAM' | 'GOOD_STANDING_CERTIFICATE' | 'TIN_VERIFICATION' | 'MSB_LICENSE' | 'DIRECTORS_REGISTRY' | 'OWNERSHIP_CHART' | 'PROOF_OF_SIGNATORY_AUTHORITY' | 'PROOF_OF_SOURCE_OF_FUNDS' | 'PROOF_OF_ENTITY_NAME_CHANGE' | 'REMOTE_ADDRESS_ATTESTATION' | 'E_SIGNATURE_CERTIFICATE' | 'COMPLIANCE_NOTES' | 'PROOF_OF_SOURCE_OF_WEALTH' | 'TAX_EXEMPT_ENTITY_CONFIRMATION' | 'OTHER') | undefined, subtype?: ('GOVERNMENT_ID_FRONT' | 'GOVERNMENT_ID_BACK' | 'SELFIE' | 'UTILITY_BILL' | 'LEASE_AGREEMENT') | undefined, description?: string | undefined, remarks?: string | undefined, file: string}; export type VerificationAssociatedEntityDto = {associatedEntityId?: string | undefined, entityType?: ('INDIVIDUAL' | 'BUSINESS') | undefined, parentEntityId?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, middleName?: string | undefined, nickname?: string | undefined, dateOfBirth?: string | undefined, taxResidenceCountry?: string | undefined, taxIdentificationNumber?: string | undefined, taxIdentificationDocumentType?: string | undefined, transliteratedFirstName?: string | undefined, transliteratedMiddleName?: string | undefined, transliteratedLastName?: string | undefined, businessName?: string | undefined, registrationNumber?: string | undefined, dateOfIncorporation?: string | undefined, businessAddress?: AddressDto | undefined, countryCode: 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AO' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BR' | 'BS' | 'BT' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'EU' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SY' | 'SZ' | 'TC' | 'TD' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW', email?: string | undefined, phone?: string | undefined, address?: AddressDto | undefined, hasOwnership: boolean, hasControl: boolean, ownershipPercentage?: number | undefined, isSigner?: boolean | undefined, isDirector?: boolean | undefined, role?: ('CEO' | 'CFO' | 'COO' | 'PRESIDENT' | 'GENERAL_COUNSEL' | 'MANAGING_MEMBER' | 'TREASURER' | 'OTHER') | undefined, governmentId?: VerificationAssociatedEntityGovernmentIdDto | undefined, proofOfAddress?: ProofOfAddressDto | undefined, supportingDocuments?: Array | undefined, attestedOwnershipStructureAt?: string | undefined, relationshipDate?: string | undefined, generateVerificationLink?: boolean | undefined, sendInvite?: boolean | undefined}; export type SubmitBusinessCustomerVerificationDto = {metadata?: {[key: string]: unknown} | undefined, hasAgreedToTos?: boolean | undefined, legalName?: string | undefined, transliteratedLegalName?: string | undefined, tradeName?: string | undefined, transliteratedTradeName?: string | undefined, businessType?: ('CORPORATION' | 'LLC' | 'PARTNERSHIP' | 'GEN_PARTNERSHIP' | 'LLP' | 'LP' | 'SOLE_PROPRIETORSHIP' | 'NON_PROFIT' | 'TRUST' | 'COOPERATIVE' | 'PRIVATE_LIMITED_COMPANY' | 'SPV' | 'JOINT_VENTURE') | undefined, description?: string | undefined, industry?: string | undefined, industryCryptoSubtype?: ('PROTOCOL' | 'EXCHANGE' | 'INVESTMENT' | 'LENDER' | 'MARKET_MAKER' | 'SAAS' | 'MINER') | undefined, industryFinancialServicesSubtype?: ('GAMING' | 'CROWD_FUNDING' | 'BANK' | 'FUND' | 'INSURANCE' | 'RIA' | 'INVESTMENT_MANAGER' | 'MSB' | 'NBFI' | 'PAYMENT_PROCESSOR' | 'VASP') | undefined, industryExplanation?: string | undefined, isCrypto?: boolean | undefined, email?: string | undefined, phone?: string | undefined, website?: string | undefined, otherWebsites?: Array | undefined, registeredAddress?: AddressDto | undefined, physicalAddress?: AddressDto | undefined, isRemoteCompany?: boolean | undefined, registrationDate?: string | undefined, registrationNumber?: string | undefined, taxIdentificationNumber?: string | undefined, accountPurpose?: ('PAYROLL' | 'VENDOR_PAYMENTS' | 'TREASURY' | 'OPERATIONS' | 'CAPITAL_DEPLOYMENT' | 'CROSS_BORDER_PAYMENTS' | 'STABLECOIN_CONVERSION' | 'ECOMMERCE' | 'OTHER') | undefined, requestedCapabilities?: (Array<'USD_ACH_PAYIN' | 'USD_ACH_PAYOUT' | 'USD_WIRE_PAYIN' | 'USD_WIRE_PAYOUT' | 'USD_BALANCE' | 'USD_YIELD' | 'SWIFT_PAYIN' | 'SWIFT_PAYOUT' | 'STABLECOIN_PAYIN' | 'STABLECOIN_PAYOUT' | 'STABLECOIN_SWAPS' | 'AED_FX_PAYOUT' | 'AUD_FX_PAYOUT' | 'BHD_FX_PAYOUT' | 'BOB_FX_PAYOUT' | 'BRL_FX_PAYOUT' | 'CLP_FX_PAYOUT' | 'CNY_FX_PAYOUT' | 'COP_FX_PAYOUT' | 'DOP_FX_PAYOUT' | 'EGP_FX_PAYOUT' | 'EUR_FX_PAYOUT' | 'GBP_FX_PAYOUT' | 'HKD_FX_PAYOUT' | 'IDR_FX_PAYOUT' | 'INR_FX_PAYOUT' | 'JPY_FX_PAYOUT' | 'KRW_FX_PAYOUT' | 'KWD_FX_PAYOUT' | 'MXN_FX_PAYOUT' | 'MYR_FX_PAYOUT' | 'PEN_FX_PAYOUT' | 'PHP_FX_PAYOUT' | 'PYG_FX_PAYOUT' | 'QAR_FX_PAYOUT' | 'SAR_FX_PAYOUT' | 'SGD_FX_PAYOUT' | 'THB_FX_PAYOUT' | 'TRY_FX_PAYOUT' | 'TWD_FX_PAYOUT' | 'USD_FX_PAYOUT' | 'VND_FX_PAYOUT'>) | undefined, accountPurposeExplanation?: string | undefined, sourceOfFunds?: ('BUSINESS_REVENUE' | 'INVESTMENT' | 'OWNER_CAPITAL' | 'LOAN' | 'GRANTS' | 'EQUITY' | 'INHERITANCE' | 'GIFT' | 'OTHER') | undefined, sourceOfFundsDescription?: string | undefined, estimatedAnnualRevenueUsd?: ('PRE_REVENUE' | 'LESS_THAN_10K' | '10K_TO_50K' | '50K_TO_100K' | '100K_TO_500K' | '500K_TO_1M' | '1M_TO_5M' | '5M_TO_10M' | '10M_TO_50M' | '50M_TO_250M' | 'MORE_THAN_250M' | 'LESS_THAN_100K') | undefined, expectedMonthlyPaymentsUsd?: number | undefined, expectedCounterpartyCountries?: Array | undefined, expectedCryptoMonthlyVolume?: number | undefined, expectedMonthlyAch?: number | undefined, expectedMonthlyWire?: number | undefined, primaryTargetMarket?: ('RETAIL' | 'COMMERCIAL' | 'GOVERNMENT' | 'OTHER') | undefined, primaryTargetMarketExplanation?: string | undefined, moneyServicesDescription?: string | undefined, complianceScreeningExplanation?: string | undefined, operatesInProhibitedCountries?: boolean | undefined, highRiskActivities?: (Array<'MONEY_SERVICES' | 'LENDING_BANKING' | 'OTC_FX_CRYPTO_BROKERAGE' | 'HOLD_CLIENT_FUNDS' | 'INVESTMENT_SERVICES' | 'SAFE_DEPOSIT_BOX' | 'PRECIOUS_METALS_STONES_JEWELRY' | 'NICOTINE_TOBACCO' | 'MARIJUANA' | 'PHARMACEUTICALS' | 'THIRD_PARTY_PAYMENT_PROCESSING' | 'ADULT_ENTERTAINMENT' | 'WEAPONS_FIREARMS_EXPLOSIVES' | 'GAMBLING'>) | undefined, highRiskActivitiesExplanation?: string | undefined, hasMaterialIntermediaryOwnership?: boolean | undefined, ownershipThreshold?: number | undefined, associatedEntities?: Array | undefined, supportingDocuments?: Array | undefined, businessFormationDocuments?: Array | undefined, ownershipInformationDocuments?: Array | undefined, businessAddressProof?: Array | undefined, amlPolicy?: Array | undefined, directorsRegistry?: Array | undefined, proofOfSignatoryAuthority?: Array | undefined, msbLicense?: Array | undefined, bankStatements?: Array | undefined, signedAgreementId?: string | undefined, ipAddress?: string | undefined, publiclyTraded?: boolean | undefined, sourceOfWealth?: string | undefined, providerSpecificData?: Record | undefined}; export type CreateApiV1CustomersIdVerificationBusinessArgs = {'X-API-Key'?: string | undefined, id: string, submit?: boolean | undefined, body: SubmitBusinessCustomerVerificationDto}; export type CreateApiV1CustomersIdVerificationBusinessOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; export const missingComplianceRequirementDto = z.object({requirementType: z.enum(["FIELD", "DOCUMENT"]), key: z.string(), displayName: z.string(), entityId: z.string().optional(), entityDisplayName: z.string().optional()}); export const submitCustomerVerificationResponseDto = z.object({customerId: z.string(), status: z.string(), submittedAt: z.string().optional(), documentIds: z.array(z.string()), missingRequirements: z.array(missingComplianceRequirementDto).optional(), reviewWarnings: z.array(z.string()).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Save business customer verification * * POST /v1/customers/{id}/verification/business */ export const createApiV1CustomersIdVerificationBusiness = async (args: CreateApiV1CustomersIdVerificationBusinessArgs, options?: CreateApiV1CustomersIdVerificationBusinessOptions) => { const {baseUrl = "https://sandbox.api.infinite.dev", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['X-API-Key'] != null) headers.set("X-API-Key", String(args['X-API-Key'])) if (args.submit != null) query.append("submit", String(args.submit)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/customers/${encodeURIComponent(String(args.id))}/verification/business${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(submitCustomerVerificationResponseDto, await res.json()) };