@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,855 @@
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("Invoiceitems Accounting Invoice Items All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.invoiceItemsAll");
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.invoiceItems.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ name: "Widgets Large",
24
+ type: "service",
25
+ },
26
+ sort: {
27
+ by: "updated_at",
28
+ direction: "desc",
29
+ },
30
+ passThrough: {
31
+ "search": "San Francisco",
32
+ },
33
+ fields: "id,updated_at",
34
+ });
35
+ expect(result.httpMeta.response.status).toBe(200);
36
+ expect(result.getInvoiceItemsResponse).toBeDefined();
37
+ expect(result.getInvoiceItemsResponse).toEqual({
38
+ statusCode: 200,
39
+ status: "OK",
40
+ service: "xero",
41
+ resource: "invoice-items",
42
+ operation: "all",
43
+ data: [
44
+ {
45
+ id: "123456",
46
+ name: "Model Y",
47
+ description:
48
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
49
+ code: "120-C",
50
+ sold: true,
51
+ purchased: true,
52
+ tracked: true,
53
+ taxable: true,
54
+ inventoryDate: new Date("2020-10-30"),
55
+ type: "inventory",
56
+ salesDetails: {
57
+ unitPrice: 27500.5,
58
+ unitOfMeasure: "pc.",
59
+ taxInclusive: true,
60
+ taxRate: {
61
+ id: "123456",
62
+ code: "N-T",
63
+ name: "GST on Purchases",
64
+ rate: 10,
65
+ },
66
+ },
67
+ purchaseDetails: {
68
+ unitPrice: 27500.5,
69
+ unitOfMeasure: "pc.",
70
+ taxInclusive: true,
71
+ taxRate: {
72
+ id: "123456",
73
+ code: "N-T",
74
+ name: "GST on Purchases",
75
+ rate: 10,
76
+ },
77
+ },
78
+ quantity: 1,
79
+ unitPrice: 27500.5,
80
+ assetAccount: {
81
+ id: "123456",
82
+ name: "Bank account",
83
+ nominalCode: "N091",
84
+ code: "453",
85
+ },
86
+ incomeAccount: {
87
+ id: "123456",
88
+ name: "Bank account",
89
+ nominalCode: "N091",
90
+ code: "453",
91
+ },
92
+ expenseAccount: {
93
+ id: "123456",
94
+ name: "Bank account",
95
+ nominalCode: "N091",
96
+ code: "453",
97
+ },
98
+ trackingCategories: [
99
+ {
100
+ id: "123456",
101
+ name: "New York",
102
+ },
103
+ {
104
+ id: "123456",
105
+ name: "New York",
106
+ },
107
+ ],
108
+ active: true,
109
+ departmentId: "12345",
110
+ locationId: "12345",
111
+ subsidiaryId: "12345",
112
+ taxScheduleId: "123456",
113
+ rowVersion: "1-12345",
114
+ updatedBy: "12345",
115
+ createdBy: "12345",
116
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
117
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
118
+ passThrough: [
119
+ {
120
+ serviceId: "<id>",
121
+ extendPaths: [
122
+ {
123
+ path: "$.nested.property",
124
+ value: {
125
+ "TaxClassificationRef": {
126
+ "value": "EUC-99990201-V1-00020000",
127
+ },
128
+ },
129
+ },
130
+ ],
131
+ },
132
+ {
133
+ serviceId: "<id>",
134
+ extendPaths: [
135
+ {
136
+ path: "$.nested.property",
137
+ value: {
138
+ "TaxClassificationRef": {
139
+ "value": "EUC-99990201-V1-00020000",
140
+ },
141
+ },
142
+ },
143
+ ],
144
+ },
145
+ {
146
+ serviceId: "<id>",
147
+ extendPaths: [
148
+ {
149
+ path: "$.nested.property",
150
+ value: {
151
+ "TaxClassificationRef": {
152
+ "value": "EUC-99990201-V1-00020000",
153
+ },
154
+ },
155
+ },
156
+ ],
157
+ },
158
+ ],
159
+ },
160
+ {
161
+ id: "123456",
162
+ name: "Model Y",
163
+ description:
164
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
165
+ code: "120-C",
166
+ sold: true,
167
+ purchased: true,
168
+ tracked: true,
169
+ taxable: true,
170
+ inventoryDate: new Date("2020-10-30"),
171
+ type: "inventory",
172
+ salesDetails: {
173
+ unitPrice: 27500.5,
174
+ unitOfMeasure: "pc.",
175
+ taxInclusive: true,
176
+ taxRate: {
177
+ id: "123456",
178
+ code: "N-T",
179
+ name: "GST on Purchases",
180
+ rate: 10,
181
+ },
182
+ },
183
+ purchaseDetails: {
184
+ unitPrice: 27500.5,
185
+ unitOfMeasure: "pc.",
186
+ taxInclusive: true,
187
+ taxRate: {
188
+ id: "123456",
189
+ code: "N-T",
190
+ name: "GST on Purchases",
191
+ rate: 10,
192
+ },
193
+ },
194
+ quantity: 1,
195
+ unitPrice: 27500.5,
196
+ assetAccount: {
197
+ id: "123456",
198
+ name: "Bank account",
199
+ nominalCode: "N091",
200
+ code: "453",
201
+ },
202
+ incomeAccount: {
203
+ id: "123456",
204
+ name: "Bank account",
205
+ nominalCode: "N091",
206
+ code: "453",
207
+ },
208
+ expenseAccount: {
209
+ id: "123456",
210
+ name: "Bank account",
211
+ nominalCode: "N091",
212
+ code: "453",
213
+ },
214
+ trackingCategories: [
215
+ {
216
+ id: "123456",
217
+ name: "New York",
218
+ },
219
+ {
220
+ id: "123456",
221
+ name: "New York",
222
+ },
223
+ ],
224
+ active: true,
225
+ departmentId: "12345",
226
+ locationId: "12345",
227
+ subsidiaryId: "12345",
228
+ taxScheduleId: "123456",
229
+ rowVersion: "1-12345",
230
+ updatedBy: "12345",
231
+ createdBy: "12345",
232
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
233
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
234
+ passThrough: [
235
+ {
236
+ serviceId: "<id>",
237
+ extendPaths: [
238
+ {
239
+ path: "$.nested.property",
240
+ value: {
241
+ "TaxClassificationRef": {
242
+ "value": "EUC-99990201-V1-00020000",
243
+ },
244
+ },
245
+ },
246
+ ],
247
+ },
248
+ {
249
+ serviceId: "<id>",
250
+ extendPaths: [
251
+ {
252
+ path: "$.nested.property",
253
+ value: {
254
+ "TaxClassificationRef": {
255
+ "value": "EUC-99990201-V1-00020000",
256
+ },
257
+ },
258
+ },
259
+ {
260
+ path: "$.nested.property",
261
+ value: {
262
+ "TaxClassificationRef": {
263
+ "value": "EUC-99990201-V1-00020000",
264
+ },
265
+ },
266
+ },
267
+ {
268
+ path: "$.nested.property",
269
+ value: {
270
+ "TaxClassificationRef": {
271
+ "value": "EUC-99990201-V1-00020000",
272
+ },
273
+ },
274
+ },
275
+ ],
276
+ },
277
+ ],
278
+ },
279
+ {
280
+ id: "123456",
281
+ name: "Model Y",
282
+ description:
283
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
284
+ code: "120-C",
285
+ sold: true,
286
+ purchased: true,
287
+ tracked: true,
288
+ taxable: true,
289
+ inventoryDate: new Date("2020-10-30"),
290
+ type: "inventory",
291
+ salesDetails: {
292
+ unitPrice: 27500.5,
293
+ unitOfMeasure: "pc.",
294
+ taxInclusive: true,
295
+ taxRate: {
296
+ id: "123456",
297
+ code: "N-T",
298
+ name: "GST on Purchases",
299
+ rate: 10,
300
+ },
301
+ },
302
+ purchaseDetails: {
303
+ unitPrice: 27500.5,
304
+ unitOfMeasure: "pc.",
305
+ taxInclusive: true,
306
+ taxRate: {
307
+ id: "123456",
308
+ code: "N-T",
309
+ name: "GST on Purchases",
310
+ rate: 10,
311
+ },
312
+ },
313
+ quantity: 1,
314
+ unitPrice: 27500.5,
315
+ assetAccount: {
316
+ id: "123456",
317
+ name: "Bank account",
318
+ nominalCode: "N091",
319
+ code: "453",
320
+ },
321
+ incomeAccount: {
322
+ id: "123456",
323
+ name: "Bank account",
324
+ nominalCode: "N091",
325
+ code: "453",
326
+ },
327
+ expenseAccount: {
328
+ id: "123456",
329
+ name: "Bank account",
330
+ nominalCode: "N091",
331
+ code: "453",
332
+ },
333
+ trackingCategories: [
334
+ {
335
+ id: "123456",
336
+ name: "New York",
337
+ },
338
+ ],
339
+ active: true,
340
+ departmentId: "12345",
341
+ locationId: "12345",
342
+ subsidiaryId: "12345",
343
+ taxScheduleId: "123456",
344
+ rowVersion: "1-12345",
345
+ updatedBy: "12345",
346
+ createdBy: "12345",
347
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
348
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
349
+ passThrough: [
350
+ {
351
+ serviceId: "<id>",
352
+ extendPaths: [
353
+ {
354
+ path: "$.nested.property",
355
+ value: {
356
+ "TaxClassificationRef": {
357
+ "value": "EUC-99990201-V1-00020000",
358
+ },
359
+ },
360
+ },
361
+ {
362
+ path: "$.nested.property",
363
+ value: {
364
+ "TaxClassificationRef": {
365
+ "value": "EUC-99990201-V1-00020000",
366
+ },
367
+ },
368
+ },
369
+ {
370
+ path: "$.nested.property",
371
+ value: {
372
+ "TaxClassificationRef": {
373
+ "value": "EUC-99990201-V1-00020000",
374
+ },
375
+ },
376
+ },
377
+ ],
378
+ },
379
+ ],
380
+ },
381
+ ],
382
+ meta: {
383
+ itemsOnPage: 50,
384
+ cursors: {
385
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
386
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
387
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
388
+ },
389
+ },
390
+ links: {
391
+ previous:
392
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
393
+ current: "https://unify.apideck.com/crm/companies",
394
+ next:
395
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
396
+ },
397
+ });
398
+ });
399
+
400
+ test("Invoiceitems Accounting Invoice Items Add", async () => {
401
+ const testHttpClient = createTestHTTPClient("accounting.invoiceItemsAdd");
402
+
403
+ const apideck = new Apideck({
404
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
405
+ httpClient: testHttpClient,
406
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
407
+ });
408
+
409
+ const result = await apideck.accounting.invoiceItems.create({
410
+ consumerId: "test-consumer",
411
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
412
+ serviceId: "salesforce",
413
+ invoiceItem: {
414
+ name: "Model Y",
415
+ description:
416
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
417
+ code: "120-C",
418
+ sold: true,
419
+ purchased: true,
420
+ tracked: true,
421
+ taxable: true,
422
+ inventoryDate: new Date("2020-10-30"),
423
+ type: "inventory",
424
+ salesDetails: {
425
+ unitPrice: 27500.5,
426
+ unitOfMeasure: "pc.",
427
+ taxInclusive: true,
428
+ taxRate: {
429
+ id: "123456",
430
+ rate: 10,
431
+ },
432
+ },
433
+ purchaseDetails: {
434
+ unitPrice: 27500.5,
435
+ unitOfMeasure: "pc.",
436
+ taxInclusive: true,
437
+ taxRate: {
438
+ id: "123456",
439
+ rate: 10,
440
+ },
441
+ },
442
+ quantity: 1,
443
+ unitPrice: 27500.5,
444
+ assetAccount: {
445
+ id: "123456",
446
+ nominalCode: "N091",
447
+ code: "453",
448
+ },
449
+ incomeAccount: {
450
+ id: "123456",
451
+ nominalCode: "N091",
452
+ code: "453",
453
+ },
454
+ expenseAccount: {
455
+ id: "123456",
456
+ nominalCode: "N091",
457
+ code: "453",
458
+ },
459
+ trackingCategories: [
460
+ {
461
+ id: "123456",
462
+ name: "New York",
463
+ },
464
+ {
465
+ id: "123456",
466
+ name: "New York",
467
+ },
468
+ ],
469
+ active: true,
470
+ departmentId: "12345",
471
+ locationId: "12345",
472
+ subsidiaryId: "12345",
473
+ taxScheduleId: "123456",
474
+ rowVersion: "1-12345",
475
+ passThrough: [
476
+ {
477
+ serviceId: "<id>",
478
+ extendPaths: [
479
+ {
480
+ path: "$.nested.property",
481
+ value: {
482
+ "TaxClassificationRef": {
483
+ "value": "EUC-99990201-V1-00020000",
484
+ },
485
+ },
486
+ },
487
+ {
488
+ path: "$.nested.property",
489
+ value: {
490
+ "TaxClassificationRef": {
491
+ "value": "EUC-99990201-V1-00020000",
492
+ },
493
+ },
494
+ },
495
+ ],
496
+ },
497
+ {
498
+ serviceId: "<id>",
499
+ extendPaths: [
500
+ {
501
+ path: "$.nested.property",
502
+ value: {
503
+ "TaxClassificationRef": {
504
+ "value": "EUC-99990201-V1-00020000",
505
+ },
506
+ },
507
+ },
508
+ ],
509
+ },
510
+ ],
511
+ },
512
+ });
513
+ expect(result.httpMeta.response.status).toBe(201);
514
+ expect(result.createInvoiceItemResponse).toBeDefined();
515
+ expect(result.createInvoiceItemResponse).toEqual({
516
+ statusCode: 200,
517
+ status: "OK",
518
+ service: "xero",
519
+ resource: "invoice-items",
520
+ operation: "add",
521
+ data: {
522
+ id: "12345",
523
+ },
524
+ });
525
+ });
526
+
527
+ test("Invoiceitems Accounting Invoice Items One", async () => {
528
+ const testHttpClient = createTestHTTPClient("accounting.invoiceItemsOne");
529
+
530
+ const apideck = new Apideck({
531
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
532
+ httpClient: testHttpClient,
533
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
534
+ });
535
+
536
+ const result = await apideck.accounting.invoiceItems.get({
537
+ id: "<id>",
538
+ consumerId: "test-consumer",
539
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
540
+ serviceId: "salesforce",
541
+ fields: "id,updated_at",
542
+ filter: {
543
+ type: "service",
544
+ },
545
+ });
546
+ expect(result.httpMeta.response.status).toBe(200);
547
+ expect(result.getInvoiceItemResponse).toBeDefined();
548
+ expect(result.getInvoiceItemResponse).toEqual({
549
+ statusCode: 200,
550
+ status: "OK",
551
+ service: "xero",
552
+ resource: "invoice-items",
553
+ operation: "one",
554
+ data: {
555
+ id: "123456",
556
+ name: "Model Y",
557
+ description:
558
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
559
+ code: "120-C",
560
+ sold: true,
561
+ purchased: true,
562
+ tracked: true,
563
+ taxable: true,
564
+ inventoryDate: new Date("2020-10-30"),
565
+ type: "inventory",
566
+ salesDetails: {
567
+ unitPrice: 27500.5,
568
+ unitOfMeasure: "pc.",
569
+ taxInclusive: true,
570
+ taxRate: {
571
+ id: "123456",
572
+ code: "N-T",
573
+ name: "GST on Purchases",
574
+ rate: 10,
575
+ },
576
+ },
577
+ purchaseDetails: {
578
+ unitPrice: 27500.5,
579
+ unitOfMeasure: "pc.",
580
+ taxInclusive: true,
581
+ taxRate: {
582
+ id: "123456",
583
+ code: "N-T",
584
+ name: "GST on Purchases",
585
+ rate: 10,
586
+ },
587
+ },
588
+ quantity: 1,
589
+ unitPrice: 27500.5,
590
+ assetAccount: {
591
+ id: "123456",
592
+ name: "Bank account",
593
+ nominalCode: "N091",
594
+ code: "453",
595
+ },
596
+ incomeAccount: {
597
+ id: "123456",
598
+ name: "Bank account",
599
+ nominalCode: "N091",
600
+ code: "453",
601
+ },
602
+ expenseAccount: {
603
+ id: "123456",
604
+ name: "Bank account",
605
+ nominalCode: "N091",
606
+ code: "453",
607
+ },
608
+ trackingCategories: [
609
+ {
610
+ id: "123456",
611
+ name: "New York",
612
+ },
613
+ {
614
+ id: "123456",
615
+ name: "New York",
616
+ },
617
+ {
618
+ id: "123456",
619
+ name: "New York",
620
+ },
621
+ ],
622
+ active: true,
623
+ departmentId: "12345",
624
+ locationId: "12345",
625
+ subsidiaryId: "12345",
626
+ taxScheduleId: "123456",
627
+ rowVersion: "1-12345",
628
+ updatedBy: "12345",
629
+ createdBy: "12345",
630
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
631
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
632
+ passThrough: [
633
+ {
634
+ serviceId: "<id>",
635
+ extendPaths: [
636
+ {
637
+ path: "$.nested.property",
638
+ value: {
639
+ "TaxClassificationRef": {
640
+ "value": "EUC-99990201-V1-00020000",
641
+ },
642
+ },
643
+ },
644
+ {
645
+ path: "$.nested.property",
646
+ value: {
647
+ "TaxClassificationRef": {
648
+ "value": "EUC-99990201-V1-00020000",
649
+ },
650
+ },
651
+ },
652
+ ],
653
+ },
654
+ {
655
+ serviceId: "<id>",
656
+ extendPaths: [
657
+ {
658
+ path: "$.nested.property",
659
+ value: {
660
+ "TaxClassificationRef": {
661
+ "value": "EUC-99990201-V1-00020000",
662
+ },
663
+ },
664
+ },
665
+ {
666
+ path: "$.nested.property",
667
+ value: {
668
+ "TaxClassificationRef": {
669
+ "value": "EUC-99990201-V1-00020000",
670
+ },
671
+ },
672
+ },
673
+ ],
674
+ },
675
+ ],
676
+ },
677
+ });
678
+ });
679
+
680
+ test("Invoiceitems Accounting Invoice Items Update", async () => {
681
+ const testHttpClient = createTestHTTPClient("accounting.invoiceItemsUpdate");
682
+
683
+ const apideck = new Apideck({
684
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
685
+ httpClient: testHttpClient,
686
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
687
+ });
688
+
689
+ const result = await apideck.accounting.invoiceItems.update({
690
+ id: "<id>",
691
+ consumerId: "test-consumer",
692
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
693
+ serviceId: "salesforce",
694
+ invoiceItem: {
695
+ name: "Model Y",
696
+ description:
697
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
698
+ code: "120-C",
699
+ sold: true,
700
+ purchased: true,
701
+ tracked: true,
702
+ taxable: true,
703
+ inventoryDate: new Date("2020-10-30"),
704
+ type: "inventory",
705
+ salesDetails: {
706
+ unitPrice: 27500.5,
707
+ unitOfMeasure: "pc.",
708
+ taxInclusive: true,
709
+ taxRate: {
710
+ id: "123456",
711
+ rate: 10,
712
+ },
713
+ },
714
+ purchaseDetails: {
715
+ unitPrice: 27500.5,
716
+ unitOfMeasure: "pc.",
717
+ taxInclusive: true,
718
+ taxRate: {
719
+ id: "123456",
720
+ rate: 10,
721
+ },
722
+ },
723
+ quantity: 1,
724
+ unitPrice: 27500.5,
725
+ assetAccount: {
726
+ id: "123456",
727
+ nominalCode: "N091",
728
+ code: "453",
729
+ },
730
+ incomeAccount: {
731
+ id: "123456",
732
+ nominalCode: "N091",
733
+ code: "453",
734
+ },
735
+ expenseAccount: {
736
+ id: "123456",
737
+ nominalCode: "N091",
738
+ code: "453",
739
+ },
740
+ trackingCategories: [
741
+ {
742
+ id: "123456",
743
+ name: "New York",
744
+ },
745
+ {
746
+ id: "123456",
747
+ name: "New York",
748
+ },
749
+ {
750
+ id: "123456",
751
+ name: "New York",
752
+ },
753
+ ],
754
+ active: true,
755
+ departmentId: "12345",
756
+ locationId: "12345",
757
+ subsidiaryId: "12345",
758
+ taxScheduleId: "123456",
759
+ rowVersion: "1-12345",
760
+ passThrough: [
761
+ {
762
+ serviceId: "<id>",
763
+ extendPaths: [
764
+ {
765
+ path: "$.nested.property",
766
+ value: {
767
+ "TaxClassificationRef": {
768
+ "value": "EUC-99990201-V1-00020000",
769
+ },
770
+ },
771
+ },
772
+ {
773
+ path: "$.nested.property",
774
+ value: {
775
+ "TaxClassificationRef": {
776
+ "value": "EUC-99990201-V1-00020000",
777
+ },
778
+ },
779
+ },
780
+ ],
781
+ },
782
+ {
783
+ serviceId: "<id>",
784
+ extendPaths: [
785
+ {
786
+ path: "$.nested.property",
787
+ value: {
788
+ "TaxClassificationRef": {
789
+ "value": "EUC-99990201-V1-00020000",
790
+ },
791
+ },
792
+ },
793
+ {
794
+ path: "$.nested.property",
795
+ value: {
796
+ "TaxClassificationRef": {
797
+ "value": "EUC-99990201-V1-00020000",
798
+ },
799
+ },
800
+ },
801
+ {
802
+ path: "$.nested.property",
803
+ value: {
804
+ "TaxClassificationRef": {
805
+ "value": "EUC-99990201-V1-00020000",
806
+ },
807
+ },
808
+ },
809
+ ],
810
+ },
811
+ ],
812
+ },
813
+ });
814
+ expect(result.httpMeta.response.status).toBe(200);
815
+ expect(result.updateInvoiceItemsResponse).toBeDefined();
816
+ expect(result.updateInvoiceItemsResponse).toEqual({
817
+ statusCode: 200,
818
+ status: "OK",
819
+ service: "xero",
820
+ resource: "invoice-items",
821
+ operation: "update",
822
+ data: {
823
+ id: "12345",
824
+ },
825
+ });
826
+ });
827
+
828
+ test("Invoiceitems Accounting Invoice Items Delete", async () => {
829
+ const testHttpClient = createTestHTTPClient("accounting.invoiceItemsDelete");
830
+
831
+ const apideck = new Apideck({
832
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
833
+ httpClient: testHttpClient,
834
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
835
+ });
836
+
837
+ const result = await apideck.accounting.invoiceItems.delete({
838
+ id: "<id>",
839
+ consumerId: "test-consumer",
840
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
841
+ serviceId: "salesforce",
842
+ });
843
+ expect(result.httpMeta.response.status).toBe(200);
844
+ expect(result.deleteTaxRateResponse).toBeDefined();
845
+ expect(result.deleteTaxRateResponse).toEqual({
846
+ statusCode: 200,
847
+ status: "OK",
848
+ service: "xero",
849
+ resource: "tax-rates",
850
+ operation: "delete",
851
+ data: {
852
+ id: "12345",
853
+ },
854
+ });
855
+ });