diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3eebe245..90ea33ab 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.129.0" + ".": "0.130.0" } diff --git a/.stats.yml b/.stats.yml index 5a93d129..c06c60ed 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 177 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c24eebe942f400bff8922a6fbef1ce551ad14f61eb4da21b50d823a62ca42586.yml -openapi_spec_hash: b79ed927e625dedff69cea29131a34d9 -config_hash: 693dddc4721eef512d75ab6c60897794 +configured_endpoints: 185 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c1dbf87770ddffb9d6d1ada33d1c43739d43498ff687c1d58e403ffc08f6f863.yml +openapi_spec_hash: f488e595de02180bb904da283b7a1c39 +config_hash: 925e84bc73b1b9b5eb0ffd230fc9800f diff --git a/CHANGELOG.md b/CHANGELOG.md index cb63768b..3d5e0202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 0.130.0 (2026-02-26) + +Full Changelog: [v0.129.0...v0.130.0](https://github.com/lithic-com/lithic-node/compare/v0.129.0...v0.130.0) + +### Features + +* **api:** Add account holder entity endpoints ([3fb22ea](https://github.com/lithic-com/lithic-node/commit/3fb22eacba6bcf9e4ea5e96bc628a9e16c6a981d)) +* **api:** Add INTEREST_AND_FEES_PAUSED substatus to financial account ([342cb07](https://github.com/lithic-com/lithic-node/commit/342cb0725d8b9d8645e20e7c7ca7a386ce657f36)) +* **api:** Expose MIL interest schedules and loan tape configuration endpoints ([c71b835](https://github.com/lithic-com/lithic-node/commit/c71b835642458ce89a801ac770b4c5c7e2788a60)) +* **mcp:** add an option to disable code tool ([c3f0f72](https://github.com/lithic-com/lithic-node/commit/c3f0f72caf3029aab0a066cffa1bee89096599f5)) + + +### Bug Fixes + +* **docs/contributing:** correct pnpm link command ([49b3676](https://github.com/lithic-com/lithic-node/commit/49b3676c5eb963fb6608a65b3effb56e2162dc44)) +* **mcp:** update prompt ([fe87cb7](https://github.com/lithic-com/lithic-node/commit/fe87cb730b53bbdfab52ee644a245393045c7808)) + + +### Chores + +* **internal:** fix MCP Dockerfiles so they can be built without buildkit ([b11e333](https://github.com/lithic-com/lithic-node/commit/b11e3337b479aa0b2eab7ae5aaa914d5ab0cd599)) +* **internal:** fix MCP Dockerfiles so they can be built without buildkit ([d654204](https://github.com/lithic-com/lithic-node/commit/d654204ff237b1ff579d704fd69518ff5f604dc0)) +* **internal:** make MCP code execution location configurable via a flag ([d7ce232](https://github.com/lithic-com/lithic-node/commit/d7ce232aec15b1fd054e8ef2b29d19d54627fcea)) +* **internal:** move stringifyQuery implementation to internal function ([18e4250](https://github.com/lithic-com/lithic-node/commit/18e4250eccfe59f8e09a7c017cfa3745ad0b1d99)) +* **internal:** upgrade @modelcontextprotocol/sdk and hono ([7e9cc7b](https://github.com/lithic-com/lithic-node/commit/7e9cc7b6d308347668dec9dc874cb0c3048fa17b)) +* **mcp:** correctly update version in sync with sdk ([71e0dc6](https://github.com/lithic-com/lithic-node/commit/71e0dc6a360f33aacffbd34619282022d8128060)) +* update mock server docs ([6657e0d](https://github.com/lithic-com/lithic-node/commit/6657e0d898b31c05c58a76c6babff472fc1dfbef)) + ## 0.129.0 (2026-02-19) Full Changelog: [v0.128.0...v0.129.0](https://github.com/lithic-com/lithic-node/compare/v0.128.0...v0.129.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffcaf95d..9e158d16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,7 +60,7 @@ $ yarn link lithic # With pnpm $ pnpm link --global $ cd ../my-package -$ pnpm link -—global lithic +$ pnpm link --global lithic ``` ## Running tests @@ -68,7 +68,7 @@ $ pnpm link -—global lithic Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. ```sh -$ npx prism mock path/to/your/openapi.yml +$ ./scripts/mock ``` ```sh diff --git a/MIGRATION.md b/MIGRATION.md index 93d5980a..eb3794cb 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -55,6 +55,7 @@ client.parents.children.retrieve('c_456', { parent_id: 'p_123' }); This affects the following methods: - `client.accountHolders.retrieveDocument()` +- `client.accountHolders.entities.delete()` - `client.authRules.v2.backtests.retrieve()` - `client.cards.financialTransactions.retrieve()` - `client.disputes.deleteEvidence()` @@ -64,6 +65,9 @@ This affects the following methods: - `client.financialAccounts.statements.retrieve()` - `client.financialAccounts.statements.lineItems.list()` - `client.financialAccounts.loanTapes.retrieve()` +- `client.financialAccounts.interestTierSchedule.retrieve()` +- `client.financialAccounts.interestTierSchedule.update()` +- `client.financialAccounts.interestTierSchedule.delete()` ### URI encoded path parameters @@ -127,6 +131,7 @@ client.example.list(undefined, { headers: { ... } }); - `client.financialAccounts.creditConfiguration.update()` - `client.financialAccounts.statements.list()` - `client.financialAccounts.loanTapes.list()` +- `client.financialAccounts.interestTierSchedule.list()` - `client.transactions.list()` - `client.externalBankAccounts.list()` - `client.externalBankAccounts.retryMicroDeposits()` diff --git a/api.md b/api.md index 2ccf54f9..ff5631a5 100644 --- a/api.md +++ b/api.md @@ -40,29 +40,41 @@ Methods: Types: -- AccountHolder -- AddressUpdate -- KYB -- KYBBusinessEntity -- KYC -- KYCExempt -- RequiredDocument -- AccountHolderCreateResponse -- AccountHolderUpdateResponse -- AccountHolderListDocumentsResponse -- AccountHolderSimulateEnrollmentReviewResponse - -Methods: - -- client.accountHolders.create({ ...params }) -> AccountHolderCreateResponse -- client.accountHolders.retrieve(accountHolderToken) -> AccountHolder -- client.accountHolders.update(accountHolderToken, { ...params }) -> AccountHolderUpdateResponse -- client.accountHolders.list({ ...params }) -> AccountHoldersSinglePage -- client.accountHolders.listDocuments(accountHolderToken) -> AccountHolderListDocumentsResponse -- client.accountHolders.retrieveDocument(documentToken, { ...params }) -> Document -- client.accountHolders.simulateEnrollmentDocumentReview({ ...params }) -> Document -- client.accountHolders.simulateEnrollmentReview({ ...params }) -> AccountHolderSimulateEnrollmentReviewResponse -- client.accountHolders.uploadDocument(accountHolderToken, { ...params }) -> Document +- AccountHolder +- AddressUpdate +- KYB +- KYBBusinessEntity +- KYC +- KYCExempt +- RequiredDocument +- AccountHolderCreateResponse +- AccountHolderUpdateResponse +- AccountHolderListDocumentsResponse +- AccountHolderSimulateEnrollmentReviewResponse + +Methods: + +- client.accountHolders.create({ ...params }) -> AccountHolderCreateResponse +- client.accountHolders.retrieve(accountHolderToken) -> AccountHolder +- client.accountHolders.update(accountHolderToken, { ...params }) -> AccountHolderUpdateResponse +- client.accountHolders.list({ ...params }) -> AccountHoldersSinglePage +- client.accountHolders.listDocuments(accountHolderToken) -> AccountHolderListDocumentsResponse +- client.accountHolders.retrieveDocument(documentToken, { ...params }) -> Document +- client.accountHolders.simulateEnrollmentDocumentReview({ ...params }) -> Document +- client.accountHolders.simulateEnrollmentReview({ ...params }) -> AccountHolderSimulateEnrollmentReviewResponse +- client.accountHolders.uploadDocument(accountHolderToken, { ...params }) -> Document + +## Entities + +Types: + +- AccountHolderEntity +- EntityCreateResponse + +Methods: + +- client.accountHolders.entities.create(accountHolderToken, { ...params }) -> EntityCreateResponse +- client.accountHolders.entities.delete(entityToken, { ...params }) -> AccountHolderEntity # AuthRules @@ -386,6 +398,32 @@ Methods: - client.financialAccounts.loanTapes.retrieve(loanTapeToken, { ...params }) -> LoanTape - client.financialAccounts.loanTapes.list(financialAccountToken, { ...params }) -> LoanTapesCursorPage +## LoanTapeConfiguration + +Types: + +- LoanTapeConfiguration +- LoanTapeRebuildConfiguration + +Methods: + +- client.financialAccounts.loanTapeConfiguration.retrieve(financialAccountToken) -> LoanTapeConfiguration + +## InterestTierSchedule + +Types: + +- CategoryTier +- InterestTierSchedule + +Methods: + +- client.financialAccounts.interestTierSchedule.create(financialAccountToken, { ...params }) -> InterestTierSchedule +- client.financialAccounts.interestTierSchedule.retrieve(effectiveDate, { ...params }) -> InterestTierSchedule +- client.financialAccounts.interestTierSchedule.update(effectiveDate, { ...params }) -> InterestTierSchedule +- client.financialAccounts.interestTierSchedule.list(financialAccountToken, { ...params }) -> InterestTierSchedulesSinglePage +- client.financialAccounts.interestTierSchedule.delete(effectiveDate, { ...params }) -> void + # Transactions Types: diff --git a/bin/migration-config.json b/bin/migration-config.json index 802f17f5..508a55ef 100644 --- a/bin/migration-config.json +++ b/bin/migration-config.json @@ -36,6 +36,39 @@ } ] }, + { + "base": "accountHolders.entities", + "name": "delete", + "params": [ + { + "type": "param", + "key": "entity_token", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "account_holder_token", + "location": "path" + }, + { + "type": "param", + "key": "entity_token", + "location": "path" + }, + { + "type": "options" + } + ] + }, { "base": "authRules.v2.backtests", "name": "retrieve", @@ -336,6 +369,109 @@ "type": "options" } ] + }, + { + "base": "financialAccounts.interestTierSchedule", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "effective_date", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "financial_account_token", + "location": "path" + }, + { + "type": "param", + "key": "effective_date", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "financialAccounts.interestTierSchedule", + "name": "update", + "params": [ + { + "type": "param", + "key": "effective_date", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "financial_account_token", + "location": "path" + }, + { + "type": "param", + "key": "effective_date", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ] + }, + { + "base": "financialAccounts.interestTierSchedule", + "name": "delete", + "params": [ + { + "type": "param", + "key": "effective_date", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "financial_account_token", + "location": "path" + }, + { + "type": "param", + "key": "effective_date", + "location": "path" + }, + { + "type": "options" + } + ] } ] } diff --git a/package.json b/package.json index 05429a54..a3cc6c7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lithic", - "version": "0.129.0", + "version": "0.130.0", "description": "The official TypeScript library for the Lithic API", "author": "Lithic ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/Dockerfile b/packages/mcp-server/Dockerfile index f063d494..9529570b 100644 --- a/packages/mcp-server/Dockerfile +++ b/packages/mcp-server/Dockerfile @@ -37,8 +37,12 @@ COPY . . RUN yarn install --frozen-lockfile && \ yarn build -# Production stage -FROM node:24-alpine +FROM denoland/deno:alpine-2.7.1 + +# Install node and npm +RUN apk add --no-cache nodejs npm + +ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/lib # Add non-root user RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001 @@ -57,6 +61,7 @@ COPY --from=builder /build/dist ./node_modules/lithic # Change ownership to nodejs user RUN chown -R nodejs:nodejs /app +RUN chown -R nodejs:nodejs /deno-dir # Switch to non-root user USER nodejs diff --git a/packages/mcp-server/manifest.json b/packages/mcp-server/manifest.json index 1a67c16e..bf005118 100644 --- a/packages/mcp-server/manifest.json +++ b/packages/mcp-server/manifest.json @@ -1,7 +1,7 @@ { "dxt_version": "0.2", "name": "lithic-mcp", - "version": "0.128.0", + "version": "0.130.0", "description": "The official MCP Server for the Lithic API", "author": { "name": "Lithic", @@ -18,7 +18,9 @@ "entry_point": "index.js", "mcp_config": { "command": "node", - "args": ["${__dirname}/index.js"], + "args": [ + "${__dirname}/index.js" + ], "env": { "LITHIC_API_KEY": "${user_config.LITHIC_API_KEY}", "LITHIC_WEBHOOK_SECRET": "${user_config.LITHIC_WEBHOOK_SECRET}" @@ -46,5 +48,7 @@ "node": ">=18.0.0" } }, - "keywords": ["api"] + "keywords": [ + "api" + ] } diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index dc282bc6..2a29d262 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "lithic-mcp", - "version": "0.129.0", + "version": "0.130.0", "description": "The official MCP Server for the Lithic API", "author": "Lithic ", "types": "dist/index.d.ts", @@ -32,7 +32,7 @@ "dependencies": { "lithic": "file:../../dist/", "@cloudflare/cabidela": "^0.2.4", - "@modelcontextprotocol/sdk": "^1.25.2", + "@modelcontextprotocol/sdk": "^1.26.0", "@valtown/deno-http-worker": "^0.0.21", "cookie-parser": "^1.4.6", "cors": "^2.8.5", diff --git a/packages/mcp-server/src/code-tool-paths.cts b/packages/mcp-server/src/code-tool-paths.cts new file mode 100644 index 00000000..15ce7f55 --- /dev/null +++ b/packages/mcp-server/src/code-tool-paths.cts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export const workerPath = require.resolve('./code-tool-worker.mjs'); diff --git a/packages/mcp-server/src/code-tool-types.ts b/packages/mcp-server/src/code-tool-types.ts index a87741dc..4b944f3a 100644 --- a/packages/mcp-server/src/code-tool-types.ts +++ b/packages/mcp-server/src/code-tool-types.ts @@ -8,6 +8,7 @@ export type WorkerInput = { client_opts: ClientOptions; intent?: string | undefined; }; + export type WorkerOutput = { is_error: boolean; result: unknown | null; diff --git a/packages/mcp-server/src/code-tool-worker.ts b/packages/mcp-server/src/code-tool-worker.ts new file mode 100644 index 00000000..695e54ac --- /dev/null +++ b/packages/mcp-server/src/code-tool-worker.ts @@ -0,0 +1,457 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import path from 'node:path'; +import util from 'node:util'; +import Fuse from 'fuse.js'; +import ts from 'typescript'; +import { WorkerOutput } from './code-tool-types'; +import { Lithic, ClientOptions } from 'lithic'; + +function getRunFunctionSource(code: string): { + type: 'declaration' | 'expression'; + client: string | undefined; + code: string; +} | null { + const sourceFile = ts.createSourceFile('code.ts', code, ts.ScriptTarget.Latest, true); + const printer = ts.createPrinter(); + + for (const statement of sourceFile.statements) { + // Check for top-level function declarations + if (ts.isFunctionDeclaration(statement)) { + if (statement.name?.text === 'run') { + return { + type: 'declaration', + client: statement.parameters[0]?.name.getText(), + code: printer.printNode(ts.EmitHint.Unspecified, statement.body!, sourceFile), + }; + } + } + + // Check for variable declarations: const run = () => {} or const run = function() {} + if (ts.isVariableStatement(statement)) { + for (const declaration of statement.declarationList.declarations) { + if ( + ts.isIdentifier(declaration.name) && + declaration.name.text === 'run' && + // Check if it's initialized with a function + declaration.initializer && + (ts.isFunctionExpression(declaration.initializer) || ts.isArrowFunction(declaration.initializer)) + ) { + return { + type: 'expression', + client: declaration.initializer.parameters[0]?.name.getText(), + code: printer.printNode(ts.EmitHint.Unspecified, declaration.initializer, sourceFile), + }; + } + } + } + } + + return null; +} + +function getTSDiagnostics(code: string): string[] { + const functionSource = getRunFunctionSource(code)!; + const codeWithImport = [ + 'import { Lithic } from "lithic";', + functionSource.type === 'declaration' ? + `async function run(${functionSource.client}: Lithic)` + : `const run: (${functionSource.client}: Lithic) => Promise =`, + functionSource.code, + ].join('\n'); + const sourcePath = path.resolve('code.ts'); + const ast = ts.createSourceFile(sourcePath, codeWithImport, ts.ScriptTarget.Latest, true); + const options = ts.getDefaultCompilerOptions(); + options.target = ts.ScriptTarget.Latest; + options.module = ts.ModuleKind.NodeNext; + options.moduleResolution = ts.ModuleResolutionKind.NodeNext; + const host = ts.createCompilerHost(options, true); + const newHost: typeof host = { + ...host, + getSourceFile: (...args) => { + if (path.resolve(args[0]) === sourcePath) { + return ast; + } + return host.getSourceFile(...args); + }, + readFile: (...args) => { + if (path.resolve(args[0]) === sourcePath) { + return codeWithImport; + } + return host.readFile(...args); + }, + fileExists: (...args) => { + if (path.resolve(args[0]) === sourcePath) { + return true; + } + return host.fileExists(...args); + }, + }; + const program = ts.createProgram({ + options, + rootNames: [sourcePath], + host: newHost, + }); + const diagnostics = ts.getPreEmitDiagnostics(program, ast); + return diagnostics.map((d) => { + const message = ts.flattenDiagnosticMessageText(d.messageText, '\n'); + if (!d.file || !d.start) return `- ${message}`; + const { line: lineNumber } = ts.getLineAndCharacterOfPosition(d.file, d.start); + const line = codeWithImport.split('\n').at(lineNumber)?.trim(); + return line ? `- ${message}\n ${line}` : `- ${message}`; + }); +} + +const fuse = new Fuse( + [ + 'client.apiStatus', + 'client.accounts.list', + 'client.accounts.retrieve', + 'client.accounts.retrieveSpendLimits', + 'client.accounts.update', + 'client.accountHolders.create', + 'client.accountHolders.list', + 'client.accountHolders.listDocuments', + 'client.accountHolders.retrieve', + 'client.accountHolders.retrieveDocument', + 'client.accountHolders.simulateEnrollmentDocumentReview', + 'client.accountHolders.simulateEnrollmentReview', + 'client.accountHolders.update', + 'client.accountHolders.uploadDocument', + 'client.accountHolders.entities.create', + 'client.accountHolders.entities.delete', + 'client.authRules.v2.create', + 'client.authRules.v2.delete', + 'client.authRules.v2.draft', + 'client.authRules.v2.list', + 'client.authRules.v2.listResults', + 'client.authRules.v2.promote', + 'client.authRules.v2.retrieve', + 'client.authRules.v2.retrieveFeatures', + 'client.authRules.v2.retrieveReport', + 'client.authRules.v2.update', + 'client.authRules.v2.backtests.create', + 'client.authRules.v2.backtests.retrieve', + 'client.authStreamEnrollment.retrieveSecret', + 'client.authStreamEnrollment.rotateSecret', + 'client.tokenizationDecisioning.retrieveSecret', + 'client.tokenizationDecisioning.rotateSecret', + 'client.tokenizations.activate', + 'client.tokenizations.deactivate', + 'client.tokenizations.list', + 'client.tokenizations.pause', + 'client.tokenizations.resendActivationCode', + 'client.tokenizations.retrieve', + 'client.tokenizations.simulate', + 'client.tokenizations.unpause', + 'client.tokenizations.updateDigitalCardArt', + 'client.cards.convertPhysical', + 'client.cards.create', + 'client.cards.embed', + 'client.cards.list', + 'client.cards.provision', + 'client.cards.reissue', + 'client.cards.renew', + 'client.cards.retrieve', + 'client.cards.retrieveSpendLimits', + 'client.cards.searchByPan', + 'client.cards.update', + 'client.cards.webProvision', + 'client.cards.balances.list', + 'client.cards.financialTransactions.list', + 'client.cards.financialTransactions.retrieve', + 'client.cardBulkOrders.create', + 'client.cardBulkOrders.list', + 'client.cardBulkOrders.retrieve', + 'client.cardBulkOrders.update', + 'client.balances.list', + 'client.disputes.create', + 'client.disputes.delete', + 'client.disputes.deleteEvidence', + 'client.disputes.initiateEvidenceUpload', + 'client.disputes.list', + 'client.disputes.listEvidences', + 'client.disputes.retrieve', + 'client.disputes.retrieveEvidence', + 'client.disputes.update', + 'client.disputesV2.list', + 'client.disputesV2.retrieve', + 'client.events.list', + 'client.events.listAttempts', + 'client.events.retrieve', + 'client.events.subscriptions.create', + 'client.events.subscriptions.delete', + 'client.events.subscriptions.list', + 'client.events.subscriptions.listAttempts', + 'client.events.subscriptions.recover', + 'client.events.subscriptions.replayMissing', + 'client.events.subscriptions.retrieve', + 'client.events.subscriptions.retrieveSecret', + 'client.events.subscriptions.rotateSecret', + 'client.events.subscriptions.sendSimulatedExample', + 'client.events.subscriptions.update', + 'client.events.eventSubscriptions.resend', + 'client.transfers.create', + 'client.financialAccounts.create', + 'client.financialAccounts.list', + 'client.financialAccounts.registerAccountNumber', + 'client.financialAccounts.retrieve', + 'client.financialAccounts.update', + 'client.financialAccounts.updateStatus', + 'client.financialAccounts.balances.list', + 'client.financialAccounts.financialTransactions.list', + 'client.financialAccounts.financialTransactions.retrieve', + 'client.financialAccounts.creditConfiguration.retrieve', + 'client.financialAccounts.creditConfiguration.update', + 'client.financialAccounts.statements.list', + 'client.financialAccounts.statements.retrieve', + 'client.financialAccounts.statements.lineItems.list', + 'client.financialAccounts.loanTapes.list', + 'client.financialAccounts.loanTapes.retrieve', + 'client.financialAccounts.loanTapeConfiguration.retrieve', + 'client.financialAccounts.interestTierSchedule.create', + 'client.financialAccounts.interestTierSchedule.delete', + 'client.financialAccounts.interestTierSchedule.list', + 'client.financialAccounts.interestTierSchedule.retrieve', + 'client.financialAccounts.interestTierSchedule.update', + 'client.transactions.expireAuthorization', + 'client.transactions.list', + 'client.transactions.retrieve', + 'client.transactions.simulateAuthorization', + 'client.transactions.simulateAuthorizationAdvice', + 'client.transactions.simulateClearing', + 'client.transactions.simulateCreditAuthorization', + 'client.transactions.simulateCreditAuthorizationAdvice', + 'client.transactions.simulateReturn', + 'client.transactions.simulateReturnReversal', + 'client.transactions.simulateVoid', + 'client.transactions.enhancedCommercialData.retrieve', + 'client.transactions.events.enhancedCommercialData.retrieve', + 'client.responderEndpoints.checkStatus', + 'client.responderEndpoints.create', + 'client.responderEndpoints.delete', + 'client.externalBankAccounts.create', + 'client.externalBankAccounts.list', + 'client.externalBankAccounts.retrieve', + 'client.externalBankAccounts.retryMicroDeposits', + 'client.externalBankAccounts.retryPrenote', + 'client.externalBankAccounts.unpause', + 'client.externalBankAccounts.update', + 'client.externalBankAccounts.microDeposits.create', + 'client.payments.create', + 'client.payments.list', + 'client.payments.retrieve', + 'client.payments.retry', + 'client.payments.return', + 'client.payments.simulateAction', + 'client.payments.simulateReceipt', + 'client.payments.simulateRelease', + 'client.payments.simulateReturn', + 'client.threeDS.authentication.retrieve', + 'client.threeDS.authentication.simulate', + 'client.threeDS.authentication.simulateOtpEntry', + 'client.threeDS.decisioning.challengeResponse', + 'client.threeDS.decisioning.retrieveSecret', + 'client.threeDS.decisioning.rotateSecret', + 'client.reports.settlement.listDetails', + 'client.reports.settlement.summary', + 'client.reports.settlement.networkTotals.list', + 'client.reports.settlement.networkTotals.retrieve', + 'client.cardPrograms.list', + 'client.cardPrograms.retrieve', + 'client.digitalCardArt.list', + 'client.digitalCardArt.retrieve', + 'client.bookTransfers.create', + 'client.bookTransfers.list', + 'client.bookTransfers.retrieve', + 'client.bookTransfers.retry', + 'client.bookTransfers.reverse', + 'client.creditProducts.extendedCredit.retrieve', + 'client.creditProducts.primeRates.create', + 'client.creditProducts.primeRates.retrieve', + 'client.externalPayments.cancel', + 'client.externalPayments.create', + 'client.externalPayments.list', + 'client.externalPayments.release', + 'client.externalPayments.retrieve', + 'client.externalPayments.reverse', + 'client.externalPayments.settle', + 'client.managementOperations.create', + 'client.managementOperations.list', + 'client.managementOperations.retrieve', + 'client.managementOperations.reverse', + 'client.fundingEvents.list', + 'client.fundingEvents.retrieve', + 'client.fundingEvents.retrieveDetails', + 'client.fraud.transactions.report', + 'client.fraud.transactions.retrieve', + 'client.networkPrograms.list', + 'client.networkPrograms.retrieve', + 'client.accountActivity.list', + 'client.accountActivity.retrieveTransaction', + 'client.transferLimits.list', + 'client.webhooks.parsed', + ], + { threshold: 1, shouldSort: true }, +); + +function getMethodSuggestions(fullyQualifiedMethodName: string): string[] { + return fuse + .search(fullyQualifiedMethodName) + .map(({ item }) => item) + .slice(0, 5); +} + +const proxyToObj = new WeakMap(); +const objToProxy = new WeakMap(); + +type ClientProxyConfig = { + path: string[]; + isBelievedBad?: boolean; +}; + +function makeSdkProxy(obj: T, { path, isBelievedBad = false }: ClientProxyConfig): T { + let proxy: T = objToProxy.get(obj); + + if (!proxy) { + proxy = new Proxy(obj, { + get(target, prop, receiver) { + const propPath = [...path, String(prop)]; + const value = Reflect.get(target, prop, receiver); + + if (isBelievedBad || (!(prop in target) && value === undefined)) { + // If we're accessing a path that doesn't exist, it will probably eventually error. + // Let's proxy it and mark it bad so that we can control the error message. + // We proxy an empty class so that an invocation or construction attempt is possible. + return makeSdkProxy(class {}, { path: propPath, isBelievedBad: true }); + } + + if (value !== null && (typeof value === 'object' || typeof value === 'function')) { + return makeSdkProxy(value, { path: propPath, isBelievedBad }); + } + + return value; + }, + + apply(target, thisArg, args) { + if (isBelievedBad || typeof target !== 'function') { + const fullyQualifiedMethodName = path.join('.'); + const suggestions = getMethodSuggestions(fullyQualifiedMethodName); + throw new Error( + `${fullyQualifiedMethodName} is not a function. Did you mean: ${suggestions.join(', ')}`, + ); + } + + return Reflect.apply(target, proxyToObj.get(thisArg) ?? thisArg, args); + }, + + construct(target, args, newTarget) { + if (isBelievedBad || typeof target !== 'function') { + const fullyQualifiedMethodName = path.join('.'); + const suggestions = getMethodSuggestions(fullyQualifiedMethodName); + throw new Error( + `${fullyQualifiedMethodName} is not a constructor. Did you mean: ${suggestions.join(', ')}`, + ); + } + + return Reflect.construct(target, args, newTarget); + }, + }); + + objToProxy.set(obj, proxy); + proxyToObj.set(proxy, obj); + } + + return proxy; +} + +function parseError(code: string, error: unknown): string | undefined { + if (!(error instanceof Error)) return; + const message = error.name ? `${error.name}: ${error.message}` : error.message; + try { + // Deno uses V8; the first ":LINE:COLUMN" is the top of stack. + const lineNumber = error.stack?.match(/:([0-9]+):[0-9]+/)?.[1]; + // -1 for the zero-based indexing + const line = + lineNumber && + code + .split('\n') + .at(parseInt(lineNumber, 10) - 1) + ?.trim(); + return line ? `${message}\n at line ${lineNumber}\n ${line}` : message; + } catch { + return message; + } +} + +const fetch = async (req: Request): Promise => { + const { opts, code } = (await req.json()) as { opts: ClientOptions; code: string }; + + const runFunctionSource = code ? getRunFunctionSource(code) : null; + if (!runFunctionSource) { + const message = + code ? + 'The code is missing a top-level `run` function.' + : 'The code argument is missing. Provide one containing a top-level `run` function.'; + return Response.json( + { + is_error: true, + result: `${message} Write code within this template:\n\n\`\`\`\nasync function run(client) {\n // Fill this out\n}\n\`\`\``, + log_lines: [], + err_lines: [], + } satisfies WorkerOutput, + { status: 400, statusText: 'Code execution error' }, + ); + } + + const diagnostics = getTSDiagnostics(code); + if (diagnostics.length > 0) { + return Response.json( + { + is_error: true, + result: `The code contains TypeScript diagnostics:\n${diagnostics.join('\n')}`, + log_lines: [], + err_lines: [], + } satisfies WorkerOutput, + { status: 400, statusText: 'Code execution error' }, + ); + } + + const client = new Lithic({ + ...opts, + }); + + const log_lines: string[] = []; + const err_lines: string[] = []; + const console = { + log: (...args: unknown[]) => { + log_lines.push(util.format(...args)); + }, + error: (...args: unknown[]) => { + err_lines.push(util.format(...args)); + }, + }; + try { + let run_ = async (client: any) => {}; + eval(`${code}\nrun_ = run;`); + const result = await run_(makeSdkProxy(client, { path: ['client'] })); + return Response.json({ + is_error: false, + result, + log_lines, + err_lines, + } satisfies WorkerOutput); + } catch (e) { + return Response.json( + { + is_error: true, + result: parseError(code, e), + log_lines, + err_lines, + } satisfies WorkerOutput, + { status: 400, statusText: 'Code execution error' }, + ); + } +}; + +export default { fetch }; diff --git a/packages/mcp-server/src/code-tool.ts b/packages/mcp-server/src/code-tool.ts index 274d9943..2939b217 100644 --- a/packages/mcp-server/src/code-tool.ts +++ b/packages/mcp-server/src/code-tool.ts @@ -1,6 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import fs from 'node:fs'; +import path from 'node:path'; +import url from 'node:url'; +import { newDenoHTTPWorker } from '@valtown/deno-http-worker'; +import { workerPath } from './code-tool-paths.cjs'; import { + ContentBlock, McpRequestContext, McpTool, Metadata, @@ -12,10 +18,12 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { readEnv, requireValue } from './util'; import { WorkerInput, WorkerOutput } from './code-tool-types'; import { SdkMethod } from './methods'; +import { McpCodeExecutionMode } from './options'; +import { ClientOptions } from 'lithic'; const prompt = `Runs JavaScript code to interact with the Lithic API. -You are a skilled programmer writing code to interface with the service. +You are a skilled TypeScript programmer writing code to interface with the service. Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run. For example: @@ -31,7 +39,9 @@ You will be returned anything that your function returns, plus the results of an Do not add try-catch blocks for single API calls. The tool will handle errors for you. Do not add comments unless necessary for generating better code. Code will run in a container, and cannot interact with the network outside of the given SDK client. -Variables will not persist between calls, so make sure to return or log any data you might need later.`; +Variables will not persist between calls, so make sure to return or log any data you might need later. +Remember that you are writing TypeScript code, so you need to be careful with your types. +Always type dynamic key-value stores explicitly as Record instead of {}.`; /** * A tool that runs code against a copy of the SDK. @@ -40,9 +50,19 @@ Variables will not persist between calls, so make sure to return or log any data * we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then * a generic endpoint that can be used to invoke any endpoint with the provided arguments. * - * @param endpoints - The endpoints to include in the list. + * @param blockedMethods - The methods to block for code execution. Blocking is done by simple string + * matching, so it is not secure against obfuscation. For stronger security, block in the downstream API + * with limited API keys. + * @param codeExecutionMode - Whether to execute code in a local Deno environment or in a remote + * sandbox environment hosted by Stainless. */ -export function codeTool({ blockedMethods }: { blockedMethods: SdkMethod[] | undefined }): McpTool { +export function codeTool({ + blockedMethods, + codeExecutionMode, +}: { + blockedMethods: SdkMethod[] | undefined; + codeExecutionMode: McpCodeExecutionMode; +}): McpTool { const metadata: Metadata = { resource: 'all', operation: 'write', tags: [] }; const tool: Tool = { name: 'execute', @@ -62,6 +82,7 @@ export function codeTool({ blockedMethods }: { blockedMethods: SdkMethod[] | und required: ['code'], }, }; + const handler = async ({ reqContext, args, @@ -70,9 +91,6 @@ export function codeTool({ blockedMethods }: { blockedMethods: SdkMethod[] | und args: any; }): Promise => { const code = args.code as string; - const intent = args.intent as string | undefined; - const client = reqContext.client; - // Do very basic blocking of code that includes forbidden method names. // // WARNING: This is not secure against obfuscation and other evasion methods. If @@ -89,55 +107,258 @@ export function codeTool({ blockedMethods }: { blockedMethods: SdkMethod[] | und } } - const codeModeEndpoint = - readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool'; - - // Setting a Stainless API key authenticates requests to the code tool endpoint. - const res = await fetch(codeModeEndpoint, { - method: 'POST', - headers: { - ...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }), - 'Content-Type': 'application/json', - client_envs: JSON.stringify({ - LITHIC_API_KEY: requireValue( - readEnv('LITHIC_API_KEY') ?? client.apiKey, - 'set LITHIC_API_KEY environment variable or provide apiKey client option', - ), - LITHIC_WEBHOOK_SECRET: readEnv('LITHIC_WEBHOOK_SECRET') ?? client.webhookSecret ?? undefined, - LITHIC_BASE_URL: - readEnv('LITHIC_BASE_URL') ?? readEnv('LITHIC_ENVIRONMENT') ? - undefined - : client.baseURL ?? undefined, - }), - }, - body: JSON.stringify({ - project_name: 'lithic', - code, - intent, - client_opts: { environment: (readEnv('LITHIC_ENVIRONMENT') || undefined) as any }, - } satisfies WorkerInput), - }); + if (codeExecutionMode === 'local') { + return await localDenoHandler({ reqContext, args }); + } else { + return await remoteStainlessHandler({ reqContext, args }); + } + }; + + return { metadata, tool, handler }; +} + +const remoteStainlessHandler = async ({ + reqContext, + args, +}: { + reqContext: McpRequestContext; + args: any; +}): Promise => { + const code = args.code as string; + const intent = args.intent as string | undefined; + const client = reqContext.client; - if (!res.ok) { - throw new Error( - `${res.status}: ${ - res.statusText - } error when trying to contact Code Tool server. Details: ${await res.text()}`, + const codeModeEndpoint = readEnv('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool'; + + // Setting a Stainless API key authenticates requests to the code tool endpoint. + const res = await fetch(codeModeEndpoint, { + method: 'POST', + headers: { + ...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }), + 'Content-Type': 'application/json', + client_envs: JSON.stringify({ + LITHIC_API_KEY: requireValue( + readEnv('LITHIC_API_KEY') ?? client.apiKey, + 'set LITHIC_API_KEY environment variable or provide apiKey client option', + ), + LITHIC_WEBHOOK_SECRET: readEnv('LITHIC_WEBHOOK_SECRET') ?? client.webhookSecret ?? undefined, + LITHIC_BASE_URL: + readEnv('LITHIC_BASE_URL') ?? readEnv('LITHIC_ENVIRONMENT') ? + undefined + : client.baseURL ?? undefined, + }), + }, + body: JSON.stringify({ + project_name: 'lithic', + code, + intent, + client_opts: { environment: (readEnv('LITHIC_ENVIRONMENT') || undefined) as any }, + } satisfies WorkerInput), + }); + + if (!res.ok) { + throw new Error( + `${res.status}: ${ + res.statusText + } error when trying to contact Code Tool server. Details: ${await res.text()}`, + ); + } + + const { is_error, result, log_lines, err_lines } = (await res.json()) as WorkerOutput; + const hasLogs = log_lines.length > 0 || err_lines.length > 0; + const output = { + result, + ...(log_lines.length > 0 && { log_lines }), + ...(err_lines.length > 0 && { err_lines }), + }; + if (is_error) { + return asErrorResult(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2)); + } + return asTextContentResult(output); +}; + +const localDenoHandler = async ({ + reqContext, + args, +}: { + reqContext: McpRequestContext; + args: unknown; +}): Promise => { + const client = reqContext.client; + const baseURLHostname = new URL(client.baseURL).hostname; + const { code } = args as { code: string }; + + let denoPath: string; + + const packageRoot = path.resolve(path.dirname(workerPath), '..'); + const packageNodeModulesPath = path.resolve(packageRoot, 'node_modules'); + + // Check if deno is in PATH + const { execSync } = await import('node:child_process'); + try { + execSync('command -v deno', { stdio: 'ignore' }); + denoPath = 'deno'; + } catch { + try { + // Use deno binary in node_modules if it's found + const denoNodeModulesPath = path.resolve(packageNodeModulesPath, 'deno', 'bin.cjs'); + await fs.promises.access(denoNodeModulesPath, fs.constants.X_OK); + denoPath = denoNodeModulesPath; + } catch { + return asErrorResult( + 'Deno is required for code execution but was not found. ' + + 'Install it from https://deno.land or run: npm install deno', ); } + } + + const allowReadPaths = [ + 'code-tool-worker.mjs', + `${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`, + packageRoot, + ]; - const { is_error, result, log_lines, err_lines } = (await res.json()) as WorkerOutput; - const hasLogs = log_lines.length > 0 || err_lines.length > 0; - const output = { - result, - ...(log_lines.length > 0 && { log_lines }), - ...(err_lines.length > 0 && { err_lines }), - }; - if (is_error) { - return asErrorResult(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2)); + // Follow symlinks in node_modules to allow read access to workspace-linked packages + try { + const sdkPkgName = 'lithic'; + const sdkDir = path.resolve(packageNodeModulesPath, sdkPkgName); + const realSdkDir = fs.realpathSync(sdkDir); + if (realSdkDir !== sdkDir) { + allowReadPaths.push(realSdkDir); } - return asTextContentResult(output); - }; + } catch { + // Ignore if symlink resolution fails + } - return { metadata, tool, handler }; -} + const allowRead = allowReadPaths.join(','); + + const worker = await newDenoHTTPWorker(url.pathToFileURL(workerPath), { + denoExecutable: denoPath, + runFlags: [ + `--node-modules-dir=manual`, + `--allow-read=${allowRead}`, + `--allow-net=${baseURLHostname}`, + // Allow environment variables because instantiating the client will try to read from them, + // even though they are not set. + '--allow-env', + ], + printOutput: true, + spawnOptions: { + cwd: path.dirname(workerPath), + }, + }); + + try { + const resp = await new Promise((resolve, reject) => { + worker.addEventListener('exit', (exitCode) => { + reject(new Error(`Worker exited with code ${exitCode}`)); + }); + + const opts: ClientOptions = { + baseURL: client.baseURL, + apiKey: client.apiKey, + webhookSecret: client.webhookSecret, + defaultHeaders: { + 'X-Stainless-MCP': 'true', + }, + }; + + const req = worker.request( + 'http://localhost', + { + headers: { + 'content-type': 'application/json', + }, + method: 'POST', + }, + (resp) => { + const body: Uint8Array[] = []; + resp.on('error', (err) => { + reject(err); + }); + resp.on('data', (chunk) => { + body.push(chunk); + }); + resp.on('end', () => { + resolve( + new Response(Buffer.concat(body).toString(), { + status: resp.statusCode ?? 200, + headers: resp.headers as any, + }), + ); + }); + }, + ); + + const body = JSON.stringify({ + opts, + code, + }); + + req.write(body, (err) => { + if (err != null) { + reject(err); + } + }); + + req.end(); + }); + + if (resp.status === 200) { + const { result, log_lines, err_lines } = (await resp.json()) as WorkerOutput; + const returnOutput: ContentBlock | null = + result == null ? null : ( + { + type: 'text', + text: typeof result === 'string' ? result : JSON.stringify(result), + } + ); + const logOutput: ContentBlock | null = + log_lines.length === 0 ? + null + : { + type: 'text', + text: log_lines.join('\n'), + }; + const errOutput: ContentBlock | null = + err_lines.length === 0 ? + null + : { + type: 'text', + text: 'Error output:\n' + err_lines.join('\n'), + }; + return { + content: [returnOutput, logOutput, errOutput].filter((block) => block !== null), + }; + } else { + const { result, log_lines, err_lines } = (await resp.json()) as WorkerOutput; + const messageOutput: ContentBlock | null = + result == null ? null : ( + { + type: 'text', + text: typeof result === 'string' ? result : JSON.stringify(result), + } + ); + const logOutput: ContentBlock | null = + log_lines.length === 0 ? + null + : { + type: 'text', + text: log_lines.join('\n'), + }; + const errOutput: ContentBlock | null = + err_lines.length === 0 ? + null + : { + type: 'text', + text: 'Error output:\n' + err_lines.join('\n'), + }; + return { + content: [messageOutput, logOutput, errOutput].filter((block) => block !== null), + isError: true, + }; + } + } finally { + worker.terminate(); + } +}; diff --git a/packages/mcp-server/src/methods.ts b/packages/mcp-server/src/methods.ts index 349dc8ad..eb007c75 100644 --- a/packages/mcp-server/src/methods.ts +++ b/packages/mcp-server/src/methods.ts @@ -94,6 +94,18 @@ export const sdkMethods: SdkMethod[] = [ httpMethod: 'post', httpPath: '/v1/account_holders/{account_holder_token}/documents', }, + { + clientCallName: 'client.accountHolders.entities.create', + fullyQualifiedName: 'accountHolders.entities.create', + httpMethod: 'post', + httpPath: '/v1/account_holders/{account_holder_token}/entities', + }, + { + clientCallName: 'client.accountHolders.entities.delete', + fullyQualifiedName: 'accountHolders.entities.delete', + httpMethod: 'delete', + httpPath: '/v1/account_holders/{account_holder_token}/entities/{entity_token}', + }, { clientCallName: 'client.authRules.v2.create', fullyQualifiedName: 'authRules.v2.create', @@ -623,6 +635,42 @@ export const sdkMethods: SdkMethod[] = [ httpMethod: 'get', httpPath: '/v1/financial_accounts/{financial_account_token}/loan_tapes', }, + { + clientCallName: 'client.financialAccounts.loanTapeConfiguration.retrieve', + fullyQualifiedName: 'financialAccounts.loanTapeConfiguration.retrieve', + httpMethod: 'get', + httpPath: '/v1/financial_accounts/{financial_account_token}/loan_tape_configuration', + }, + { + clientCallName: 'client.financialAccounts.interestTierSchedule.create', + fullyQualifiedName: 'financialAccounts.interestTierSchedule.create', + httpMethod: 'post', + httpPath: '/v1/financial_accounts/{financial_account_token}/interest_tier_schedule', + }, + { + clientCallName: 'client.financialAccounts.interestTierSchedule.retrieve', + fullyQualifiedName: 'financialAccounts.interestTierSchedule.retrieve', + httpMethod: 'get', + httpPath: '/v1/financial_accounts/{financial_account_token}/interest_tier_schedule/{effective_date}', + }, + { + clientCallName: 'client.financialAccounts.interestTierSchedule.update', + fullyQualifiedName: 'financialAccounts.interestTierSchedule.update', + httpMethod: 'put', + httpPath: '/v1/financial_accounts/{financial_account_token}/interest_tier_schedule/{effective_date}', + }, + { + clientCallName: 'client.financialAccounts.interestTierSchedule.list', + fullyQualifiedName: 'financialAccounts.interestTierSchedule.list', + httpMethod: 'get', + httpPath: '/v1/financial_accounts/{financial_account_token}/interest_tier_schedule', + }, + { + clientCallName: 'client.financialAccounts.interestTierSchedule.delete', + fullyQualifiedName: 'financialAccounts.interestTierSchedule.delete', + httpMethod: 'delete', + httpPath: '/v1/financial_accounts/{financial_account_token}/interest_tier_schedule/{effective_date}', + }, { clientCallName: 'client.transactions.retrieve', fullyQualifiedName: 'transactions.retrieve', diff --git a/packages/mcp-server/src/options.ts b/packages/mcp-server/src/options.ts index 32a88713..069b8811 100644 --- a/packages/mcp-server/src/options.ts +++ b/packages/mcp-server/src/options.ts @@ -14,13 +14,17 @@ export type CLIOptions = McpOptions & { }; export type McpOptions = { + includeCodeTool?: boolean | undefined; includeDocsTools?: boolean | undefined; stainlessApiKey?: string | undefined; codeAllowHttpGets?: boolean | undefined; codeAllowedMethods?: string[] | undefined; codeBlockedMethods?: string[] | undefined; + codeExecutionMode: McpCodeExecutionMode; }; +export type McpCodeExecutionMode = 'stainless-sandbox' | 'local'; + export function parseCLIOptions(): CLIOptions { const opts = yargs(hideBin(process.argv)) .option('code-allow-http-gets', { @@ -40,6 +44,13 @@ export function parseCLIOptions(): CLIOptions { description: 'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.', }) + .option('code-execution-mode', { + type: 'string', + choices: ['stainless-sandbox', 'local'], + default: 'stainless-sandbox', + description: + "Where to run code execution in code tool; 'stainless-sandbox' will execute code in Stainless-hosted sandboxes whereas 'local' will execute code locally on the MCP server machine.", + }) .option('debug', { type: 'boolean', description: 'Enable debug logging' }) .option('no-tools', { type: 'string', @@ -82,17 +93,20 @@ export function parseCLIOptions(): CLIOptions { : argv.tools?.includes(toolType) ? true : undefined; + const includeCodeTool = shouldIncludeToolType('code'); const includeDocsTools = shouldIncludeToolType('docs'); const transport = argv.transport as 'stdio' | 'http'; return { + ...(includeCodeTool !== undefined && { includeCodeTool }), ...(includeDocsTools !== undefined && { includeDocsTools }), debug: !!argv.debug, stainlessApiKey: argv.stainlessApiKey, codeAllowHttpGets: argv.codeAllowHttpGets, codeAllowedMethods: argv.codeAllowedMethods, codeBlockedMethods: argv.codeBlockedMethods, + codeExecutionMode: argv.codeExecutionMode as McpCodeExecutionMode, transport, port: argv.port, socket: argv.socket, @@ -118,12 +132,19 @@ export function parseQueryOptions(defaultOptions: McpOptions, query: unknown): M const queryObject = typeof query === 'string' ? qs.parse(query) : query; const queryOptions = QueryOptions.parse(queryObject); + let codeTool: boolean | undefined = + queryOptions.no_tools && queryOptions.no_tools?.includes('code') ? false + : queryOptions.tools?.includes('code') ? true + : defaultOptions.includeCodeTool; + let docsTools: boolean | undefined = queryOptions.no_tools && queryOptions.no_tools?.includes('docs') ? false : queryOptions.tools?.includes('docs') ? true : defaultOptions.includeDocsTools; return { + ...(codeTool !== undefined && { includeCodeTool: codeTool }), ...(docsTools !== undefined && { includeDocsTools: docsTools }), + codeExecutionMode: defaultOptions.codeExecutionMode, }; } diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index 65317fd1..8768a039 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -21,7 +21,7 @@ export const newMcpServer = async (stainlessApiKey: string | undefined) => new McpServer( { name: 'lithic_api', - version: '0.129.0', + version: '0.130.0', }, { instructions: await getInstructions(stainlessApiKey), @@ -158,11 +158,16 @@ export async function initMcpServer(params: { * Selects the tools to include in the MCP Server based on the provided options. */ export function selectTools(options?: McpOptions): McpTool[] { - const includedTools = [ - codeTool({ - blockedMethods: blockedMethodsForCodeTool(options), - }), - ]; + const includedTools = []; + + if (options?.includeCodeTool ?? true) { + includedTools.push( + codeTool({ + blockedMethods: blockedMethodsForCodeTool(options), + codeExecutionMode: options?.codeExecutionMode ?? 'stainless-sandbox', + }), + ); + } if (options?.includeDocsTools ?? true) { includedTools.push(docsSearchTool); } diff --git a/packages/mcp-server/tests/options.test.ts b/packages/mcp-server/tests/options.test.ts index 7a2d5114..17306295 100644 --- a/packages/mcp-server/tests/options.test.ts +++ b/packages/mcp-server/tests/options.test.ts @@ -1,4 +1,4 @@ -import { parseCLIOptions, parseQueryOptions } from '../src/options'; +import { parseCLIOptions } from '../src/options'; // Mock process.argv const mockArgv = (args: string[]) => { @@ -30,21 +30,3 @@ describe('parseCLIOptions', () => { cleanup(); }); }); - -describe('parseQueryOptions', () => { - const defaultOptions = {}; - - it('default parsing should be empty', () => { - const query = ''; - const result = parseQueryOptions(defaultOptions, query); - - expect(result).toEqual({}); - }); - - it('should handle invalid query string gracefully', () => { - const query = 'invalid=value&tools=invalid-operation'; - - // Should throw due to Zod validation for invalid tools - expect(() => parseQueryOptions(defaultOptions, query)).toThrow(); - }); -}); diff --git a/release-please-config.json b/release-please-config.json index b1909804..9b042792 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -68,6 +68,11 @@ "type": "json", "path": "packages/mcp-server/package.json", "jsonpath": "$.version" + }, + { + "type": "json", + "path": "packages/mcp-server/manifest.json", + "jsonpath": "$.version" } ] } diff --git a/src/client.ts b/src/client.ts index c996dde8..0633506d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse'; import { getPlatformHeaders } from './internal/detect-platform'; import * as Shims from './internal/shims'; import * as Opts from './internal/request-options'; -import * as qs from './internal/qs'; +import { stringifyQuery } from './internal/utils/query'; import { VERSION } from './version'; import * as Errors from './core/error'; import * as Pagination from './core/pagination'; @@ -34,28 +34,6 @@ import { AccountActivityRetrieveTransactionResponse, WirePartyDetails, } from './resources/account-activity'; -import { - AccountHolder, - AccountHolderCreateParams, - AccountHolderCreateResponse, - AccountHolderListDocumentsResponse, - AccountHolderListParams, - AccountHolderRetrieveDocumentParams, - AccountHolderSimulateEnrollmentDocumentReviewParams, - AccountHolderSimulateEnrollmentReviewParams, - AccountHolderSimulateEnrollmentReviewResponse, - AccountHolderUpdateParams, - AccountHolderUpdateResponse, - AccountHolderUploadDocumentParams, - AccountHolders, - AccountHoldersSinglePage, - AddressUpdate, - KYB, - KYBBusinessEntity, - KYC, - KYCExempt, - RequiredDocument, -} from './resources/account-holders'; import { Account, AccountListParams, @@ -258,6 +236,28 @@ import { TokenizationUpdatedWebhookEvent, Webhooks, } from './resources/webhooks'; +import { + AccountHolder, + AccountHolderCreateParams, + AccountHolderCreateResponse, + AccountHolderListDocumentsResponse, + AccountHolderListParams, + AccountHolderRetrieveDocumentParams, + AccountHolderSimulateEnrollmentDocumentReviewParams, + AccountHolderSimulateEnrollmentReviewParams, + AccountHolderSimulateEnrollmentReviewResponse, + AccountHolderUpdateParams, + AccountHolderUpdateResponse, + AccountHolderUploadDocumentParams, + AccountHolders, + AccountHoldersSinglePage, + AddressUpdate, + KYB, + KYBBusinessEntity, + KYC, + KYCExempt, + RequiredDocument, +} from './resources/account-holders/account-holders'; import { AuthRules } from './resources/auth-rules/auth-rules'; import { Card, @@ -592,8 +592,8 @@ export class Lithic { return buildHeaders([{ Authorization: this.apiKey }]); } - protected stringifyQuery(query: Record): string { - return qs.stringify(query, { arrayFormat: 'comma' }); + protected stringifyQuery(query: object | Record): string { + return stringifyQuery(query); } private getUserAgent(): string { @@ -630,7 +630,7 @@ export class Lithic { } if (typeof query === 'object' && query && !Array.isArray(query)) { - url.search = this.stringifyQuery(query as Record); + url.search = this.stringifyQuery(query); } return url.toString(); @@ -1093,7 +1093,7 @@ export class Lithic { ) { return { bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, - body: this.stringifyQuery(body as Record), + body: this.stringifyQuery(body), }; } else { return this.#encoder({ body, headers }); diff --git a/src/internal/utils.ts b/src/internal/utils.ts index 3cbfacce..c591353b 100644 --- a/src/internal/utils.ts +++ b/src/internal/utils.ts @@ -6,3 +6,4 @@ export * from './utils/env'; export * from './utils/log'; export * from './utils/uuid'; export * from './utils/sleep'; +export * from './utils/query'; diff --git a/src/internal/utils/query.ts b/src/internal/utils/query.ts new file mode 100644 index 00000000..0139cacb --- /dev/null +++ b/src/internal/utils/query.ts @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as qs from '../qs/stringify'; + +export function stringifyQuery(query: object | Record) { + return qs.stringify(query, { arrayFormat: 'comma' }); +} diff --git a/src/resources/account-holders.ts b/src/resources/account-holders.ts index f5a8b3f7..6b00bf14 100644 --- a/src/resources/account-holders.ts +++ b/src/resources/account-holders.ts @@ -1,3510 +1,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../core/resource'; -import * as AccountHoldersAPI from './account-holders'; -import * as Shared from './shared'; -import { APIPromise } from '../core/api-promise'; -import { PagePromise, SinglePage } from '../core/pagination'; -import { RequestOptions } from '../internal/request-options'; -import { path } from '../internal/utils/path'; - -export class AccountHolders extends APIResource { - /** - * Create an account holder and initiate the appropriate onboarding workflow. - * Account holders and accounts have a 1:1 relationship. When an account holder is - * successfully created an associated account is also created. All calls to this - * endpoint will return a synchronous response. The response time will depend on - * the workflow. In some cases, the response may indicate the workflow is under - * review or further action will be needed to complete the account creation - * process. This endpoint can only be used on accounts that are part of the program - * that the calling API key manages. - * - * @example - * ```ts - * const accountHolder = await client.accountHolders.create({ - * beneficial_owner_individuals: [ - * { - * address: { ... }, - * dob: '1991-03-08T08:00:00Z', - * email: 'tim@left-earth.com', - * first_name: 'Timmy', - * government_id: '211-23-1412', - * last_name: 'Turner', - * phone_number: '+15555555555', - * }, - * ], - * business_entity: { - * address: { ... }, - * dba_business_name: 'Example Business Solutions', - * government_id: '12-3456789', - * legal_business_name: 'Busy Business, Inc.', - * phone_numbers: ['+15555555555'], - * }, - * control_person: { - * address: { ... }, - * dob: '1991-03-08T08:00:00Z', - * email: 'tom@middle-pluto.com', - * first_name: 'Tom', - * government_id: '111-23-1412', - * last_name: 'Timothy', - * phone_number: '+15555555555', - * }, - * nature_of_business: 'Software company selling solutions to the restaurant industry', - * tos_timestamp: '2022-03-08T08:00:00Z', - * workflow: 'KYB_BYO', - * beneficial_owner_entities: [ - * { - * address: { ... }, - * dba_business_name: 'MHoldings', - * government_id: '98-7654321', - * legal_business_name: 'Majority Holdings LLC', - * phone_numbers: ['+15555555555'], - * }, - * ], - * kyb_passed_timestamp: '2022-03-08T08:00:00Z', - * naics_code: '541512', - * website_url: 'https://www.mybusiness.com', - * }); - * ``` - */ - create(body: AccountHolderCreateParams, options?: RequestOptions): APIPromise { - return this._client.post('/v1/account_holders', { - body, - timeout: (this._client as any)._options.timeout ?? 300000, - ...options, - }); - } - - /** - * Get an Individual or Business Account Holder and/or their KYC or KYB evaluation - * status. - * - * @example - * ```ts - * const accountHolder = await client.accountHolders.retrieve( - * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * ); - * ``` - */ - retrieve(accountHolderToken: string, options?: RequestOptions): APIPromise { - return this._client.get(path`/v1/account_holders/${accountHolderToken}`, options); - } - - /** - * Update the information associated with a particular account holder (including - * business owners and control persons associated to a business account). If Lithic - * is performing KYB or KYC and additional verification is required we will run the - * individual's or business's updated information again and return whether the - * status is accepted or pending (i.e., further action required). All calls to this - * endpoint will return a synchronous response. The response time will depend on - * the workflow. In some cases, the response may indicate the workflow is under - * review or further action will be needed to complete the account creation - * process. This endpoint can only be used on existing accounts that are part of - * the program that the calling API key manages. - * - * @example - * ```ts - * const accountHolder = await client.accountHolders.update( - * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * { - * business_entity: { - * entity_token: '83cf25ae-c14f-4d10-9fa2-0119f36c7286', - * address: { postal_code: '61023' }, - * }, - * control_person: { - * entity_token: 'fd771a07-c5c2-42f3-a53c-a6c79c6c0d07', - * address: { postal_code: '68023' }, - * }, - * naics_code: '541512', - * website_url: 'https://www.mynewbusiness.com', - * }, - * ); - * ``` - */ - update( - accountHolderToken: string, - body: AccountHolderUpdateParams, - options?: RequestOptions, - ): APIPromise { - return this._client.patch(path`/v1/account_holders/${accountHolderToken}`, { body, ...options }); - } - - /** - * Get a list of individual or business account holders and their KYC or KYB - * evaluation status. - * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const accountHolder of client.accountHolders.list()) { - * // ... - * } - * ``` - */ - list( - query: AccountHolderListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/v1/account_holders', SinglePage, { query, ...options }); - } - - /** - * Retrieve the status of account holder document uploads, or retrieve the upload - * URLs to process your image uploads. - * - * Note that this is not equivalent to checking the status of the KYC evaluation - * overall (a document may be successfully uploaded but not be sufficient for KYC - * to pass). - * - * In the event your upload URLs have expired, calling this endpoint will refresh - * them. Similarly, in the event a previous account holder document upload has - * failed, you can use this endpoint to get a new upload URL for the failed image - * upload. - * - * When a new document upload is generated for a failed attempt, the response will - * show an additional entry in the `required_document_uploads` list in a `PENDING` - * state for the corresponding `image_type`. - * - * @example - * ```ts - * const response = await client.accountHolders.listDocuments( - * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * ); - * ``` - */ - listDocuments( - accountHolderToken: string, - options?: RequestOptions, - ): APIPromise { - return this._client.get(path`/v1/account_holders/${accountHolderToken}/documents`, options); - } - - /** - * Check the status of an account holder document upload, or retrieve the upload - * URLs to process your image uploads. - * - * Note that this is not equivalent to checking the status of the KYC evaluation - * overall (a document may be successfully uploaded but not be sufficient for KYC - * to pass). - * - * In the event your upload URLs have expired, calling this endpoint will refresh - * them. Similarly, in the event a document upload has failed, you can use this - * endpoint to get a new upload URL for the failed image upload. - * - * When a new account holder document upload is generated for a failed attempt, the - * response will show an additional entry in the `required_document_uploads` array - * in a `PENDING` state for the corresponding `image_type`. - * - * @example - * ```ts - * const document = - * await client.accountHolders.retrieveDocument( - * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * { - * account_holder_token: - * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * }, - * ); - * ``` - */ - retrieveDocument( - documentToken: string, - params: AccountHolderRetrieveDocumentParams, - options?: RequestOptions, - ): APIPromise { - const { account_holder_token } = params; - return this._client.get( - path`/v1/account_holders/${account_holder_token}/documents/${documentToken}`, - options, - ); - } - - /** - * Simulates a review for an account holder document upload. - * - * @example - * ```ts - * const document = - * await client.accountHolders.simulateEnrollmentDocumentReview( - * { - * document_upload_token: - * 'b11cd67b-0a52-4180-8365-314f3def5426', - * status: 'UPLOADED', - * }, - * ); - * ``` - */ - simulateEnrollmentDocumentReview( - body: AccountHolderSimulateEnrollmentDocumentReviewParams, - options?: RequestOptions, - ): APIPromise { - return this._client.post('/v1/simulate/account_holders/enrollment_document_review', { body, ...options }); - } - - /** - * Simulates an enrollment review for an account holder. This endpoint is only - * applicable for workflows that may required intervention such as `KYB_BASIC`. - * - * @example - * ```ts - * const response = - * await client.accountHolders.simulateEnrollmentReview({ - * account_holder_token: - * '1415964d-4400-4d79-9fb3-eee0faaee4e4', - * status: 'ACCEPTED', - * status_reasons: [], - * }); - * ``` - */ - simulateEnrollmentReview( - body: AccountHolderSimulateEnrollmentReviewParams, - options?: RequestOptions, - ): APIPromise { - return this._client.post('/v1/simulate/account_holders/enrollment_review', { body, ...options }); - } - - /** - * Use this endpoint to identify which type of supported government-issued - * documentation you will upload for further verification. It will return two URLs - * to upload your document images to - one for the front image and one for the back - * image. - * - * This endpoint is only valid for evaluations in a `PENDING_DOCUMENT` state. - * - * Uploaded images must either be a `jpg` or `png` file, and each must be less than - * 15 MiB. Once both required uploads have been successfully completed, your - * document will be run through KYC verification. - * - * If you have registered a webhook, you will receive evaluation updates for any - * document submission evaluations, as well as for any failed document uploads. - * - * Two document submission attempts are permitted via this endpoint before a - * `REJECTED` status is returned and the account creation process is ended. - * Currently only one type of account holder document is supported per KYC - * verification. - * - * @example - * ```ts - * const document = await client.accountHolders.uploadDocument( - * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - * { - * document_type: 'EIN_LETTER', - * entity_token: '83cf25ae-c14f-4d10-9fa2-0119f36c7286', - * }, - * ); - * ``` - */ - uploadDocument( - accountHolderToken: string, - body: AccountHolderUploadDocumentParams, - options?: RequestOptions, - ): APIPromise { - return this._client.post(path`/v1/account_holders/${accountHolderToken}/documents`, { body, ...options }); - } -} - -export type AccountHoldersSinglePage = SinglePage; - -export interface AccountHolder { - /** - * Globally unique identifier for the account holder. - */ - token: string; - - /** - * Timestamp of when the account holder was created. - */ - created: string; - - /** - * Globally unique identifier for the account. - */ - account_token?: string; - - /** - * @deprecated Deprecated. - */ - beneficial_owner_entities?: Array; - - /** - * Only present when user_type == "BUSINESS". You must submit a list of all direct - * and indirect individuals with 25% or more ownership in the company. A maximum of - * 4 beneficial owners can be submitted. If no individual owns 25% of the company - * you do not need to send beneficial owner information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals?: Array; - - /** - * Only applicable for customers using the KYC-Exempt workflow to enroll authorized - * users of businesses. Pass the account_token of the enrolled business associated - * with the AUTHORIZED_USER in this field. - */ - business_account_token?: string; - - /** - * Only present when user_type == "BUSINESS". Information about the business for - * which the account is being opened and KYB is being run. - */ - business_entity?: AccountHolder.BusinessEntity; - - /** - * Only present when user_type == "BUSINESS". An individual with significant - * responsibility for managing the legal entity (e.g., a Chief Executive Officer, - * Chief Financial Officer, Chief Operating Officer, Managing Member, General - * Partner, President, Vice President, or Treasurer). This can be an executive, or - * someone who will have program-wide access to the cards that Lithic will provide. - * In some cases, this individual could also be a beneficial owner listed above. - */ - control_person?: AccountHolder.ControlPerson; - - /** - * (Deprecated. Use control_person.email when user_type == "BUSINESS". Use - * individual.phone_number when user_type == "INDIVIDUAL".) Primary email of - * Account Holder. - */ - email?: string; - - /** - * The type of KYC exemption for a KYC-Exempt Account Holder. - */ - exemption_type?: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; - - /** - * Customer-provided token that indicates a relationship with an object outside of - * the Lithic ecosystem. - */ - external_id?: string; - - /** - * Only present when user_type == "INDIVIDUAL". Information about the individual - * for which the account is being opened and KYC is being run. - */ - individual?: AccountHolder.Individual; - - /** - * Only present when user_type == "BUSINESS". 6-digit North American Industry - * Classification System (NAICS) code for the business. - */ - naics_code?: string; - - /** - * Only present when user_type == "BUSINESS". User-submitted description of the - * business. - */ - nature_of_business?: string; - - /** - * (Deprecated. Use control_person.phone_number when user_type == "BUSINESS". Use - * individual.phone_number when user_type == "INDIVIDUAL".) Primary phone of - * Account Holder, entered in E.164 format. - */ - phone_number?: string; - - /** - * Only present for "KYB_BASIC" workflow. A list of documents required for the - * account holder to be approved. - */ - required_documents?: Array; - - /** - * (Deprecated. Use verification_application.status instead) - * - * KYC and KYB evaluation states. - * - * Note: - * - * - `PENDING_REVIEW` is only applicable for the `KYB_BASIC` workflow. - */ - status?: 'ACCEPTED' | 'PENDING_REVIEW' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * (Deprecated. Use verification_application.status_reasons) - * - * Reason for the evaluation status. - */ - status_reasons?: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - >; - - /** - * The type of Account Holder. If the type is "INDIVIDUAL", the "individual" - * attribute will be present. If the type is "BUSINESS" then the "business_entity", - * "control_person", "beneficial_owner_individuals", "naics_code", - * "nature_of_business", and "website_url" attributes will be present. - */ - user_type?: 'BUSINESS' | 'INDIVIDUAL'; - - /** - * Information about the most recent identity verification attempt - */ - verification_application?: AccountHolder.VerificationApplication; - - /** - * Only present when user_type == "BUSINESS". Business's primary website. - */ - website_url?: string; -} - -export namespace AccountHolder { - export interface BeneficialOwnerEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name: string; - - /** - * Globally unique identifier for the entity. - */ - entity_token: string; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - } - - /** - * Information about an individual associated with an account holder. A subset of - * the information provided via KYC. For example, we do not return the government - * id. - */ - export interface BeneficialOwnerIndividual { - /** - * Individual's current address - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. - */ - email: string; - - /** - * Globally unique identifier for the entity. - */ - entity_token: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number: string; - } - - /** - * Only present when user_type == "BUSINESS". Information about the business for - * which the account is being opened and KYB is being run. - */ - export interface BusinessEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name: string; - - /** - * Globally unique identifier for the entity. - */ - entity_token: string; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - } - - /** - * Only present when user_type == "BUSINESS". An individual with significant - * responsibility for managing the legal entity (e.g., a Chief Executive Officer, - * Chief Financial Officer, Chief Operating Officer, Managing Member, General - * Partner, President, Vice President, or Treasurer). This can be an executive, or - * someone who will have program-wide access to the cards that Lithic will provide. - * In some cases, this individual could also be a beneficial owner listed above. - */ - export interface ControlPerson { - /** - * Individual's current address - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. - */ - email: string; - - /** - * Globally unique identifier for the entity. - */ - entity_token: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number: string; - } - - /** - * Only present when user_type == "INDIVIDUAL". Information about the individual - * for which the account is being opened and KYC is being run. - */ - export interface Individual { - /** - * Individual's current address - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. - */ - email: string; - - /** - * Globally unique identifier for the entity. - */ - entity_token: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number: string; - } - - /** - * Information about the most recent identity verification attempt - */ - export interface VerificationApplication { - /** - * Timestamp of when the application was created. - */ - created?: string; - - /** - * KYC and KYB evaluation states. - * - * Note: - * - * - `PENDING_REVIEW` is only applicable for the `KYB_BASIC` workflow. - */ - status?: 'ACCEPTED' | 'PENDING_REVIEW' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * Reason for the evaluation status. - */ - status_reasons?: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - >; - - /** - * Timestamp of when the application was last updated. - */ - updated?: string; - } -} - -export interface AddressUpdate { - /** - * Valid deliverable address (no PO boxes). - */ - address1?: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - - /** - * Name of city. - */ - city?: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country?: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code?: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state?: string; -} - -export interface KYB { - /** - * You must submit a list of all direct and indirect individuals with 25% or more - * ownership in the company. A maximum of 4 beneficial owners can be submitted. If - * no individual owns 25% of the company you do not need to send beneficial owner - * information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals: Array; - - /** - * Information for business for which the account is being opened and KYB is being - * run. - */ - business_entity: KYB.BusinessEntity; - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - control_person: KYB.ControlPerson; - - /** - * Short description of the company's line of business (i.e., what does the company - * do?). - */ - nature_of_business: string; - - /** - * An RFC 3339 timestamp indicating when the account holder accepted the applicable - * legal agreements (e.g., cardholder terms) as agreed upon during API customer's - * implementation with Lithic. - */ - tos_timestamp: string; - - /** - * Specifies the type of KYB workflow to run. - */ - workflow: 'KYB_BASIC' | 'KYB_BYO'; - - /** - * @deprecated Deprecated. - */ - beneficial_owner_entities?: Array; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * An RFC 3339 timestamp indicating when precomputed KYB was completed on the - * business with a pass result. - * - * This field is required only if workflow type is `KYB_BYO`. - */ - kyb_passed_timestamp?: string; - - /** - * 6-digit North American Industry Classification System (NAICS) code for the - * business. - */ - naics_code?: string; - - /** - * Company website URL. - */ - website_url?: string; -} - -export namespace KYB { - /** - * Individuals associated with a KYB application. Phone number is optional. - */ - export interface BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - /** - * Information for business for which the account is being opened and KYB is being - * run. - */ - export interface BusinessEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - } - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - export interface ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export interface BeneficialOwnerEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - } -} - -export interface KYBBusinessEntity { - /** - * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: KYBBusinessEntity.Address; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; -} - -export namespace KYBBusinessEntity { - /** - * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } -} - -export interface KYC { - /** - * Information on individual for whom the account is being opened and KYC is being - * run. - */ - individual: KYC.Individual; - - /** - * An RFC 3339 timestamp indicating when the account holder accepted the applicable - * legal agreements (e.g., cardholder terms) as agreed upon during API customer's - * implementation with Lithic. - */ - tos_timestamp: string; - - /** - * Specifies the type of KYC workflow to run. - */ - workflow: 'KYC_BASIC' | 'KYC_BYO'; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * An RFC 3339 timestamp indicating when precomputed KYC was completed on the - * individual with a pass result. - * - * This field is required only if workflow type is `KYC_BYO`. - */ - kyc_passed_timestamp?: string; -} - -export namespace KYC { - /** - * Information on individual for whom the account is being opened and KYC is being - * run. - */ - export interface Individual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number: string; - } -} - -export interface KYCExempt { - /** - * KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * The KYC Exempt user's email - */ - email: string; - - /** - * The KYC Exempt user's first name - */ - first_name: string; - - /** - * Specifies the type of KYC Exempt user - */ - kyc_exemption_type: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; - - /** - * The KYC Exempt user's last name - */ - last_name: string; - - /** - * The KYC Exempt user's phone number, entered in E.164 format. - */ - phone_number: string; - - /** - * Specifies the workflow type. This must be 'KYC_EXEMPT' - */ - workflow: 'KYC_EXEMPT'; - - /** - * Only applicable for customers using the KYC-Exempt workflow to enroll authorized - * users of businesses. Pass the account_token of the enrolled business associated - * with the AUTHORIZED_USER in this field. - */ - business_account_token?: string; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; -} - -export interface RequiredDocument { - /** - * Globally unique identifier for an entity. - */ - entity_token: string; - - /** - * Provides the status reasons that will be satisfied by providing one of the valid - * documents. - */ - status_reasons: Array; - - /** - * A list of valid documents that will satisfy the KYC requirements for the - * specified entity. - */ - valid_documents: Array; -} - -export interface AccountHolderCreateResponse { - /** - * Globally unique identifier for the account holder. - */ - token: string; - - /** - * Globally unique identifier for the account. - */ - account_token: string; - - /** - * KYC and KYB evaluation states. - * - * Note: - * - * - `PENDING_REVIEW` is only applicable for the `KYB_BASIC` workflow. - */ - status: 'ACCEPTED' | 'PENDING_REVIEW' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * Reason for the evaluation status. - */ - status_reasons: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' - | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' - | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' - | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' - >; - - /** - * Timestamp of when the account holder was created. - */ - created?: string; - - /** - * Customer-provided token that indicates a relationship with an object outside of - * the Lithic ecosystem. - */ - external_id?: string; - - /** - * Only present for "KYB_BASIC" workflow. A list of documents required for the - * account holder to be approved. - */ - required_documents?: Array; -} - -export type AccountHolderUpdateResponse = - | AccountHolderUpdateResponse.KYBKYCPatchResponse - | AccountHolderUpdateResponse.PatchResponse; - -export namespace AccountHolderUpdateResponse { - export interface KYBKYCPatchResponse { - /** - * Globally unique identifier for the account holder. - */ - token?: string; - - /** - * Globally unique identifier for the account. - */ - account_token?: string; - - /** - * Deprecated. - */ - beneficial_owner_entities?: Array; - - /** - * Only present when user_type == "BUSINESS". You must submit a list of all direct - * and indirect individuals with 25% or more ownership in the company. A maximum of - * 4 beneficial owners can be submitted. If no individual owns 25% of the company - * you do not need to send beneficial owner information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals?: Array; - - /** - * Only applicable for customers using the KYC-Exempt workflow to enroll authorized - * users of businesses. Pass the account_token of the enrolled business associated - * with the AUTHORIZED_USER in this field. - */ - business_account_token?: string | null; - - /** - * Only present when user_type == "BUSINESS". Information about the business for - * which the account is being opened and KYB is being run. - */ - business_entity?: AccountHoldersAPI.KYBBusinessEntity; - - /** - * Only present when user_type == "BUSINESS". - * - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, - * - * Managing Member, General Partner, President, Vice President, or Treasurer). This - * can be an executive, or someone who will have program-wide access - * - * to the cards that Lithic will provide. In some cases, this individual could also - * be a beneficial owner listed above. - */ - control_person?: KYBKYCPatchResponse.ControlPerson; - - /** - * Timestamp of when the account holder was created. - */ - created?: string; - - /** - * (Deprecated. Use control_person.email when user_type == "BUSINESS". Use - * individual.phone_number when user_type == "INDIVIDUAL".) Primary email of - * Account Holder. - */ - email?: string; - - /** - * The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account - * holder is not KYC-Exempt. - */ - exemption_type?: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; - - /** - * Customer-provided token that indicates a relationship with an object outside of - * the Lithic ecosystem. - */ - external_id?: string; - - /** - * Only present when user_type == "INDIVIDUAL". Information about the individual - * for which the account is being opened and KYC is being run. - */ - individual?: KYBKYCPatchResponse.Individual; - - /** - * Only present when user_type == "BUSINESS". 6-digit North American Industry - * Classification System (NAICS) code for the business. - */ - naics_code?: string; - - /** - * Only present when user_type == "BUSINESS". User-submitted description of the - * business. - */ - nature_of_business?: string; - - /** - * (Deprecated. Use control_person.phone_number when user_type == "BUSINESS". Use - * individual.phone_number when user_type == "INDIVIDUAL".) Primary phone of - * Account Holder, entered in E.164 format. - */ - phone_number?: string; - - /** - * Only present for "KYB_BASIC" and "KYC_ADVANCED" workflows. A list of documents - * required for the account holder to be approved. - */ - required_documents?: Array; - - /** - * (Deprecated. Use verification_application.status instead) KYC and KYB evaluation - * states. - * - * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the - * `ADVANCED` workflow. - */ - status?: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * (Deprecated. Use verification_application.status_reasons) Reason for the - * evaluation status. - */ - status_reasons?: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' - | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' - | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' - | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' - >; - - /** - * The type of Account Holder. If the type is "INDIVIDUAL", the "individual" - * attribute will be present. - * - * If the type is "BUSINESS" then the "business_entity", "control_person", - * "beneficial_owner_individuals", "naics_code", "nature_of_business", and - * "website_url" attributes will be present. - */ - user_type?: 'BUSINESS' | 'INDIVIDUAL'; - - /** - * Information about the most recent identity verification attempt - */ - verification_application?: KYBKYCPatchResponse.VerificationApplication; - - /** - * Only present when user_type == "BUSINESS". Business's primary website. - */ - website_url?: string; - } - - export namespace KYBKYCPatchResponse { - export interface BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: BeneficialOwnerIndividual.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export namespace BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } - - /** - * Only present when user_type == "BUSINESS". - * - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, - * - * Managing Member, General Partner, President, Vice President, or Treasurer). This - * can be an executive, or someone who will have program-wide access - * - * to the cards that Lithic will provide. In some cases, this individual could also - * be a beneficial owner listed above. - */ - export interface ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: ControlPerson.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export namespace ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } - - /** - * Only present when user_type == "INDIVIDUAL". Information about the individual - * for which the account is being opened and KYC is being run. - */ - export interface Individual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: Individual.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export namespace Individual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } - - /** - * Information about the most recent identity verification attempt - */ - export interface VerificationApplication { - /** - * Timestamp of when the application was created. - */ - created: string; - - /** - * KYC and KYB evaluation states. - * - * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the - * `ADVANCED` workflow. - */ - status: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * Reason for the evaluation status. - */ - status_reasons: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' - | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' - | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' - | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' - >; - - /** - * Timestamp of when the application was last updated. - */ - updated: string; - - /** - * Timestamp of when the application passed the verification process. Only present - * if `status` is `ACCEPTED` - */ - ky_passed_at?: string; - } - } - - export interface PatchResponse { - /** - * The token for the account holder that was updated - */ - token?: string; - - /** - * The address for the account holder - */ - address?: PatchResponse.Address; - - /** - * The token for the business account that the account holder is associated with - */ - business_account_token?: string | null; - - /** - * The email for the account holder - */ - email?: string; - - /** - * The first name for the account holder - */ - first_name?: string; - - /** - * The last name for the account holder - */ - last_name?: string; - - /** - * The legal business name for the account holder - */ - legal_business_name?: string; - - /** - * The phone_number for the account holder - */ - phone_number?: string; - } - - export namespace PatchResponse { - /** - * The address for the account holder - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } -} - -export interface AccountHolderListDocumentsResponse { - data?: Array; -} - -export interface AccountHolderSimulateEnrollmentReviewResponse { - /** - * Globally unique identifier for the account holder. - */ - token?: string; - - /** - * Globally unique identifier for the account. - */ - account_token?: string; - - /** - * Deprecated. - */ - beneficial_owner_entities?: Array; - - /** - * Only present when user_type == "BUSINESS". You must submit a list of all direct - * and indirect individuals with 25% or more ownership in the company. A maximum of - * 4 beneficial owners can be submitted. If no individual owns 25% of the company - * you do not need to send beneficial owner information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals?: Array; - - /** - * Only applicable for customers using the KYC-Exempt workflow to enroll authorized - * users of businesses. Pass the account_token of the enrolled business associated - * with the AUTHORIZED_USER in this field. - */ - business_account_token?: string | null; - - /** - * Only present when user_type == "BUSINESS". Information about the business for - * which the account is being opened and KYB is being run. - */ - business_entity?: KYBBusinessEntity; - - /** - * Only present when user_type == "BUSINESS". - * - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, - * - * Managing Member, General Partner, President, Vice President, or Treasurer). This - * can be an executive, or someone who will have program-wide access - * - * to the cards that Lithic will provide. In some cases, this individual could also - * be a beneficial owner listed above. - */ - control_person?: AccountHolderSimulateEnrollmentReviewResponse.ControlPerson; - - /** - * Timestamp of when the account holder was created. - */ - created?: string; - - /** - * (Deprecated. Use control_person.email when user_type == "BUSINESS". Use - * individual.phone_number when user_type == "INDIVIDUAL".) Primary email of - * Account Holder. - */ - email?: string; - - /** - * The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account - * holder is not KYC-Exempt. - */ - exemption_type?: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; - - /** - * Customer-provided token that indicates a relationship with an object outside of - * the Lithic ecosystem. - */ - external_id?: string; - - /** - * Only present when user_type == "INDIVIDUAL". Information about the individual - * for which the account is being opened and KYC is being run. - */ - individual?: AccountHolderSimulateEnrollmentReviewResponse.Individual; - - /** - * Only present when user_type == "BUSINESS". 6-digit North American Industry - * Classification System (NAICS) code for the business. - */ - naics_code?: string; - - /** - * Only present when user_type == "BUSINESS". User-submitted description of the - * business. - */ - nature_of_business?: string; - - /** - * (Deprecated. Use control_person.phone_number when user_type == "BUSINESS". Use - * individual.phone_number when user_type == "INDIVIDUAL".) Primary phone of - * Account Holder, entered in E.164 format. - */ - phone_number?: string; - - /** - * Only present for "KYB_BASIC" and "KYC_ADVANCED" workflows. A list of documents - * required for the account holder to be approved. - */ - required_documents?: Array; - - /** - * (Deprecated. Use verification_application.status instead) KYC and KYB evaluation - * states. - * - * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the - * `ADVANCED` workflow. - */ - status?: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * (Deprecated. Use verification_application.status_reasons) Reason for the - * evaluation status. - */ - status_reasons?: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' - | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' - | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' - | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' - >; - - /** - * The type of Account Holder. If the type is "INDIVIDUAL", the "individual" - * attribute will be present. - * - * If the type is "BUSINESS" then the "business_entity", "control_person", - * "beneficial_owner_individuals", "naics_code", "nature_of_business", and - * "website_url" attributes will be present. - */ - user_type?: 'BUSINESS' | 'INDIVIDUAL'; - - /** - * Information about the most recent identity verification attempt - */ - verification_application?: AccountHolderSimulateEnrollmentReviewResponse.VerificationApplication; - - /** - * Only present when user_type == "BUSINESS". Business's primary website. - */ - website_url?: string; -} - -export namespace AccountHolderSimulateEnrollmentReviewResponse { - export interface BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: BeneficialOwnerIndividual.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export namespace BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } - - /** - * Only present when user_type == "BUSINESS". - * - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, - * - * Managing Member, General Partner, President, Vice President, or Treasurer). This - * can be an executive, or someone who will have program-wide access - * - * to the cards that Lithic will provide. In some cases, this individual could also - * be a beneficial owner listed above. - */ - export interface ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: ControlPerson.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export namespace ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } - - /** - * Only present when user_type == "INDIVIDUAL". Information about the individual - * for which the account is being opened and KYC is being run. - */ - export interface Individual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: Individual.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export namespace Individual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - export interface Address { - /** - * Valid deliverable address (no PO boxes). - */ - address1: string; - - /** - * Name of city. - */ - city: string; - - /** - * Valid country code. Only USA is currently supported, entered in uppercase ISO - * 3166-1 alpha-3 three-character format. - */ - country: string; - - /** - * Valid postal code. Only USA ZIP codes are currently supported, entered as a - * five-digit ZIP or nine-digit ZIP+4. - */ - postal_code: string; - - /** - * Valid state code. Only USA state codes are currently supported, entered in - * uppercase ISO 3166-2 two-character format. - */ - state: string; - - /** - * Unit or apartment number (if applicable). - */ - address2?: string; - } - } - - /** - * Information about the most recent identity verification attempt - */ - export interface VerificationApplication { - /** - * Timestamp of when the application was created. - */ - created: string; - - /** - * KYC and KYB evaluation states. - * - * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the - * `ADVANCED` workflow. - */ - status: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; - - /** - * Reason for the evaluation status. - */ - status_reasons: Array< - | 'ADDRESS_VERIFICATION_FAILURE' - | 'AGE_THRESHOLD_FAILURE' - | 'COMPLETE_VERIFICATION_FAILURE' - | 'DOB_VERIFICATION_FAILURE' - | 'ID_VERIFICATION_FAILURE' - | 'MAX_DOCUMENT_ATTEMPTS' - | 'MAX_RESUBMISSION_ATTEMPTS' - | 'NAME_VERIFICATION_FAILURE' - | 'OTHER_VERIFICATION_FAILURE' - | 'RISK_THRESHOLD_FAILURE' - | 'WATCHLIST_ALERT_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' - | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' - | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' - | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' - >; - - /** - * Timestamp of when the application was last updated. - */ - updated: string; - - /** - * Timestamp of when the application passed the verification process. Only present - * if `status` is `ACCEPTED` - */ - ky_passed_at?: string; - } -} - -export type AccountHolderCreateParams = - | AccountHolderCreateParams.KYB - | AccountHolderCreateParams.KYBDelegated - | AccountHolderCreateParams.KYC - | AccountHolderCreateParams.KYCExempt; - -export declare namespace AccountHolderCreateParams { - export interface KYB { - /** - * You must submit a list of all direct and indirect individuals with 25% or more - * ownership in the company. A maximum of 4 beneficial owners can be submitted. If - * no individual owns 25% of the company you do not need to send beneficial owner - * information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals: Array; - - /** - * Information for business for which the account is being opened and KYB is being - * run. - */ - business_entity: KYB.BusinessEntity; - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - control_person: KYB.ControlPerson; - - /** - * Short description of the company's line of business (i.e., what does the company - * do?). - */ - nature_of_business: string; - - /** - * An RFC 3339 timestamp indicating when the account holder accepted the applicable - * legal agreements (e.g., cardholder terms) as agreed upon during API customer's - * implementation with Lithic. - */ - tos_timestamp: string; - - /** - * Specifies the type of KYB workflow to run. - */ - workflow: 'KYB_BASIC' | 'KYB_BYO'; - - /** - * @deprecated Deprecated. - */ - beneficial_owner_entities?: Array; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * An RFC 3339 timestamp indicating when precomputed KYB was completed on the - * business with a pass result. - * - * This field is required only if workflow type is `KYB_BYO`. - */ - kyb_passed_timestamp?: string; - - /** - * 6-digit North American Industry Classification System (NAICS) code for the - * business. - */ - naics_code?: string; - - /** - * Company website URL. - */ - website_url?: string; - } - - export namespace KYB { - /** - * Individuals associated with a KYB application. Phone number is optional. - */ - export interface BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - /** - * Information for business for which the account is being opened and KYB is being - * run. - */ - export interface BusinessEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - } - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - export interface ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - export interface BeneficialOwnerEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id: string; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers: Array; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - } - } - - export interface KYBDelegated { - /** - * Information for business for which the account is being opened. - */ - business_entity: KYBDelegated.BusinessEntity; - - /** - * You can submit a list of all direct and indirect individuals with 25% or more - * ownership in the company. A maximum of 4 beneficial owners can be submitted. If - * no individual owns 25% of the company you do not need to send beneficial owner - * information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals?: Array; - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - control_person?: KYBDelegated.ControlPerson; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * 6-digit North American Industry Classification System (NAICS) code for the - * business. - */ - naics_code?: string; - - /** - * Short description of the company's line of business (i.e., what does the company - * do?). - */ - nature_of_business?: string; - - /** - * An RFC 3339 timestamp indicating when the account holder accepted the applicable - * legal agreements (e.g., cardholder terms) as agreed upon during API customer's - * implementation with Lithic. - */ - tos_timestamp?: string; - - /** - * Company website URL. - */ - website_url?: string; - - /** - * Specifies the type of KYB workflow to run. - */ - workflow?: 'KYB_DELEGATED'; - } - - export namespace KYBDelegated { - /** - * Information for business for which the account is being opened. - */ - export interface BusinessEntity { - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * Legal (formal) business name. - */ - legal_business_name: string; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers?: Array; - } - - /** - * Individuals associated with a KYB application. Phone number is optional. - */ - export interface BeneficialOwnerIndividual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - export interface ControlPerson { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - } - - export interface KYC { - /** - * Information on individual for whom the account is being opened and KYC is being - * run. - */ - individual: KYC.Individual; - - /** - * An RFC 3339 timestamp indicating when the account holder accepted the applicable - * legal agreements (e.g., cardholder terms) as agreed upon during API customer's - * implementation with Lithic. - */ - tos_timestamp: string; - - /** - * Specifies the type of KYC workflow to run. - */ - workflow: 'KYC_BASIC' | 'KYC_BYO'; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * An RFC 3339 timestamp indicating when precomputed KYC was completed on the - * individual with a pass result. - * - * This field is required only if workflow type is `KYC_BYO`. - */ - kyc_passed_timestamp?: string; - } - - export namespace KYC { - /** - * Information on individual for whom the account is being opened and KYC is being - * run. - */ - export interface Individual { - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address: Shared.Address; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number: string; - } - } - - export interface KYCExempt { - /** - * KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address: Shared.Address; - - /** - * The KYC Exempt user's email - */ - email: string; - - /** - * The KYC Exempt user's first name - */ - first_name: string; - - /** - * Specifies the type of KYC Exempt user - */ - kyc_exemption_type: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; - - /** - * The KYC Exempt user's last name - */ - last_name: string; - - /** - * The KYC Exempt user's phone number, entered in E.164 format. - */ - phone_number: string; - - /** - * Specifies the workflow type. This must be 'KYC_EXEMPT' - */ - workflow: 'KYC_EXEMPT'; - - /** - * Only applicable for customers using the KYC-Exempt workflow to enroll authorized - * users of businesses. Pass the account_token of the enrolled business associated - * with the AUTHORIZED_USER in this field. - */ - business_account_token?: string; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - } -} - -export type AccountHolderUpdateParams = - | AccountHolderUpdateParams.KYBPatchRequest - | AccountHolderUpdateParams.KYCPatchRequest - | AccountHolderUpdateParams.PatchRequest; - -export declare namespace AccountHolderUpdateParams { - export interface KYBPatchRequest { - /** - * @deprecated Deprecated. - */ - beneficial_owner_entities?: Array; - - /** - * You must submit a list of all direct and indirect individuals with 25% or more - * ownership in the company. A maximum of 4 beneficial owners can be submitted. If - * no individual owns 25% of the company you do not need to send beneficial owner - * information. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section I) for more background on individuals that should be included. - */ - beneficial_owner_individuals?: Array; - - /** - * Information for business for which the account is being opened and KYB is being - * run. - */ - business_entity?: KYBPatchRequest.BusinessEntity; - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - control_person?: KYBPatchRequest.ControlPerson; - - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * 6-digit North American Industry Classification System (NAICS) code for the - * business. - */ - naics_code?: string; - - /** - * Short description of the company's line of business (i.e., what does the company - * do?). - */ - nature_of_business?: string; - - /** - * Company website URL. - */ - website_url?: string; - } - - export namespace KYBPatchRequest { - export interface BeneficialOwnerEntity { - /** - * Globally unique identifier for an entity. - */ - entity_token: string; - - /** - * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address?: AccountHoldersAPI.AddressUpdate; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id?: string; - - /** - * Legal (formal) business name. - */ - legal_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers?: Array; - } - - /** - * Individuals associated with a KYB application. Phone number is optional. - */ - export interface BeneficialOwnerIndividual { - /** - * Globally unique identifier for an entity. - */ - entity_token: string; - - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: AccountHoldersAPI.AddressUpdate; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - - /** - * Information for business for which the account is being opened and KYB is being - * run. - */ - export interface BusinessEntity { - /** - * Globally unique identifier for an entity. - */ - entity_token: string; - - /** - * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ - address?: AccountHoldersAPI.AddressUpdate; - - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - dba_business_name?: string; - - /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. - */ - government_id?: string; - - /** - * Legal (formal) business name. - */ - legal_business_name?: string; - - /** - * Parent company name (if applicable). - */ - parent_company?: string; - - /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. - */ - phone_numbers?: Array; - } - - /** - * An individual with significant responsibility for managing the legal entity - * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating - * Officer, Managing Member, General Partner, President, Vice President, or - * Treasurer). This can be an executive, or someone who will have program-wide - * access to the cards that Lithic will provide. In some cases, this individual - * could also be a beneficial owner listed above. See - * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) - * (Section II) for more background. - */ - export interface ControlPerson { - /** - * Globally unique identifier for an entity. - */ - entity_token: string; - - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: AccountHoldersAPI.AddressUpdate; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - } - - export interface KYCPatchRequest { - /** - * A user provided id that can be used to link an account holder with an external - * system - */ - external_id?: string; - - /** - * Information on the individual for whom the account is being opened and KYC is - * being run. - */ - individual?: KYCPatchRequest.Individual; - } - - export namespace KYCPatchRequest { - /** - * Information on the individual for whom the account is being opened and KYC is - * being run. - */ - export interface Individual { - /** - * Globally unique identifier for an entity. - */ - entity_token: string; - - /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. - */ - address?: AccountHoldersAPI.AddressUpdate; - - /** - * Individual's date of birth, as an RFC 3339 date. - */ - dob?: string; - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. - */ - email?: string; - - /** - * Individual's first name, as it appears on government-issued identity documents. - */ - first_name?: string; - - /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - government_id?: string; - - /** - * Individual's last name, as it appears on government-issued identity documents. - */ - last_name?: string; - - /** - * Individual's phone number, entered in E.164 format. - */ - phone_number?: string; - } - } - - export interface PatchRequest { - /** - * Allowed for: KYC-Exempt, BYO-KYC, BYO-KYB. - */ - address?: AddressUpdate; - - /** - * Allowed for: KYC-Exempt, BYO-KYC. The token of the business account to which the - * account holder is associated. - */ - business_account_token?: string; - - /** - * Allowed for all Account Holders. Account holder's email address. The primary - * purpose of this field is for cardholder identification and verification during - * the digital wallet tokenization process. - */ - email?: string; - - /** - * Allowed for KYC-Exempt, BYO-KYC. Account holder's first name. - */ - first_name?: string; - - /** - * Allowed for KYC-Exempt, BYO-KYC. Account holder's last name. - */ - last_name?: string; - - /** - * Allowed for BYO-KYB. Legal business name of the account holder. - */ - legal_business_name?: string; - - /** - * Allowed for all Account Holders. Account holder's phone number, entered in E.164 - * format. The primary purpose of this field is for cardholder identification and - * verification during the digital wallet tokenization process. - */ - phone_number?: string; - } -} - -export interface AccountHolderListParams { - /** - * Date string in RFC 3339 format. Only entries created after the specified time - * will be included. UTC time zone. - */ - begin?: string; - - /** - * Email address of the account holder. The query must be an exact match, case - * insensitive. - */ - email?: string; - - /** - * Date string in RFC 3339 format. Only entries created before the specified time - * will be included. UTC time zone. - */ - end?: string; - - /** - * A cursor representing an item's token before which a page of results should end. - * Used to retrieve the previous page of results before this item. - */ - ending_before?: string; - - /** - * If applicable, represents the external_id associated with the account_holder. - */ - external_id?: string; - - /** - * (Individual Account Holders only) The first name of the account holder. The - * query is case insensitive and supports partial matches. - */ - first_name?: string; - - /** - * (Individual Account Holders only) The last name of the account holder. The query - * is case insensitive and supports partial matches. - */ - last_name?: string; - - /** - * (Business Account Holders only) The legal business name of the account holder. - * The query is case insensitive and supports partial matches. - */ - legal_business_name?: string; - - /** - * The number of account_holders to limit the response to. - */ - limit?: number; - - /** - * Phone number of the account holder. The query must be an exact match. - */ - phone_number?: string; - - /** - * A cursor representing an item's token after which a page of results should - * begin. Used to retrieve the next page of results after this item. - */ - starting_after?: string; -} - -export interface AccountHolderRetrieveDocumentParams { - /** - * Globally unique identifier for the account holder. - */ - account_holder_token: string; -} - -export interface AccountHolderSimulateEnrollmentDocumentReviewParams { - /** - * The account holder document upload which to perform the simulation upon. - */ - document_upload_token: string; - - /** - * An account holder document's upload status for use within the simulation. - */ - status: 'UPLOADED' | 'ACCEPTED' | 'REJECTED' | 'PARTIAL_APPROVAL'; - - /** - * A list of status reasons associated with a KYB account holder in PENDING_REVIEW - */ - accepted_entity_status_reasons?: Array; - - /** - * Status reason that will be associated with the simulated account holder status. - * Only required for a `REJECTED` status or `PARTIAL_APPROVAL` status. - */ - status_reason?: - | 'DOCUMENT_MISSING_REQUIRED_DATA' - | 'DOCUMENT_UPLOAD_TOO_BLURRY' - | 'FILE_SIZE_TOO_LARGE' - | 'INVALID_DOCUMENT_TYPE' - | 'INVALID_DOCUMENT_UPLOAD' - | 'INVALID_ENTITY' - | 'DOCUMENT_EXPIRED' - | 'DOCUMENT_ISSUED_GREATER_THAN_30_DAYS' - | 'DOCUMENT_TYPE_NOT_SUPPORTED' - | 'UNKNOWN_FAILURE_REASON' - | 'UNKNOWN_ERROR'; -} - -export interface AccountHolderSimulateEnrollmentReviewParams { - /** - * The account holder which to perform the simulation upon. - */ - account_holder_token?: string; - - /** - * An account holder's status for use within the simulation. - */ - status?: 'ACCEPTED' | 'REJECTED' | 'PENDING_REVIEW'; - - /** - * Status reason that will be associated with the simulated account holder status. - * Only required for a `REJECTED` status. - */ - status_reasons?: Array< - | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' - | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' - | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' - | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' - | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' - | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' - | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' - | 'BENEFICIAL_OWNER_INDIVIDUAL_DOB_VERIFICATION_FAILURE' - | 'BENEFICIAL_OWNER_INDIVIDUAL_BLOCKLIST_ALERT_FAILURE' - | 'BENEFICIAL_OWNER_INDIVIDUAL_ID_VERIFICATION_FAILURE' - | 'BENEFICIAL_OWNER_INDIVIDUAL_NAME_VERIFICATION_FAILURE' - >; -} - -export interface AccountHolderUploadDocumentParams { - /** - * The type of document to upload - */ - document_type: - | 'EIN_LETTER' - | 'TAX_RETURN' - | 'OPERATING_AGREEMENT' - | 'CERTIFICATE_OF_FORMATION' - | 'DRIVERS_LICENSE' - | 'PASSPORT' - | 'PASSPORT_CARD' - | 'CERTIFICATE_OF_GOOD_STANDING' - | 'ARTICLES_OF_INCORPORATION' - | 'ARTICLES_OF_ORGANIZATION' - | 'BYLAWS' - | 'GOVERNMENT_BUSINESS_LICENSE' - | 'PARTNERSHIP_AGREEMENT' - | 'SS4_FORM' - | 'BANK_STATEMENT' - | 'UTILITY_BILL_STATEMENT' - | 'SSN_CARD' - | 'ITIN_LETTER' - | 'FINCEN_BOI_REPORT'; - - /** - * Globally unique identifier for the entity. - */ - entity_token: string; -} - -export declare namespace AccountHolders { - export { - type AccountHolder as AccountHolder, - type AddressUpdate as AddressUpdate, - type KYB as KYB, - type KYBBusinessEntity as KYBBusinessEntity, - type KYC as KYC, - type KYCExempt as KYCExempt, - type RequiredDocument as RequiredDocument, - type AccountHolderCreateResponse as AccountHolderCreateResponse, - type AccountHolderUpdateResponse as AccountHolderUpdateResponse, - type AccountHolderListDocumentsResponse as AccountHolderListDocumentsResponse, - type AccountHolderSimulateEnrollmentReviewResponse as AccountHolderSimulateEnrollmentReviewResponse, - type AccountHoldersSinglePage as AccountHoldersSinglePage, - type AccountHolderCreateParams as AccountHolderCreateParams, - type AccountHolderUpdateParams as AccountHolderUpdateParams, - type AccountHolderListParams as AccountHolderListParams, - type AccountHolderRetrieveDocumentParams as AccountHolderRetrieveDocumentParams, - type AccountHolderSimulateEnrollmentDocumentReviewParams as AccountHolderSimulateEnrollmentDocumentReviewParams, - type AccountHolderSimulateEnrollmentReviewParams as AccountHolderSimulateEnrollmentReviewParams, - type AccountHolderUploadDocumentParams as AccountHolderUploadDocumentParams, - }; -} +export * from './account-holders/index'; diff --git a/src/resources/account-holders/account-holders.ts b/src/resources/account-holders/account-holders.ts new file mode 100644 index 00000000..43e56e22 --- /dev/null +++ b/src/resources/account-holders/account-holders.ts @@ -0,0 +1,3530 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as AccountHoldersAPI from './account-holders'; +import * as Shared from '../shared'; +import * as EntitiesAPI from './entities'; +import { + AccountHolderEntity, + Entities, + EntityCreateParams, + EntityCreateResponse, + EntityDeleteParams, +} from './entities'; +import { APIPromise } from '../../core/api-promise'; +import { PagePromise, SinglePage } from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class AccountHolders extends APIResource { + entities: EntitiesAPI.Entities = new EntitiesAPI.Entities(this._client); + + /** + * Create an account holder and initiate the appropriate onboarding workflow. + * Account holders and accounts have a 1:1 relationship. When an account holder is + * successfully created an associated account is also created. All calls to this + * endpoint will return a synchronous response. The response time will depend on + * the workflow. In some cases, the response may indicate the workflow is under + * review or further action will be needed to complete the account creation + * process. This endpoint can only be used on accounts that are part of the program + * that the calling API key manages. + * + * @example + * ```ts + * const accountHolder = await client.accountHolders.create({ + * beneficial_owner_individuals: [ + * { + * address: { ... }, + * dob: '1991-03-08T08:00:00Z', + * email: 'tim@left-earth.com', + * first_name: 'Timmy', + * government_id: '211-23-1412', + * last_name: 'Turner', + * phone_number: '+15555555555', + * }, + * ], + * business_entity: { + * address: { ... }, + * dba_business_name: 'Example Business Solutions', + * government_id: '12-3456789', + * legal_business_name: 'Busy Business, Inc.', + * phone_numbers: ['+15555555555'], + * }, + * control_person: { + * address: { ... }, + * dob: '1991-03-08T08:00:00Z', + * email: 'tom@middle-pluto.com', + * first_name: 'Tom', + * government_id: '111-23-1412', + * last_name: 'Timothy', + * phone_number: '+15555555555', + * }, + * nature_of_business: 'Software company selling solutions to the restaurant industry', + * tos_timestamp: '2022-03-08T08:00:00Z', + * workflow: 'KYB_BYO', + * beneficial_owner_entities: [ + * { + * address: { ... }, + * dba_business_name: 'MHoldings', + * government_id: '98-7654321', + * legal_business_name: 'Majority Holdings LLC', + * phone_numbers: ['+15555555555'], + * }, + * ], + * kyb_passed_timestamp: '2022-03-08T08:00:00Z', + * naics_code: '541512', + * website_url: 'https://www.mybusiness.com', + * }); + * ``` + */ + create(body: AccountHolderCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/v1/account_holders', { + body, + timeout: (this._client as any)._options.timeout ?? 300000, + ...options, + }); + } + + /** + * Get an Individual or Business Account Holder and/or their KYC or KYB evaluation + * status. + * + * @example + * ```ts + * const accountHolder = await client.accountHolders.retrieve( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` + */ + retrieve(accountHolderToken: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/v1/account_holders/${accountHolderToken}`, options); + } + + /** + * Update the information associated with a particular account holder (including + * business owners and control persons associated to a business account). If Lithic + * is performing KYB or KYC and additional verification is required we will run the + * individual's or business's updated information again and return whether the + * status is accepted or pending (i.e., further action required). All calls to this + * endpoint will return a synchronous response. The response time will depend on + * the workflow. In some cases, the response may indicate the workflow is under + * review or further action will be needed to complete the account creation + * process. This endpoint can only be used on existing accounts that are part of + * the program that the calling API key manages. + * + * @example + * ```ts + * const accountHolder = await client.accountHolders.update( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * business_entity: { + * entity_token: '83cf25ae-c14f-4d10-9fa2-0119f36c7286', + * address: { postal_code: '61023' }, + * }, + * control_person: { + * entity_token: 'fd771a07-c5c2-42f3-a53c-a6c79c6c0d07', + * address: { postal_code: '68023' }, + * }, + * naics_code: '541512', + * website_url: 'https://www.mynewbusiness.com', + * }, + * ); + * ``` + */ + update( + accountHolderToken: string, + body: AccountHolderUpdateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.patch(path`/v1/account_holders/${accountHolderToken}`, { body, ...options }); + } + + /** + * Get a list of individual or business account holders and their KYC or KYB + * evaluation status. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const accountHolder of client.accountHolders.list()) { + * // ... + * } + * ``` + */ + list( + query: AccountHolderListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/v1/account_holders', SinglePage, { query, ...options }); + } + + /** + * Retrieve the status of account holder document uploads, or retrieve the upload + * URLs to process your image uploads. + * + * Note that this is not equivalent to checking the status of the KYC evaluation + * overall (a document may be successfully uploaded but not be sufficient for KYC + * to pass). + * + * In the event your upload URLs have expired, calling this endpoint will refresh + * them. Similarly, in the event a previous account holder document upload has + * failed, you can use this endpoint to get a new upload URL for the failed image + * upload. + * + * When a new document upload is generated for a failed attempt, the response will + * show an additional entry in the `required_document_uploads` list in a `PENDING` + * state for the corresponding `image_type`. + * + * @example + * ```ts + * const response = await client.accountHolders.listDocuments( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` + */ + listDocuments( + accountHolderToken: string, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/v1/account_holders/${accountHolderToken}/documents`, options); + } + + /** + * Check the status of an account holder document upload, or retrieve the upload + * URLs to process your image uploads. + * + * Note that this is not equivalent to checking the status of the KYC evaluation + * overall (a document may be successfully uploaded but not be sufficient for KYC + * to pass). + * + * In the event your upload URLs have expired, calling this endpoint will refresh + * them. Similarly, in the event a document upload has failed, you can use this + * endpoint to get a new upload URL for the failed image upload. + * + * When a new account holder document upload is generated for a failed attempt, the + * response will show an additional entry in the `required_document_uploads` array + * in a `PENDING` state for the corresponding `image_type`. + * + * @example + * ```ts + * const document = + * await client.accountHolders.retrieveDocument( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * account_holder_token: + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * }, + * ); + * ``` + */ + retrieveDocument( + documentToken: string, + params: AccountHolderRetrieveDocumentParams, + options?: RequestOptions, + ): APIPromise { + const { account_holder_token } = params; + return this._client.get( + path`/v1/account_holders/${account_holder_token}/documents/${documentToken}`, + options, + ); + } + + /** + * Simulates a review for an account holder document upload. + * + * @example + * ```ts + * const document = + * await client.accountHolders.simulateEnrollmentDocumentReview( + * { + * document_upload_token: + * 'b11cd67b-0a52-4180-8365-314f3def5426', + * status: 'UPLOADED', + * }, + * ); + * ``` + */ + simulateEnrollmentDocumentReview( + body: AccountHolderSimulateEnrollmentDocumentReviewParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/v1/simulate/account_holders/enrollment_document_review', { body, ...options }); + } + + /** + * Simulates an enrollment review for an account holder. This endpoint is only + * applicable for workflows that may required intervention such as `KYB_BASIC`. + * + * @example + * ```ts + * const response = + * await client.accountHolders.simulateEnrollmentReview({ + * account_holder_token: + * '1415964d-4400-4d79-9fb3-eee0faaee4e4', + * status: 'ACCEPTED', + * status_reasons: [], + * }); + * ``` + */ + simulateEnrollmentReview( + body: AccountHolderSimulateEnrollmentReviewParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post('/v1/simulate/account_holders/enrollment_review', { body, ...options }); + } + + /** + * Use this endpoint to identify which type of supported government-issued + * documentation you will upload for further verification. It will return two URLs + * to upload your document images to - one for the front image and one for the back + * image. + * + * This endpoint is only valid for evaluations in a `PENDING_DOCUMENT` state. + * + * Uploaded images must either be a `jpg` or `png` file, and each must be less than + * 15 MiB. Once both required uploads have been successfully completed, your + * document will be run through KYC verification. + * + * If you have registered a webhook, you will receive evaluation updates for any + * document submission evaluations, as well as for any failed document uploads. + * + * Two document submission attempts are permitted via this endpoint before a + * `REJECTED` status is returned and the account creation process is ended. + * Currently only one type of account holder document is supported per KYC + * verification. + * + * @example + * ```ts + * const document = await client.accountHolders.uploadDocument( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * document_type: 'EIN_LETTER', + * entity_token: '83cf25ae-c14f-4d10-9fa2-0119f36c7286', + * }, + * ); + * ``` + */ + uploadDocument( + accountHolderToken: string, + body: AccountHolderUploadDocumentParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post(path`/v1/account_holders/${accountHolderToken}/documents`, { body, ...options }); + } +} + +export type AccountHoldersSinglePage = SinglePage; + +export interface AccountHolder { + /** + * Globally unique identifier for the account holder. + */ + token: string; + + /** + * Timestamp of when the account holder was created. + */ + created: string; + + /** + * Globally unique identifier for the account. + */ + account_token?: string; + + /** + * @deprecated Deprecated. + */ + beneficial_owner_entities?: Array; + + /** + * Only present when user_type == "BUSINESS". You must submit a list of all direct + * and indirect individuals with 25% or more ownership in the company. A maximum of + * 4 beneficial owners can be submitted. If no individual owns 25% of the company + * you do not need to send beneficial owner information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals?: Array; + + /** + * Only applicable for customers using the KYC-Exempt workflow to enroll authorized + * users of businesses. Pass the account_token of the enrolled business associated + * with the AUTHORIZED_USER in this field. + */ + business_account_token?: string; + + /** + * Only present when user_type == "BUSINESS". Information about the business for + * which the account is being opened and KYB is being run. + */ + business_entity?: AccountHolder.BusinessEntity; + + /** + * Only present when user_type == "BUSINESS". An individual with significant + * responsibility for managing the legal entity (e.g., a Chief Executive Officer, + * Chief Financial Officer, Chief Operating Officer, Managing Member, General + * Partner, President, Vice President, or Treasurer). This can be an executive, or + * someone who will have program-wide access to the cards that Lithic will provide. + * In some cases, this individual could also be a beneficial owner listed above. + */ + control_person?: AccountHolder.ControlPerson; + + /** + * (Deprecated. Use control_person.email when user_type == "BUSINESS". Use + * individual.phone_number when user_type == "INDIVIDUAL".) Primary email of + * Account Holder. + */ + email?: string; + + /** + * The type of KYC exemption for a KYC-Exempt Account Holder. + */ + exemption_type?: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; + + /** + * Customer-provided token that indicates a relationship with an object outside of + * the Lithic ecosystem. + */ + external_id?: string; + + /** + * Only present when user_type == "INDIVIDUAL". Information about the individual + * for which the account is being opened and KYC is being run. + */ + individual?: AccountHolder.Individual; + + /** + * Only present when user_type == "BUSINESS". 6-digit North American Industry + * Classification System (NAICS) code for the business. + */ + naics_code?: string; + + /** + * Only present when user_type == "BUSINESS". User-submitted description of the + * business. + */ + nature_of_business?: string; + + /** + * (Deprecated. Use control_person.phone_number when user_type == "BUSINESS". Use + * individual.phone_number when user_type == "INDIVIDUAL".) Primary phone of + * Account Holder, entered in E.164 format. + */ + phone_number?: string; + + /** + * Only present for "KYB_BASIC" workflow. A list of documents required for the + * account holder to be approved. + */ + required_documents?: Array; + + /** + * (Deprecated. Use verification_application.status instead) + * + * KYC and KYB evaluation states. + * + * Note: + * + * - `PENDING_REVIEW` is only applicable for the `KYB_BASIC` workflow. + */ + status?: 'ACCEPTED' | 'PENDING_REVIEW' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * (Deprecated. Use verification_application.status_reasons) + * + * Reason for the evaluation status. + */ + status_reasons?: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + >; + + /** + * The type of Account Holder. If the type is "INDIVIDUAL", the "individual" + * attribute will be present. If the type is "BUSINESS" then the "business_entity", + * "control_person", "beneficial_owner_individuals", "naics_code", + * "nature_of_business", and "website_url" attributes will be present. + */ + user_type?: 'BUSINESS' | 'INDIVIDUAL'; + + /** + * Information about the most recent identity verification attempt + */ + verification_application?: AccountHolder.VerificationApplication; + + /** + * Only present when user_type == "BUSINESS". Business's primary website. + */ + website_url?: string; +} + +export namespace AccountHolder { + export interface BeneficialOwnerEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name: string; + + /** + * Globally unique identifier for the entity. + */ + entity_token: string; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + } + + /** + * Information about an individual associated with an account holder. A subset of + * the information provided via KYC. For example, we do not return the government + * id. + */ + export interface BeneficialOwnerIndividual { + /** + * Individual's current address + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. + */ + email: string; + + /** + * Globally unique identifier for the entity. + */ + entity_token: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number: string; + } + + /** + * Only present when user_type == "BUSINESS". Information about the business for + * which the account is being opened and KYB is being run. + */ + export interface BusinessEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name: string; + + /** + * Globally unique identifier for the entity. + */ + entity_token: string; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + } + + /** + * Only present when user_type == "BUSINESS". An individual with significant + * responsibility for managing the legal entity (e.g., a Chief Executive Officer, + * Chief Financial Officer, Chief Operating Officer, Managing Member, General + * Partner, President, Vice President, or Treasurer). This can be an executive, or + * someone who will have program-wide access to the cards that Lithic will provide. + * In some cases, this individual could also be a beneficial owner listed above. + */ + export interface ControlPerson { + /** + * Individual's current address + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. + */ + email: string; + + /** + * Globally unique identifier for the entity. + */ + entity_token: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number: string; + } + + /** + * Only present when user_type == "INDIVIDUAL". Information about the individual + * for which the account is being opened and KYC is being run. + */ + export interface Individual { + /** + * Individual's current address + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. + */ + email: string; + + /** + * Globally unique identifier for the entity. + */ + entity_token: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number: string; + } + + /** + * Information about the most recent identity verification attempt + */ + export interface VerificationApplication { + /** + * Timestamp of when the application was created. + */ + created?: string; + + /** + * KYC and KYB evaluation states. + * + * Note: + * + * - `PENDING_REVIEW` is only applicable for the `KYB_BASIC` workflow. + */ + status?: 'ACCEPTED' | 'PENDING_REVIEW' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * Reason for the evaluation status. + */ + status_reasons?: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + >; + + /** + * Timestamp of when the application was last updated. + */ + updated?: string; + } +} + +export interface AddressUpdate { + /** + * Valid deliverable address (no PO boxes). + */ + address1?: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + + /** + * Name of city. + */ + city?: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country?: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code?: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state?: string; +} + +export interface KYB { + /** + * You must submit a list of all direct and indirect individuals with 25% or more + * ownership in the company. A maximum of 4 beneficial owners can be submitted. If + * no individual owns 25% of the company you do not need to send beneficial owner + * information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals: Array; + + /** + * Information for business for which the account is being opened and KYB is being + * run. + */ + business_entity: KYB.BusinessEntity; + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + control_person: KYB.ControlPerson; + + /** + * Short description of the company's line of business (i.e., what does the company + * do?). + */ + nature_of_business: string; + + /** + * An RFC 3339 timestamp indicating when the account holder accepted the applicable + * legal agreements (e.g., cardholder terms) as agreed upon during API customer's + * implementation with Lithic. + */ + tos_timestamp: string; + + /** + * Specifies the type of KYB workflow to run. + */ + workflow: 'KYB_BASIC' | 'KYB_BYO'; + + /** + * @deprecated Deprecated. + */ + beneficial_owner_entities?: Array; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * An RFC 3339 timestamp indicating when precomputed KYB was completed on the + * business with a pass result. + * + * This field is required only if workflow type is `KYB_BYO`. + */ + kyb_passed_timestamp?: string; + + /** + * 6-digit North American Industry Classification System (NAICS) code for the + * business. + */ + naics_code?: string; + + /** + * Company website URL. + */ + website_url?: string; +} + +export namespace KYB { + /** + * Individuals associated with a KYB application. Phone number is optional. + */ + export interface BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + /** + * Information for business for which the account is being opened and KYB is being + * run. + */ + export interface BusinessEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + } + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + export interface ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export interface BeneficialOwnerEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + } +} + +export interface KYBBusinessEntity { + /** + * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: KYBBusinessEntity.Address; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; +} + +export namespace KYBBusinessEntity { + /** + * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } +} + +export interface KYC { + /** + * Information on individual for whom the account is being opened and KYC is being + * run. + */ + individual: KYC.Individual; + + /** + * An RFC 3339 timestamp indicating when the account holder accepted the applicable + * legal agreements (e.g., cardholder terms) as agreed upon during API customer's + * implementation with Lithic. + */ + tos_timestamp: string; + + /** + * Specifies the type of KYC workflow to run. + */ + workflow: 'KYC_BASIC' | 'KYC_BYO'; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * An RFC 3339 timestamp indicating when precomputed KYC was completed on the + * individual with a pass result. + * + * This field is required only if workflow type is `KYC_BYO`. + */ + kyc_passed_timestamp?: string; +} + +export namespace KYC { + /** + * Information on individual for whom the account is being opened and KYC is being + * run. + */ + export interface Individual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number: string; + } +} + +export interface KYCExempt { + /** + * KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * The KYC Exempt user's email + */ + email: string; + + /** + * The KYC Exempt user's first name + */ + first_name: string; + + /** + * Specifies the type of KYC Exempt user + */ + kyc_exemption_type: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; + + /** + * The KYC Exempt user's last name + */ + last_name: string; + + /** + * The KYC Exempt user's phone number, entered in E.164 format. + */ + phone_number: string; + + /** + * Specifies the workflow type. This must be 'KYC_EXEMPT' + */ + workflow: 'KYC_EXEMPT'; + + /** + * Only applicable for customers using the KYC-Exempt workflow to enroll authorized + * users of businesses. Pass the account_token of the enrolled business associated + * with the AUTHORIZED_USER in this field. + */ + business_account_token?: string; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; +} + +export interface RequiredDocument { + /** + * Globally unique identifier for an entity. + */ + entity_token: string; + + /** + * Provides the status reasons that will be satisfied by providing one of the valid + * documents. + */ + status_reasons: Array; + + /** + * A list of valid documents that will satisfy the KYC requirements for the + * specified entity. + */ + valid_documents: Array; +} + +export interface AccountHolderCreateResponse { + /** + * Globally unique identifier for the account holder. + */ + token: string; + + /** + * Globally unique identifier for the account. + */ + account_token: string; + + /** + * KYC and KYB evaluation states. + * + * Note: + * + * - `PENDING_REVIEW` is only applicable for the `KYB_BASIC` workflow. + */ + status: 'ACCEPTED' | 'PENDING_REVIEW' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * Reason for the evaluation status. + */ + status_reasons: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + >; + + /** + * Timestamp of when the account holder was created. + */ + created?: string; + + /** + * Customer-provided token that indicates a relationship with an object outside of + * the Lithic ecosystem. + */ + external_id?: string; + + /** + * Only present for "KYB_BASIC" workflow. A list of documents required for the + * account holder to be approved. + */ + required_documents?: Array; +} + +export type AccountHolderUpdateResponse = + | AccountHolderUpdateResponse.KYBKYCPatchResponse + | AccountHolderUpdateResponse.PatchResponse; + +export namespace AccountHolderUpdateResponse { + export interface KYBKYCPatchResponse { + /** + * Globally unique identifier for the account holder. + */ + token?: string; + + /** + * Globally unique identifier for the account. + */ + account_token?: string; + + /** + * Deprecated. + */ + beneficial_owner_entities?: Array; + + /** + * Only present when user_type == "BUSINESS". You must submit a list of all direct + * and indirect individuals with 25% or more ownership in the company. A maximum of + * 4 beneficial owners can be submitted. If no individual owns 25% of the company + * you do not need to send beneficial owner information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals?: Array; + + /** + * Only applicable for customers using the KYC-Exempt workflow to enroll authorized + * users of businesses. Pass the account_token of the enrolled business associated + * with the AUTHORIZED_USER in this field. + */ + business_account_token?: string | null; + + /** + * Only present when user_type == "BUSINESS". Information about the business for + * which the account is being opened and KYB is being run. + */ + business_entity?: AccountHoldersAPI.KYBBusinessEntity; + + /** + * Only present when user_type == "BUSINESS". + * + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, + * + * Managing Member, General Partner, President, Vice President, or Treasurer). This + * can be an executive, or someone who will have program-wide access + * + * to the cards that Lithic will provide. In some cases, this individual could also + * be a beneficial owner listed above. + */ + control_person?: KYBKYCPatchResponse.ControlPerson; + + /** + * Timestamp of when the account holder was created. + */ + created?: string; + + /** + * (Deprecated. Use control_person.email when user_type == "BUSINESS". Use + * individual.phone_number when user_type == "INDIVIDUAL".) Primary email of + * Account Holder. + */ + email?: string; + + /** + * The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account + * holder is not KYC-Exempt. + */ + exemption_type?: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; + + /** + * Customer-provided token that indicates a relationship with an object outside of + * the Lithic ecosystem. + */ + external_id?: string; + + /** + * Only present when user_type == "INDIVIDUAL". Information about the individual + * for which the account is being opened and KYC is being run. + */ + individual?: KYBKYCPatchResponse.Individual; + + /** + * Only present when user_type == "BUSINESS". 6-digit North American Industry + * Classification System (NAICS) code for the business. + */ + naics_code?: string; + + /** + * Only present when user_type == "BUSINESS". User-submitted description of the + * business. + */ + nature_of_business?: string; + + /** + * (Deprecated. Use control_person.phone_number when user_type == "BUSINESS". Use + * individual.phone_number when user_type == "INDIVIDUAL".) Primary phone of + * Account Holder, entered in E.164 format. + */ + phone_number?: string; + + /** + * Only present for "KYB_BASIC" and "KYC_ADVANCED" workflows. A list of documents + * required for the account holder to be approved. + */ + required_documents?: Array; + + /** + * (Deprecated. Use verification_application.status instead) KYC and KYB evaluation + * states. + * + * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the + * `ADVANCED` workflow. + */ + status?: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * (Deprecated. Use verification_application.status_reasons) Reason for the + * evaluation status. + */ + status_reasons?: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + >; + + /** + * The type of Account Holder. If the type is "INDIVIDUAL", the "individual" + * attribute will be present. + * + * If the type is "BUSINESS" then the "business_entity", "control_person", + * "beneficial_owner_individuals", "naics_code", "nature_of_business", and + * "website_url" attributes will be present. + */ + user_type?: 'BUSINESS' | 'INDIVIDUAL'; + + /** + * Information about the most recent identity verification attempt + */ + verification_application?: KYBKYCPatchResponse.VerificationApplication; + + /** + * Only present when user_type == "BUSINESS". Business's primary website. + */ + website_url?: string; + } + + export namespace KYBKYCPatchResponse { + export interface BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: BeneficialOwnerIndividual.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export namespace BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } + + /** + * Only present when user_type == "BUSINESS". + * + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, + * + * Managing Member, General Partner, President, Vice President, or Treasurer). This + * can be an executive, or someone who will have program-wide access + * + * to the cards that Lithic will provide. In some cases, this individual could also + * be a beneficial owner listed above. + */ + export interface ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: ControlPerson.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export namespace ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } + + /** + * Only present when user_type == "INDIVIDUAL". Information about the individual + * for which the account is being opened and KYC is being run. + */ + export interface Individual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: Individual.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export namespace Individual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } + + /** + * Information about the most recent identity verification attempt + */ + export interface VerificationApplication { + /** + * Timestamp of when the application was created. + */ + created: string; + + /** + * KYC and KYB evaluation states. + * + * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the + * `ADVANCED` workflow. + */ + status: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * Reason for the evaluation status. + */ + status_reasons: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + >; + + /** + * Timestamp of when the application was last updated. + */ + updated: string; + + /** + * Timestamp of when the application passed the verification process. Only present + * if `status` is `ACCEPTED` + */ + ky_passed_at?: string; + } + } + + export interface PatchResponse { + /** + * The token for the account holder that was updated + */ + token?: string; + + /** + * The address for the account holder + */ + address?: PatchResponse.Address; + + /** + * The token for the business account that the account holder is associated with + */ + business_account_token?: string | null; + + /** + * The email for the account holder + */ + email?: string; + + /** + * The first name for the account holder + */ + first_name?: string; + + /** + * The last name for the account holder + */ + last_name?: string; + + /** + * The legal business name for the account holder + */ + legal_business_name?: string; + + /** + * The phone_number for the account holder + */ + phone_number?: string; + } + + export namespace PatchResponse { + /** + * The address for the account holder + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } +} + +export interface AccountHolderListDocumentsResponse { + data?: Array; +} + +export interface AccountHolderSimulateEnrollmentReviewResponse { + /** + * Globally unique identifier for the account holder. + */ + token?: string; + + /** + * Globally unique identifier for the account. + */ + account_token?: string; + + /** + * Deprecated. + */ + beneficial_owner_entities?: Array; + + /** + * Only present when user_type == "BUSINESS". You must submit a list of all direct + * and indirect individuals with 25% or more ownership in the company. A maximum of + * 4 beneficial owners can be submitted. If no individual owns 25% of the company + * you do not need to send beneficial owner information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals?: Array; + + /** + * Only applicable for customers using the KYC-Exempt workflow to enroll authorized + * users of businesses. Pass the account_token of the enrolled business associated + * with the AUTHORIZED_USER in this field. + */ + business_account_token?: string | null; + + /** + * Only present when user_type == "BUSINESS". Information about the business for + * which the account is being opened and KYB is being run. + */ + business_entity?: KYBBusinessEntity; + + /** + * Only present when user_type == "BUSINESS". + * + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, + * + * Managing Member, General Partner, President, Vice President, or Treasurer). This + * can be an executive, or someone who will have program-wide access + * + * to the cards that Lithic will provide. In some cases, this individual could also + * be a beneficial owner listed above. + */ + control_person?: AccountHolderSimulateEnrollmentReviewResponse.ControlPerson; + + /** + * Timestamp of when the account holder was created. + */ + created?: string; + + /** + * (Deprecated. Use control_person.email when user_type == "BUSINESS". Use + * individual.phone_number when user_type == "INDIVIDUAL".) Primary email of + * Account Holder. + */ + email?: string; + + /** + * The type of KYC exemption for a KYC-Exempt Account Holder. "None" if the account + * holder is not KYC-Exempt. + */ + exemption_type?: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; + + /** + * Customer-provided token that indicates a relationship with an object outside of + * the Lithic ecosystem. + */ + external_id?: string; + + /** + * Only present when user_type == "INDIVIDUAL". Information about the individual + * for which the account is being opened and KYC is being run. + */ + individual?: AccountHolderSimulateEnrollmentReviewResponse.Individual; + + /** + * Only present when user_type == "BUSINESS". 6-digit North American Industry + * Classification System (NAICS) code for the business. + */ + naics_code?: string; + + /** + * Only present when user_type == "BUSINESS". User-submitted description of the + * business. + */ + nature_of_business?: string; + + /** + * (Deprecated. Use control_person.phone_number when user_type == "BUSINESS". Use + * individual.phone_number when user_type == "INDIVIDUAL".) Primary phone of + * Account Holder, entered in E.164 format. + */ + phone_number?: string; + + /** + * Only present for "KYB_BASIC" and "KYC_ADVANCED" workflows. A list of documents + * required for the account holder to be approved. + */ + required_documents?: Array; + + /** + * (Deprecated. Use verification_application.status instead) KYC and KYB evaluation + * states. + * + * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the + * `ADVANCED` workflow. + */ + status?: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * (Deprecated. Use verification_application.status_reasons) Reason for the + * evaluation status. + */ + status_reasons?: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + >; + + /** + * The type of Account Holder. If the type is "INDIVIDUAL", the "individual" + * attribute will be present. + * + * If the type is "BUSINESS" then the "business_entity", "control_person", + * "beneficial_owner_individuals", "naics_code", "nature_of_business", and + * "website_url" attributes will be present. + */ + user_type?: 'BUSINESS' | 'INDIVIDUAL'; + + /** + * Information about the most recent identity verification attempt + */ + verification_application?: AccountHolderSimulateEnrollmentReviewResponse.VerificationApplication; + + /** + * Only present when user_type == "BUSINESS". Business's primary website. + */ + website_url?: string; +} + +export namespace AccountHolderSimulateEnrollmentReviewResponse { + export interface BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: BeneficialOwnerIndividual.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export namespace BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } + + /** + * Only present when user_type == "BUSINESS". + * + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, + * + * Managing Member, General Partner, President, Vice President, or Treasurer). This + * can be an executive, or someone who will have program-wide access + * + * to the cards that Lithic will provide. In some cases, this individual could also + * be a beneficial owner listed above. + */ + export interface ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: ControlPerson.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export namespace ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } + + /** + * Only present when user_type == "INDIVIDUAL". Information about the individual + * for which the account is being opened and KYC is being run. + */ + export interface Individual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: Individual.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export namespace Individual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } + } + + /** + * Information about the most recent identity verification attempt + */ + export interface VerificationApplication { + /** + * Timestamp of when the application was created. + */ + created: string; + + /** + * KYC and KYB evaluation states. + * + * Note: `PENDING_RESUBMIT` and `PENDING_DOCUMENT` are only applicable for the + * `ADVANCED` workflow. + */ + status: 'ACCEPTED' | 'PENDING_DOCUMENT' | 'PENDING_RESUBMIT' | 'REJECTED'; + + /** + * Reason for the evaluation status. + */ + status_reasons: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + >; + + /** + * Timestamp of when the application was last updated. + */ + updated: string; + + /** + * Timestamp of when the application passed the verification process. Only present + * if `status` is `ACCEPTED` + */ + ky_passed_at?: string; + } +} + +export type AccountHolderCreateParams = + | AccountHolderCreateParams.KYB + | AccountHolderCreateParams.KYBDelegated + | AccountHolderCreateParams.KYC + | AccountHolderCreateParams.KYCExempt; + +export declare namespace AccountHolderCreateParams { + export interface KYB { + /** + * You must submit a list of all direct and indirect individuals with 25% or more + * ownership in the company. A maximum of 4 beneficial owners can be submitted. If + * no individual owns 25% of the company you do not need to send beneficial owner + * information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals: Array; + + /** + * Information for business for which the account is being opened and KYB is being + * run. + */ + business_entity: KYB.BusinessEntity; + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + control_person: KYB.ControlPerson; + + /** + * Short description of the company's line of business (i.e., what does the company + * do?). + */ + nature_of_business: string; + + /** + * An RFC 3339 timestamp indicating when the account holder accepted the applicable + * legal agreements (e.g., cardholder terms) as agreed upon during API customer's + * implementation with Lithic. + */ + tos_timestamp: string; + + /** + * Specifies the type of KYB workflow to run. + */ + workflow: 'KYB_BASIC' | 'KYB_BYO'; + + /** + * @deprecated Deprecated. + */ + beneficial_owner_entities?: Array; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * An RFC 3339 timestamp indicating when precomputed KYB was completed on the + * business with a pass result. + * + * This field is required only if workflow type is `KYB_BYO`. + */ + kyb_passed_timestamp?: string; + + /** + * 6-digit North American Industry Classification System (NAICS) code for the + * business. + */ + naics_code?: string; + + /** + * Company website URL. + */ + website_url?: string; + } + + export namespace KYB { + /** + * Individuals associated with a KYB application. Phone number is optional. + */ + export interface BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + /** + * Information for business for which the account is being opened and KYB is being + * run. + */ + export interface BusinessEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + } + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + export interface ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + export interface BeneficialOwnerEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id: string; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers: Array; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + } + } + + export interface KYBDelegated { + /** + * Information for business for which the account is being opened. + */ + business_entity: KYBDelegated.BusinessEntity; + + /** + * You can submit a list of all direct and indirect individuals with 25% or more + * ownership in the company. A maximum of 4 beneficial owners can be submitted. If + * no individual owns 25% of the company you do not need to send beneficial owner + * information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals?: Array; + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + control_person?: KYBDelegated.ControlPerson; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * 6-digit North American Industry Classification System (NAICS) code for the + * business. + */ + naics_code?: string; + + /** + * Short description of the company's line of business (i.e., what does the company + * do?). + */ + nature_of_business?: string; + + /** + * An RFC 3339 timestamp indicating when the account holder accepted the applicable + * legal agreements (e.g., cardholder terms) as agreed upon during API customer's + * implementation with Lithic. + */ + tos_timestamp?: string; + + /** + * Company website URL. + */ + website_url?: string; + + /** + * Specifies the type of KYB workflow to run. + */ + workflow?: 'KYB_DELEGATED'; + } + + export namespace KYBDelegated { + /** + * Information for business for which the account is being opened. + */ + export interface BusinessEntity { + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * Legal (formal) business name. + */ + legal_business_name: string; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers?: Array; + } + + /** + * Individuals associated with a KYB application. Phone number is optional. + */ + export interface BeneficialOwnerIndividual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + export interface ControlPerson { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + } + + export interface KYC { + /** + * Information on individual for whom the account is being opened and KYC is being + * run. + */ + individual: KYC.Individual; + + /** + * An RFC 3339 timestamp indicating when the account holder accepted the applicable + * legal agreements (e.g., cardholder terms) as agreed upon during API customer's + * implementation with Lithic. + */ + tos_timestamp: string; + + /** + * Specifies the type of KYC workflow to run. + */ + workflow: 'KYC_BASIC' | 'KYC_BYO'; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * An RFC 3339 timestamp indicating when precomputed KYC was completed on the + * individual with a pass result. + * + * This field is required only if workflow type is `KYC_BYO`. + */ + kyc_passed_timestamp?: string; + } + + export namespace KYC { + /** + * Information on individual for whom the account is being opened and KYC is being + * run. + */ + export interface Individual { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: Shared.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number: string; + } + } + + export interface KYCExempt { + /** + * KYC Exempt user's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address: Shared.Address; + + /** + * The KYC Exempt user's email + */ + email: string; + + /** + * The KYC Exempt user's first name + */ + first_name: string; + + /** + * Specifies the type of KYC Exempt user + */ + kyc_exemption_type: 'AUTHORIZED_USER' | 'PREPAID_CARD_USER'; + + /** + * The KYC Exempt user's last name + */ + last_name: string; + + /** + * The KYC Exempt user's phone number, entered in E.164 format. + */ + phone_number: string; + + /** + * Specifies the workflow type. This must be 'KYC_EXEMPT' + */ + workflow: 'KYC_EXEMPT'; + + /** + * Only applicable for customers using the KYC-Exempt workflow to enroll authorized + * users of businesses. Pass the account_token of the enrolled business associated + * with the AUTHORIZED_USER in this field. + */ + business_account_token?: string; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + } +} + +export type AccountHolderUpdateParams = + | AccountHolderUpdateParams.KYBPatchRequest + | AccountHolderUpdateParams.KYCPatchRequest + | AccountHolderUpdateParams.PatchRequest; + +export declare namespace AccountHolderUpdateParams { + export interface KYBPatchRequest { + /** + * @deprecated Deprecated. + */ + beneficial_owner_entities?: Array; + + /** + * You must submit a list of all direct and indirect individuals with 25% or more + * ownership in the company. A maximum of 4 beneficial owners can be submitted. If + * no individual owns 25% of the company you do not need to send beneficial owner + * information. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section I) for more background on individuals that should be included. + */ + beneficial_owner_individuals?: Array; + + /** + * Information for business for which the account is being opened and KYB is being + * run. + */ + business_entity?: KYBPatchRequest.BusinessEntity; + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + control_person?: KYBPatchRequest.ControlPerson; + + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * 6-digit North American Industry Classification System (NAICS) code for the + * business. + */ + naics_code?: string; + + /** + * Short description of the company's line of business (i.e., what does the company + * do?). + */ + nature_of_business?: string; + + /** + * Company website URL. + */ + website_url?: string; + } + + export namespace KYBPatchRequest { + export interface BeneficialOwnerEntity { + /** + * Globally unique identifier for an entity. + */ + entity_token: string; + + /** + * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address?: AccountHoldersAPI.AddressUpdate; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id?: string; + + /** + * Legal (formal) business name. + */ + legal_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers?: Array; + } + + /** + * Individuals associated with a KYB application. Phone number is optional. + */ + export interface BeneficialOwnerIndividual { + /** + * Globally unique identifier for an entity. + */ + entity_token: string; + + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: AccountHoldersAPI.AddressUpdate; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + + /** + * Information for business for which the account is being opened and KYB is being + * run. + */ + export interface BusinessEntity { + /** + * Globally unique identifier for an entity. + */ + entity_token: string; + + /** + * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ + address?: AccountHoldersAPI.AddressUpdate; + + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + dba_business_name?: string; + + /** + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. + */ + government_id?: string; + + /** + * Legal (formal) business name. + */ + legal_business_name?: string; + + /** + * Parent company name (if applicable). + */ + parent_company?: string; + + /** + * One or more of the business's phone number(s), entered as a list in E.164 + * format. + */ + phone_numbers?: Array; + } + + /** + * An individual with significant responsibility for managing the legal entity + * (e.g., a Chief Executive Officer, Chief Financial Officer, Chief Operating + * Officer, Managing Member, General Partner, President, Vice President, or + * Treasurer). This can be an executive, or someone who will have program-wide + * access to the cards that Lithic will provide. In some cases, this individual + * could also be a beneficial owner listed above. See + * [FinCEN requirements](https://www.fincen.gov/sites/default/files/shared/CDD_Rev6.7_Sept_2017_Certificate.pdf) + * (Section II) for more background. + */ + export interface ControlPerson { + /** + * Globally unique identifier for an entity. + */ + entity_token: string; + + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: AccountHoldersAPI.AddressUpdate; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + } + + export interface KYCPatchRequest { + /** + * A user provided id that can be used to link an account holder with an external + * system + */ + external_id?: string; + + /** + * Information on the individual for whom the account is being opened and KYC is + * being run. + */ + individual?: KYCPatchRequest.Individual; + } + + export namespace KYCPatchRequest { + /** + * Information on the individual for whom the account is being opened and KYC is + * being run. + */ + export interface Individual { + /** + * Globally unique identifier for an entity. + */ + entity_token: string; + + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address?: AccountHoldersAPI.AddressUpdate; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob?: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email?: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name?: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id?: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name?: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number?: string; + } + } + + export interface PatchRequest { + /** + * Allowed for: KYC-Exempt, BYO-KYC, BYO-KYB. + */ + address?: AddressUpdate; + + /** + * Allowed for: KYC-Exempt, BYO-KYC. The token of the business account to which the + * account holder is associated. + */ + business_account_token?: string; + + /** + * Allowed for all Account Holders. Account holder's email address. The primary + * purpose of this field is for cardholder identification and verification during + * the digital wallet tokenization process. + */ + email?: string; + + /** + * Allowed for KYC-Exempt, BYO-KYC. Account holder's first name. + */ + first_name?: string; + + /** + * Allowed for KYC-Exempt, BYO-KYC. Account holder's last name. + */ + last_name?: string; + + /** + * Allowed for BYO-KYB. Legal business name of the account holder. + */ + legal_business_name?: string; + + /** + * Allowed for all Account Holders. Account holder's phone number, entered in E.164 + * format. The primary purpose of this field is for cardholder identification and + * verification during the digital wallet tokenization process. + */ + phone_number?: string; + } +} + +export interface AccountHolderListParams { + /** + * Date string in RFC 3339 format. Only entries created after the specified time + * will be included. UTC time zone. + */ + begin?: string; + + /** + * Email address of the account holder. The query must be an exact match, case + * insensitive. + */ + email?: string; + + /** + * Date string in RFC 3339 format. Only entries created before the specified time + * will be included. UTC time zone. + */ + end?: string; + + /** + * A cursor representing an item's token before which a page of results should end. + * Used to retrieve the previous page of results before this item. + */ + ending_before?: string; + + /** + * If applicable, represents the external_id associated with the account_holder. + */ + external_id?: string; + + /** + * (Individual Account Holders only) The first name of the account holder. The + * query is case insensitive and supports partial matches. + */ + first_name?: string; + + /** + * (Individual Account Holders only) The last name of the account holder. The query + * is case insensitive and supports partial matches. + */ + last_name?: string; + + /** + * (Business Account Holders only) The legal business name of the account holder. + * The query is case insensitive and supports partial matches. + */ + legal_business_name?: string; + + /** + * The number of account_holders to limit the response to. + */ + limit?: number; + + /** + * Phone number of the account holder. The query must be an exact match. + */ + phone_number?: string; + + /** + * A cursor representing an item's token after which a page of results should + * begin. Used to retrieve the next page of results after this item. + */ + starting_after?: string; +} + +export interface AccountHolderRetrieveDocumentParams { + /** + * Globally unique identifier for the account holder. + */ + account_holder_token: string; +} + +export interface AccountHolderSimulateEnrollmentDocumentReviewParams { + /** + * The account holder document upload which to perform the simulation upon. + */ + document_upload_token: string; + + /** + * An account holder document's upload status for use within the simulation. + */ + status: 'UPLOADED' | 'ACCEPTED' | 'REJECTED' | 'PARTIAL_APPROVAL'; + + /** + * A list of status reasons associated with a KYB account holder in PENDING_REVIEW + */ + accepted_entity_status_reasons?: Array; + + /** + * Status reason that will be associated with the simulated account holder status. + * Only required for a `REJECTED` status or `PARTIAL_APPROVAL` status. + */ + status_reason?: + | 'DOCUMENT_MISSING_REQUIRED_DATA' + | 'DOCUMENT_UPLOAD_TOO_BLURRY' + | 'FILE_SIZE_TOO_LARGE' + | 'INVALID_DOCUMENT_TYPE' + | 'INVALID_DOCUMENT_UPLOAD' + | 'INVALID_ENTITY' + | 'DOCUMENT_EXPIRED' + | 'DOCUMENT_ISSUED_GREATER_THAN_30_DAYS' + | 'DOCUMENT_TYPE_NOT_SUPPORTED' + | 'UNKNOWN_FAILURE_REASON' + | 'UNKNOWN_ERROR'; +} + +export interface AccountHolderSimulateEnrollmentReviewParams { + /** + * The account holder which to perform the simulation upon. + */ + account_holder_token?: string; + + /** + * An account holder's status for use within the simulation. + */ + status?: 'ACCEPTED' | 'REJECTED' | 'PENDING_REVIEW'; + + /** + * Status reason that will be associated with the simulated account holder status. + * Only required for a `REJECTED` status. + */ + status_reasons?: Array< + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + | 'BENEFICIAL_OWNER_INDIVIDUAL_DOB_VERIFICATION_FAILURE' + | 'BENEFICIAL_OWNER_INDIVIDUAL_BLOCKLIST_ALERT_FAILURE' + | 'BENEFICIAL_OWNER_INDIVIDUAL_ID_VERIFICATION_FAILURE' + | 'BENEFICIAL_OWNER_INDIVIDUAL_NAME_VERIFICATION_FAILURE' + >; +} + +export interface AccountHolderUploadDocumentParams { + /** + * The type of document to upload + */ + document_type: + | 'EIN_LETTER' + | 'TAX_RETURN' + | 'OPERATING_AGREEMENT' + | 'CERTIFICATE_OF_FORMATION' + | 'DRIVERS_LICENSE' + | 'PASSPORT' + | 'PASSPORT_CARD' + | 'CERTIFICATE_OF_GOOD_STANDING' + | 'ARTICLES_OF_INCORPORATION' + | 'ARTICLES_OF_ORGANIZATION' + | 'BYLAWS' + | 'GOVERNMENT_BUSINESS_LICENSE' + | 'PARTNERSHIP_AGREEMENT' + | 'SS4_FORM' + | 'BANK_STATEMENT' + | 'UTILITY_BILL_STATEMENT' + | 'SSN_CARD' + | 'ITIN_LETTER' + | 'FINCEN_BOI_REPORT'; + + /** + * Globally unique identifier for the entity. + */ + entity_token: string; +} + +AccountHolders.Entities = Entities; + +export declare namespace AccountHolders { + export { + type AccountHolder as AccountHolder, + type AddressUpdate as AddressUpdate, + type KYB as KYB, + type KYBBusinessEntity as KYBBusinessEntity, + type KYC as KYC, + type KYCExempt as KYCExempt, + type RequiredDocument as RequiredDocument, + type AccountHolderCreateResponse as AccountHolderCreateResponse, + type AccountHolderUpdateResponse as AccountHolderUpdateResponse, + type AccountHolderListDocumentsResponse as AccountHolderListDocumentsResponse, + type AccountHolderSimulateEnrollmentReviewResponse as AccountHolderSimulateEnrollmentReviewResponse, + type AccountHoldersSinglePage as AccountHoldersSinglePage, + type AccountHolderCreateParams as AccountHolderCreateParams, + type AccountHolderUpdateParams as AccountHolderUpdateParams, + type AccountHolderListParams as AccountHolderListParams, + type AccountHolderRetrieveDocumentParams as AccountHolderRetrieveDocumentParams, + type AccountHolderSimulateEnrollmentDocumentReviewParams as AccountHolderSimulateEnrollmentDocumentReviewParams, + type AccountHolderSimulateEnrollmentReviewParams as AccountHolderSimulateEnrollmentReviewParams, + type AccountHolderUploadDocumentParams as AccountHolderUploadDocumentParams, + }; + + export { + Entities as Entities, + type AccountHolderEntity as AccountHolderEntity, + type EntityCreateResponse as EntityCreateResponse, + type EntityCreateParams as EntityCreateParams, + type EntityDeleteParams as EntityDeleteParams, + }; +} diff --git a/src/resources/account-holders/entities.ts b/src/resources/account-holders/entities.ts new file mode 100644 index 00000000..fde363d0 --- /dev/null +++ b/src/resources/account-holders/entities.ts @@ -0,0 +1,335 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as AccountHoldersAPI from './account-holders'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class Entities extends APIResource { + /** + * Create a new beneficial owner or replace the control person entity on an + * existing KYB account holder. This endpoint is only applicable for account + * holders enrolled through a KYB workflow with the Persona KYB provider. A new + * control person can only replace the existing one. A maximum of 4 beneficial + * owners can be associated with an account holder. + * + * @example + * ```ts + * const entity = await client.accountHolders.entities.create( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * address: { + * address1: '300 Normal Forest Way', + * city: 'Portland', + * country: 'USA', + * postal_code: '90210', + * state: 'OR', + * }, + * dob: '1991-03-08T08:00:00Z', + * email: 'tim@left-earth.com', + * first_name: 'Timmy', + * government_id: '211-23-1412', + * last_name: 'Turner', + * phone_number: '+15555555555', + * type: 'BENEFICIAL_OWNER_INDIVIDUAL', + * }, + * ); + * ``` + */ + create( + accountHolderToken: string, + body: EntityCreateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post(path`/v1/account_holders/${accountHolderToken}/entities`, { body, ...options }); + } + + /** + * Deactivate a beneficial owner entity on an existing KYB account holder. Only + * beneficial owner entities can be deactivated. + * + * @example + * ```ts + * const accountHolderEntity = + * await client.accountHolders.entities.delete( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * account_holder_token: + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * }, + * ); + * ``` + */ + delete( + entityToken: string, + params: EntityDeleteParams, + options?: RequestOptions, + ): APIPromise { + const { account_holder_token } = params; + return this._client.delete( + path`/v1/account_holders/${account_holder_token}/entities/${entityToken}`, + options, + ); + } +} + +/** + * Information about an entity associated with an account holder + */ +export interface AccountHolderEntity { + /** + * Globally unique identifier for the entity + */ + token: string; + + /** + * Globally unique identifier for the account holder + */ + account_holder_token: string; + + /** + * Individual's current address + */ + address: AccountHolderEntity.Address; + + /** + * Individual's date of birth, as an RFC 3339 date + */ + dob: string | null; + + /** + * Individual's email address + */ + email: string | null; + + /** + * Individual's first name, as it appears on government-issued identity documents + */ + first_name: string | null; + + /** + * Individual's last name, as it appears on government-issued identity documents + */ + last_name: string | null; + + /** + * Individual's phone number, entered in E.164 format + */ + phone_number: string | null; + + /** + * The status of the entity + */ + status: 'ACCEPTED' | 'INACTIVE' | 'PENDING_REVIEW' | 'REJECTED'; + + /** + * The type of entity + */ + type: 'BENEFICIAL_OWNER_INDIVIDUAL' | 'CONTROL_PERSON'; +} + +export namespace AccountHolderEntity { + /** + * Individual's current address + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } +} + +/** + * Response body for creating a new beneficial owner or replacing the control + * person entity on an existing KYB account holder. + */ +export interface EntityCreateResponse { + /** + * Globally unique identifier for the entity + */ + token: string; + + /** + * Globally unique identifier for the account holder + */ + account_holder_token: string; + + /** + * Timestamp of when the entity was created + */ + created: string; + + /** + * A list of documents required for the entity to be approved + */ + required_documents: Array; + + /** + * Entity verification status + */ + status: 'ACCEPTED' | 'INACTIVE' | 'PENDING_REVIEW' | 'REJECTED'; + + /** + * Reason for the evaluation status + */ + status_reasons: Array< + | 'ADDRESS_VERIFICATION_FAILURE' + | 'AGE_THRESHOLD_FAILURE' + | 'COMPLETE_VERIFICATION_FAILURE' + | 'DOB_VERIFICATION_FAILURE' + | 'ID_VERIFICATION_FAILURE' + | 'MAX_DOCUMENT_ATTEMPTS' + | 'MAX_RESUBMISSION_ATTEMPTS' + | 'NAME_VERIFICATION_FAILURE' + | 'OTHER_VERIFICATION_FAILURE' + | 'RISK_THRESHOLD_FAILURE' + | 'WATCHLIST_ALERT_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ID_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_ADDRESS_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_NAME_VERIFICATION_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_BUSINESS_OFFICERS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_SOS_FILING_INACTIVE' + | 'PRIMARY_BUSINESS_ENTITY_SOS_NOT_MATCHED' + | 'PRIMARY_BUSINESS_ENTITY_CMRA_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_WATCHLIST_FAILURE' + | 'PRIMARY_BUSINESS_ENTITY_REGISTERED_AGENT_FAILURE' + | 'CONTROL_PERSON_BLOCKLIST_ALERT_FAILURE' + | 'CONTROL_PERSON_ID_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_DOB_VERIFICATION_FAILURE' + | 'CONTROL_PERSON_NAME_VERIFICATION_FAILURE' + >; +} + +export interface EntityCreateParams { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + address: EntityCreateParams.Address; + + /** + * Individual's date of birth, as an RFC 3339 date. + */ + dob: string; + + /** + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. + */ + email: string; + + /** + * Individual's first name, as it appears on government-issued identity documents. + */ + first_name: string; + + /** + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + government_id: string; + + /** + * Individual's last name, as it appears on government-issued identity documents. + */ + last_name: string; + + /** + * Individual's phone number, entered in E.164 format. + */ + phone_number: string; + + /** + * The type of entity to create on the account holder + */ + type: 'BENEFICIAL_OWNER_INDIVIDUAL' | 'CONTROL_PERSON'; +} + +export namespace EntityCreateParams { + /** + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + */ + export interface Address { + /** + * Valid deliverable address (no PO boxes). + */ + address1: string; + + /** + * Name of city. + */ + city: string; + + /** + * Valid country code. Only USA is currently supported, entered in uppercase ISO + * 3166-1 alpha-3 three-character format. + */ + country: string; + + /** + * Valid postal code. Only USA ZIP codes are currently supported, entered as a + * five-digit ZIP or nine-digit ZIP+4. + */ + postal_code: string; + + /** + * Valid state code. Only USA state codes are currently supported, entered in + * uppercase ISO 3166-2 two-character format. + */ + state: string; + + /** + * Unit or apartment number (if applicable). + */ + address2?: string; + } +} + +export interface EntityDeleteParams { + /** + * Globally unique identifier for the account holder. + */ + account_holder_token: string; +} + +export declare namespace Entities { + export { + type AccountHolderEntity as AccountHolderEntity, + type EntityCreateResponse as EntityCreateResponse, + type EntityCreateParams as EntityCreateParams, + type EntityDeleteParams as EntityDeleteParams, + }; +} diff --git a/src/resources/account-holders/index.ts b/src/resources/account-holders/index.ts new file mode 100644 index 00000000..cab451bb --- /dev/null +++ b/src/resources/account-holders/index.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + AccountHolders, + type AccountHolder, + type AddressUpdate, + type KYB, + type KYBBusinessEntity, + type KYC, + type KYCExempt, + type RequiredDocument, + type AccountHolderCreateResponse, + type AccountHolderUpdateResponse, + type AccountHolderListDocumentsResponse, + type AccountHolderSimulateEnrollmentReviewResponse, + type AccountHolderCreateParams, + type AccountHolderUpdateParams, + type AccountHolderListParams, + type AccountHolderRetrieveDocumentParams, + type AccountHolderSimulateEnrollmentDocumentReviewParams, + type AccountHolderSimulateEnrollmentReviewParams, + type AccountHolderUploadDocumentParams, + type AccountHoldersSinglePage, +} from './account-holders'; +export { + Entities, + type AccountHolderEntity, + type EntityCreateResponse, + type EntityCreateParams, + type EntityDeleteParams, +} from './entities'; diff --git a/src/resources/financial-accounts/financial-accounts.ts b/src/resources/financial-accounts/financial-accounts.ts index f5cbebce..e6b0249d 100644 --- a/src/resources/financial-accounts/financial-accounts.ts +++ b/src/resources/financial-accounts/financial-accounts.ts @@ -16,6 +16,24 @@ import { FinancialTransactionRetrieveParams, FinancialTransactions, } from './financial-transactions'; +import * as InterestTierScheduleAPI from './interest-tier-schedule'; +import { + CategoryTier, + InterestTierSchedule, + InterestTierScheduleCreateParams, + InterestTierScheduleDeleteParams, + InterestTierScheduleListParams, + InterestTierScheduleResource, + InterestTierScheduleRetrieveParams, + InterestTierScheduleUpdateParams, + InterestTierSchedulesSinglePage, +} from './interest-tier-schedule'; +import * as LoanTapeConfigurationAPI from './loan-tape-configuration'; +import { + LoanTapeConfiguration, + LoanTapeConfigurationResource, + LoanTapeRebuildConfiguration, +} from './loan-tape-configuration'; import * as LoanTapesAPI from './loan-tapes'; import { CategoryBalances, @@ -47,6 +65,10 @@ export class FinancialAccounts extends APIResource { new CreditConfigurationAPI.CreditConfiguration(this._client); statements: StatementsAPI.Statements = new StatementsAPI.Statements(this._client); loanTapes: LoanTapesAPI.LoanTapes = new LoanTapesAPI.LoanTapes(this._client); + loanTapeConfiguration: LoanTapeConfigurationAPI.LoanTapeConfigurationResource = + new LoanTapeConfigurationAPI.LoanTapeConfigurationResource(this._client); + interestTierSchedule: InterestTierScheduleAPI.InterestTierScheduleResource = + new InterestTierScheduleAPI.InterestTierScheduleResource(this._client); /** * Create a new financial account @@ -221,6 +243,7 @@ export interface FinancialAccount { | 'END_USER_REQUEST' | 'BANK_REQUEST' | 'DELINQUENT' + | 'INTEREST_AND_FEES_PAUSED' | null; type: @@ -533,7 +556,13 @@ export interface FinancialAccountUpdateStatusParams { /** * Substatus for the financial account */ - substatus: 'CHARGED_OFF_FRAUD' | 'END_USER_REQUEST' | 'BANK_REQUEST' | 'CHARGED_OFF_DELINQUENT' | null; + substatus: + | 'CHARGED_OFF_FRAUD' + | 'END_USER_REQUEST' + | 'BANK_REQUEST' + | 'CHARGED_OFF_DELINQUENT' + | 'INTEREST_AND_FEES_PAUSED' + | null; /** * User-defined status for the financial account @@ -545,6 +574,8 @@ FinancialAccounts.Balances = Balances; FinancialAccounts.FinancialTransactions = FinancialTransactions; FinancialAccounts.CreditConfiguration = CreditConfigurationAPICreditConfiguration; FinancialAccounts.LoanTapes = LoanTapes; +FinancialAccounts.LoanTapeConfigurationResource = LoanTapeConfigurationResource; +FinancialAccounts.InterestTierScheduleResource = InterestTierScheduleResource; export declare namespace FinancialAccounts { export { @@ -591,4 +622,22 @@ export declare namespace FinancialAccounts { type LoanTapeRetrieveParams as LoanTapeRetrieveParams, type LoanTapeListParams as LoanTapeListParams, }; + + export { + LoanTapeConfigurationResource as LoanTapeConfigurationResource, + type LoanTapeConfiguration as LoanTapeConfiguration, + type LoanTapeRebuildConfiguration as LoanTapeRebuildConfiguration, + }; + + export { + InterestTierScheduleResource as InterestTierScheduleResource, + type CategoryTier as CategoryTier, + type InterestTierSchedule as InterestTierSchedule, + type InterestTierSchedulesSinglePage as InterestTierSchedulesSinglePage, + type InterestTierScheduleCreateParams as InterestTierScheduleCreateParams, + type InterestTierScheduleRetrieveParams as InterestTierScheduleRetrieveParams, + type InterestTierScheduleUpdateParams as InterestTierScheduleUpdateParams, + type InterestTierScheduleListParams as InterestTierScheduleListParams, + type InterestTierScheduleDeleteParams as InterestTierScheduleDeleteParams, + }; } diff --git a/src/resources/financial-accounts/index.ts b/src/resources/financial-accounts/index.ts index d5b39e0c..bad98ab6 100644 --- a/src/resources/financial-accounts/index.ts +++ b/src/resources/financial-accounts/index.ts @@ -27,6 +27,22 @@ export { type FinancialTransactionRetrieveParams, type FinancialTransactionListParams, } from './financial-transactions'; +export { + InterestTierScheduleResource, + type CategoryTier, + type InterestTierSchedule, + type InterestTierScheduleCreateParams, + type InterestTierScheduleRetrieveParams, + type InterestTierScheduleUpdateParams, + type InterestTierScheduleListParams, + type InterestTierScheduleDeleteParams, + type InterestTierSchedulesSinglePage, +} from './interest-tier-schedule'; +export { + LoanTapeConfigurationResource, + type LoanTapeConfiguration, + type LoanTapeRebuildConfiguration, +} from './loan-tape-configuration'; export { LoanTapes, type CategoryBalances, diff --git a/src/resources/financial-accounts/interest-tier-schedule.ts b/src/resources/financial-accounts/interest-tier-schedule.ts new file mode 100644 index 00000000..7d5a4b21 --- /dev/null +++ b/src/resources/financial-accounts/interest-tier-schedule.ts @@ -0,0 +1,292 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; +import { PagePromise, SinglePage } from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class InterestTierScheduleResource extends APIResource { + /** + * Create a new interest tier schedule entry for a supported financial account + * + * @example + * ```ts + * const interestTierSchedule = + * await client.financialAccounts.interestTierSchedule.create( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * { + * credit_product_token: 'credit_product_token', + * effective_date: '2019-12-27', + * }, + * ); + * ``` + */ + create( + financialAccountToken: string, + body: InterestTierScheduleCreateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post(path`/v1/financial_accounts/${financialAccountToken}/interest_tier_schedule`, { + body, + ...options, + }); + } + + /** + * Get a specific interest tier schedule by effective date + * + * @example + * ```ts + * const interestTierSchedule = + * await client.financialAccounts.interestTierSchedule.retrieve( + * '2019-12-27', + * { + * financial_account_token: + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * }, + * ); + * ``` + */ + retrieve( + effectiveDate: string, + params: InterestTierScheduleRetrieveParams, + options?: RequestOptions, + ): APIPromise { + const { financial_account_token } = params; + return this._client.get( + path`/v1/financial_accounts/${financial_account_token}/interest_tier_schedule/${effectiveDate}`, + options, + ); + } + + /** + * Update an existing interest tier schedule + * + * @example + * ```ts + * const interestTierSchedule = + * await client.financialAccounts.interestTierSchedule.update( + * '2019-12-27', + * { + * financial_account_token: + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * }, + * ); + * ``` + */ + update( + effectiveDate: string, + params: InterestTierScheduleUpdateParams, + options?: RequestOptions, + ): APIPromise { + const { financial_account_token, ...body } = params; + return this._client.put( + path`/v1/financial_accounts/${financial_account_token}/interest_tier_schedule/${effectiveDate}`, + { body, ...options }, + ); + } + + /** + * List interest tier schedules for a financial account with optional date + * filtering. + * + * If no date parameters are provided, returns all tier schedules. If date + * parameters are provided, uses filtering to return matching schedules (max 100). + * + * - for_date: Returns exact match (takes precedence over other dates) + * - before_date: Returns schedules with effective_date <= before_date + * - after_date: Returns schedules with effective_date >= after_date + * - Both before_date and after_date: Returns schedules in range + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const interestTierSchedule of client.financialAccounts.interestTierSchedule.list( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * )) { + * // ... + * } + * ``` + */ + list( + financialAccountToken: string, + query: InterestTierScheduleListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList( + path`/v1/financial_accounts/${financialAccountToken}/interest_tier_schedule`, + SinglePage, + { query, ...options }, + ); + } + + /** + * Delete an interest tier schedule entry. + * + * Returns: + * + * - 400 Bad Request: Invalid effective_date format OR attempting to delete the + * earliest tier schedule entry for a non-PENDING account + * - 404 Not Found: Tier schedule entry not found for the given effective_date OR + * ledger account not found + * + * Note: PENDING accounts can delete the earliest tier schedule entry (account + * hasn't opened yet). Active/non-PENDING accounts cannot delete the earliest entry + * to prevent orphaning the account. + * + * If the deleted tier schedule has a past effective_date and the account is + * ACTIVE, the loan tape rebuild configuration will be updated to trigger rebuilds + * from that date. + * + * @example + * ```ts + * await client.financialAccounts.interestTierSchedule.delete( + * '2019-12-27', + * { + * financial_account_token: + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * }, + * ); + * ``` + */ + delete( + effectiveDate: string, + params: InterestTierScheduleDeleteParams, + options?: RequestOptions, + ): APIPromise { + const { financial_account_token } = params; + return this._client.delete( + path`/v1/financial_accounts/${financial_account_token}/interest_tier_schedule/${effectiveDate}`, + options, + ); + } +} + +export type InterestTierSchedulesSinglePage = SinglePage; + +/** + * Rate and rate cap for interest on a category + */ +export interface CategoryTier { + /** + * Maximum interest rate for this category, e.g. '0.0525' for 5.25% + */ + cap_rate?: string; + + /** + * Interest rate for this category, e.g. '0.0525' for 5.25% + */ + rate?: string; +} + +/** + * Entry in the Tier Schedule of an account + */ +export interface InterestTierSchedule { + /** + * Globally unique identifier for a credit product + */ + credit_product_token: string; + + /** + * Date the tier should be effective in YYYY-MM-DD format + */ + effective_date: string; + + /** + * Name of a tier contained in the credit product. Mutually exclusive with + * tier_rates + */ + tier_name?: string; + + /** + * Custom rates per category. Mutually exclusive with tier_name + */ + tier_rates?: unknown; +} + +export interface InterestTierScheduleCreateParams { + /** + * Globally unique identifier for a credit product + */ + credit_product_token: string; + + /** + * Date the tier should be effective in YYYY-MM-DD format + */ + effective_date: string; + + /** + * Name of a tier contained in the credit product. Mutually exclusive with + * tier_rates + */ + tier_name?: string; + + /** + * Custom rates per category. Mutually exclusive with tier_name + */ + tier_rates?: unknown; +} + +export interface InterestTierScheduleRetrieveParams { + /** + * Globally unique identifier for financial account + */ + financial_account_token: string; +} + +export interface InterestTierScheduleUpdateParams { + /** + * Path param: Globally unique identifier for financial account + */ + financial_account_token: string; + + /** + * Body param: Name of a tier contained in the credit product. Mutually exclusive + * with tier_rates + */ + tier_name?: string; + + /** + * Body param: Custom rates per category. Mutually exclusive with tier_name + */ + tier_rates?: unknown; +} + +export interface InterestTierScheduleListParams { + /** + * Return schedules with effective_date >= after_date (ISO format YYYY-MM-DD) + */ + after_date?: string; + + /** + * Return schedules with effective_date <= before_date (ISO format YYYY-MM-DD) + */ + before_date?: string; + + /** + * Return schedule with effective_date == for_date (ISO format YYYY-MM-DD) + */ + for_date?: string; +} + +export interface InterestTierScheduleDeleteParams { + /** + * Globally unique identifier for financial account + */ + financial_account_token: string; +} + +export declare namespace InterestTierScheduleResource { + export { + type CategoryTier as CategoryTier, + type InterestTierSchedule as InterestTierSchedule, + type InterestTierSchedulesSinglePage as InterestTierSchedulesSinglePage, + type InterestTierScheduleCreateParams as InterestTierScheduleCreateParams, + type InterestTierScheduleRetrieveParams as InterestTierScheduleRetrieveParams, + type InterestTierScheduleUpdateParams as InterestTierScheduleUpdateParams, + type InterestTierScheduleListParams as InterestTierScheduleListParams, + type InterestTierScheduleDeleteParams as InterestTierScheduleDeleteParams, + }; +} diff --git a/src/resources/financial-accounts/loan-tape-configuration.ts b/src/resources/financial-accounts/loan-tape-configuration.ts new file mode 100644 index 00000000..41a1272e --- /dev/null +++ b/src/resources/financial-accounts/loan-tape-configuration.ts @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class LoanTapeConfigurationResource extends APIResource { + /** + * Get the loan tape configuration for a given financial account. + * + * @example + * ```ts + * const loanTapeConfiguration = + * await client.financialAccounts.loanTapeConfiguration.retrieve( + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * ); + * ``` + */ + retrieve(financialAccountToken: string, options?: RequestOptions): APIPromise { + return this._client.get( + path`/v1/financial_accounts/${financialAccountToken}/loan_tape_configuration`, + options, + ); + } +} + +/** + * Configuration for loan tapes + */ +export interface LoanTapeConfiguration { + created_at: string; + + financial_account_token: string; + + instance_token: string; + + updated_at: string; + + credit_product_token?: string; + + /** + * Configuration for building loan tapes + */ + loan_tape_rebuild_configuration?: LoanTapeRebuildConfiguration; + + tier_schedule_changed_at?: string; +} + +/** + * Configuration for building loan tapes + */ +export interface LoanTapeRebuildConfiguration { + /** + * Whether the account's loan tapes need to be rebuilt or not + */ + rebuild_needed: boolean; + + /** + * The date for which the account's loan tapes were last rebuilt + */ + last_rebuild?: string; + + /** + * Date from which to start rebuilding from if the account requires a rebuild + */ + rebuild_from?: string; +} + +export declare namespace LoanTapeConfigurationResource { + export { + type LoanTapeConfiguration as LoanTapeConfiguration, + type LoanTapeRebuildConfiguration as LoanTapeRebuildConfiguration, + }; +} diff --git a/src/resources/financial-accounts/loan-tapes.ts b/src/resources/financial-accounts/loan-tapes.ts index a03e61cd..e94fa7bf 100644 --- a/src/resources/financial-accounts/loan-tapes.ts +++ b/src/resources/financial-accounts/loan-tapes.ts @@ -220,6 +220,7 @@ export namespace LoanTape { | 'END_USER_REQUEST' | 'BANK_REQUEST' | 'DELINQUENT' + | 'INTEREST_AND_FEES_PAUSED' | null; } } diff --git a/src/resources/financial-accounts/statements/statements.ts b/src/resources/financial-accounts/statements/statements.ts index 2b2d813f..7ed7769d 100644 --- a/src/resources/financial-accounts/statements/statements.ts +++ b/src/resources/financial-accounts/statements/statements.ts @@ -233,6 +233,7 @@ export namespace Statement { | 'END_USER_REQUEST' | 'BANK_REQUEST' | 'DELINQUENT' + | 'INTEREST_AND_FEES_PAUSED' | null; } } diff --git a/src/resources/index.ts b/src/resources/index.ts index 6a1ffb7b..209d86ae 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -30,7 +30,7 @@ export { type AccountHolderSimulateEnrollmentReviewParams, type AccountHolderUploadDocumentParams, type AccountHoldersSinglePage, -} from './account-holders'; +} from './account-holders/account-holders'; export { Accounts, type Account, diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index 7a97e806..5e4596c4 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -2,7 +2,6 @@ import { getRequiredHeader, HeadersLike } from '../internal/headers'; import { APIResource } from '../core/resource'; -import * as AccountHoldersAPI from './account-holders'; import { Webhook } from 'standardwebhooks'; import * as BookTransfersAPI from './book-transfers'; import * as DisputesAPI from './disputes'; @@ -14,6 +13,7 @@ import * as ManagementOperationsAPI from './management-operations'; import * as PaymentsAPI from './payments'; import * as Shared from './shared'; import * as TokenizationsAPI from './tokenizations'; +import * as AccountHoldersAPI from './account-holders/account-holders'; import * as ExternalBankAccountsAPI from './external-bank-accounts/external-bank-accounts'; import * as FinancialAccountsAPI from './financial-accounts/financial-accounts'; import * as LoanTapesAPI from './financial-accounts/loan-tapes'; diff --git a/src/version.ts b/src/version.ts index 54ba18a0..bfde34bc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.129.0'; // x-release-please-version +export const VERSION = '0.130.0'; // x-release-please-version diff --git a/tests/api-resources/account-holders.test.ts b/tests/api-resources/account-holders/account-holders.test.ts similarity index 100% rename from tests/api-resources/account-holders.test.ts rename to tests/api-resources/account-holders/account-holders.test.ts diff --git a/tests/api-resources/account-holders/entities.test.ts b/tests/api-resources/account-holders/entities.test.ts new file mode 100644 index 00000000..d0c4ea71 --- /dev/null +++ b/tests/api-resources/account-holders/entities.test.ts @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Lithic from 'lithic'; + +const client = new Lithic({ + apiKey: 'My Lithic API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource entities', () => { + test('create: only required params', async () => { + const responsePromise = client.accountHolders.entities.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + address: { + address1: '300 Normal Forest Way', + city: 'Portland', + country: 'USA', + postal_code: '90210', + state: 'OR', + }, + dob: '1991-03-08T08:00:00Z', + email: 'tim@left-earth.com', + first_name: 'Timmy', + government_id: '211-23-1412', + last_name: 'Turner', + phone_number: '+15555555555', + type: 'BENEFICIAL_OWNER_INDIVIDUAL', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.accountHolders.entities.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + address: { + address1: '300 Normal Forest Way', + city: 'Portland', + country: 'USA', + postal_code: '90210', + state: 'OR', + address2: 'address2', + }, + dob: '1991-03-08T08:00:00Z', + email: 'tim@left-earth.com', + first_name: 'Timmy', + government_id: '211-23-1412', + last_name: 'Turner', + phone_number: '+15555555555', + type: 'BENEFICIAL_OWNER_INDIVIDUAL', + }); + }); + + test('delete: only required params', async () => { + const responsePromise = client.accountHolders.entities.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + account_holder_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.accountHolders.entities.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { + account_holder_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + }); +}); diff --git a/tests/api-resources/financial-accounts/interest-tier-schedule.test.ts b/tests/api-resources/financial-accounts/interest-tier-schedule.test.ts new file mode 100644 index 00000000..5312bb21 --- /dev/null +++ b/tests/api-resources/financial-accounts/interest-tier-schedule.test.ts @@ -0,0 +1,123 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Lithic from 'lithic'; + +const client = new Lithic({ + apiKey: 'My Lithic API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource interestTierSchedule', () => { + test('create: only required params', async () => { + const responsePromise = client.financialAccounts.interestTierSchedule.create( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { credit_product_token: 'credit_product_token', effective_date: '2019-12-27' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.financialAccounts.interestTierSchedule.create( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { + credit_product_token: 'credit_product_token', + effective_date: '2019-12-27', + tier_name: 'tier_name', + tier_rates: {}, + }, + ); + }); + + test('retrieve: only required params', async () => { + const responsePromise = client.financialAccounts.interestTierSchedule.retrieve('2019-12-27', { + financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('retrieve: required and optional params', async () => { + const response = await client.financialAccounts.interestTierSchedule.retrieve('2019-12-27', { + financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + }); + + test('update: only required params', async () => { + const responsePromise = client.financialAccounts.interestTierSchedule.update('2019-12-27', { + financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: required and optional params', async () => { + const response = await client.financialAccounts.interestTierSchedule.update('2019-12-27', { + financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + tier_name: 'tier_name', + tier_rates: {}, + }); + }); + + test('list', async () => { + const responsePromise = client.financialAccounts.interestTierSchedule.list( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.financialAccounts.interestTierSchedule.list( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { + after_date: '2019-12-27', + before_date: '2019-12-27', + for_date: '2019-12-27', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Lithic.NotFoundError); + }); + + test('delete: only required params', async () => { + const responsePromise = client.financialAccounts.interestTierSchedule.delete('2019-12-27', { + financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.financialAccounts.interestTierSchedule.delete('2019-12-27', { + financial_account_token: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + }); + }); +}); diff --git a/tests/api-resources/financial-accounts/loan-tape-configuration.test.ts b/tests/api-resources/financial-accounts/loan-tape-configuration.test.ts new file mode 100644 index 00000000..038abc1f --- /dev/null +++ b/tests/api-resources/financial-accounts/loan-tape-configuration.test.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Lithic from 'lithic'; + +const client = new Lithic({ + apiKey: 'My Lithic API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource loanTapeConfiguration', () => { + test('retrieve', async () => { + const responsePromise = client.financialAccounts.loanTapeConfiguration.retrieve( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); +}); diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index 6ee6686b..61743ccc 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -1,8 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { Lithic } from 'lithic'; - -const { stringifyQuery } = Lithic.prototype as any; +import { stringifyQuery } from 'lithic/internal/utils/query'; describe(stringifyQuery, () => { for (const [input, expected] of [ @@ -15,7 +13,7 @@ describe(stringifyQuery, () => { 'e=f', )}=${encodeURIComponent('g&h')}`, ], - ]) { + ] as const) { it(`${JSON.stringify(input)} -> ${expected}`, () => { expect(stringifyQuery(input)).toEqual(expected); });