@apideck/unify 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +3 -3
  3. package/lib/config.js +3 -3
  4. package/models/components/note.d.ts +5 -0
  5. package/models/components/note.d.ts.map +1 -1
  6. package/models/components/note.js +4 -0
  7. package/models/components/note.js.map +1 -1
  8. package/models/components/noteinput.d.ts +5 -0
  9. package/models/components/noteinput.d.ts.map +1 -1
  10. package/models/components/noteinput.js +4 -0
  11. package/models/components/noteinput.js.map +1 -1
  12. package/package.json +5 -1
  13. package/src/__tests__/activities.test.ts +783 -0
  14. package/src/__tests__/agedcreditors.test.ts +279 -0
  15. package/src/__tests__/ageddebtors.test.ts +279 -0
  16. package/src/__tests__/apideckcompanies.test.ts +712 -0
  17. package/src/__tests__/apideckcustomers.test.ts +360 -0
  18. package/src/__tests__/apideckdepartments.test.ts +319 -0
  19. package/src/__tests__/apiresources.test.ts +61 -0
  20. package/src/__tests__/apis.test.ts +214 -0
  21. package/src/__tests__/applicants.test.ts +976 -0
  22. package/src/__tests__/applications.test.ts +329 -0
  23. package/src/__tests__/assertions.ts +13 -0
  24. package/src/__tests__/attachments.test.ts +363 -0
  25. package/src/__tests__/balancesheet.test.ts +451 -0
  26. package/src/__tests__/billpayments.test.ts +666 -0
  27. package/src/__tests__/bills.test.ts +1133 -0
  28. package/src/__tests__/collections.test.ts +115 -0
  29. package/src/__tests__/collectiontags.test.ts +66 -0
  30. package/src/__tests__/collectionticketcomments.test.ts +318 -0
  31. package/src/__tests__/collectiontickets.test.ts +436 -0
  32. package/src/__tests__/collectionusers.test.ts +122 -0
  33. package/src/__tests__/companies.test.ts +1059 -0
  34. package/src/__tests__/companyinfo.test.ts +218 -0
  35. package/src/__tests__/connectioncustommappings.test.ts +67 -0
  36. package/src/__tests__/connections.test.ts +1713 -0
  37. package/src/__tests__/connectionsettings.test.ts +280 -0
  38. package/src/__tests__/connectordocs.test.ts +28 -0
  39. package/src/__tests__/connectors.test.ts +751 -0
  40. package/src/__tests__/consumerrequestcounts.test.ts +41 -0
  41. package/src/__tests__/consumers.test.ts +517 -0
  42. package/src/__tests__/contacts.test.ts +957 -0
  43. package/src/__tests__/createcallback.test.ts +34 -0
  44. package/src/__tests__/creditnotes.test.ts +1362 -0
  45. package/src/__tests__/customers.test.ts +1089 -0
  46. package/src/__tests__/customfields.test.ts +50 -0
  47. package/src/__tests__/custommappings.test.ts +63 -0
  48. package/src/__tests__/departments.test.ts +359 -0
  49. package/src/__tests__/drivegroups.test.ts +318 -0
  50. package/src/__tests__/drives.test.ts +311 -0
  51. package/src/__tests__/employeepayrolls.test.ts +487 -0
  52. package/src/__tests__/employees.test.ts +1682 -0
  53. package/src/__tests__/employeeschedules.test.ts +456 -0
  54. package/src/__tests__/eventlogs.test.ts +157 -0
  55. package/src/__tests__/expenses.test.ts +566 -0
  56. package/src/__tests__/files.test.ts +392 -0
  57. package/src/__tests__/files.ts +56 -0
  58. package/src/__tests__/folders.test.ts +103 -0
  59. package/src/__tests__/invoiceitems.test.ts +586 -0
  60. package/src/__tests__/invoices.test.ts +1561 -0
  61. package/src/__tests__/jobs.test.ts +837 -0
  62. package/src/__tests__/journalentries.test.ts +1053 -0
  63. package/src/__tests__/leads.test.ts +897 -0
  64. package/src/__tests__/ledgeraccounts.test.ts +594 -0
  65. package/src/__tests__/locations.test.ts +561 -0
  66. package/src/__tests__/logs.test.ts +135 -0
  67. package/src/__tests__/messages.test.ts +396 -0
  68. package/src/__tests__/mockserver/README.md +52 -0
  69. package/src/__tests__/notes.test.ts +335 -0
  70. package/src/__tests__/opportunities.test.ts +503 -0
  71. package/src/__tests__/orders.test.ts +849 -0
  72. package/src/__tests__/payments.test.ts +557 -0
  73. package/src/__tests__/payrolls.test.ts +481 -0
  74. package/src/__tests__/pipelines.test.ts +383 -0
  75. package/src/__tests__/products.test.ts +505 -0
  76. package/src/__tests__/profitandloss.test.ts +221 -0
  77. package/src/__tests__/purchaseorders.test.ts +1464 -0
  78. package/src/__tests__/sessions.test.ts +70 -0
  79. package/src/__tests__/sharedlinks.test.ts +331 -0
  80. package/src/__tests__/stores.test.ts +39 -0
  81. package/src/__tests__/subsidiaries.test.ts +316 -0
  82. package/src/__tests__/suppliers.test.ts +1071 -0
  83. package/src/__tests__/taxrates.test.ts +472 -0
  84. package/src/__tests__/testclient.ts +48 -0
  85. package/src/__tests__/timeoffrequests.test.ts +381 -0
  86. package/src/__tests__/trackingcategories.test.ts +329 -0
  87. package/src/__tests__/uploadsessions.test.ts +142 -0
  88. package/src/__tests__/users.test.ts +667 -0
  89. package/src/__tests__/validateconnection.test.ts +32 -0
  90. package/src/__tests__/webhooks.test.ts +248 -0
  91. package/src/lib/config.ts +3 -3
  92. package/src/models/components/note.ts +9 -0
  93. package/src/models/components/noteinput.ts +9 -0
