/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { bankAccountsCreate } from "../funcs/bankAccountsCreate.js"; import { bankAccountsCreateFromPlaidToken } from "../funcs/bankAccountsCreateFromPlaidToken.js"; import { bankAccountsDeleteV1CompaniesCompanyIdBankAccountsBankAccountId } from "../funcs/bankAccountsDeleteV1CompaniesCompanyIdBankAccountsBankAccountId.js"; import { bankAccountsGet } from "../funcs/bankAccountsGet.js"; import { bankAccountsVerify } from "../funcs/bankAccountsVerify.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1CompaniesCompanyIdBankAccountsBankAccountIdRequest, DeleteV1CompaniesCompanyIdBankAccountsBankAccountIdResponse, } from "../models/operations/deletev1companiescompanyidbankaccountsbankaccountid.js"; import { GetV1CompaniesCompanyIdBankAccountsRequest, GetV1CompaniesCompanyIdBankAccountsResponse, } from "../models/operations/getv1companiescompanyidbankaccounts.js"; import { PostV1CompaniesCompanyIdBankAccountsRequest, PostV1CompaniesCompanyIdBankAccountsResponse, } from "../models/operations/postv1companiescompanyidbankaccounts.js"; import { PostV1PlaidProcessorTokenRequest, PostV1PlaidProcessorTokenResponse, } from "../models/operations/postv1plaidprocessortoken.js"; import { PutV1CompaniesCompanyIdBankAccountsVerifyRequest, PutV1CompaniesCompanyIdBankAccountsVerifyResponse, } from "../models/operations/putv1companiescompanyidbankaccountsverify.js"; import { unwrapAsync } from "../types/fp.js"; export class BankAccounts extends ClientSDK { /** * Get all company bank accounts * * @remarks * Returns company bank accounts. Currently, we only support a single default bank account per company. * * scope: `company_bank_accounts:read` */ async get( request: GetV1CompaniesCompanyIdBankAccountsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsGet( this, request, options, )); } /** * Create a company bank account * * @remarks * This endpoint creates a new company bank account. * * Upon being created, two verification deposits are automatically sent to the bank account, and the bank account's verification_status is 'awaiting_deposits'. * * When the deposits are successfully transferred, the verification_status changes to 'ready_for_verification', at which point the verify endpoint can be used to verify the bank account. * After successful verification, the bank account's verification_status is 'verified'. * * >🚧 Warning * > * > If a default bank account exists, it will be disabled and the new bank account will replace it as the company's default funding method. * * scope: `company_bank_accounts:write` */ async create( request: PostV1CompaniesCompanyIdBankAccountsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsCreate( this, request, options, )); } /** * Verify a company bank account * * @remarks * Verify a company bank account by confirming the two micro-deposits sent to the bank account. * * Note that the order of the two deposits specified in request parameters does not matter. * There's a maximum of 5 verification attempts, after which we will automatically initiate a new set of micro-deposits and require the bank account to be verified with the new micro-deposits. * * ### Bank account verification in demo * In the demo environment, use the `POST /v1/companies/{company_id}/bank_accounts/{bank_account_uuid}/send_test_deposits` endpoint to simulate the micro-deposits transfer and return the two amounts in the response. You can call this endpoint as many times as you wish to retrieve the values of the two micro-deposits. * * ### Webhooks * - `company.bank_account.verified`: Fires when the company bank account is successfully verified. * * ### Related guides * - [Manage company bank accounts](doc:manage-company-bank-accounts) * - [Bank Account Events](doc:bank-account-events) * * scope: `company_bank_accounts:write` */ async verify( request: PutV1CompaniesCompanyIdBankAccountsVerifyRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsVerify( this, request, options, )); } /** * Create a bank account from a plaid processor token * * @remarks * This endpoint creates a new **verified** bank account by using a plaid processor token to retrieve its information. * * > 📘 * > To create a token please use the [plaid api](https://plaid.com/docs/api/processors/#processortokencreate) and select "gusto" as processor. * * > 🚧 Warning - Company Bank Accounts * > * > If a default company bank account exists, it will be disabled and the new bank account will replace it as the company's default funding method. * * scope: `plaid_processor:write` */ async createFromPlaidToken( request: PostV1PlaidProcessorTokenRequest, options?: RequestOptions, ): Promise { return unwrapAsync(bankAccountsCreateFromPlaidToken( this, request, options, )); } /** * Delete a company bank account * * @remarks * This endpoint disables a company bank account. * * A bank account cannot be disabled if it is used for any unprocessed payments. * * scope: `company_bank_accounts:write` */ async deleteV1CompaniesCompanyIdBankAccountsBankAccountId( request: DeleteV1CompaniesCompanyIdBankAccountsBankAccountIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync( bankAccountsDeleteV1CompaniesCompanyIdBankAccountsBankAccountId( this, request, options, ), ); } }