/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { bankAccountsCompleteMicroDeposits } from "../funcs/bankAccountsCompleteMicroDeposits.js"; import { bankAccountsCompleteVerification } from "../funcs/bankAccountsCompleteVerification.js"; import { bankAccountsDisable } from "../funcs/bankAccountsDisable.js"; import { bankAccountsGet } from "../funcs/bankAccountsGet.js"; import { bankAccountsGetVerification } from "../funcs/bankAccountsGetVerification.js"; import { bankAccountsInitiateMicroDeposits } from "../funcs/bankAccountsInitiateMicroDeposits.js"; import { bankAccountsInitiateVerification } from "../funcs/bankAccountsInitiateVerification.js"; import { bankAccountsLink } from "../funcs/bankAccountsLink.js"; import { bankAccountsList } from "../funcs/bankAccountsList.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class BankAccounts extends ClientSDK { /** * Link a bank account to an existing Moov account. Read our [bank accounts guide](https://docs.moov.io/guides/sources/bank-accounts/) to learn more. * * It is strongly recommended that callers include the `X-Wait-For` header, set to `payment-method`, if the newly linked * bank-account is intended to be used right away. If this header is not included, the caller will need to poll the [List Payment * Methods](https://docs.moov.io/api/sources/payment-methods/list/) * endpoint to wait for the new payment methods to be available for use. * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.write` scope. */ async link( request: operations.LinkBankAccountRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsLink( this, request, options, )); } /** * List all the bank accounts associated with a particular Moov account. * * Read our [bank accounts guide](https://docs.moov.io/guides/sources/bank-accounts/) to learn more. * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.read` scope. */ async list( request: operations.ListBankAccountsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsList( this, request, options, )); } /** * Retrieve bank account details (i.e. routing number or account type) associated with a specific Moov account. * * Read our [bank accounts guide](https://docs.moov.io/guides/sources/bank-accounts/) to learn more. * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.read` scope. */ async get( request: operations.GetBankAccountRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsGet( this, request, options, )); } /** * Discontinue using a specified bank account linked to a Moov account. * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.write` scope. */ async disable( request: operations.DisableBankAccountRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsDisable( this, request, options, )); } /** * Micro-deposits help confirm bank account ownership, helping reduce fraud and the risk of unauthorized activity. * Use this method to initiate the micro-deposit verification, sending two small credit transfers to the bank account * you want to confirm. * * If you request micro-deposits before 4:15PM ET, they will appear that same day. If you request micro-deposits any * time after 4:15PM ET, they will appear the next banking day. When the two credits are initiated, Moov simultaneously * initiates a debit to recoup the micro-deposits. * * Micro-deposits initiated for a `sandbox` bank account will always be `$0.00` / `$0.00` and instantly verifiable once initiated. * * You can simulate micro-deposit verification in test mode. See our [test mode](https://docs.moov.io/guides/get-started/test-mode/#micro-deposits) * guide for more information. * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.write` scope. */ async initiateMicroDeposits( request: operations.InitiateMicroDepositsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsInitiateMicroDeposits( this, request, options, )); } /** * Complete the micro-deposit validation process by passing the amounts of the two transfers within three tries. * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.write` scope. */ async completeMicroDeposits( request: operations.CompleteMicroDepositsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsCompleteMicroDeposits( this, request, options, )); } /** * Retrieve the current status and details of an instant verification, including whether the verification method was instant (RTP or FedNow) or same-day * ACH. This helps track the verification process in real-time and provides details in case of exceptions. * * The status will indicate the following: * * - `new`: Verification initiated, credit pending to the payment network * - `sent-credit`: Credit sent, available for verification * - `failed`: Verification failed, description provided, user needs to add a new bank account * - `expired`: Verification expired after 14 days, initiate another verification * - `max-attempts-exceeded`: Five incorrect code attempts exhausted, initiate another verification * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.read` scope. */ async getVerification( request: operations.GetBankAccountVerificationRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsGetVerification( this, request, options, )); } /** * Instant micro-deposit verification offers a quick and efficient way to verify bank account ownership. * * Send a $0.01 credit with a unique verification code via RTP, FedNow, or same-day ACH, depending on the receiving bank's capabilities. This * feature provides a faster alternative to traditional methods, allowing verification in a single session. * * It is recommended to use the `X-Wait-For: rail-response` header to synchronously receive the outcome of the instant credit in the * response payload. * * Possible verification methods: * - `instant`: Real-time verification credit sent via RTP or FedNow * - `ach`: Verification credit sent via same-day ACH * * Possible statuses: * - `new`: Verification initiated, credit pending * - `sent-credit`: Credit sent, available for verification in the external bank account * - `failed`: Verification failed due to credit rejection/return, details in `exceptionDetails` * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.write` scope. */ async initiateVerification( request: operations.InitiateBankAccountVerificationRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsInitiateVerification( this, request, options, )); } /** * Finalize the instant micro-deposit verification by submitting the verification code displayed in the user's bank account. * * Upon successful verification, the bank account status will be updated to `verified` and eligible for ACH debit transactions. * * The following formats are accepted: * - `MV0000` * - `mv0000` * - `0000` * * To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/) * you'll need to specify the `/accounts/{accountID}/bank-accounts.write` scope. */ async completeVerification( request: operations.CompleteBankAccountVerificationRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsCompleteVerification( this, request, options, )); } }