/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { expect, test } from "vitest"; import { Apideck } from "../index.js"; import { createTestHTTPClient } from "./testclient.js"; test("Bankaccounts Accounting Bank Accounts All", async () => { const testHttpClient = createTestHTTPClient("accounting.bankAccountsAll"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.bankAccounts.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", filter: { name: "Main Operating", accountType: "checking", status: "active", }, sort: {}, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getBankAccountsResponse).toBeDefined(); expect(result.getBankAccountsResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-accounts", operation: "all", data: [ { id: "12345", displayId: "BA-001", name: "Main Operating Account", accountNumber: "1234567890", accountType: "checking", bankName: "Chase Bank", currency: "USD", balance: 25000, availableBalance: 24500, overdraftLimit: 5000, routingNumber: "021000021", iban: "GB33BUKB20201555555555", bic: "CHASUS33", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", country: "US", status: "active", description: "Primary operating account for daily transactions", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", updatedBy: "12345", }, ], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: [ { type: "downstream_request_failed", statusCode: 429, operation: "getManager", }, ], }, links: { previous: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D", current: "https://unify.apideck.com/crm/companies", next: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM", }, }); }); test("Bankaccounts Accounting Bank Accounts Add", async () => { const testHttpClient = createTestHTTPClient("accounting.bankAccountsAdd"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.bankAccounts.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", accountingBankAccount: { displayId: "BA-001", name: "Main Operating Account", accountNumber: "123465", accountType: "checking", ledgerAccount: { id: "123456", name: "Bank account", nominalCode: "N091", code: "453", parentId: "123456", displayId: "123456", }, bankName: "Chase Bank", currency: "USD", balance: 25000, availableBalance: 24500, overdraftLimit: 5000, routingNumber: "021000021", iban: "GB33BUKB20201555555555", bic: "CHASUS33", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", country: "US", status: "active", description: "Primary operating account for daily transactions", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createBankAccountResponse).toBeDefined(); expect(result.createBankAccountResponse).toEqual({ statusCode: 201, status: "Created", service: "quickbooks", resource: "bank-accounts", operation: "add", data: { id: "12345", }, }); }); test("Bankaccounts Accounting Bank Accounts One", async () => { const testHttpClient = createTestHTTPClient("accounting.bankAccountsOne"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.bankAccounts.get({ id: "", filter: { accountType: "checking", }, consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", companyId: "12345", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getBankAccountResponse).toBeDefined(); expect(result.getBankAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-accounts", operation: "one", data: { id: "12345", downstreamId: "12345", displayId: "BA-001", name: "Main Operating Account", accountNumber: "123465", accountType: "checking", ledgerAccount: { id: "123456", name: "Bank account", nominalCode: "N091", code: "453", parentId: "123456", displayId: "123456", }, bankName: "Chase Bank", currency: "USD", balance: 25000, availableBalance: 24500, overdraftLimit: 5000, routingNumber: "021000021", iban: "GB33BUKB20201555555555", bic: "CHASUS33", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", country: "US", status: "active", description: "Primary operating account for daily transactions", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", updatedBy: "12345", }, meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, totalCount: 1, warnings: [ { type: "downstream_request_failed", statusCode: 429, operation: "getManager", }, ], }, }); }); test("Bankaccounts Accounting Bank Accounts Update", async () => { const testHttpClient = createTestHTTPClient("accounting.bankAccountsUpdate"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.bankAccounts.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", accountingBankAccount: { displayId: "BA-001", name: "Main Operating Account", accountNumber: "123465", accountType: "checking", ledgerAccount: { id: "123456", name: "Bank account", nominalCode: "N091", code: "453", parentId: "123456", displayId: "123456", }, bankName: "Chase Bank", currency: "USD", balance: 25000, availableBalance: 24500, overdraftLimit: 5000, routingNumber: "021000021", iban: "GB33BUKB20201555555555", bic: "CHASUS33", bsbNumber: "062-001", branchIdentifier: "001", bankCode: "BNH", country: "US", status: "active", description: "Primary operating account for daily transactions", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateBankAccountResponse).toBeDefined(); expect(result.updateBankAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-accounts", operation: "update", data: { id: "12345", }, }); }); test("Bankaccounts Accounting Bank Accounts Delete", async () => { const testHttpClient = createTestHTTPClient("accounting.bankAccountsDelete"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.bankAccounts.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteBankAccountResponse).toBeDefined(); expect(result.deleteBankAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-accounts", operation: "delete", data: { id: "12345", }, }); });