/* * 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("Bankfeedstatements Accounting Bank Feed Statements All", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedStatementsAll", ); 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.bankFeedStatements.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getBankFeedStatementsResponse).toBeDefined(); expect(result.getBankFeedStatementsResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-statements", operation: "all", data: [ { id: "12345", bankFeedAccountId: "acc_456", status: "pending", startDate: new Date("2021-05-01T12:00:00.000Z"), endDate: new Date("2025-01-31T12:00:00.000Z"), startBalance: 10500.25, startBalanceCreditOrDebit: "debit", endBalance: 9800.5, endBalanceCreditOrDebit: "debit", transactions: [ { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", }, { id: "12345", bankFeedAccountId: "acc_456", status: "pending", startDate: new Date("2021-05-01T12:00:00.000Z"), endDate: new Date("2025-01-31T12:00:00.000Z"), startBalance: 10500.25, startBalanceCreditOrDebit: "debit", endBalance: 9800.5, endBalanceCreditOrDebit: "debit", transactions: [ { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", }, { id: "12345", bankFeedAccountId: "acc_456", status: "pending", startDate: new Date("2021-05-01T12:00:00.000Z"), endDate: new Date("2025-01-31T12:00:00.000Z"), startBalance: 10500.25, startBalanceCreditOrDebit: "debit", endBalance: 9800.5, endBalanceCreditOrDebit: "debit", transactions: [ { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", }, ], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, }, 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("Bankfeedstatements Accounting Bank Feed Statements Add", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedStatementsAdd", ); 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.bankFeedStatements.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", bankFeedStatement: { bankFeedAccountId: "acc_456", status: "pending", startDate: new Date("2021-05-01T12:00:00.000Z"), endDate: new Date("2025-01-31T12:00:00.000Z"), startBalance: 10500.25, startBalanceCreditOrDebit: "debit", endBalance: 9800.5, endBalanceCreditOrDebit: "debit", transactions: [ { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createBankFeedStatementResponse).toBeDefined(); expect(result.createBankFeedStatementResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "bills", operation: "add", data: { id: "12345", }, }); }); test("Bankfeedstatements Accounting Bank Feed Statements One", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedStatementsOne", ); 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.bankFeedStatements.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getBankFeedStatementResponse).toBeDefined(); expect(result.getBankFeedStatementResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-statements", operation: "one", data: { id: "12345", bankFeedAccountId: "acc_456", status: "pending", startDate: new Date("2021-05-01T12:00:00.000Z"), endDate: new Date("2025-01-31T12:00:00.000Z"), startBalance: 10500.25, startBalanceCreditOrDebit: "debit", endBalance: 9800.5, endBalanceCreditOrDebit: "debit", transactions: [ { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", }, }); }); test("Bankfeedstatements Accounting Bank Feed Statements Update", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedStatementsUpdate", ); 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.bankFeedStatements.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", bankFeedStatement: { bankFeedAccountId: "acc_456", status: "pending", startDate: new Date("2021-05-01T12:00:00.000Z"), endDate: new Date("2025-01-31T12:00:00.000Z"), startBalance: 10500.25, startBalanceCreditOrDebit: "debit", endBalance: 9800.5, endBalanceCreditOrDebit: "debit", transactions: [ { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, { postedDate: new Date("2025-01-15T12:00:00.000Z"), description: "Payment received from ACME Corp", amount: 250, creditOrDebit: "debit", sourceTransactionId: "txn_987", counterparty: "ACME Corp", reference: "INV-2025-01", transactionType: "payment", }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateBankFeedStatementResponse).toBeDefined(); expect(result.updateBankFeedStatementResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-statements", operation: "update", data: { id: "12345", }, }); }); test("Bankfeedstatements Accounting Bank Feed Statements Delete", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedStatementsDelete", ); 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.bankFeedStatements.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteBankFeedStatementResponse).toBeDefined(); expect(result.deleteBankFeedStatementResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-statements", operation: "delete", data: { id: "12345", }, }); });