conductor-node 0.1.4 → 0.2.0
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 +1 -1
- package/dist/src/BaseClient.js +1 -1
- package/dist/src/Client.d.ts +1 -1
- package/dist/src/Client.js +1 -1
- package/dist/src/qbd/ClientQBD.d.ts +170 -0
- package/dist/src/qbd/ClientQBD.js +291 -0
- package/dist/src/qbd/qbdTypes.d.ts +1017 -0
- package/dist/src/{qb/qbXMLTypes/Account.js → qbd/qbdTypes.js} +0 -0
- package/package.json +1 -1
- package/dist/src/qb/ClientQBD.d.ts +0 -72
- package/dist/src/qb/ClientQBD.js +0 -136
- package/dist/src/qb/qbXMLTypes/Account.d.ts +0 -320
- package/dist/src/qb/qbXMLTypes/Customer.d.ts +0 -226
- package/dist/src/qb/qbXMLTypes/Customer.js +0 -2
- package/dist/src/qb/qbXMLTypes/Employee.d.ts +0 -590
- package/dist/src/qb/qbXMLTypes/Employee.js +0 -2
- package/dist/src/qb/qbXMLTypes/Vendor.d.ts +0 -245
- package/dist/src/qb/qbXMLTypes/Vendor.js +0 -2
- package/dist/src/qb/qbXMLTypes/shared.d.ts +0 -109
- package/dist/src/qb/qbXMLTypes/shared.js +0 -2
package/dist/src/BaseClient.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export default class BaseClient {
|
|
|
9
9
|
protected readonly verbose: boolean;
|
|
10
10
|
protected readonly serverURL: string;
|
|
11
11
|
constructor({ apiKey, verbose, environment, }: BaseClientOptions);
|
|
12
|
-
protected sendAPIRequest<T>(
|
|
12
|
+
protected sendAPIRequest<T>(apiPath: string, username: string, requestObj: T): Promise<T>;
|
|
13
13
|
}
|
package/dist/src/BaseClient.js
CHANGED
|
@@ -16,7 +16,7 @@ class BaseClient {
|
|
|
16
16
|
this.verbose = verbose;
|
|
17
17
|
this.serverURL = (0, environment_1.envToBaseServerURL)(environment);
|
|
18
18
|
}
|
|
19
|
-
async sendAPIRequest(username, requestObj
|
|
19
|
+
async sendAPIRequest(apiPath, username, requestObj) {
|
|
20
20
|
const apiServerURL = `${this.serverURL}/${apiPath}`;
|
|
21
21
|
if (this.verbose) {
|
|
22
22
|
console.log(`Client sent request to ${apiServerURL} for user ${username}:`, JSON.stringify(requestObj, null, 2));
|
package/dist/src/Client.d.ts
CHANGED
package/dist/src/Client.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const ClientQBD_1 = __importDefault(require("./
|
|
6
|
+
const ClientQBD_1 = __importDefault(require("./qbd/ClientQBD"));
|
|
7
7
|
class Client {
|
|
8
8
|
/** QuickBooks Desktop integration. */
|
|
9
9
|
qbd;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import BaseClient from "../BaseClient";
|
|
2
|
+
import type * as qbd from "../qbd/qbdTypes";
|
|
3
|
+
export interface QBXMLObj {
|
|
4
|
+
[apiName: string]: object;
|
|
5
|
+
}
|
|
6
|
+
export default class ClientQBD extends BaseClient {
|
|
7
|
+
/**
|
|
8
|
+
* Send any QBXML request to QuickBooks Desktop.
|
|
9
|
+
*
|
|
10
|
+
* Available APIs: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop
|
|
11
|
+
*/
|
|
12
|
+
sendRequest(qbwcUsername: string, requestObj: QBXMLObj): Promise<QBXMLObj>;
|
|
13
|
+
/**
|
|
14
|
+
* Perform the same activities as a user does in the QB New Account form,
|
|
15
|
+
* which can be accessed in QB by selecting "Lists" → "Chart of Accounts" →
|
|
16
|
+
* "Accounts" → "New".
|
|
17
|
+
*
|
|
18
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountAdd
|
|
19
|
+
*/
|
|
20
|
+
accountAdd(qbwcUsername: string, params: qbd.AccountAddRq["AccountAdd"]): Promise<qbd.AccountAddRs["AccountRet"]>;
|
|
21
|
+
/**
|
|
22
|
+
* Modifies an account.
|
|
23
|
+
*
|
|
24
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountMod
|
|
25
|
+
*/
|
|
26
|
+
accountMod(qbwcUsername: string, params: qbd.AccountModRq["AccountMod"]): Promise<qbd.AccountModRs["AccountRet"]>;
|
|
27
|
+
/**
|
|
28
|
+
* `AccountQuery` is a list query that returns data for all accounts that
|
|
29
|
+
* match the provided filter criteria. Notice that it returns only data
|
|
30
|
+
* internal to the account itself. It does not return any data about
|
|
31
|
+
* transactions involving the account. It does, however, return the parent
|
|
32
|
+
* account, if there is one. You can search across all accounts or you can
|
|
33
|
+
* specify an account type and search only those.
|
|
34
|
+
*
|
|
35
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountQuery
|
|
36
|
+
*/
|
|
37
|
+
accountQuery(qbwcUsername: string, params: qbd.AccountQueryRq): Promise<qbd.AccountQueryRs["AccountRet"]>;
|
|
38
|
+
/**
|
|
39
|
+
* The customer list includes information about the QuickBooks user’s
|
|
40
|
+
* customers and the individual jobs that are being performed for them. A
|
|
41
|
+
* `CustomerRef` aggregate refers to one of the customers (or customer jobs)
|
|
42
|
+
* on the list. In a request, if a `CustomerRef` aggregate includes both
|
|
43
|
+
* `FullName` and `ListID`, `FullName` will be ignored. Special cases to note:
|
|
44
|
+
*
|
|
45
|
+
* - In `SalesReceipt` and `ReceivePayment` requests, `CustomerRef` refers to
|
|
46
|
+
* the customer or customer job to which the payment is credited.
|
|
47
|
+
*
|
|
48
|
+
* - In a `TimeTracking` request, CustomerRef refers to the customer or
|
|
49
|
+
* customer job to which this time could be billed. If `IsBillable` is set
|
|
50
|
+
* to true, `CustomerRef` is required in `TimeTrackingAdd`.
|
|
51
|
+
*
|
|
52
|
+
* - In an `ExpenseLineAdd` request, if `AccountRef` refers to an A/P account,
|
|
53
|
+
* `CustomerRef` must refer to a vendor (not to a customer). If `AccountRef`
|
|
54
|
+
* refers to any other type of account, the `CustomerRef` must refer to a
|
|
55
|
+
* customer.
|
|
56
|
+
*
|
|
57
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerAdd
|
|
58
|
+
*/
|
|
59
|
+
customerAdd(qbwcUsername: string, params: qbd.CustomerAddRq["CustomerAdd"]): Promise<qbd.CustomerAddRs["CustomerRet"]>;
|
|
60
|
+
/**
|
|
61
|
+
* Modifies the customer record.
|
|
62
|
+
*
|
|
63
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerMod
|
|
64
|
+
*/
|
|
65
|
+
customerMod(qbwcUsername: string, params: qbd.CustomerModRq["CustomerMod"]): Promise<qbd.CustomerModRs["CustomerRet"]>;
|
|
66
|
+
/**
|
|
67
|
+
* Returns data for the specified customers.
|
|
68
|
+
*
|
|
69
|
+
* Important: We highly recommend that you use the `IncludeRetElement` tag in
|
|
70
|
+
* your `CustomerQuery` to include any data you want but do NOT include the
|
|
71
|
+
* `ShipAddress` data in the `Response`, unless you need to get the shipping
|
|
72
|
+
* address for a particular customer. Excluding the shipping address data will
|
|
73
|
+
* significantly improve the performance of the `CustomerQuery`.
|
|
74
|
+
*
|
|
75
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerQuery
|
|
76
|
+
*/
|
|
77
|
+
customerQuery(qbwcUsername: string, params: qbd.CustomerQueryRq): Promise<qbd.CustomerQueryRs["CustomerRet"]>;
|
|
78
|
+
/**
|
|
79
|
+
* Adds an employee with personal data about the employee as well as certain
|
|
80
|
+
* payroll-related data.
|
|
81
|
+
*
|
|
82
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeAdd
|
|
83
|
+
*/
|
|
84
|
+
employeeAdd(qbwcUsername: string, params: qbd.EmployeeAddRq["EmployeeAdd"]): Promise<qbd.EmployeeAddRs["EmployeeRet"]>;
|
|
85
|
+
/**
|
|
86
|
+
* Modifies an existing employee.
|
|
87
|
+
*
|
|
88
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeMod
|
|
89
|
+
*/
|
|
90
|
+
employeeMod(qbwcUsername: string, params: qbd.EmployeeModRq["EmployeeMod"]): Promise<qbd.EmployeeModRs["EmployeeRet"]>;
|
|
91
|
+
/**
|
|
92
|
+
* Returns employee data.
|
|
93
|
+
*
|
|
94
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeQuery
|
|
95
|
+
*/
|
|
96
|
+
employeeQuery(qbwcUsername: string, params: qbd.EmployeeQueryRq): Promise<qbd.EmployeeQueryRs["EmployeeRet"]>;
|
|
97
|
+
/**
|
|
98
|
+
* The debit and credit lines can be intermingled. A credit line can legally
|
|
99
|
+
* come first in the journal entry add.
|
|
100
|
+
*
|
|
101
|
+
* In traditional accounting, transactions are entered into the general
|
|
102
|
+
* journal and categorized exclusively by account. In QuickBooks, most
|
|
103
|
+
* transactions can be categorized either by account or by type (invoice,
|
|
104
|
+
* check, and so on). For a few activities in QuickBooks, you must use the
|
|
105
|
+
* general journal directly, for example for recording depreciation. Notice
|
|
106
|
+
* that you must supply the credit line and a corresponding debit line in the
|
|
107
|
+
* same request. It will not work to supply them in two distinct requests. You
|
|
108
|
+
* can supply as many credit lines and debit lines in one single request as
|
|
109
|
+
* you want so long as the total monetary amount from the credits equals the
|
|
110
|
+
* total monetary amount from the debits in that request.
|
|
111
|
+
*
|
|
112
|
+
* Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
|
|
113
|
+
* does that for you. If you do supply the negative sign, amounts will add
|
|
114
|
+
* instead of cancel and you’ll get a runtime error.
|
|
115
|
+
*
|
|
116
|
+
* Querying for Condensed Transactions: If you need the query to return
|
|
117
|
+
* condensed transactions, you can do this by using either an `Entity` or
|
|
118
|
+
* `Account` filter in the journal query request. Alternatively, you could use
|
|
119
|
+
* the The generic `TransactionQuery`, which can return condensed
|
|
120
|
+
* transactions.
|
|
121
|
+
*
|
|
122
|
+
* If the transaction is a home currency adjustment, QuickBooks will ignore
|
|
123
|
+
* the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
|
|
124
|
+
* elements.
|
|
125
|
+
*
|
|
126
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryAdd
|
|
127
|
+
*/
|
|
128
|
+
journalEntryAdd(qbwcUsername: string, params: qbd.JournalEntryAddRq): Promise<qbd.JournalEntryAddRs["JournalEntryRet"]>;
|
|
129
|
+
/**
|
|
130
|
+
* Modifies a journal entry.
|
|
131
|
+
*
|
|
132
|
+
* If the transaction is a home currency adjustment, QuickBooks will ignore
|
|
133
|
+
* the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
|
|
134
|
+
* elements.
|
|
135
|
+
*
|
|
136
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryMod
|
|
137
|
+
*/
|
|
138
|
+
journalEntryMod(qbwcUsername: string, params: qbd.JournalEntryModRq["JournalEntryMod"]): Promise<qbd.JournalEntryModRs["JournalEntryRet"]>;
|
|
139
|
+
/**
|
|
140
|
+
* In traditional accounting, transactions are entered into the general
|
|
141
|
+
* journal and categorized exclusively by account. In QuickBooks, most
|
|
142
|
+
* transactions can be categorized either by account or by type (invoice,
|
|
143
|
+
* check, and so on). For a few activities in QuickBooks, you must use the
|
|
144
|
+
* general journal directly, for example for recording depreciation. Notice
|
|
145
|
+
* that you must supply the credit line and a corresponding debit line in the
|
|
146
|
+
* same request. It will not work to supply them in two distinct requests. You
|
|
147
|
+
* can supply as many credit lines and debit lines in one single request as
|
|
148
|
+
* you want so long as the total monetary amount from the credits equals the
|
|
149
|
+
* total monetary amount from the debits in that request.
|
|
150
|
+
*
|
|
151
|
+
* Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
|
|
152
|
+
* does that for you. If you do supply the negative sign, amounts will add
|
|
153
|
+
* instead of cancel and you’ll get a runtime error.
|
|
154
|
+
*
|
|
155
|
+
* Querying for Condensed Transactions: If you need the query to return
|
|
156
|
+
* condensed transactions, you can do this by using either an `Entity` or
|
|
157
|
+
* `Account` filter in the journal query request. Alternatively, you could use
|
|
158
|
+
* the The generic `TransactionQuery`, which can return condensed
|
|
159
|
+
* transactions.
|
|
160
|
+
*
|
|
161
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryQuery
|
|
162
|
+
*/
|
|
163
|
+
journalEntryQuery(qbwcUsername: string, params: qbd.JournalEntryQueryRq): Promise<qbd.JournalEntryQueryRs["JournalEntryRet"]>;
|
|
164
|
+
/**
|
|
165
|
+
* Queries for the specified vendor or set of vendors.
|
|
166
|
+
*
|
|
167
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorQuery
|
|
168
|
+
*/
|
|
169
|
+
vendorQuery(qbwcUsername: string, params: qbd.VendorQueryRq): Promise<qbd.VendorQueryRs["VendorRet"]>;
|
|
170
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Send any QBXML request to QuickBooks Desktop.
|
|
10
|
+
*
|
|
11
|
+
* Available APIs: https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop
|
|
12
|
+
*/
|
|
13
|
+
async sendRequest(qbwcUsername, requestObj) {
|
|
14
|
+
return this.sendAPIRequest("qbd", qbwcUsername, requestObj);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Perform the same activities as a user does in the QB New Account form,
|
|
18
|
+
* which can be accessed in QB by selecting "Lists" → "Chart of Accounts" →
|
|
19
|
+
* "Accounts" → "New".
|
|
20
|
+
*
|
|
21
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountAdd
|
|
22
|
+
*/
|
|
23
|
+
async accountAdd(qbwcUsername, params) {
|
|
24
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
25
|
+
AccountAddRq: { AccountAdd: params },
|
|
26
|
+
}));
|
|
27
|
+
const responseBody = response.AccountAddRs.AccountRet;
|
|
28
|
+
if (!responseBody) {
|
|
29
|
+
throw new Error("No response");
|
|
30
|
+
}
|
|
31
|
+
return responseBody;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Modifies an account.
|
|
35
|
+
*
|
|
36
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountMod
|
|
37
|
+
*/
|
|
38
|
+
async accountMod(qbwcUsername, params) {
|
|
39
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
40
|
+
AccountModRq: { AccountMod: params },
|
|
41
|
+
}));
|
|
42
|
+
const responseBody = response.AccountModRs.AccountRet;
|
|
43
|
+
if (!responseBody) {
|
|
44
|
+
throw new Error("No response");
|
|
45
|
+
}
|
|
46
|
+
return responseBody;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* `AccountQuery` is a list query that returns data for all accounts that
|
|
50
|
+
* match the provided filter criteria. Notice that it returns only data
|
|
51
|
+
* internal to the account itself. It does not return any data about
|
|
52
|
+
* transactions involving the account. It does, however, return the parent
|
|
53
|
+
* account, if there is one. You can search across all accounts or you can
|
|
54
|
+
* specify an account type and search only those.
|
|
55
|
+
*
|
|
56
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/AccountQuery
|
|
57
|
+
*/
|
|
58
|
+
async accountQuery(qbwcUsername, params) {
|
|
59
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
60
|
+
AccountQueryRq: params,
|
|
61
|
+
}));
|
|
62
|
+
const responseBody = response.AccountQueryRs.AccountRet;
|
|
63
|
+
if (!responseBody) {
|
|
64
|
+
throw new Error("No response");
|
|
65
|
+
}
|
|
66
|
+
return responseBody;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The customer list includes information about the QuickBooks user’s
|
|
70
|
+
* customers and the individual jobs that are being performed for them. A
|
|
71
|
+
* `CustomerRef` aggregate refers to one of the customers (or customer jobs)
|
|
72
|
+
* on the list. In a request, if a `CustomerRef` aggregate includes both
|
|
73
|
+
* `FullName` and `ListID`, `FullName` will be ignored. Special cases to note:
|
|
74
|
+
*
|
|
75
|
+
* - In `SalesReceipt` and `ReceivePayment` requests, `CustomerRef` refers to
|
|
76
|
+
* the customer or customer job to which the payment is credited.
|
|
77
|
+
*
|
|
78
|
+
* - In a `TimeTracking` request, CustomerRef refers to the customer or
|
|
79
|
+
* customer job to which this time could be billed. If `IsBillable` is set
|
|
80
|
+
* to true, `CustomerRef` is required in `TimeTrackingAdd`.
|
|
81
|
+
*
|
|
82
|
+
* - In an `ExpenseLineAdd` request, if `AccountRef` refers to an A/P account,
|
|
83
|
+
* `CustomerRef` must refer to a vendor (not to a customer). If `AccountRef`
|
|
84
|
+
* refers to any other type of account, the `CustomerRef` must refer to a
|
|
85
|
+
* customer.
|
|
86
|
+
*
|
|
87
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerAdd
|
|
88
|
+
*/
|
|
89
|
+
async customerAdd(qbwcUsername, params) {
|
|
90
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
91
|
+
CustomerAddRq: { CustomerAdd: params },
|
|
92
|
+
}));
|
|
93
|
+
const responseBody = response.CustomerAddRs.CustomerRet;
|
|
94
|
+
if (!responseBody) {
|
|
95
|
+
throw new Error("No response");
|
|
96
|
+
}
|
|
97
|
+
return responseBody;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Modifies the customer record.
|
|
101
|
+
*
|
|
102
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerMod
|
|
103
|
+
*/
|
|
104
|
+
async customerMod(qbwcUsername, params) {
|
|
105
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
106
|
+
CustomerModRq: { CustomerMod: params },
|
|
107
|
+
}));
|
|
108
|
+
const responseBody = response.CustomerModRs.CustomerRet;
|
|
109
|
+
if (!responseBody) {
|
|
110
|
+
throw new Error("No response");
|
|
111
|
+
}
|
|
112
|
+
return responseBody;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns data for the specified customers.
|
|
116
|
+
*
|
|
117
|
+
* Important: We highly recommend that you use the `IncludeRetElement` tag in
|
|
118
|
+
* your `CustomerQuery` to include any data you want but do NOT include the
|
|
119
|
+
* `ShipAddress` data in the `Response`, unless you need to get the shipping
|
|
120
|
+
* address for a particular customer. Excluding the shipping address data will
|
|
121
|
+
* significantly improve the performance of the `CustomerQuery`.
|
|
122
|
+
*
|
|
123
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CustomerQuery
|
|
124
|
+
*/
|
|
125
|
+
async customerQuery(qbwcUsername, params) {
|
|
126
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
127
|
+
CustomerQueryRq: params,
|
|
128
|
+
}));
|
|
129
|
+
const responseBody = response.CustomerQueryRs.CustomerRet;
|
|
130
|
+
if (!responseBody) {
|
|
131
|
+
throw new Error("No response");
|
|
132
|
+
}
|
|
133
|
+
return responseBody;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Adds an employee with personal data about the employee as well as certain
|
|
137
|
+
* payroll-related data.
|
|
138
|
+
*
|
|
139
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeAdd
|
|
140
|
+
*/
|
|
141
|
+
async employeeAdd(qbwcUsername, params) {
|
|
142
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
143
|
+
EmployeeAddRq: { EmployeeAdd: params },
|
|
144
|
+
}));
|
|
145
|
+
const responseBody = response.EmployeeAddRs.EmployeeRet;
|
|
146
|
+
if (!responseBody) {
|
|
147
|
+
throw new Error("No response");
|
|
148
|
+
}
|
|
149
|
+
return responseBody;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Modifies an existing employee.
|
|
153
|
+
*
|
|
154
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeMod
|
|
155
|
+
*/
|
|
156
|
+
async employeeMod(qbwcUsername, params) {
|
|
157
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
158
|
+
EmployeeModRq: { EmployeeMod: params },
|
|
159
|
+
}));
|
|
160
|
+
const responseBody = response.EmployeeModRs.EmployeeRet;
|
|
161
|
+
if (!responseBody) {
|
|
162
|
+
throw new Error("No response");
|
|
163
|
+
}
|
|
164
|
+
return responseBody;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Returns employee data.
|
|
168
|
+
*
|
|
169
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EmployeeQuery
|
|
170
|
+
*/
|
|
171
|
+
async employeeQuery(qbwcUsername, params) {
|
|
172
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
173
|
+
EmployeeQueryRq: params,
|
|
174
|
+
}));
|
|
175
|
+
const responseBody = response.EmployeeQueryRs.EmployeeRet;
|
|
176
|
+
if (!responseBody) {
|
|
177
|
+
throw new Error("No response");
|
|
178
|
+
}
|
|
179
|
+
return responseBody;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The debit and credit lines can be intermingled. A credit line can legally
|
|
183
|
+
* come first in the journal entry add.
|
|
184
|
+
*
|
|
185
|
+
* In traditional accounting, transactions are entered into the general
|
|
186
|
+
* journal and categorized exclusively by account. In QuickBooks, most
|
|
187
|
+
* transactions can be categorized either by account or by type (invoice,
|
|
188
|
+
* check, and so on). For a few activities in QuickBooks, you must use the
|
|
189
|
+
* general journal directly, for example for recording depreciation. Notice
|
|
190
|
+
* that you must supply the credit line and a corresponding debit line in the
|
|
191
|
+
* same request. It will not work to supply them in two distinct requests. You
|
|
192
|
+
* can supply as many credit lines and debit lines in one single request as
|
|
193
|
+
* you want so long as the total monetary amount from the credits equals the
|
|
194
|
+
* total monetary amount from the debits in that request.
|
|
195
|
+
*
|
|
196
|
+
* Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
|
|
197
|
+
* does that for you. If you do supply the negative sign, amounts will add
|
|
198
|
+
* instead of cancel and you’ll get a runtime error.
|
|
199
|
+
*
|
|
200
|
+
* Querying for Condensed Transactions: If you need the query to return
|
|
201
|
+
* condensed transactions, you can do this by using either an `Entity` or
|
|
202
|
+
* `Account` filter in the journal query request. Alternatively, you could use
|
|
203
|
+
* the The generic `TransactionQuery`, which can return condensed
|
|
204
|
+
* transactions.
|
|
205
|
+
*
|
|
206
|
+
* If the transaction is a home currency adjustment, QuickBooks will ignore
|
|
207
|
+
* the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
|
|
208
|
+
* elements.
|
|
209
|
+
*
|
|
210
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryAdd
|
|
211
|
+
*/
|
|
212
|
+
async journalEntryAdd(qbwcUsername, params) {
|
|
213
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
214
|
+
JournalEntryAddRq: params,
|
|
215
|
+
}));
|
|
216
|
+
const responseBody = response.JournalEntryAddRs.JournalEntryRet;
|
|
217
|
+
if (!responseBody) {
|
|
218
|
+
throw new Error("No response");
|
|
219
|
+
}
|
|
220
|
+
return responseBody;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Modifies a journal entry.
|
|
224
|
+
*
|
|
225
|
+
* If the transaction is a home currency adjustment, QuickBooks will ignore
|
|
226
|
+
* the `IsAmountsEnteredInHomeCurrency`, `CurrencyRef`, and `ExchangeRate`
|
|
227
|
+
* elements.
|
|
228
|
+
*
|
|
229
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryMod
|
|
230
|
+
*/
|
|
231
|
+
async journalEntryMod(qbwcUsername, params) {
|
|
232
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
233
|
+
JournalEntryModRq: { JournalEntryMod: params },
|
|
234
|
+
}));
|
|
235
|
+
const responseBody = response.JournalEntryModRs.JournalEntryRet;
|
|
236
|
+
if (!responseBody) {
|
|
237
|
+
throw new Error("No response");
|
|
238
|
+
}
|
|
239
|
+
return responseBody;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* In traditional accounting, transactions are entered into the general
|
|
243
|
+
* journal and categorized exclusively by account. In QuickBooks, most
|
|
244
|
+
* transactions can be categorized either by account or by type (invoice,
|
|
245
|
+
* check, and so on). For a few activities in QuickBooks, you must use the
|
|
246
|
+
* general journal directly, for example for recording depreciation. Notice
|
|
247
|
+
* that you must supply the credit line and a corresponding debit line in the
|
|
248
|
+
* same request. It will not work to supply them in two distinct requests. You
|
|
249
|
+
* can supply as many credit lines and debit lines in one single request as
|
|
250
|
+
* you want so long as the total monetary amount from the credits equals the
|
|
251
|
+
* total monetary amount from the debits in that request.
|
|
252
|
+
*
|
|
253
|
+
* Finally, DO NOT supply negative sign for the monetary amounts. QuickBooks
|
|
254
|
+
* does that for you. If you do supply the negative sign, amounts will add
|
|
255
|
+
* instead of cancel and you’ll get a runtime error.
|
|
256
|
+
*
|
|
257
|
+
* Querying for Condensed Transactions: If you need the query to return
|
|
258
|
+
* condensed transactions, you can do this by using either an `Entity` or
|
|
259
|
+
* `Account` filter in the journal query request. Alternatively, you could use
|
|
260
|
+
* the The generic `TransactionQuery`, which can return condensed
|
|
261
|
+
* transactions.
|
|
262
|
+
*
|
|
263
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/JournalEntryQuery
|
|
264
|
+
*/
|
|
265
|
+
async journalEntryQuery(qbwcUsername, params) {
|
|
266
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
267
|
+
JournalEntryQueryRq: params,
|
|
268
|
+
}));
|
|
269
|
+
const responseBody = response.JournalEntryQueryRs.JournalEntryRet;
|
|
270
|
+
if (!responseBody) {
|
|
271
|
+
throw new Error("No response");
|
|
272
|
+
}
|
|
273
|
+
return responseBody;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Queries for the specified vendor or set of vendors.
|
|
277
|
+
*
|
|
278
|
+
* https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/VendorQuery
|
|
279
|
+
*/
|
|
280
|
+
async vendorQuery(qbwcUsername, params) {
|
|
281
|
+
const response = (await this.sendRequest(qbwcUsername, {
|
|
282
|
+
VendorQueryRq: params,
|
|
283
|
+
}));
|
|
284
|
+
const responseBody = response.VendorQueryRs.VendorRet;
|
|
285
|
+
if (!responseBody) {
|
|
286
|
+
throw new Error("No response");
|
|
287
|
+
}
|
|
288
|
+
return responseBody;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exports.default = ClientQBD;
|