conductor-node 0.4.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,266 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const BaseClient_1 = __importDefault(require("../BaseClient"));
7
- class ClientQBD extends BaseClient_1.default {
8
- account = {
9
- /**
10
- * Perform the same activities as a user does in the QB New Account form,
11
- * which can be accessed in QB by selecting "Lists" → "Chart of Accounts" →
12
- * "Accounts" → "New".
13
- *
14
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountAdd
15
- */
16
- add: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { AccountAddRq: { AccountAdd: params } }, "AccountAddRs", "AccountRet"),
17
- /**
18
- * Modifies an account.
19
- *
20
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountMod
21
- */
22
- mod: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { AccountModRq: { AccountMod: params } }, "AccountModRs", "AccountRet"),
23
- /**
24
- * `AccountQuery` is a list query that returns data for all accounts that
25
- * match the provided filter criteria. Notice that it returns only data
26
- * internal to the account itself. It does not return any data about
27
- * transactions involving the account. It does, however, return the parent
28
- * account, if there is one. You can search across all accounts or you can
29
- * specify an account type and search only those.
30
- *
31
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountQuery
32
- */
33
- query: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { AccountQueryRq: params }, "AccountQueryRs", "AccountRet"),
34
- };
35
- customer = {
36
- /**
37
- * The customer list includes information about the QuickBooks user’s
38
- * customers and the individual jobs that are being performed for them. A
39
- * `CustomerRef` aggregate refers to one of the customers (or customer jobs)
40
- * on the list. In a request, if a `CustomerRef` aggregate includes both
41
- * `FullName` and `ListID`, `FullName` will be ignored. Special cases to
42
- * note:
43
- *
44
- * - In `SalesReceipt` and `ReceivePayment` requests, `CustomerRef` refers
45
- * to the customer or customer job to which the payment is credited.
46
- *
47
- * - In a `TimeTracking` request, CustomerRef refers to the customer or
48
- * customer job to which this time could be billed. If `IsBillable` is set
49
- * to true, `CustomerRef` is required in `TimeTrackingAdd`.
50
- *
51
- * - In an `ExpenseLineAdd` request, if `AccountRef` refers to an A/P
52
- * account, `CustomerRef` must refer to a vendor (not to a customer). If
53
- * `AccountRef` refers to any other type of account, the `CustomerRef`
54
- * must refer to a customer.
55
- *
56
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerAdd
57
- */
58
- add: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { CustomerAddRq: { CustomerAdd: params } }, "CustomerAddRs", "CustomerRet"),
59
- /**
60
- * Modifies the customer record.
61
- *
62
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerMod
63
- */
64
- mod: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { CustomerModRq: { CustomerMod: params } }, "CustomerModRs", "CustomerRet"),
65
- /**
66
- * Returns data for the specified customers.
67
- *
68
- * Important: We highly recommend that you use the `IncludeRetElement` tag
69
- * in your `CustomerQuery` to include any data you want but do NOT include
70
- * the `ShipAddress` data in the `Response`, unless you need to get the
71
- * shipping address for a particular customer. Excluding the shipping
72
- * address data will significantly improve the performance of the
73
- * `CustomerQuery`.
74
- *
75
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerQuery
76
- */
77
- query: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { CustomerQueryRq: params }, "CustomerQueryRs", "CustomerRet"),
78
- };
79
- employee = {
80
- /**
81
- * Adds an employee with personal data about the employee as well as certain
82
- * payroll-related data.
83
- *
84
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeAdd
85
- */
86
- add: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { EmployeeAddRq: { EmployeeAdd: params } }, "EmployeeAddRs", "EmployeeRet"),
87
- /**
88
- * Modifies an existing employee.
89
- *
90
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeMod
91
- */
92
- mod: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { EmployeeModRq: { EmployeeMod: params } }, "EmployeeModRs", "EmployeeRet"),
93
- /**
94
- * Returns employee data.
95
- *
96
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeQuery
97
- */
98
- query: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { EmployeeQueryRq: params }, "EmployeeQueryRs", "EmployeeRet"),
99
- };
100
- journalEntry = {
101
- /**
102
- * The debit and credit lines can be intermingled. A credit line can legally
103
- * come first in the journal entry add.
104
- *
105
- * In traditional accounting, transactions are entered into the general
106
- * journal and categorized exclusively by account. In QuickBooks, most
107
- * transactions can be categorized either by account or by type (invoice,
108
- * check, and so on). For a few activities in QuickBooks, you must use the
109
- * general journal directly, for example for recording depreciation. Notice
110
- * that you must supply the credit line and a corresponding debit line in
111
- * the same request. It will not work to supply them in two distinct
112
- * requests. You can supply as many credit lines and debit lines in one
113
- * single request as you want so long as the total monetary amount from the
114
- * credits equals the total monetary amount from the debits in that request.
115
- *
116
- * Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
117
- * does that for you. If you do supply the negative sign, amounts will add
118
- * instead of cancel and you’ll get a runtime error.
119
- *
120
- * Querying for Condensed Transactions: If you need the query to return
121
- * condensed transactions, you can do this by using either an `Entity` or
122
- * `Account` filter in the journal query request. Alternatively, you could
123
- * use the The generic `TransactionQuery`, which can return condensed
124
- * transactions.
125
- *
126
- * If the transaction is a home currency adjustment, QuickBooks will ignore
127
- * the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
128
- * elements.
129
- *
130
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryAdd
131
- */
132
- add: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { JournalEntryAddRq: { JournalEntryAdd: params } }, "JournalEntryAddRs", "JournalEntryRet"),
133
- /**
134
- * Modifies a journal entry.
135
- *
136
- * If the transaction is a home currency adjustment, QuickBooks will ignore
137
- * the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
138
- * elements.
139
- *
140
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryMod
141
- */
142
- mod: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { JournalEntryModRq: { JournalEntryMod: params } }, "JournalEntryModRs", "JournalEntryRet"),
143
- /**
144
- * In traditional accounting, transactions are entered into the general
145
- * journal and categorized exclusively by account. In QuickBooks, most
146
- * transactions can be categorized either by account or by type (invoice,
147
- * check, and so on). For a few activities in QuickBooks, you must use the
148
- * general journal directly, for example for recording depreciation. Notice
149
- * that you must supply the credit line and a corresponding debit line in
150
- * the same request. It will not work to supply them in two distinct
151
- * requests. You can supply as many credit lines and debit lines in one
152
- * single request as you want so long as the total monetary amount from the
153
- * credits equals the total monetary amount from the debits in that request.
154
- *
155
- * Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
156
- * does that for you. If you do supply the negative sign, amounts will add
157
- * instead of cancel and you’ll get a runtime error.
158
- *
159
- * Querying for Condensed Transactions: If you need the query to return
160
- * condensed transactions, you can do this by using either an `Entity` or
161
- * `Account` filter in the journal query request. Alternatively, you could
162
- * use the The generic `TransactionQuery`, which can return condensed
163
- * transactions.
164
- *
165
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryQuery
166
- */
167
- query: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { JournalEntryQueryRq: params }, "JournalEntryQueryRs", "JournalEntryRet"),
168
- };
169
- timeTracking = {
170
- /**
171
- * The time-tracking transactions that are returned in this query include
172
- * time tracking information that was entered into QuickBooks manually or
173
- * gathered using the QuickBooks “Timer” or “Stopwatch.” Note that the
174
- * QuickBooks Timer application can run on its own without QuickBooks, but
175
- * the QuickBooks SDK cannot access the Timer data directly. The Timer data
176
- * must be imported into QuickBooks before it is accessible via the SDK.)
177
- *
178
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/TimeTrackingQuery
179
- */
180
- add: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { TimeTrackingAddRq: { TimeTrackingAdd: params } }, "TimeTrackingAddRs", "TimeTrackingRet"),
181
- /**
182
- * Modifies a time tracking transaction.
183
- *
184
- * This allows you to modify time entry and mark time entered as billed.
185
- * Applications using qbXML spec levels less than 6.0 aren’t able to Modify
186
- * a time tracking transaction. However, those applications can achieve the
187
- * results of a modify operation by deleting the time tracking transaction
188
- * (using `TxnDelRq`) and then re-adding it with the desired values. You can
189
- * do this only if no other downstream transactions have used that
190
- * particular time tracking transaction. (Otherwise, the `TxnDel` request
191
- * will fail.) This differs slightly from the UI, which allows these
192
- * transactions to be edited directly. However, even in the UI, modifying a
193
- * time tracking transaction does not result in changes to any downstream
194
- * transactions that use it. There is no link between an invoice and the
195
- * time entries. However when you do the invoicing from QuickBooks,
196
- * QuickBooks does mark the time entries as “billed.” If you don’t record
197
- * the time entries as billed properly, then you get into a user workflow
198
- * issue where every time the user creates an invoice for a customer, QB
199
- * pops up a dialog asking if they want to bill the un-billed time (which
200
- * you already billed from your app). That’s why beginning with QB2007 and
201
- * qbXML spec 6.0 we added support for the “BillableStatus” field *and* add
202
- * `TimeTrackingMod` so that you can mark the time as billed when you create
203
- * an invoice for it.
204
- *
205
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/TimeTrackingMod
206
- */
207
- mod: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { TimeTrackingModRq: { TimeTrackingMod: params } }, "TimeTrackingModRs", "TimeTrackingRet"),
208
- /**
209
- * The time-tracking transactions that are returned in this query include
210
- * time tracking information that was entered into QuickBooks manually or
211
- * gathered using the QuickBooks “Timer” or “Stopwatch.” Note that the
212
- * QuickBooks Timer application can run on its own without QuickBooks, but
213
- * the QuickBooks SDK cannot access the Timer data directly. The Timer data
214
- * must be imported into QuickBooks before it is accessible via the SDK.)
215
- *
216
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/TimeTrackingQuery
217
- */
218
- query: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { TimeTrackingQueryRq: params }, "TimeTrackingQueryRs", "TimeTrackingRet"),
219
- };
220
- vendor = {
221
- /**
222
- * Adds a vendor.
223
- *
224
- * A vendor is any person or company from whom a small business owner buys
225
- * goods and services. (Banks and tax agencies usually are included on the
226
- * vendor list.) A company’s vendor list contains information such as
227
- * account balance and contact information about each vendor. A `VendorRef`
228
- * aggregate refers to one of the vendors on the list. In a request, if a
229
- * `VendorRef` aggregate includes both `FullName` and `ListID`, `FullName`
230
- * will be ignored.
231
- *
232
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorAdd
233
- */
234
- add: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { VendorAddRq: { VendorAdd: params } }, "VendorAddRs", "VendorRet"),
235
- /**
236
- * Modifies a vendor.
237
- *
238
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorMod
239
- */
240
- mod: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { VendorModRq: { VendorMod: params } }, "VendorModRs", "VendorRet"),
241
- /**
242
- * Queries for the specified vendor or set of vendors.
243
- *
244
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorQuery
245
- */
246
- query: async (qbwcUsername, params) => this.sendRequestBase(qbwcUsername, { VendorQueryRq: params }, "VendorQueryRs", "VendorRet"),
247
- };
248
- /**
249
- * Send any QBXML request to QuickBooks Desktop.
250
- *
251
- * Available APIs:
252
- * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop
253
- */
254
- async sendRequest(qbwcUsername, requestObj) {
255
- return this.sendAPIRequest("qbd", qbwcUsername, requestObj);
256
- }
257
- async sendRequestBase(qbwcUsername, params, responseKey, responseBodyKey) {
258
- const response = (await this.sendRequest(qbwcUsername, params));
259
- const responseBody = response[responseKey]?.[responseBodyKey];
260
- if (responseBody == null) {
261
- throw new Error("No response");
262
- }
263
- return responseBody;
264
- }
265
- }
266
- exports.default = ClientQBD;