@apideck/unify 0.40.0 → 0.41.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.
Files changed (96) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +4 -4
  3. package/lib/config.js +4 -4
  4. package/package.json +6 -2
  5. package/src/__tests__/activities.test.ts +1141 -0
  6. package/src/__tests__/agedcreditors.test.ts +280 -0
  7. package/src/__tests__/ageddebtors.test.ts +280 -0
  8. package/src/__tests__/apideckcompanies.test.ts +1082 -0
  9. package/src/__tests__/apideckcustomers.test.ts +364 -0
  10. package/src/__tests__/apideckdepartments.test.ts +497 -0
  11. package/src/__tests__/apiresources.test.ts +62 -0
  12. package/src/__tests__/apis.test.ts +216 -0
  13. package/src/__tests__/applicants.test.ts +1445 -0
  14. package/src/__tests__/applications.test.ts +515 -0
  15. package/src/__tests__/assertions.ts +13 -0
  16. package/src/__tests__/attachments.test.ts +371 -0
  17. package/src/__tests__/balancesheet.test.ts +453 -0
  18. package/src/__tests__/bankaccounts.test.ts +324 -0
  19. package/src/__tests__/bankfeedaccounts.test.ts +343 -0
  20. package/src/__tests__/bankfeedstatements.test.ts +408 -0
  21. package/src/__tests__/billpayments.test.ts +1031 -0
  22. package/src/__tests__/bills.test.ts +1630 -0
  23. package/src/__tests__/categories.test.ts +127 -0
  24. package/src/__tests__/collections.test.ts +120 -0
  25. package/src/__tests__/collectiontags.test.ts +68 -0
  26. package/src/__tests__/collectionticketcomments.test.ts +501 -0
  27. package/src/__tests__/collectiontickets.test.ts +627 -0
  28. package/src/__tests__/collectionusers.test.ts +126 -0
  29. package/src/__tests__/companies.test.ts +1642 -0
  30. package/src/__tests__/companyinfo.test.ts +219 -0
  31. package/src/__tests__/connectionconsent.test.ts +89 -0
  32. package/src/__tests__/connectionconsents.test.ts +31 -0
  33. package/src/__tests__/connectioncustommappings.test.ts +69 -0
  34. package/src/__tests__/connections.test.ts +2127 -0
  35. package/src/__tests__/connectionsettings.test.ts +687 -0
  36. package/src/__tests__/connectordocs.test.ts +29 -0
  37. package/src/__tests__/connectors.test.ts +753 -0
  38. package/src/__tests__/consumerrequestcounts.test.ts +42 -0
  39. package/src/__tests__/consumers.test.ts +523 -0
  40. package/src/__tests__/contacts.test.ts +1421 -0
  41. package/src/__tests__/createcallback.test.ts +36 -0
  42. package/src/__tests__/creditnotes.test.ts +2040 -0
  43. package/src/__tests__/customers.test.ts +1600 -0
  44. package/src/__tests__/customfields.test.ts +52 -0
  45. package/src/__tests__/custommappings.test.ts +65 -0
  46. package/src/__tests__/customobjects.test.ts +408 -0
  47. package/src/__tests__/customobjectschemas.test.ts +734 -0
  48. package/src/__tests__/departments.test.ts +529 -0
  49. package/src/__tests__/drivegroups.test.ts +496 -0
  50. package/src/__tests__/drives.test.ts +487 -0
  51. package/src/__tests__/employeepayrolls.test.ts +491 -0
  52. package/src/__tests__/employees.test.ts +2968 -0
  53. package/src/__tests__/employeeschedules.test.ts +457 -0
  54. package/src/__tests__/eventlogs.test.ts +158 -0
  55. package/src/__tests__/expensecategories.test.ts +324 -0
  56. package/src/__tests__/expensereports.test.ts +634 -0
  57. package/src/__tests__/expenses.test.ts +867 -0
  58. package/src/__tests__/files.test.ts +506 -0
  59. package/src/__tests__/files.ts +56 -0
  60. package/src/__tests__/folders.test.ts +390 -0
  61. package/src/__tests__/invoiceitems.test.ts +855 -0
  62. package/src/__tests__/invoices.test.ts +2173 -0
  63. package/src/__tests__/jobs.test.ts +1150 -0
  64. package/src/__tests__/journalentries.test.ts +1542 -0
  65. package/src/__tests__/leads.test.ts +1341 -0
  66. package/src/__tests__/ledgeraccounts.test.ts +829 -0
  67. package/src/__tests__/locations.test.ts +856 -0
  68. package/src/__tests__/logs.test.ts +137 -0
  69. package/src/__tests__/messages.test.ts +588 -0
  70. package/src/__tests__/notes.test.ts +523 -0
  71. package/src/__tests__/opportunities.test.ts +718 -0
  72. package/src/__tests__/orders.test.ts +854 -0
  73. package/src/__tests__/payments.test.ts +867 -0
  74. package/src/__tests__/payrolls.test.ts +485 -0
  75. package/src/__tests__/pipelines.test.ts +574 -0
  76. package/src/__tests__/products.test.ts +509 -0
  77. package/src/__tests__/profitandloss.test.ts +223 -0
  78. package/src/__tests__/projects.test.ts +480 -0
  79. package/src/__tests__/proxy.test.ts +41 -0
  80. package/src/__tests__/purchaseorders.test.ts +2139 -0
  81. package/src/__tests__/quotes.test.ts +678 -0
  82. package/src/__tests__/refunds.test.ts +812 -0
  83. package/src/__tests__/sessions.test.ts +72 -0
  84. package/src/__tests__/sharedlinks.test.ts +511 -0
  85. package/src/__tests__/stores.test.ts +41 -0
  86. package/src/__tests__/subsidiaries.test.ts +496 -0
  87. package/src/__tests__/suppliers.test.ts +1574 -0
  88. package/src/__tests__/taxrates.test.ts +701 -0
  89. package/src/__tests__/testclient.ts +48 -0
  90. package/src/__tests__/timeoffrequests.test.ts +588 -0
  91. package/src/__tests__/trackingcategories.test.ts +515 -0
  92. package/src/__tests__/uploadsessions.test.ts +221 -0
  93. package/src/__tests__/users.test.ts +1020 -0
  94. package/src/__tests__/validateconnection.test.ts +34 -0
  95. package/src/__tests__/webhooks.test.ts +254 -0
  96. package/src/lib/config.ts +4 -4