@@ -0,0 +1,1133 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { assert, expect, it, test } from "vitest";
6
+ import { Apideck } from "../index.js";
7
+ import { RFCDate } from "../types/index.js";
8
+ import { createTestHTTPClient } from "./testclient.js";
9
+
10
+ test("Bills Accounting Bills All", async () => {
11
+ const testHttpClient = createTestHTTPClient("accounting.billsAll");
12
+
13
+ const apideck = new Apideck({
14
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
15
+ httpClient: testHttpClient,
16
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
17
+ });
18
+
19
+ const result = await apideck.accounting.bills.list({
20
+ serviceId: "salesforce",
21
+ filter: {
22
+ updatedSince: new Date("2020-09-30T07:43:32.000Z"),
23
+ },
24
+ sort: {
25
+ by: "updated_at",
26
+ },
27
+ passThrough: {
28
+ "search": "San Francisco",
29
+ },
30
+ fields: "id,updated_at",
31
+ });
32
+ expect(result.httpMeta.response.status).toBe(200);
33
+ expect(result.getBillsResponse).toBeDefined();
34
+ expect(result.getBillsResponse).toEqual({
35
+ statusCode: 200,
36
+ status: "OK",
37
+ service: "xero",
38
+ resource: "bills",
39
+ operation: "all",
40
+ data: [
41
+ {
42
+ id: "12345",
43
+ downstreamId: "12345",
44
+ billNumber: "10001",
45
+ supplier: {
46
+ id: "12345",
47
+ displayId: "SUPP00101",
48
+ displayName: "Windsurf Shop",
49
+ companyName: "The boring company",
50
+ address: {
51
+ id: "123",
52
+ type: "primary",
53
+ string: "25 Spring Street, Blackburn, VIC 3130",
54
+ name: "HQ US",
55
+ line1: "Main street",
56
+ line2: "apt #",
57
+ line3: "Suite #",
58
+ line4: "delivery instructions",
59
+ streetNumber: "25",
60
+ city: "San Francisco",
61
+ state: "CA",
62
+ postalCode: "94104",
63
+ country: "US",
64
+ latitude: "40.759211",
65
+ longitude: "-73.984638",
66
+ county: "Santa Clara",
67
+ contactName: "Elon Musk",
68
+ salutation: "Mr",
69
+ phoneNumber: "111-111-1111",
70
+ fax: "122-111-1111",
71
+ email: "elon@musk.com",
72
+ website: "https://elonmusk.com",
73
+ notes: "Address notes or delivery instructions.",
74
+ rowVersion: "1-12345",
75
+ },
76
+ },
77
+ companyId: "12345",
78
+ currency: "USD",
79
+ currencyRate: 0.69,
80
+ taxInclusive: true,
81
+ billDate: new RFCDate("2020-09-30"),
82
+ dueDate: new RFCDate("2020-10-30"),
83
+ paidDate: new RFCDate("2020-10-30"),
84
+ poNumber: "90000117",
85
+ reference: "123456",
86
+ lineItems: [
87
+ {
88
+ id: "12345",
89
+ rowId: "12345",
90
+ code: "120-C",
91
+ lineNumber: 1,
92
+ description:
93
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
94
+ type: "expense_account",
95
+ taxAmount: 27500,
96
+ totalAmount: 27500,
97
+ quantity: 1,
98
+ unitPrice: 27500.5,
99
+ unitOfMeasure: "pc.",
100
+ discountPercentage: 0.01,
101
+ discountAmount: 19.99,
102
+ locationId: "12345",
103
+ departmentId: "12345",
104
+ item: {
105
+ id: "12344",
106
+ code: "120-C",
107
+ name: "Model Y",
108
+ },
109
+ taxRate: {
110
+ id: "123456",
111
+ code: "N-T",
112
+ name: "GST on Purchases",
113
+ rate: 10,
114
+ },
115
+ ledgerAccount: {
116
+ id: "123456",
117
+ name: "Bank account",
118
+ nominalCode: "N091",
119
+ code: "453",
120
+ },
121
+ trackingCategories: [
122
+ {
123
+ id: "123456",
124
+ name: "New York",
125
+ },
126
+ {
127
+ id: "123456",
128
+ name: "New York",
129
+ },
130
+ {
131
+ id: "123456",
132
+ name: "New York",
133
+ },
134
+ ],
135
+ rowVersion: "1-12345",
136
+ updatedBy: "12345",
137
+ createdBy: "12345",
138
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
139
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
140
+ },
141
+ {
142
+ id: "12345",
143
+ rowId: "12345",
144
+ code: "120-C",
145
+ lineNumber: 1,
146
+ description:
147
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
148
+ type: "expense_account",
149
+ taxAmount: 27500,
150
+ totalAmount: 27500,
151
+ quantity: 1,
152
+ unitPrice: 27500.5,
153
+ unitOfMeasure: "pc.",
154
+ discountPercentage: 0.01,
155
+ discountAmount: 19.99,
156
+ locationId: "12345",
157
+ departmentId: "12345",
158
+ item: {
159
+ id: "12344",
160
+ code: "120-C",
161
+ name: "Model Y",
162
+ },
163
+ taxRate: {
164
+ id: "123456",
165
+ code: "N-T",
166
+ name: "GST on Purchases",
167
+ rate: 10,
168
+ },
169
+ ledgerAccount: {
170
+ id: "123456",
171
+ name: "Bank account",
172
+ nominalCode: "N091",
173
+ code: "453",
174
+ },
175
+ trackingCategories: [
176
+ {
177
+ id: "123456",
178
+ name: "New York",
179
+ },
180
+ ],
181
+ rowVersion: "1-12345",
182
+ updatedBy: "12345",
183
+ createdBy: "12345",
184
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
185
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
186
+ },
187
+ ],
188
+ terms: "Net 30 days",
189
+ balance: 27500,
190
+ deposit: 0,
191
+ subTotal: 27500,
192
+ totalTax: 2500,
193
+ total: 27500,
194
+ taxCode: "1234",
195
+ notes: "Some notes about this bill.",
196
+ status: "draft",
197
+ ledgerAccount: {
198
+ id: "123456",
199
+ name: "Bank account",
200
+ nominalCode: "N091",
201
+ code: "453",
202
+ },
203
+ paymentMethod: "cash",
204
+ channel: "email",
205
+ language: "EN",
206
+ accountingByRow: false,
207
+ bankAccount: {
208
+ bankName: "Monzo",
209
+ accountNumber: "123465",
210
+ accountName: "SPACEX LLC",
211
+ accountType: "credit_card",
212
+ iban: "CH2989144532982975332",
213
+ bic: "AUDSCHGGXXX",
214
+ routingNumber: "012345678",
215
+ bsbNumber: "062-001",
216
+ branchIdentifier: "001",
217
+ bankCode: "BNH",
218
+ currency: "USD",
219
+ },
220
+ discountPercentage: 5.5,
221
+ sourceDocumentUrl: "https://www.invoicesolution.com/bill/123456",
222
+ trackingCategories: [
223
+ {
224
+ id: "123456",
225
+ name: "New York",
226
+ },
227
+ ],
228
+ updatedBy: "12345",
229
+ createdBy: "12345",
230
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
231
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
232
+ rowVersion: "1-12345",
233
+ customFields: [
234
+ {
235
+ id: "2389328923893298",
236
+ name: "employee_level",
237
+ description: "Employee Level",
238
+ value: {},
239
+ },
240
+ ],
241
+ passThrough: [
242
+ {
243
+ serviceId: "<id>",
244
+ extendPaths: [
245
+ {
246
+ path: "$.nested.property",
247
+ value: {
248
+ "TaxClassificationRef": {
249
+ "value": "EUC-99990201-V1-00020000",
250
+ },
251
+ },
252
+ },
253
+ ],
254
+ },
255
+ {
256
+ serviceId: "<id>",
257
+ extendPaths: [
258
+ {
259
+ path: "$.nested.property",
260
+ value: {
261
+ "TaxClassificationRef": {
262
+ "value": "EUC-99990201-V1-00020000",
263
+ },
264
+ },
265
+ },
266
+ {
267
+ path: "$.nested.property",
268
+ value: {
269
+ "TaxClassificationRef": {
270
+ "value": "EUC-99990201-V1-00020000",
271
+ },
272
+ },
273
+ },
274
+ {
275
+ path: "$.nested.property",
276
+ value: {
277
+ "TaxClassificationRef": {
278
+ "value": "EUC-99990201-V1-00020000",
279
+ },
280
+ },
281
+ },
282
+ ],
283
+ },
284
+ ],
285
+ accountingPeriod: "01-24",
286
+ },
287
+ {
288
+ id: "12345",
289
+ downstreamId: "12345",
290
+ billNumber: "10001",
291
+ supplier: {
292
+ id: "12345",
293
+ displayId: "SUPP00101",
294
+ displayName: "Windsurf Shop",
295
+ companyName: "The boring company",
296
+ address: {
297
+ id: "123",
298
+ type: "primary",
299
+ string: "25 Spring Street, Blackburn, VIC 3130",
300
+ name: "HQ US",
301
+ line1: "Main street",
302
+ line2: "apt #",
303
+ line3: "Suite #",
304
+ line4: "delivery instructions",
305
+ streetNumber: "25",
306
+ city: "San Francisco",
307
+ state: "CA",
308
+ postalCode: "94104",
309
+ country: "US",
310
+ latitude: "40.759211",
311
+ longitude: "-73.984638",
312
+ county: "Santa Clara",
313
+ contactName: "Elon Musk",
314
+ salutation: "Mr",
315
+ phoneNumber: "111-111-1111",
316
+ fax: "122-111-1111",
317
+ email: "elon@musk.com",
318
+ website: "https://elonmusk.com",
319
+ notes: "Address notes or delivery instructions.",
320
+ rowVersion: "1-12345",
321
+ },
322
+ },
323
+ companyId: "12345",
324
+ currency: "USD",
325
+ currencyRate: 0.69,
326
+ taxInclusive: true,
327
+ billDate: new RFCDate("2020-09-30"),
328
+ dueDate: new RFCDate("2020-10-30"),
329
+ paidDate: new RFCDate("2020-10-30"),
330
+ poNumber: "90000117",
331
+ reference: "123456",
332
+ lineItems: [
333
+ {
334
+ id: "12345",
335
+ rowId: "12345",
336
+ code: "120-C",
337
+ lineNumber: 1,
338
+ description:
339
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
340
+ type: "expense_account",
341
+ taxAmount: 27500,
342
+ totalAmount: 27500,
343
+ quantity: 1,
344
+ unitPrice: 27500.5,
345
+ unitOfMeasure: "pc.",
346
+ discountPercentage: 0.01,
347
+ discountAmount: 19.99,
348
+ locationId: "12345",
349
+ departmentId: "12345",
350
+ item: {
351
+ id: "12344",
352
+ code: "120-C",
353
+ name: "Model Y",
354
+ },
355
+ taxRate: {
356
+ id: "123456",
357
+ code: "N-T",
358
+ name: "GST on Purchases",
359
+ rate: 10,
360
+ },
361
+ ledgerAccount: {
362
+ id: "123456",
363
+ name: "Bank account",
364
+ nominalCode: "N091",
365
+ code: "453",
366
+ },
367
+ trackingCategories: [
368
+ {
369
+ id: "123456",
370
+ name: "New York",
371
+ },
372
+ ],
373
+ rowVersion: "1-12345",
374
+ updatedBy: "12345",
375
+ createdBy: "12345",
376
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
377
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
378
+ },
379
+ ],
380
+ terms: "Net 30 days",
381
+ balance: 27500,
382
+ deposit: 0,
383
+ subTotal: 27500,
384
+ totalTax: 2500,
385
+ total: 27500,
386
+ taxCode: "1234",
387
+ notes: "Some notes about this bill.",
388
+ status: "draft",
389
+ ledgerAccount: {
390
+ id: "123456",
391
+ name: "Bank account",
392
+ nominalCode: "N091",
393
+ code: "453",
394
+ },
395
+ paymentMethod: "cash",
396
+ channel: "email",
397
+ language: "EN",
398
+ accountingByRow: false,
399
+ bankAccount: {
400
+ bankName: "Monzo",
401
+ accountNumber: "123465",
402
+ accountName: "SPACEX LLC",
403
+ accountType: "credit_card",
404
+ iban: "CH2989144532982975332",
405
+ bic: "AUDSCHGGXXX",
406
+ routingNumber: "012345678",
407
+ bsbNumber: "062-001",
408
+ branchIdentifier: "001",
409
+ bankCode: "BNH",
410
+ currency: "USD",
411
+ },
412
+ discountPercentage: 5.5,
413
+ sourceDocumentUrl: "https://www.invoicesolution.com/bill/123456",
414
+ trackingCategories: [
415
+ {
416
+ id: "123456",
417
+ name: "New York",
418
+ },
419
+ {
420
+ id: "123456",
421
+ name: "New York",
422
+ },
423
+ {
424
+ id: "123456",
425
+ name: "New York",
426
+ },
427
+ ],
428
+ updatedBy: "12345",
429
+ createdBy: "12345",
430
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
431
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
432
+ rowVersion: "1-12345",
433
+ customFields: [
434
+ {
435
+ id: "2389328923893298",
436
+ name: "employee_level",
437
+ description: "Employee Level",
438
+ value: {},
439
+ },
440
+ {
441
+ id: "2389328923893298",
442
+ name: "employee_level",
443
+ description: "Employee Level",
444
+ value: "Uses Salesforce and Marketo",
445
+ },
446
+ ],
447
+ passThrough: [
448
+ {
449
+ serviceId: "<id>",
450
+ extendPaths: [
451
+ {
452
+ path: "$.nested.property",
453
+ value: {
454
+ "TaxClassificationRef": {
455
+ "value": "EUC-99990201-V1-00020000",
456
+ },
457
+ },
458
+ },
459
+ {
460
+ path: "$.nested.property",
461
+ value: {
462
+ "TaxClassificationRef": {
463
+ "value": "EUC-99990201-V1-00020000",
464
+ },
465
+ },
466
+ },
467
+ ],
468
+ },
469
+ ],
470
+ accountingPeriod: "01-24",
471
+ },
472
+ {
473
+ id: "12345",
474
+ downstreamId: "12345",
475
+ billNumber: "10001",
476
+ supplier: {
477
+ id: "12345",
478
+ displayId: "SUPP00101",
479
+ displayName: "Windsurf Shop",
480
+ companyName: "The boring company",
481
+ address: {
482
+ id: "123",
483
+ type: "primary",
484
+ string: "25 Spring Street, Blackburn, VIC 3130",
485
+ name: "HQ US",
486
+ line1: "Main street",
487
+ line2: "apt #",
488
+ line3: "Suite #",
489
+ line4: "delivery instructions",
490
+ streetNumber: "25",
491
+ city: "San Francisco",
492
+ state: "CA",
493
+ postalCode: "94104",
494
+ country: "US",
495
+ latitude: "40.759211",
496
+ longitude: "-73.984638",
497
+ county: "Santa Clara",
498
+ contactName: "Elon Musk",
499
+ salutation: "Mr",
500
+ phoneNumber: "111-111-1111",
501
+ fax: "122-111-1111",
502
+ email: "elon@musk.com",
503
+ website: "https://elonmusk.com",
504
+ notes: "Address notes or delivery instructions.",
505
+ rowVersion: "1-12345",
506
+ },
507
+ },
508
+ companyId: "12345",
509
+ currency: "USD",
510
+ currencyRate: 0.69,
511
+ taxInclusive: true,
512
+ billDate: new RFCDate("2020-09-30"),
513
+ dueDate: new RFCDate("2020-10-30"),
514
+ paidDate: new RFCDate("2020-10-30"),
515
+ poNumber: "90000117",
516
+ reference: "123456",
517
+ lineItems: [
518
+ {
519
+ id: "12345",
520
+ rowId: "12345",
521
+ code: "120-C",
522
+ lineNumber: 1,
523
+ description:
524
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
525
+ type: "expense_account",
526
+ taxAmount: 27500,
527
+ totalAmount: 27500,
528
+ quantity: 1,
529
+ unitPrice: 27500.5,
530
+ unitOfMeasure: "pc.",
531
+ discountPercentage: 0.01,
532
+ discountAmount: 19.99,
533
+ locationId: "12345",
534
+ departmentId: "12345",
535
+ item: {
536
+ id: "12344",
537
+ code: "120-C",
538
+ name: "Model Y",
539
+ },
540
+ taxRate: {
541
+ id: "123456",
542
+ code: "N-T",
543
+ name: "GST on Purchases",
544
+ rate: 10,
545
+ },
546
+ ledgerAccount: {
547
+ id: "123456",
548
+ name: "Bank account",
549
+ nominalCode: "N091",
550
+ code: "453",
551
+ },
552
+ trackingCategories: [
553
+ {
554
+ id: "123456",
555
+ name: "New York",
556
+ },
557
+ ],
558
+ rowVersion: "1-12345",
559
+ updatedBy: "12345",
560
+ createdBy: "12345",
561
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
562
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
563
+ },
564
+ {
565
+ id: "12345",
566
+ rowId: "12345",
567
+ code: "120-C",
568
+ lineNumber: 1,
569
+ description:
570
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
571
+ type: "expense_account",
572
+ taxAmount: 27500,
573
+ totalAmount: 27500,
574
+ quantity: 1,
575
+ unitPrice: 27500.5,
576
+ unitOfMeasure: "pc.",
577
+ discountPercentage: 0.01,
578
+ discountAmount: 19.99,
579
+ locationId: "12345",
580
+ departmentId: "12345",
581
+ item: {
582
+ id: "12344",
583
+ code: "120-C",
584
+ name: "Model Y",
585
+ },
586
+ taxRate: {
587
+ id: "123456",
588
+ code: "N-T",
589
+ name: "GST on Purchases",
590
+ rate: 10,
591
+ },
592
+ ledgerAccount: {
593
+ id: "123456",
594
+ name: "Bank account",
595
+ nominalCode: "N091",
596
+ code: "453",
597
+ },
598
+ trackingCategories: [
599
+ {
600
+ id: "123456",
601
+ name: "New York",
602
+ },
603
+ {
604
+ id: "123456",
605
+ name: "New York",
606
+ },
607
+ {
608
+ id: "123456",
609
+ name: "New York",
610
+ },
611
+ ],
612
+ rowVersion: "1-12345",
613
+ updatedBy: "12345",
614
+ createdBy: "12345",
615
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
616
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
617
+ },
618
+ ],
619
+ terms: "Net 30 days",
620
+ balance: 27500,
621
+ deposit: 0,
622
+ subTotal: 27500,
623
+ totalTax: 2500,
624
+ total: 27500,
625
+ taxCode: "1234",
626
+ notes: "Some notes about this bill.",
627
+ status: "draft",
628
+ ledgerAccount: {
629
+ id: "123456",
630
+ name: "Bank account",
631
+ nominalCode: "N091",
632
+ code: "453",
633
+ },
634
+ paymentMethod: "cash",
635
+ channel: "email",
636
+ language: "EN",
637
+ accountingByRow: false,
638
+ bankAccount: {
639
+ bankName: "Monzo",
640
+ accountNumber: "123465",
641
+ accountName: "SPACEX LLC",
642
+ accountType: "credit_card",
643
+ iban: "CH2989144532982975332",
644
+ bic: "AUDSCHGGXXX",
645
+ routingNumber: "012345678",
646
+ bsbNumber: "062-001",
647
+ branchIdentifier: "001",
648
+ bankCode: "BNH",
649
+ currency: "USD",
650
+ },
651
+ discountPercentage: 5.5,
652
+ sourceDocumentUrl: "https://www.invoicesolution.com/bill/123456",
653
+ trackingCategories: [
654
+ {
655
+ id: "123456",
656
+ name: "New York",
657
+ },
658
+ {
659
+ id: "123456",
660
+ name: "New York",
661
+ },
662
+ ],
663
+ updatedBy: "12345",
664
+ createdBy: "12345",
665
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
666
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
667
+ rowVersion: "1-12345",
668
+ customFields: [
669
+ {
670
+ id: "2389328923893298",
671
+ name: "employee_level",
672
+ description: "Employee Level",
673
+ value: true,
674
+ },
675
+ {
676
+ id: "2389328923893298",
677
+ name: "employee_level",
678
+ description: "Employee Level",
679
+ value: "Uses Salesforce and Marketo",
680
+ },
681
+ {
682
+ id: "2389328923893298",
683
+ name: "employee_level",
684
+ description: "Employee Level",
685
+ value: 10,
686
+ },
687
+ ],
688
+ passThrough: [
689
+ {
690
+ serviceId: "<id>",
691
+ extendPaths: [
692
+ {
693
+ path: "$.nested.property",
694
+ value: {
695
+ "TaxClassificationRef": {
696
+ "value": "EUC-99990201-V1-00020000",
697
+ },
698
+ },
699
+ },
700
+ ],
701
+ },
702
+ {
703
+ serviceId: "<id>",
704
+ extendPaths: [
705
+ {
706
+ path: "$.nested.property",
707
+ value: {
708
+ "TaxClassificationRef": {
709
+ "value": "EUC-99990201-V1-00020000",
710
+ },
711
+ },
712
+ },
713
+ {
714
+ path: "$.nested.property",
715
+ value: {
716
+ "TaxClassificationRef": {
717
+ "value": "EUC-99990201-V1-00020000",
718
+ },
719
+ },
720
+ },
721
+ {
722
+ path: "$.nested.property",
723
+ value: {
724
+ "TaxClassificationRef": {
725
+ "value": "EUC-99990201-V1-00020000",
726
+ },
727
+ },
728
+ },
729
+ ],
730
+ },
731
+ {
732
+ serviceId: "<id>",
733
+ extendPaths: [
734
+ {
735
+ path: "$.nested.property",
736
+ value: {
737
+ "TaxClassificationRef": {
738
+ "value": "EUC-99990201-V1-00020000",
739
+ },
740
+ },
741
+ },
742
+ {
743
+ path: "$.nested.property",
744
+ value: {
745
+ "TaxClassificationRef": {
746
+ "value": "EUC-99990201-V1-00020000",
747
+ },
748
+ },
749
+ },
750
+ ],
751
+ },
752
+ ],
753
+ accountingPeriod: "01-24",
754
+ },
755
+ ],
756
+ meta: {
757
+ itemsOnPage: 50,
758
+ cursors: {
759
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
760
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
761
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
762
+ },
763
+ },
764
+ links: {
765
+ previous:
766
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
767
+ current: "https://unify.apideck.com/crm/companies",
768
+ next:
769
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
770
+ },
771
+ });
772
+ });
773
+
774
+ it.skip("Bills Accounting Bills Add", async () => {
775
+ assert.fail(
776
+ "incomplete test found please make sure to address the following errors: [`workflow step accounting.billsAdd.test referencing operation accounting.billsAdd with expression in requestBody with type not currently supported`]",
777
+ );
778
+ });
779
+
780
+ test("Bills Accounting Bills One", async () => {
781
+ const testHttpClient = createTestHTTPClient("accounting.billsOne");
782
+
783
+ const apideck = new Apideck({
784
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
785
+ httpClient: testHttpClient,
786
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
787
+ });
788
+
789
+ const result = await apideck.accounting.bills.get({
790
+ id: "<id>",
791
+ serviceId: "salesforce",
792
+ fields: "id,updated_at",
793
+ });
794
+ expect(result.httpMeta.response.status).toBe(200);
795
+ expect(result.getBillResponse).toBeDefined();
796
+ expect(result.getBillResponse).toEqual({
797
+ statusCode: 200,
798
+ status: "OK",
799
+ service: "xero",
800
+ resource: "bills",
801
+ operation: "one",
802
+ data: {
803
+ id: "12345",
804
+ downstreamId: "12345",
805
+ billNumber: "10001",
806
+ supplier: {
807
+ id: "12345",
808
+ displayId: "SUPP00101",
809
+ displayName: "Windsurf Shop",
810
+ companyName: "The boring company",
811
+ address: {
812
+ id: "123",
813
+ type: "primary",
814
+ string: "25 Spring Street, Blackburn, VIC 3130",
815
+ name: "HQ US",
816
+ line1: "Main street",
817
+ line2: "apt #",
818
+ line3: "Suite #",
819
+ line4: "delivery instructions",
820
+ streetNumber: "25",
821
+ city: "San Francisco",
822
+ state: "CA",
823
+ postalCode: "94104",
824
+ country: "US",
825
+ latitude: "40.759211",
826
+ longitude: "-73.984638",
827
+ county: "Santa Clara",
828
+ contactName: "Elon Musk",
829
+ salutation: "Mr",
830
+ phoneNumber: "111-111-1111",
831
+ fax: "122-111-1111",
832
+ email: "elon@musk.com",
833
+ website: "https://elonmusk.com",
834
+ notes: "Address notes or delivery instructions.",
835
+ rowVersion: "1-12345",
836
+ },
837
+ },
838
+ companyId: "12345",
839
+ currency: "USD",
840
+ currencyRate: 0.69,
841
+ taxInclusive: true,
842
+ billDate: new RFCDate("2020-09-30"),
843
+ dueDate: new RFCDate("2020-10-30"),
844
+ paidDate: new RFCDate("2020-10-30"),
845
+ poNumber: "90000117",
846
+ reference: "123456",
847
+ lineItems: [
848
+ {
849
+ id: "12345",
850
+ rowId: "12345",
851
+ code: "120-C",
852
+ lineNumber: 1,
853
+ description:
854
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
855
+ type: "expense_account",
856
+ taxAmount: 27500,
857
+ totalAmount: 27500,
858
+ quantity: 1,
859
+ unitPrice: 27500.5,
860
+ unitOfMeasure: "pc.",
861
+ discountPercentage: 0.01,
862
+ discountAmount: 19.99,
863
+ locationId: "12345",
864
+ departmentId: "12345",
865
+ item: {
866
+ id: "12344",
867
+ code: "120-C",
868
+ name: "Model Y",
869
+ },
870
+ taxRate: {
871
+ id: "123456",
872
+ code: "N-T",
873
+ name: "GST on Purchases",
874
+ rate: 10,
875
+ },
876
+ ledgerAccount: {
877
+ id: "123456",
878
+ name: "Bank account",
879
+ nominalCode: "N091",
880
+ code: "453",
881
+ },
882
+ trackingCategories: [
883
+ {
884
+ id: "123456",
885
+ name: "New York",
886
+ },
887
+ {
888
+ id: "123456",
889
+ name: "New York",
890
+ },
891
+ ],
892
+ rowVersion: "1-12345",
893
+ updatedBy: "12345",
894
+ createdBy: "12345",
895
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
896
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
897
+ },
898
+ {
899
+ id: "12345",
900
+ rowId: "12345",
901
+ code: "120-C",
902
+ lineNumber: 1,
903
+ description:
904
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
905
+ type: "expense_account",
906
+ taxAmount: 27500,
907
+ totalAmount: 27500,
908
+ quantity: 1,
909
+ unitPrice: 27500.5,
910
+ unitOfMeasure: "pc.",
911
+ discountPercentage: 0.01,
912
+ discountAmount: 19.99,
913
+ locationId: "12345",
914
+ departmentId: "12345",
915
+ item: {
916
+ id: "12344",
917
+ code: "120-C",
918
+ name: "Model Y",
919
+ },
920
+ taxRate: {
921
+ id: "123456",
922
+ code: "N-T",
923
+ name: "GST on Purchases",
924
+ rate: 10,
925
+ },
926
+ ledgerAccount: {
927
+ id: "123456",
928
+ name: "Bank account",
929
+ nominalCode: "N091",
930
+ code: "453",
931
+ },
932
+ trackingCategories: [
933
+ {
934
+ id: "123456",
935
+ name: "New York",
936
+ },
937
+ {
938
+ id: "123456",
939
+ name: "New York",
940
+ },
941
+ ],
942
+ rowVersion: "1-12345",
943
+ updatedBy: "12345",
944
+ createdBy: "12345",
945
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
946
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
947
+ },
948
+ {
949
+ id: "12345",
950
+ rowId: "12345",
951
+ code: "120-C",
952
+ lineNumber: 1,
953
+ description:
954
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
955
+ type: "expense_account",
956
+ taxAmount: 27500,
957
+ totalAmount: 27500,
958
+ quantity: 1,
959
+ unitPrice: 27500.5,
960
+ unitOfMeasure: "pc.",
961
+ discountPercentage: 0.01,
962
+ discountAmount: 19.99,
963
+ locationId: "12345",
964
+ departmentId: "12345",
965
+ item: {
966
+ id: "12344",
967
+ code: "120-C",
968
+ name: "Model Y",
969
+ },
970
+ taxRate: {
971
+ id: "123456",
972
+ code: "N-T",
973
+ name: "GST on Purchases",
974
+ rate: 10,
975
+ },
976
+ ledgerAccount: {
977
+ id: "123456",
978
+ name: "Bank account",
979
+ nominalCode: "N091",
980
+ code: "453",
981
+ },
982
+ trackingCategories: [
983
+ {
984
+ id: "123456",
985
+ name: "New York",
986
+ },
987
+ {
988
+ id: "123456",
989
+ name: "New York",
990
+ },
991
+ ],
992
+ rowVersion: "1-12345",
993
+ updatedBy: "12345",
994
+ createdBy: "12345",
995
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
996
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
997
+ },
998
+ ],
999
+ terms: "Net 30 days",
1000
+ balance: 27500,
1001
+ deposit: 0,
1002
+ subTotal: 27500,
1003
+ totalTax: 2500,
1004
+ total: 27500,
1005
+ taxCode: "1234",
1006
+ notes: "Some notes about this bill.",
1007
+ status: "draft",
1008
+ ledgerAccount: {
1009
+ id: "123456",
1010
+ name: "Bank account",
1011
+ nominalCode: "N091",
1012
+ code: "453",
1013
+ },
1014
+ paymentMethod: "cash",
1015
+ channel: "email",
1016
+ language: "EN",
1017
+ accountingByRow: false,
1018
+ bankAccount: {
1019
+ bankName: "Monzo",
1020
+ accountNumber: "123465",
1021
+ accountName: "SPACEX LLC",
1022
+ accountType: "credit_card",
1023
+ iban: "CH2989144532982975332",
1024
+ bic: "AUDSCHGGXXX",
1025
+ routingNumber: "012345678",
1026
+ bsbNumber: "062-001",
1027
+ branchIdentifier: "001",
1028
+ bankCode: "BNH",
1029
+ currency: "USD",
1030
+ },
1031
+ discountPercentage: 5.5,
1032
+ sourceDocumentUrl: "https://www.invoicesolution.com/bill/123456",
1033
+ trackingCategories: [
1034
+ {
1035
+ id: "123456",
1036
+ name: "New York",
1037
+ },
1038
+ {
1039
+ id: "123456",
1040
+ name: "New York",
1041
+ },
1042
+ {
1043
+ id: "123456",
1044
+ name: "New York",
1045
+ },
1046
+ ],
1047
+ updatedBy: "12345",
1048
+ createdBy: "12345",
1049
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1050
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1051
+ rowVersion: "1-12345",
1052
+ customFields: [
1053
+ {
1054
+ id: "2389328923893298",
1055
+ name: "employee_level",
1056
+ description: "Employee Level",
1057
+ value: true,
1058
+ },
1059
+ {
1060
+ id: "2389328923893298",
1061
+ name: "employee_level",
1062
+ description: "Employee Level",
1063
+ value: 10,
1064
+ },
1065
+ ],
1066
+ passThrough: [
1067
+ {
1068
+ serviceId: "<id>",
1069
+ extendPaths: [
1070
+ {
1071
+ path: "$.nested.property",
1072
+ value: {
1073
+ "TaxClassificationRef": {
1074
+ "value": "EUC-99990201-V1-00020000",
1075
+ },
1076
+ },
1077
+ },
1078
+ {
1079
+ path: "$.nested.property",
1080
+ value: {
1081
+ "TaxClassificationRef": {
1082
+ "value": "EUC-99990201-V1-00020000",
1083
+ },
1084
+ },
1085
+ },
1086
+ {
1087
+ path: "$.nested.property",
1088
+ value: {
1089
+ "TaxClassificationRef": {
1090
+ "value": "EUC-99990201-V1-00020000",
1091
+ },
1092
+ },
1093
+ },
1094
+ ],
1095
+ },
1096
+ ],
1097
+ accountingPeriod: "01-24",
1098
+ },
1099
+ });
1100
+ });
1101
+
1102
+ it.skip("Bills Accounting Bills Update", async () => {
1103
+ assert.fail(
1104
+ "incomplete test found please make sure to address the following errors: [`workflow step accounting.billsUpdate.test referencing operation accounting.billsUpdate with expression in requestBody with type not currently supported`]",
1105
+ );
1106
+ });
1107
+
1108
+ test("Bills Accounting Bills Delete", async () => {
1109
+ const testHttpClient = createTestHTTPClient("accounting.billsDelete");
1110
+
1111
+ const apideck = new Apideck({
1112
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1113
+ httpClient: testHttpClient,
1114
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1115
+ });
1116
+
1117
+ const result = await apideck.accounting.bills.delete({
1118
+ id: "<id>",
1119
+ serviceId: "salesforce",
1120
+ });
1121
+ expect(result.httpMeta.response.status).toBe(200);
1122
+ expect(result.deleteBillResponse).toBeDefined();
1123
+ expect(result.deleteBillResponse).toEqual({
1124
+ statusCode: 200,
1125
+ status: "OK",
1126
+ service: "xero",
1127
+ resource: "bills",
1128
+ operation: "delete",
1129
+ data: {
1130
+ id: "12345",
1131
+ },
1132
+ });
1133
+ });