conductor-node 3.2.0 → 3.2.2
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.
- package/dist/src/BaseClient.d.ts +5 -0
- package/dist/src/BaseClient.js +9 -0
- package/dist/src/Client.d.ts +21 -0
- package/dist/src/Client.js +62 -0
- package/dist/src/__tests__/Client.test.d.ts +1 -0
- package/dist/src/__tests__/Client.test.js +16 -0
- package/dist/src/environment.d.ts +2 -0
- package/dist/src/environment.js +16 -0
- package/dist/src/qbd/ClientQbd.d.ts +376 -0
- package/dist/src/qbd/ClientQbd.js +393 -0
- package/dist/src/qbd/__tests__/ClientQbd.test.d.ts +1 -0
- package/dist/src/qbd/__tests__/ClientQbd.test.js +26 -0
- package/dist/src/qbd/qbdTypes.d.ts +3007 -0
- package/dist/src/qbd/qbdTypes.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,393 @@
|
|
|
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 (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { 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 (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { 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 (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { AccountQueryRq: params }, "AccountQueryRs", "AccountRet"),
|
|
34
|
+
};
|
|
35
|
+
check = {
|
|
36
|
+
/**
|
|
37
|
+
* The amount of a check is the total of the amounts assigned to expense
|
|
38
|
+
* lines and item lines. You can write a check for:
|
|
39
|
+
* - Any expense that you track through expense accounts.
|
|
40
|
+
* - The following types of items: fixed asset, non-inventory part, service,
|
|
41
|
+
* and other charge.
|
|
42
|
+
* - Putting money into your petty cash account.
|
|
43
|
+
* - Inventory part items (if you use the inventory/purchase order feature).
|
|
44
|
+
*
|
|
45
|
+
* You cannot use a `CheckAdd` for any of the following:
|
|
46
|
+
* - Paying a bill by check; instead, use a `BillPaymentCheckAdd`.
|
|
47
|
+
* - Paying employees or create paychecks.
|
|
48
|
+
* - Paying payroll taxes and liabilities.
|
|
49
|
+
* - Paying sales tax.
|
|
50
|
+
* - Paying for received items.
|
|
51
|
+
*
|
|
52
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckAdd
|
|
53
|
+
*/
|
|
54
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CheckAddRq: { CheckAdd: params } }, "CheckAddRs", "CheckRet"),
|
|
55
|
+
/**
|
|
56
|
+
* Modifies an existing Check. Notice that you cannot use this to modify BillPaymentChecks.
|
|
57
|
+
*
|
|
58
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckMod
|
|
59
|
+
*/
|
|
60
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CheckModRq: { CheckMod: params } }, "CheckModRs", "CheckRet"),
|
|
61
|
+
/**
|
|
62
|
+
* Returns certain types of checks based on the supplied query criteria.
|
|
63
|
+
* Note that `BillPaymentChecks`, payroll checks, and liability checks are
|
|
64
|
+
* not returned.
|
|
65
|
+
*
|
|
66
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckQuery
|
|
67
|
+
*/
|
|
68
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CheckQueryRq: params }, "CheckQueryRs", "CheckRet"),
|
|
69
|
+
};
|
|
70
|
+
class = {
|
|
71
|
+
/**
|
|
72
|
+
* Classes can be used to separate transactions into meaningful categories.
|
|
73
|
+
* (For example, transactions could be classified according to department,
|
|
74
|
+
* business location, or type of work.) In QuickBooks, class tracking is off
|
|
75
|
+
* by default.
|
|
76
|
+
*
|
|
77
|
+
* A `ClassRef` aggregate refers to one of these named classes. For example,
|
|
78
|
+
* in a `TimeTracking` message, `ClassRef` refers to the QuickBooks class
|
|
79
|
+
* into which the timed activity falls. If a `ClassRef` aggregate includes
|
|
80
|
+
* both `FullName` and `ListID`, `FullName` will be ignored.
|
|
81
|
+
*
|
|
82
|
+
* In an `InvoiceAdd` request, if you specify a `ClassRef` for the whole
|
|
83
|
+
* invoice, that same `ClassRef` is automatically used in the line items. If
|
|
84
|
+
* you want to clear that (that is, have NO `ClassRef` for the line item,
|
|
85
|
+
* you can clear it in the line item by simply not specifying it in the line
|
|
86
|
+
* item.
|
|
87
|
+
*
|
|
88
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassAdd
|
|
89
|
+
*/
|
|
90
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ClassAddRq: { ClassAdd: params } }, "ClassAddRs", "ClassRet"),
|
|
91
|
+
/**
|
|
92
|
+
* Modifies the specified class.
|
|
93
|
+
*
|
|
94
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassMod
|
|
95
|
+
*/
|
|
96
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ClassModRq: { ClassMod: params } }, "ClassModRs", "ClassRet"),
|
|
97
|
+
/**
|
|
98
|
+
* Queries for existing classes.
|
|
99
|
+
*
|
|
100
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassQuery
|
|
101
|
+
*/
|
|
102
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ClassQueryRq: params }, "ClassQueryRs", "ClassRet"),
|
|
103
|
+
};
|
|
104
|
+
customer = {
|
|
105
|
+
/**
|
|
106
|
+
* The customer list includes information about the QuickBooks user’s
|
|
107
|
+
* customers and the individual jobs that are being performed for them. A
|
|
108
|
+
* `CustomerRef` aggregate refers to one of the customers (or customer jobs)
|
|
109
|
+
* on the list. In a request, if a `CustomerRef` aggregate includes both
|
|
110
|
+
* `FullName` and `ListID`, `FullName` will be ignored. Special cases to
|
|
111
|
+
* note:
|
|
112
|
+
*
|
|
113
|
+
* - In `SalesReceipt` and `ReceivePayment` requests, `CustomerRef` refers
|
|
114
|
+
* to the customer or customer job to which the payment is credited.
|
|
115
|
+
*
|
|
116
|
+
* - In a `TimeTracking` request, CustomerRef refers to the customer or
|
|
117
|
+
* customer job to which this time could be billed. If `IsBillable` is set
|
|
118
|
+
* to true, `CustomerRef` is required in `TimeTrackingAdd`.
|
|
119
|
+
*
|
|
120
|
+
* - In an `ExpenseLineAdd` request, if `AccountRef` refers to an A/P
|
|
121
|
+
* account, `CustomerRef` must refer to a vendor (not to a customer). If
|
|
122
|
+
* `AccountRef` refers to any other type of account, the `CustomerRef`
|
|
123
|
+
* must refer to a customer.
|
|
124
|
+
*
|
|
125
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerAdd
|
|
126
|
+
*/
|
|
127
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CustomerAddRq: { CustomerAdd: params } }, "CustomerAddRs", "CustomerRet"),
|
|
128
|
+
/**
|
|
129
|
+
* Modifies the customer record.
|
|
130
|
+
*
|
|
131
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerMod
|
|
132
|
+
*/
|
|
133
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CustomerModRq: { CustomerMod: params } }, "CustomerModRs", "CustomerRet"),
|
|
134
|
+
/**
|
|
135
|
+
* Returns data for the specified customers.
|
|
136
|
+
*
|
|
137
|
+
* Important: We highly recommend that you use the `IncludeRetElement` tag
|
|
138
|
+
* in your `CustomerQuery` to include any data you want but do NOT include
|
|
139
|
+
* the `ShipAddress` data in the `Response`, unless you need to get the
|
|
140
|
+
* shipping address for a particular customer. Excluding the shipping
|
|
141
|
+
* address data will significantly improve the performance of the
|
|
142
|
+
* `CustomerQuery`.
|
|
143
|
+
*
|
|
144
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerQuery
|
|
145
|
+
*/
|
|
146
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CustomerQueryRq: params }, "CustomerQueryRs", "CustomerRet"),
|
|
147
|
+
};
|
|
148
|
+
employee = {
|
|
149
|
+
/**
|
|
150
|
+
* Adds an employee with personal data about the employee as well as certain
|
|
151
|
+
* payroll-related data.
|
|
152
|
+
*
|
|
153
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeAdd
|
|
154
|
+
*/
|
|
155
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { EmployeeAddRq: { EmployeeAdd: params } }, "EmployeeAddRs", "EmployeeRet"),
|
|
156
|
+
/**
|
|
157
|
+
* Modifies an existing employee.
|
|
158
|
+
*
|
|
159
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeMod
|
|
160
|
+
*/
|
|
161
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { EmployeeModRq: { EmployeeMod: params } }, "EmployeeModRs", "EmployeeRet"),
|
|
162
|
+
/**
|
|
163
|
+
* Returns employee data.
|
|
164
|
+
*
|
|
165
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeQuery
|
|
166
|
+
*/
|
|
167
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { EmployeeQueryRq: params }, "EmployeeQueryRs", "EmployeeRet"),
|
|
168
|
+
};
|
|
169
|
+
itemService = {
|
|
170
|
+
/**
|
|
171
|
+
* Adds a service item, which is an item that refers to services that a
|
|
172
|
+
* business charges for or purchases. Examples include specialized labor,
|
|
173
|
+
* consulting hours, and professional fees. An `ItemServiceRef` aggregate
|
|
174
|
+
* refers to an item on the ItemService list. In a request, if an
|
|
175
|
+
* `ItemServiceRef` aggregate includes both `FullName` and `ListID`,
|
|
176
|
+
* `FullName` will be ignored.
|
|
177
|
+
*
|
|
178
|
+
* In a `TimeTracking` message, `ItemServiceRef` refers to the type of work.
|
|
179
|
+
* If no `CustomerRef` is specified, then `ItemServiceRef` is not needed. If
|
|
180
|
+
* `IsBillable` is set to true, then `TimeTrackingAdd` must include both
|
|
181
|
+
* `ItemServiceRef` and `CustomerRef`.
|
|
182
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceAdd
|
|
183
|
+
*/
|
|
184
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ItemServiceAddRq: { ItemServiceAdd: params } }, "ItemServiceAddRs", "ItemServiceRet"),
|
|
185
|
+
/**
|
|
186
|
+
* Modifies an existing service item.
|
|
187
|
+
*
|
|
188
|
+
* About `SalesOrPurchaseMod` versus `SalesAndPurchaseMod` in an
|
|
189
|
+
* `ItemServiceMod` request:
|
|
190
|
+
* - You cannot change the reimbursable status of a service item through the
|
|
191
|
+
* SDK. For example, if a service item is marked as non-reimbursable in
|
|
192
|
+
* QuickBooks, you cannot send a modify request that includes a
|
|
193
|
+
* `SalesAndPurchaseMod` aggregate. Similarly, if you send an
|
|
194
|
+
* `ItemServiceAdd` request that includes a `SalesOrPurchase` aggregate,
|
|
195
|
+
* you cannot later modify that item using a `SalesAndPurchaseMod`
|
|
196
|
+
* aggregate.
|
|
197
|
+
* - You can modify the various account references using the appropriate
|
|
198
|
+
* account reference aggregate and the matching `RefToExistingTxns`
|
|
199
|
+
* boolean. You need to use the boolean when you change an account ref
|
|
200
|
+
* because the QuickBooks UI displays a prompt asking whether the change
|
|
201
|
+
* should apply to existing transactions or not.
|
|
202
|
+
* - Specifying `False` means that the mod will not take affect if there
|
|
203
|
+
* are existing transactions.
|
|
204
|
+
* - Specifying `True` for the boolean basically dismisses this with a
|
|
205
|
+
* “Yes” answer, allowing your changes to be made and changes any
|
|
206
|
+
* existing transactions that use the item with that `AccountRef`.
|
|
207
|
+
* Setting this to `True` should be used with caution and normally only
|
|
208
|
+
* after some user has indicated that they want those changes made to
|
|
209
|
+
* all those existing transactions! If any affected transactions are
|
|
210
|
+
* protected by a closing date and password, the `AccountRef` changes
|
|
211
|
+
* will not be made and so the `Mod` request will return an error
|
|
212
|
+
* without making the requested `Mod`.
|
|
213
|
+
*
|
|
214
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceMod
|
|
215
|
+
*/
|
|
216
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ItemServiceModRq: { ItemServiceMod: params } }, "ItemServiceModRs", "ItemServiceRet"),
|
|
217
|
+
/**
|
|
218
|
+
* Queries for the specified service item or set of items.
|
|
219
|
+
*
|
|
220
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceQuery
|
|
221
|
+
*/
|
|
222
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ItemServiceQueryRq: params }, "ItemServiceQueryRs", "ItemServiceRet"),
|
|
223
|
+
};
|
|
224
|
+
journalEntry = {
|
|
225
|
+
/**
|
|
226
|
+
* The debit and credit lines can be intermingled. A credit line can legally
|
|
227
|
+
* come first in the journal entry add.
|
|
228
|
+
*
|
|
229
|
+
* In traditional accounting, transactions are entered into the general
|
|
230
|
+
* journal and categorized exclusively by account. In QuickBooks, most
|
|
231
|
+
* transactions can be categorized either by account or by type (invoice,
|
|
232
|
+
* check, and so on). For a few activities in QuickBooks, you must use the
|
|
233
|
+
* general journal directly, for example for recording depreciation. Notice
|
|
234
|
+
* that you must supply the credit line and a corresponding debit line in
|
|
235
|
+
* the same request. It will not work to supply them in two distinct
|
|
236
|
+
* requests. You can supply as many credit lines and debit lines in one
|
|
237
|
+
* single request as you want so long as the total monetary amount from the
|
|
238
|
+
* credits equals the total monetary amount from the debits in that request.
|
|
239
|
+
*
|
|
240
|
+
* Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
|
|
241
|
+
* does that for you. If you do supply the negative sign, amounts will add
|
|
242
|
+
* instead of cancel and you’ll get a runtime error.
|
|
243
|
+
*
|
|
244
|
+
* Querying for Condensed Transactions: If you need the query to return
|
|
245
|
+
* condensed transactions, you can do this by using either an `Entity` or
|
|
246
|
+
* `Account` filter in the journal query request. Alternatively, you could
|
|
247
|
+
* use the The generic `TransactionQuery`, which can return condensed
|
|
248
|
+
* transactions.
|
|
249
|
+
*
|
|
250
|
+
* If the transaction is a home currency adjustment, QuickBooks will ignore
|
|
251
|
+
* the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
|
|
252
|
+
* elements.
|
|
253
|
+
*
|
|
254
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryAdd
|
|
255
|
+
*/
|
|
256
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { JournalEntryAddRq: { JournalEntryAdd: params } }, "JournalEntryAddRs", "JournalEntryRet"),
|
|
257
|
+
/**
|
|
258
|
+
* Modifies a journal entry.
|
|
259
|
+
*
|
|
260
|
+
* If the transaction is a home currency adjustment, QuickBooks will ignore
|
|
261
|
+
* the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
|
|
262
|
+
* elements.
|
|
263
|
+
*
|
|
264
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryMod
|
|
265
|
+
*/
|
|
266
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { JournalEntryModRq: { JournalEntryMod: params } }, "JournalEntryModRs", "JournalEntryRet"),
|
|
267
|
+
/**
|
|
268
|
+
* In traditional accounting, transactions are entered into the general
|
|
269
|
+
* journal and categorized exclusively by account. In QuickBooks, most
|
|
270
|
+
* transactions can be categorized either by account or by type (invoice,
|
|
271
|
+
* check, and so on). For a few activities in QuickBooks, you must use the
|
|
272
|
+
* general journal directly, for example for recording depreciation. Notice
|
|
273
|
+
* that you must supply the credit line and a corresponding debit line in
|
|
274
|
+
* the same request. It will not work to supply them in two distinct
|
|
275
|
+
* requests. You can supply as many credit lines and debit lines in one
|
|
276
|
+
* single request as you want so long as the total monetary amount from the
|
|
277
|
+
* credits equals the total monetary amount from the debits in that request.
|
|
278
|
+
*
|
|
279
|
+
* Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
|
|
280
|
+
* does that for you. If you do supply the negative sign, amounts will add
|
|
281
|
+
* instead of cancel and you’ll get a runtime error.
|
|
282
|
+
*
|
|
283
|
+
* Querying for Condensed Transactions: If you need the query to return
|
|
284
|
+
* condensed transactions, you can do this by using either an `Entity` or
|
|
285
|
+
* `Account` filter in the journal query request. Alternatively, you could
|
|
286
|
+
* use the The generic `TransactionQuery`, which can return condensed
|
|
287
|
+
* transactions.
|
|
288
|
+
*
|
|
289
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryQuery
|
|
290
|
+
*/
|
|
291
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { JournalEntryQueryRq: params }, "JournalEntryQueryRs", "JournalEntryRet"),
|
|
292
|
+
};
|
|
293
|
+
timeTracking = {
|
|
294
|
+
/**
|
|
295
|
+
* The time-tracking transactions that are returned in this query include
|
|
296
|
+
* time tracking information that was entered into QuickBooks manually or
|
|
297
|
+
* gathered using the QuickBooks “Timer” or “Stopwatch.” Note that the
|
|
298
|
+
* QuickBooks Timer application can run on its own without QuickBooks, but
|
|
299
|
+
* the QuickBooks SDK cannot access the Timer data directly. The Timer data
|
|
300
|
+
* must be imported into QuickBooks before it is accessible via the SDK.)
|
|
301
|
+
*
|
|
302
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/TimeTrackingQuery
|
|
303
|
+
*/
|
|
304
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { TimeTrackingAddRq: { TimeTrackingAdd: params } }, "TimeTrackingAddRs", "TimeTrackingRet"),
|
|
305
|
+
/**
|
|
306
|
+
* Modifies a time tracking transaction.
|
|
307
|
+
*
|
|
308
|
+
* This allows you to modify time entry and mark time entered as billed.
|
|
309
|
+
* Applications using qbXML spec levels less than 6.0 aren’t able to Modify
|
|
310
|
+
* a time tracking transaction. However, those applications can achieve the
|
|
311
|
+
* results of a modify operation by deleting the time tracking transaction
|
|
312
|
+
* (using `TxnDelRq`) and then re-adding it with the desired values. You can
|
|
313
|
+
* do this only if no other downstream transactions have used that
|
|
314
|
+
* particular time tracking transaction. (Otherwise, the `TxnDel` request
|
|
315
|
+
* will fail.) This differs slightly from the UI, which allows these
|
|
316
|
+
* transactions to be edited directly. However, even in the UI, modifying a
|
|
317
|
+
* time tracking transaction does not result in changes to any downstream
|
|
318
|
+
* transactions that use it. There is no link between an invoice and the
|
|
319
|
+
* time entries. However when you do the invoicing from QuickBooks,
|
|
320
|
+
* QuickBooks does mark the time entries as “billed.” If you don’t record
|
|
321
|
+
* the time entries as billed properly, then you get into a user workflow
|
|
322
|
+
* issue where every time the user creates an invoice for a customer, QB
|
|
323
|
+
* pops up a dialog asking if they want to bill the un-billed time (which
|
|
324
|
+
* you already billed from your app). That’s why beginning with QB2007 and
|
|
325
|
+
* qbXML spec 6.0 we added support for the “BillableStatus” field *and* add
|
|
326
|
+
* `TimeTrackingMod` so that you can mark the time as billed when you create
|
|
327
|
+
* an invoice for it.
|
|
328
|
+
*
|
|
329
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/TimeTrackingMod
|
|
330
|
+
*/
|
|
331
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { TimeTrackingModRq: { TimeTrackingMod: params } }, "TimeTrackingModRs", "TimeTrackingRet"),
|
|
332
|
+
/**
|
|
333
|
+
* The time-tracking transactions that are returned in this query include
|
|
334
|
+
* time tracking information that was entered into QuickBooks manually or
|
|
335
|
+
* gathered using the QuickBooks “Timer” or “Stopwatch.” Note that the
|
|
336
|
+
* QuickBooks Timer application can run on its own without QuickBooks, but
|
|
337
|
+
* the QuickBooks SDK cannot access the Timer data directly. The Timer data
|
|
338
|
+
* must be imported into QuickBooks before it is accessible via the SDK.)
|
|
339
|
+
*
|
|
340
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/TimeTrackingQuery
|
|
341
|
+
*/
|
|
342
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { TimeTrackingQueryRq: params }, "TimeTrackingQueryRs", "TimeTrackingRet"),
|
|
343
|
+
};
|
|
344
|
+
vendor = {
|
|
345
|
+
/**
|
|
346
|
+
* Adds a vendor.
|
|
347
|
+
*
|
|
348
|
+
* A vendor is any person or company from whom a small business owner buys
|
|
349
|
+
* goods and services. (Banks and tax agencies usually are included on the
|
|
350
|
+
* vendor list.) A company’s vendor list contains information such as
|
|
351
|
+
* account balance and contact information about each vendor. A `VendorRef`
|
|
352
|
+
* aggregate refers to one of the vendors on the list. In a request, if a
|
|
353
|
+
* `VendorRef` aggregate includes both `FullName` and `ListID`, `FullName`
|
|
354
|
+
* will be ignored.
|
|
355
|
+
*
|
|
356
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorAdd
|
|
357
|
+
*/
|
|
358
|
+
add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { VendorAddRq: { VendorAdd: params } }, "VendorAddRs", "VendorRet"),
|
|
359
|
+
/**
|
|
360
|
+
* Modifies a vendor.
|
|
361
|
+
*
|
|
362
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorMod
|
|
363
|
+
*/
|
|
364
|
+
mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { VendorModRq: { VendorMod: params } }, "VendorModRs", "VendorRet"),
|
|
365
|
+
/**
|
|
366
|
+
* Queries for the specified vendor or set of vendors.
|
|
367
|
+
*
|
|
368
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorQuery
|
|
369
|
+
*/
|
|
370
|
+
query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { VendorQueryRq: params }, "VendorQueryRs", "VendorRet"),
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Send any QBXML request to QuickBooks Desktop.
|
|
374
|
+
*
|
|
375
|
+
* Available APIs:
|
|
376
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop
|
|
377
|
+
*/
|
|
378
|
+
async sendRequest(integrationUserConnectionId, requestObject) {
|
|
379
|
+
return this.root.integrationRequest({
|
|
380
|
+
integrationUserConnectionId,
|
|
381
|
+
requestObject,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
async sendRequestBase(integrationUserConnectionId, params, responseKey, responseBodyKey) {
|
|
385
|
+
const response = (await this.sendRequest(integrationUserConnectionId, params));
|
|
386
|
+
const responseBody = response[responseKey]?.[responseBodyKey];
|
|
387
|
+
if (responseBody == null) {
|
|
388
|
+
throw new Error("No response");
|
|
389
|
+
}
|
|
390
|
+
return responseBody;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
exports.default = ClientQbd;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
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 Client_1 = __importDefault(require("../../Client"));
|
|
7
|
+
describe("ClientQbd", () => {
|
|
8
|
+
const client = new Client_1.default("sk_test_miter", { environment: "staging" });
|
|
9
|
+
jest.setTimeout(10000);
|
|
10
|
+
describe("Mock staging request", () => {
|
|
11
|
+
test("Returns success", async () => {
|
|
12
|
+
const response = await client.qbd.customer.add("mock_qbd_user_connection_id", { Name: `Test Customer ${Date.now()}` });
|
|
13
|
+
expect(response).toBeDefined();
|
|
14
|
+
});
|
|
15
|
+
test("Throws an error for an unrecognizable field", async () => {
|
|
16
|
+
try {
|
|
17
|
+
await client.qbd.customer.add("mock_qbd_user_connection_id",
|
|
18
|
+
// @ts-expect-error - Intentionally passing an invalid field.
|
|
19
|
+
{ UnrecognizableField: true });
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
expect(error).toBeDefined();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|