import { Wallets } from "./wallets/models"; export type AccountType = "business" | "individual"; export type BusinessType = "corporation" | "partnership" | "llc" | "sole-proprietorship" | "non-profit"; export type BankAccountType = "checking" | "savings" | "unknown"; export type BankAccountStatusType = "new" | "validated" | "pending" | "errored"; export type Account = { accountID?: string; foreignID?: string; accountType: AccountType; displayName: string; profile: { individual?: IndividualProfile; business?: BusinessProfile; }; metadata: {}; termsOfService: { acceptedDate: string; acceptedIP: string; fingerprint: string; }; } export type Card = { cardNumber: string; expiration: { month: string; year: string; }, cardCvv: string; holderName: string; billingAddress: Address }; export type BankAccount = { bankAccountID: string; fingerprint?: string; status?: BankAccountStatusType; holderName?: string; holderType?: string; bankName?: string; bankAccountType?: BankAccountType; routingNumber?: string; lastFourAccountNumber?: string; } export type NewBankAccount = { holderName: string; holderType: string; accountNumber: string; bankAccountType: "checking" | "savings"; routingNumber: string; } export type PaymentMethod = { paymentMethodID: string; paymentMethodType: string; bankAccount: BankAccount; } export type Capability = { capability: string; accountID: string; status: string; requirements: { currentlyDue: string[]; errors: { requirement: string; errorCode: string; }[]; disabledReason: string[]; }; } export type Representative = { accountID?: string; representativeID: string; name: { firstName: string; middleName: string; lastName: string; suffix: string; }; phone: { number: string; countryCode: string; }; email: string; address: Address; birthDate: { day: number; month: number; year: number; }; governmentID: { ssn: { full?: string; lastFour: string; }; itin: { full: string; lastFour: string; }; passport: { full: string; lastFour: string; }; }; responsibilities: { isController: boolean; isOwner: boolean; ownershipPercentage: number; jobTitle: string; }; } export type BusinessProfile = { legalBusinessName: string; doingBusinessAs: string; businessType: BusinessType; address: Address; phone: { number: string; countryCode: string; }; email: string; website: string; description: string; taxID: { ein: { number: string; }; }; ownersProvided: boolean; industryDetails?: { naics: string; sic: string; mcc: string; }; } export type IndividualProfile = { name: { firstName: string; middleName: string; lastName: string; suffix: string; }; phone: { number: string; countryCode: string; }; email: string; address: Address; birthDate: { day: number; month: number; year: number; }; governmentID: { ssn: { full?: string; lastFour: string; }; itin: { full: string; lastFour: string; }; passport: { full: string; lastFour: string; }; }; responsibilities: { isController: boolean; isOwner: boolean; ownershipPercentage: number; jobTitle: string; }; } export type Address = { addressLine1: string; addressLine2?: string; city: string; stateOrProvince: string; postalCode: string; country: string; } export type AccountQueryParams = { query?: string; email?: string; status?: string; accountType?: "individual" | "business"; skip?: number; count?: number; accountIDs?: string[]; } export type EnrichmentResponse = { individual: { firstName: string; middleName: string; lastName: string; suffix: string; }, email: string; address: Address; business: { legalBusinessName: string; address: { addressLine1: string; addressLine2: string; city: string; stateOrProvince: string; postalCode: string; country: string; }, email: string; phone: { number: string; countryCode: string; }, industryCodes: { naics: string; sic: string; }, website: string; } } export type Industry = { title: string; naics?: string; sic?: string; mcc?: string; } export interface AddressResponse extends Address { entries: number; } export interface Enrichment { lookup: (params: { email: string }) => Promise; avatar: (params: { avatarID: string }) => Promise; listIndustries: () => Promise; lookupAddress: (params: { search: string, maxResults?: number, includeCities?: string, includeStates?: string, includeZipCodes?: string, excludeStates?: string, preferCities?: string, preferStates?: string, preferZipCodes?: string, preferRatio?: number, preferGeolocation?: string, selected?: string, source?: string, }) => Promise; } export interface Accounts { create: (params: Account) => Promise; get: (params: { accountID?: string; foreignID?: string }) => Promise; update: (params: Account) => Promise; patch: (params: Account) => Promise; getTermsOfServiceToken: () => Promise; acceptTermsOfService: (params: { accountID: string }) => Promise; bankAccounts: BankAccounts; wallets: Wallets; representatives: Representatives; paymentMethods: PaymentMethods; capabilities: Capabilities; // applePay: ApplePay; TODO: Expose this after ApplePay API is finalized } export interface BankAccounts { link: (params: { accountID: string; bankAccount?: NewBankAccount; plaidToken?: string; mxAuthorizationCode?: string; }) => Promise; list: (params: { accountID: string }) => Promise; get: (params: { accountID: string; bankAccountID: string }) => Promise; delete: (params: { accountID: string; bankAccountID: string }) => Promise; startMicroDepositVerification: (params: { accountID: string; bankAccountID: string }) => Promise; completeMicroDepositVerification: (params: { accountID: string; bankAccountID: string; amounts: Number[]; }) => Promise; } export interface Cards { list: (params: { accountID: string }) => Promise; get: (params: { accountID: string; cardID: string }) => Promise; disable: (params: { accountID: string, cardID: string }) => Promise; } export interface Representatives { get: (params: { accountID: string; representativeID: string }) => Promise; list: (params: { accountID: string }) => Promise; create: (params: { accountID: string; representative: Representative; }) => Promise; update: (params: { accountID: string; representative: Representative; }) => Promise; delete: (params: { accountID: string; representativeID: string }) => Promise; } export interface PaymentMethods { get: (params: { accountID: string; paymentMethodID: string }) => Promise; list: (params: { accountID: string }) => Promise; } export interface Capabilities { get: (params: { accountID: string; capabilityID: string }) => Promise; list: (params: { accountID: string }) => Promise; request: (params: { accountID: string; capabilities: string[] }) => Promise; unrequest: (params: { accountID: string; capabilityID: string }) => Promise; } export type TermsOfServiceToken = { token: string; } export interface ApplePayPaymentToken { token: { paymentData: { version: string; data: string; signature: string; header: { ephemeralPublicKey: string; publicKeyHash: string; transactionID: string; } }; paymentMethod: { displayName: string; network: string; type: string; }; transactionIdentifier: string; } } export interface LinkedApplePayPaymentMethod { paymentMethodID: string; paymentMethodType: string; applePay: LinkedApplePayToken; } export interface LinkedApplePayToken { brand: "American Express" | "Discover" | "Mastercard" | "Visa"; cardType: "debit" | "credit" | "prepaid" | "unknown"; cardDisplayName: string; } export interface ApplePayTokens { create: (params: { accountID: string; applePayToken: ApplePayPaymentToken } ) => Promise; } export interface ApplePaySessionConfig { displayName: string; } export interface ApplePaySessions { create: (params: { accountID: string; applePaySessionConfig: ApplePaySessionConfig; }) => Promise; } export interface ApplePay { tokens: ApplePayTokens; sessions: ApplePaySessions; }