@@ -0,0 +1,867 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { expect, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Expenses Accounting Expenses All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.expensesAll");
11
+
12
+ const apideck = new Apideck({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
16
+ });
17
+
18
+ const result = await apideck.accounting.expenses.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ });
23
+ expect(result.httpMeta.response.status).toBe(200);
24
+ expect(result.getExpensesResponse).toBeDefined();
25
+ expect(result.getExpensesResponse).toEqual({
26
+ statusCode: 200,
27
+ status: "OK",
28
+ service: "quickbooks",
29
+ resource: "Expenses",
30
+ operation: "all",
31
+ data: [
32
+ {
33
+ id: "12345",
34
+ number: "OIT00546",
35
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
36
+ accountId: "123456",
37
+ supplierId: "12345",
38
+ companyId: "12345",
39
+ departmentId: "12345",
40
+ paymentType: "cash",
41
+ currency: "USD",
42
+ currencyRate: 0.69,
43
+ type: "expense",
44
+ memo: "For travel expenses incurred on 2024-05-15",
45
+ taxRate: {
46
+ id: "123456",
47
+ code: "N-T",
48
+ name: "GST on Purchases",
49
+ rate: 10,
50
+ },
51
+ totalAmount: 275,
52
+ lineItems: [
53
+ {
54
+ id: "12345",
55
+ trackingCategories: [
56
+ {
57
+ id: "123456",
58
+ name: "New York",
59
+ },
60
+ {
61
+ id: "123456",
62
+ name: "New York",
63
+ },
64
+ {
65
+ id: "123456",
66
+ name: "New York",
67
+ },
68
+ ],
69
+ accountId: "123456",
70
+ customerId: "12345",
71
+ departmentId: "12345",
72
+ locationId: "12345",
73
+ taxRate: {
74
+ id: "123456",
75
+ code: "N-T",
76
+ name: "GST on Purchases",
77
+ rate: 10,
78
+ },
79
+ description: "Travel US.",
80
+ totalAmount: 275,
81
+ },
82
+ {
83
+ id: "12345",
84
+ trackingCategories: [
85
+ {
86
+ id: "123456",
87
+ name: "New York",
88
+ },
89
+ ],
90
+ accountId: "123456",
91
+ customerId: "12345",
92
+ departmentId: "12345",
93
+ locationId: "12345",
94
+ taxRate: {
95
+ id: "123456",
96
+ code: "N-T",
97
+ name: "GST on Purchases",
98
+ rate: 10,
99
+ },
100
+ description: "Travel US.",
101
+ totalAmount: 275,
102
+ },
103
+ ],
104
+ customFields: [
105
+ {
106
+ id: "2389328923893298",
107
+ name: "employee_level",
108
+ description: "Employee Level",
109
+ value: "Uses Salesforce and Marketo",
110
+ },
111
+ ],
112
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
113
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
114
+ rowVersion: "1-12345",
115
+ passThrough: [
116
+ {
117
+ serviceId: "<id>",
118
+ extendPaths: [
119
+ {
120
+ path: "$.nested.property",
121
+ value: {
122
+ "TaxClassificationRef": {
123
+ "value": "EUC-99990201-V1-00020000",
124
+ },
125
+ },
126
+ },
127
+ {
128
+ path: "$.nested.property",
129
+ value: {
130
+ "TaxClassificationRef": {
131
+ "value": "EUC-99990201-V1-00020000",
132
+ },
133
+ },
134
+ },
135
+ ],
136
+ },
137
+ {
138
+ serviceId: "<id>",
139
+ extendPaths: [
140
+ {
141
+ path: "$.nested.property",
142
+ value: {
143
+ "TaxClassificationRef": {
144
+ "value": "EUC-99990201-V1-00020000",
145
+ },
146
+ },
147
+ },
148
+ ],
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ id: "12345",
154
+ number: "OIT00546",
155
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
156
+ accountId: "123456",
157
+ supplierId: "12345",
158
+ companyId: "12345",
159
+ departmentId: "12345",
160
+ paymentType: "cash",
161
+ currency: "USD",
162
+ currencyRate: 0.69,
163
+ type: "expense",
164
+ memo: "For travel expenses incurred on 2024-05-15",
165
+ taxRate: {
166
+ id: "123456",
167
+ code: "N-T",
168
+ name: "GST on Purchases",
169
+ rate: 10,
170
+ },
171
+ totalAmount: 275,
172
+ lineItems: [
173
+ {
174
+ id: "12345",
175
+ trackingCategories: [
176
+ {
177
+ id: "123456",
178
+ name: "New York",
179
+ },
180
+ ],
181
+ accountId: "123456",
182
+ customerId: "12345",
183
+ departmentId: "12345",
184
+ locationId: "12345",
185
+ taxRate: {
186
+ id: "123456",
187
+ code: "N-T",
188
+ name: "GST on Purchases",
189
+ rate: 10,
190
+ },
191
+ description: "Travel US.",
192
+ totalAmount: 275,
193
+ },
194
+ {
195
+ id: "12345",
196
+ trackingCategories: [
197
+ {
198
+ id: "123456",
199
+ name: "New York",
200
+ },
201
+ ],
202
+ accountId: "123456",
203
+ customerId: "12345",
204
+ departmentId: "12345",
205
+ locationId: "12345",
206
+ taxRate: {
207
+ id: "123456",
208
+ code: "N-T",
209
+ name: "GST on Purchases",
210
+ rate: 10,
211
+ },
212
+ description: "Travel US.",
213
+ totalAmount: 275,
214
+ },
215
+ ],
216
+ customFields: [
217
+ {
218
+ id: "2389328923893298",
219
+ name: "employee_level",
220
+ description: "Employee Level",
221
+ value: {},
222
+ },
223
+ {
224
+ id: "2389328923893298",
225
+ name: "employee_level",
226
+ description: "Employee Level",
227
+ value: {},
228
+ },
229
+ {
230
+ id: "2389328923893298",
231
+ name: "employee_level",
232
+ description: "Employee Level",
233
+ value: "Uses Salesforce and Marketo",
234
+ },
235
+ ],
236
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
237
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
238
+ rowVersion: "1-12345",
239
+ passThrough: [
240
+ {
241
+ serviceId: "<id>",
242
+ extendPaths: [
243
+ {
244
+ path: "$.nested.property",
245
+ value: {
246
+ "TaxClassificationRef": {
247
+ "value": "EUC-99990201-V1-00020000",
248
+ },
249
+ },
250
+ },
251
+ {
252
+ path: "$.nested.property",
253
+ value: {
254
+ "TaxClassificationRef": {
255
+ "value": "EUC-99990201-V1-00020000",
256
+ },
257
+ },
258
+ },
259
+ ],
260
+ },
261
+ ],
262
+ },
263
+ {
264
+ id: "12345",
265
+ number: "OIT00546",
266
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
267
+ accountId: "123456",
268
+ supplierId: "12345",
269
+ companyId: "12345",
270
+ departmentId: "12345",
271
+ paymentType: "cash",
272
+ currency: "USD",
273
+ currencyRate: 0.69,
274
+ type: "expense",
275
+ memo: "For travel expenses incurred on 2024-05-15",
276
+ taxRate: {
277
+ id: "123456",
278
+ code: "N-T",
279
+ name: "GST on Purchases",
280
+ rate: 10,
281
+ },
282
+ totalAmount: 275,
283
+ lineItems: [
284
+ {
285
+ id: "12345",
286
+ trackingCategories: [
287
+ {
288
+ id: "123456",
289
+ name: "New York",
290
+ },
291
+ ],
292
+ accountId: "123456",
293
+ customerId: "12345",
294
+ departmentId: "12345",
295
+ locationId: "12345",
296
+ taxRate: {
297
+ id: "123456",
298
+ code: "N-T",
299
+ name: "GST on Purchases",
300
+ rate: 10,
301
+ },
302
+ description: "Travel US.",
303
+ totalAmount: 275,
304
+ },
305
+ ],
306
+ customFields: [
307
+ {
308
+ id: "2389328923893298",
309
+ name: "employee_level",
310
+ description: "Employee Level",
311
+ value: {},
312
+ },
313
+ {
314
+ id: "2389328923893298",
315
+ name: "employee_level",
316
+ description: "Employee Level",
317
+ value: {
318
+ "0": {},
319
+ },
320
+ },
321
+ {
322
+ id: "2389328923893298",
323
+ name: "employee_level",
324
+ description: "Employee Level",
325
+ value: "Uses Salesforce and Marketo",
326
+ },
327
+ ],
328
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
329
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
330
+ rowVersion: "1-12345",
331
+ passThrough: [
332
+ {
333
+ serviceId: "<id>",
334
+ extendPaths: [
335
+ {
336
+ path: "$.nested.property",
337
+ value: {
338
+ "TaxClassificationRef": {
339
+ "value": "EUC-99990201-V1-00020000",
340
+ },
341
+ },
342
+ },
343
+ {
344
+ path: "$.nested.property",
345
+ value: {
346
+ "TaxClassificationRef": {
347
+ "value": "EUC-99990201-V1-00020000",
348
+ },
349
+ },
350
+ },
351
+ {
352
+ path: "$.nested.property",
353
+ value: {
354
+ "TaxClassificationRef": {
355
+ "value": "EUC-99990201-V1-00020000",
356
+ },
357
+ },
358
+ },
359
+ ],
360
+ },
361
+ ],
362
+ },
363
+ ],
364
+ meta: {
365
+ itemsOnPage: 50,
366
+ cursors: {
367
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
368
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
369
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
370
+ },
371
+ },
372
+ links: {
373
+ previous:
374
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
375
+ current: "https://unify.apideck.com/crm/companies",
376
+ next:
377
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
378
+ },
379
+ });
380
+ });
381
+
382
+ test("Expenses Accounting Expenses Add", async () => {
383
+ const testHttpClient = createTestHTTPClient("accounting.expensesAdd");
384
+
385
+ const apideck = new Apideck({
386
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
387
+ httpClient: testHttpClient,
388
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
389
+ });
390
+
391
+ const result = await apideck.accounting.expenses.create({
392
+ consumerId: "test-consumer",
393
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
394
+ serviceId: "salesforce",
395
+ expense: {
396
+ number: "OIT00546",
397
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
398
+ accountId: "123456",
399
+ supplierId: "12345",
400
+ companyId: "12345",
401
+ departmentId: "12345",
402
+ paymentType: "cash",
403
+ currency: "USD",
404
+ currencyRate: 0.69,
405
+ type: "expense",
406
+ memo: "For travel expenses incurred on 2024-05-15",
407
+ taxRate: {
408
+ id: "123456",
409
+ rate: 10,
410
+ },
411
+ totalAmount: 275,
412
+ lineItems: [
413
+ {
414
+ trackingCategories: [
415
+ {
416
+ id: "123456",
417
+ name: "New York",
418
+ },
419
+ {
420
+ id: "123456",
421
+ name: "New York",
422
+ },
423
+ ],
424
+ accountId: "123456",
425
+ customerId: "12345",
426
+ departmentId: "12345",
427
+ locationId: "12345",
428
+ taxRate: {
429
+ id: "123456",
430
+ rate: 10,
431
+ },
432
+ description: "Travel US.",
433
+ totalAmount: 275,
434
+ },
435
+ ],
436
+ customFields: [
437
+ {
438
+ id: "2389328923893298",
439
+ name: "employee_level",
440
+ description: "Employee Level",
441
+ value: "Uses Salesforce and Marketo",
442
+ },
443
+ {
444
+ id: "2389328923893298",
445
+ name: "employee_level",
446
+ description: "Employee Level",
447
+ value: "Uses Salesforce and Marketo",
448
+ },
449
+ ],
450
+ rowVersion: "1-12345",
451
+ passThrough: [
452
+ {
453
+ serviceId: "<id>",
454
+ extendPaths: [
455
+ {
456
+ path: "$.nested.property",
457
+ value: {
458
+ "TaxClassificationRef": {
459
+ "value": "EUC-99990201-V1-00020000",
460
+ },
461
+ },
462
+ },
463
+ {
464
+ path: "$.nested.property",
465
+ value: {
466
+ "TaxClassificationRef": {
467
+ "value": "EUC-99990201-V1-00020000",
468
+ },
469
+ },
470
+ },
471
+ {
472
+ path: "$.nested.property",
473
+ value: {
474
+ "TaxClassificationRef": {
475
+ "value": "EUC-99990201-V1-00020000",
476
+ },
477
+ },
478
+ },
479
+ ],
480
+ },
481
+ {
482
+ serviceId: "<id>",
483
+ extendPaths: [
484
+ {
485
+ path: "$.nested.property",
486
+ value: {
487
+ "TaxClassificationRef": {
488
+ "value": "EUC-99990201-V1-00020000",
489
+ },
490
+ },
491
+ },
492
+ ],
493
+ },
494
+ {
495
+ serviceId: "<id>",
496
+ extendPaths: [
497
+ {
498
+ path: "$.nested.property",
499
+ value: {
500
+ "TaxClassificationRef": {
501
+ "value": "EUC-99990201-V1-00020000",
502
+ },
503
+ },
504
+ },
505
+ ],
506
+ },
507
+ ],
508
+ },
509
+ });
510
+ expect(result.httpMeta.response.status).toBe(201);
511
+ expect(result.createExpenseResponse).toBeDefined();
512
+ expect(result.createExpenseResponse).toEqual({
513
+ statusCode: 200,
514
+ status: "OK",
515
+ service: "quickbooks",
516
+ resource: "Expenses",
517
+ operation: "add",
518
+ data: {
519
+ id: "12345",
520
+ },
521
+ });
522
+ });
523
+
524
+ test("Expenses Accounting Expenses One", async () => {
525
+ const testHttpClient = createTestHTTPClient("accounting.expensesOne");
526
+
527
+ const apideck = new Apideck({
528
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
529
+ httpClient: testHttpClient,
530
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
531
+ });
532
+
533
+ const result = await apideck.accounting.expenses.get({
534
+ id: "<id>",
535
+ consumerId: "test-consumer",
536
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
537
+ serviceId: "salesforce",
538
+ });
539
+ expect(result.httpMeta.response.status).toBe(200);
540
+ expect(result.getExpenseResponse).toBeDefined();
541
+ expect(result.getExpenseResponse).toEqual({
542
+ statusCode: 200,
543
+ status: "OK",
544
+ service: "quickbooks",
545
+ resource: "Expenses",
546
+ operation: "one",
547
+ data: {
548
+ id: "12345",
549
+ number: "OIT00546",
550
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
551
+ accountId: "123456",
552
+ supplierId: "12345",
553
+ companyId: "12345",
554
+ departmentId: "12345",
555
+ paymentType: "cash",
556
+ currency: "USD",
557
+ currencyRate: 0.69,
558
+ type: "expense",
559
+ memo: "For travel expenses incurred on 2024-05-15",
560
+ taxRate: {
561
+ id: "123456",
562
+ code: "N-T",
563
+ name: "GST on Purchases",
564
+ rate: 10,
565
+ },
566
+ totalAmount: 275,
567
+ lineItems: [
568
+ {
569
+ id: "12345",
570
+ trackingCategories: [
571
+ {
572
+ id: "123456",
573
+ name: "New York",
574
+ },
575
+ {
576
+ id: "123456",
577
+ name: "New York",
578
+ },
579
+ ],
580
+ accountId: "123456",
581
+ customerId: "12345",
582
+ departmentId: "12345",
583
+ locationId: "12345",
584
+ taxRate: {
585
+ id: "123456",
586
+ code: "N-T",
587
+ name: "GST on Purchases",
588
+ rate: 10,
589
+ },
590
+ description: "Travel US.",
591
+ totalAmount: 275,
592
+ },
593
+ {
594
+ id: "12345",
595
+ trackingCategories: [
596
+ {
597
+ id: "123456",
598
+ name: "New York",
599
+ },
600
+ {
601
+ id: "123456",
602
+ name: "New York",
603
+ },
604
+ ],
605
+ accountId: "123456",
606
+ customerId: "12345",
607
+ departmentId: "12345",
608
+ locationId: "12345",
609
+ taxRate: {
610
+ id: "123456",
611
+ code: "N-T",
612
+ name: "GST on Purchases",
613
+ rate: 10,
614
+ },
615
+ description: "Travel US.",
616
+ totalAmount: 275,
617
+ },
618
+ ],
619
+ customFields: [
620
+ {
621
+ id: "2389328923893298",
622
+ name: "employee_level",
623
+ description: "Employee Level",
624
+ value: {
625
+ "0": {},
626
+ },
627
+ },
628
+ {
629
+ id: "2389328923893298",
630
+ name: "employee_level",
631
+ description: "Employee Level",
632
+ value: true,
633
+ },
634
+ ],
635
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
636
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
637
+ rowVersion: "1-12345",
638
+ passThrough: [
639
+ {
640
+ serviceId: "<id>",
641
+ extendPaths: [
642
+ {
643
+ path: "$.nested.property",
644
+ value: {
645
+ "TaxClassificationRef": {
646
+ "value": "EUC-99990201-V1-00020000",
647
+ },
648
+ },
649
+ },
650
+ ],
651
+ },
652
+ ],
653
+ },
654
+ });
655
+ });
656
+
657
+ test("Expenses Accounting Expenses Update", async () => {
658
+ const testHttpClient = createTestHTTPClient("accounting.expensesUpdate");
659
+
660
+ const apideck = new Apideck({
661
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
662
+ httpClient: testHttpClient,
663
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
664
+ });
665
+
666
+ const result = await apideck.accounting.expenses.update({
667
+ id: "<id>",
668
+ consumerId: "test-consumer",
669
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
670
+ serviceId: "salesforce",
671
+ expense: {
672
+ number: "OIT00546",
673
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
674
+ accountId: "123456",
675
+ supplierId: "12345",
676
+ companyId: "12345",
677
+ departmentId: "12345",
678
+ paymentType: "cash",
679
+ currency: "USD",
680
+ currencyRate: 0.69,
681
+ type: "expense",
682
+ memo: "For travel expenses incurred on 2024-05-15",
683
+ taxRate: {
684
+ id: "123456",
685
+ rate: 10,
686
+ },
687
+ totalAmount: 275,
688
+ lineItems: [
689
+ {
690
+ trackingCategories: [
691
+ {
692
+ id: "123456",
693
+ name: "New York",
694
+ },
695
+ {
696
+ id: "123456",
697
+ name: "New York",
698
+ },
699
+ ],
700
+ accountId: "123456",
701
+ customerId: "12345",
702
+ departmentId: "12345",
703
+ locationId: "12345",
704
+ taxRate: {
705
+ id: "123456",
706
+ rate: 10,
707
+ },
708
+ description: "Travel US.",
709
+ totalAmount: 275,
710
+ },
711
+ {
712
+ trackingCategories: [
713
+ {
714
+ id: "123456",
715
+ name: "New York",
716
+ },
717
+ {
718
+ id: "123456",
719
+ name: "New York",
720
+ },
721
+ ],
722
+ accountId: "123456",
723
+ customerId: "12345",
724
+ departmentId: "12345",
725
+ locationId: "12345",
726
+ taxRate: {
727
+ id: "123456",
728
+ rate: 10,
729
+ },
730
+ description: "Travel US.",
731
+ totalAmount: 275,
732
+ },
733
+ {
734
+ trackingCategories: [
735
+ {
736
+ id: "123456",
737
+ name: "New York",
738
+ },
739
+ {
740
+ id: "123456",
741
+ name: "New York",
742
+ },
743
+ {
744
+ id: "123456",
745
+ name: "New York",
746
+ },
747
+ ],
748
+ accountId: "123456",
749
+ customerId: "12345",
750
+ departmentId: "12345",
751
+ locationId: "12345",
752
+ taxRate: {
753
+ id: "123456",
754
+ rate: 10,
755
+ },
756
+ description: "Travel US.",
757
+ totalAmount: 275,
758
+ },
759
+ ],
760
+ customFields: [
761
+ {
762
+ id: "2389328923893298",
763
+ name: "employee_level",
764
+ description: "Employee Level",
765
+ value: true,
766
+ },
767
+ {
768
+ id: "2389328923893298",
769
+ name: "employee_level",
770
+ description: "Employee Level",
771
+ value: {},
772
+ },
773
+ ],
774
+ rowVersion: "1-12345",
775
+ passThrough: [
776
+ {
777
+ serviceId: "<id>",
778
+ extendPaths: [
779
+ {
780
+ path: "$.nested.property",
781
+ value: {
782
+ "TaxClassificationRef": {
783
+ "value": "EUC-99990201-V1-00020000",
784
+ },
785
+ },
786
+ },
787
+ {
788
+ path: "$.nested.property",
789
+ value: {
790
+ "TaxClassificationRef": {
791
+ "value": "EUC-99990201-V1-00020000",
792
+ },
793
+ },
794
+ },
795
+ ],
796
+ },
797
+ {
798
+ serviceId: "<id>",
799
+ extendPaths: [
800
+ {
801
+ path: "$.nested.property",
802
+ value: {
803
+ "TaxClassificationRef": {
804
+ "value": "EUC-99990201-V1-00020000",
805
+ },
806
+ },
807
+ },
808
+ ],
809
+ },
810
+ {
811
+ serviceId: "<id>",
812
+ extendPaths: [
813
+ {
814
+ path: "$.nested.property",
815
+ value: {
816
+ "TaxClassificationRef": {
817
+ "value": "EUC-99990201-V1-00020000",
818
+ },
819
+ },
820
+ },
821
+ ],
822
+ },
823
+ ],
824
+ },
825
+ });
826
+ expect(result.httpMeta.response.status).toBe(200);
827
+ expect(result.updateExpenseResponse).toBeDefined();
828
+ expect(result.updateExpenseResponse).toEqual({
829
+ statusCode: 200,
830
+ status: "OK",
831
+ service: "quickbooks",
832
+ resource: "Expenses",
833
+ operation: "update",
834
+ data: {
835
+ id: "12345",
836
+ },
837
+ });
838
+ });
839
+
840
+ test("Expenses Accounting Expenses Delete", async () => {
841
+ const testHttpClient = createTestHTTPClient("accounting.expensesDelete");
842
+
843
+ const apideck = new Apideck({
844
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
845
+ httpClient: testHttpClient,
846
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
847
+ });
848
+
849
+ const result = await apideck.accounting.expenses.delete({
850
+ id: "<id>",
851
+ consumerId: "test-consumer",
852
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
853
+ serviceId: "salesforce",
854
+ });
855
+ expect(result.httpMeta.response.status).toBe(200);
856
+ expect(result.deleteExpenseResponse).toBeDefined();
857
+ expect(result.deleteExpenseResponse).toEqual({
858
+ statusCode: 200,
859
+ status: "OK",
860
+ service: "quickbooks",
861
+ resource: "Expenses",
862
+ operation: "delete",
863
+ data: {
864
+ id: "12345",
865
+ },
866
+ });
867
+ });