@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,1031 @@
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("Billpayments Accounting Bill Payments All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.billPaymentsAll");
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.billPayments.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ updatedSince: new Date("2020-09-30T07:43:32.000Z"),
24
+ },
25
+ sort: {
26
+ by: "updated_at",
27
+ direction: "desc",
28
+ },
29
+ passThrough: {
30
+ "search": "San Francisco",
31
+ },
32
+ fields: "id,updated_at",
33
+ });
34
+ expect(result.httpMeta.response.status).toBe(200);
35
+ expect(result.getBillPaymentsResponse).toBeDefined();
36
+ expect(result.getBillPaymentsResponse).toEqual({
37
+ statusCode: 200,
38
+ status: "OK",
39
+ service: "xero",
40
+ resource: "payments",
41
+ operation: "all",
42
+ data: [
43
+ {
44
+ id: "12345",
45
+ downstreamId: "12345",
46
+ currency: "USD",
47
+ currencyRate: 0.69,
48
+ totalAmount: 49.99,
49
+ reference: "123456",
50
+ paymentMethod: "cash",
51
+ paymentMethodReference: "123456",
52
+ paymentMethodId: "12345",
53
+ account: {
54
+ id: "123456",
55
+ name: "Bank account",
56
+ nominalCode: "N091",
57
+ code: "453",
58
+ },
59
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
60
+ supplier: {
61
+ id: "12345",
62
+ displayId: "SUPP00101",
63
+ displayName: "Windsurf Shop",
64
+ companyName: "The boring company",
65
+ address: {
66
+ id: "123",
67
+ type: "primary",
68
+ string: "25 Spring Street, Blackburn, VIC 3130",
69
+ name: "HQ US",
70
+ line1: "Main street",
71
+ line2: "apt #",
72
+ line3: "Suite #",
73
+ line4: "delivery instructions",
74
+ streetNumber: "25",
75
+ city: "San Francisco",
76
+ state: "CA",
77
+ postalCode: "94104",
78
+ country: "US",
79
+ latitude: "40.759211",
80
+ longitude: "-73.984638",
81
+ county: "Santa Clara",
82
+ contactName: "Elon Musk",
83
+ salutation: "Mr",
84
+ phoneNumber: "111-111-1111",
85
+ fax: "122-111-1111",
86
+ email: "elon@musk.com",
87
+ website: "https://elonmusk.com",
88
+ notes: "Address notes or delivery instructions.",
89
+ rowVersion: "1-12345",
90
+ },
91
+ },
92
+ companyId: "12345",
93
+ reconciled: true,
94
+ status: "authorised",
95
+ type: "accounts_payable",
96
+ allocations: [
97
+ {
98
+ id: "12345",
99
+ type: "bill",
100
+ code: "N091",
101
+ amount: 49.99,
102
+ allocationId: "123456",
103
+ },
104
+ {
105
+ id: "12345",
106
+ type: "bill",
107
+ code: "N091",
108
+ amount: 49.99,
109
+ allocationId: "123456",
110
+ },
111
+ ],
112
+ note: "Some notes about this transaction",
113
+ number: "123456",
114
+ trackingCategories: [
115
+ {
116
+ id: "123456",
117
+ name: "New York",
118
+ },
119
+ {
120
+ id: "123456",
121
+ name: "New York",
122
+ },
123
+ {
124
+ id: "123456",
125
+ name: "New York",
126
+ },
127
+ ],
128
+ customFields: [
129
+ {
130
+ id: "2389328923893298",
131
+ name: "employee_level",
132
+ description: "Employee Level",
133
+ value: 10,
134
+ },
135
+ ],
136
+ rowVersion: "1-12345",
137
+ displayId: "123456",
138
+ updatedBy: "12345",
139
+ createdBy: "12345",
140
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
141
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
142
+ passThrough: [
143
+ {
144
+ serviceId: "<id>",
145
+ extendPaths: [
146
+ {
147
+ path: "$.nested.property",
148
+ value: {
149
+ "TaxClassificationRef": {
150
+ "value": "EUC-99990201-V1-00020000",
151
+ },
152
+ },
153
+ },
154
+ {
155
+ path: "$.nested.property",
156
+ value: {
157
+ "TaxClassificationRef": {
158
+ "value": "EUC-99990201-V1-00020000",
159
+ },
160
+ },
161
+ },
162
+ ],
163
+ },
164
+ ],
165
+ },
166
+ {
167
+ id: "12345",
168
+ downstreamId: "12345",
169
+ currency: "USD",
170
+ currencyRate: 0.69,
171
+ totalAmount: 49.99,
172
+ reference: "123456",
173
+ paymentMethod: "cash",
174
+ paymentMethodReference: "123456",
175
+ paymentMethodId: "12345",
176
+ account: {
177
+ id: "123456",
178
+ name: "Bank account",
179
+ nominalCode: "N091",
180
+ code: "453",
181
+ },
182
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
183
+ supplier: {
184
+ id: "12345",
185
+ displayId: "SUPP00101",
186
+ displayName: "Windsurf Shop",
187
+ companyName: "The boring company",
188
+ address: {
189
+ id: "123",
190
+ type: "primary",
191
+ string: "25 Spring Street, Blackburn, VIC 3130",
192
+ name: "HQ US",
193
+ line1: "Main street",
194
+ line2: "apt #",
195
+ line3: "Suite #",
196
+ line4: "delivery instructions",
197
+ streetNumber: "25",
198
+ city: "San Francisco",
199
+ state: "CA",
200
+ postalCode: "94104",
201
+ country: "US",
202
+ latitude: "40.759211",
203
+ longitude: "-73.984638",
204
+ county: "Santa Clara",
205
+ contactName: "Elon Musk",
206
+ salutation: "Mr",
207
+ phoneNumber: "111-111-1111",
208
+ fax: "122-111-1111",
209
+ email: "elon@musk.com",
210
+ website: "https://elonmusk.com",
211
+ notes: "Address notes or delivery instructions.",
212
+ rowVersion: "1-12345",
213
+ },
214
+ },
215
+ companyId: "12345",
216
+ reconciled: true,
217
+ status: "authorised",
218
+ type: "accounts_payable",
219
+ allocations: [
220
+ {
221
+ id: "12345",
222
+ type: "bill",
223
+ code: "N091",
224
+ amount: 49.99,
225
+ allocationId: "123456",
226
+ },
227
+ {
228
+ id: "12345",
229
+ type: "bill",
230
+ code: "N091",
231
+ amount: 49.99,
232
+ allocationId: "123456",
233
+ },
234
+ ],
235
+ note: "Some notes about this transaction",
236
+ number: "123456",
237
+ trackingCategories: [
238
+ {
239
+ id: "123456",
240
+ name: "New York",
241
+ },
242
+ ],
243
+ customFields: [
244
+ {
245
+ id: "2389328923893298",
246
+ name: "employee_level",
247
+ description: "Employee Level",
248
+ value: "Uses Salesforce and Marketo",
249
+ },
250
+ {
251
+ id: "2389328923893298",
252
+ name: "employee_level",
253
+ description: "Employee Level",
254
+ value: "Uses Salesforce and Marketo",
255
+ },
256
+ {
257
+ id: "2389328923893298",
258
+ name: "employee_level",
259
+ description: "Employee Level",
260
+ value: {
261
+ "0": "<value>",
262
+ "1": "<value>",
263
+ },
264
+ },
265
+ ],
266
+ rowVersion: "1-12345",
267
+ displayId: "123456",
268
+ updatedBy: "12345",
269
+ createdBy: "12345",
270
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
271
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
272
+ passThrough: [
273
+ {
274
+ serviceId: "<id>",
275
+ extendPaths: [
276
+ {
277
+ path: "$.nested.property",
278
+ value: {
279
+ "TaxClassificationRef": {
280
+ "value": "EUC-99990201-V1-00020000",
281
+ },
282
+ },
283
+ },
284
+ ],
285
+ },
286
+ {
287
+ serviceId: "<id>",
288
+ extendPaths: [
289
+ {
290
+ path: "$.nested.property",
291
+ value: {
292
+ "TaxClassificationRef": {
293
+ "value": "EUC-99990201-V1-00020000",
294
+ },
295
+ },
296
+ },
297
+ ],
298
+ },
299
+ ],
300
+ },
301
+ {
302
+ id: "12345",
303
+ downstreamId: "12345",
304
+ currency: "USD",
305
+ currencyRate: 0.69,
306
+ totalAmount: 49.99,
307
+ reference: "123456",
308
+ paymentMethod: "cash",
309
+ paymentMethodReference: "123456",
310
+ paymentMethodId: "12345",
311
+ account: {
312
+ id: "123456",
313
+ name: "Bank account",
314
+ nominalCode: "N091",
315
+ code: "453",
316
+ },
317
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
318
+ supplier: {
319
+ id: "12345",
320
+ displayId: "SUPP00101",
321
+ displayName: "Windsurf Shop",
322
+ companyName: "The boring company",
323
+ address: {
324
+ id: "123",
325
+ type: "primary",
326
+ string: "25 Spring Street, Blackburn, VIC 3130",
327
+ name: "HQ US",
328
+ line1: "Main street",
329
+ line2: "apt #",
330
+ line3: "Suite #",
331
+ line4: "delivery instructions",
332
+ streetNumber: "25",
333
+ city: "San Francisco",
334
+ state: "CA",
335
+ postalCode: "94104",
336
+ country: "US",
337
+ latitude: "40.759211",
338
+ longitude: "-73.984638",
339
+ county: "Santa Clara",
340
+ contactName: "Elon Musk",
341
+ salutation: "Mr",
342
+ phoneNumber: "111-111-1111",
343
+ fax: "122-111-1111",
344
+ email: "elon@musk.com",
345
+ website: "https://elonmusk.com",
346
+ notes: "Address notes or delivery instructions.",
347
+ rowVersion: "1-12345",
348
+ },
349
+ },
350
+ companyId: "12345",
351
+ reconciled: true,
352
+ status: "authorised",
353
+ type: "accounts_payable",
354
+ allocations: [
355
+ {
356
+ id: "12345",
357
+ type: "bill",
358
+ code: "N091",
359
+ amount: 49.99,
360
+ allocationId: "123456",
361
+ },
362
+ {
363
+ id: "12345",
364
+ type: "bill",
365
+ code: "N091",
366
+ amount: 49.99,
367
+ allocationId: "123456",
368
+ },
369
+ ],
370
+ note: "Some notes about this transaction",
371
+ number: "123456",
372
+ trackingCategories: [
373
+ {
374
+ id: "123456",
375
+ name: "New York",
376
+ },
377
+ {
378
+ id: "123456",
379
+ name: "New York",
380
+ },
381
+ ],
382
+ customFields: [
383
+ {
384
+ id: "2389328923893298",
385
+ name: "employee_level",
386
+ description: "Employee Level",
387
+ value: {
388
+ "0": {},
389
+ "1": {},
390
+ },
391
+ },
392
+ ],
393
+ rowVersion: "1-12345",
394
+ displayId: "123456",
395
+ updatedBy: "12345",
396
+ createdBy: "12345",
397
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
398
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
399
+ passThrough: [
400
+ {
401
+ serviceId: "<id>",
402
+ extendPaths: [
403
+ {
404
+ path: "$.nested.property",
405
+ value: {
406
+ "TaxClassificationRef": {
407
+ "value": "EUC-99990201-V1-00020000",
408
+ },
409
+ },
410
+ },
411
+ {
412
+ path: "$.nested.property",
413
+ value: {
414
+ "TaxClassificationRef": {
415
+ "value": "EUC-99990201-V1-00020000",
416
+ },
417
+ },
418
+ },
419
+ ],
420
+ },
421
+ {
422
+ serviceId: "<id>",
423
+ extendPaths: [
424
+ {
425
+ path: "$.nested.property",
426
+ value: {
427
+ "TaxClassificationRef": {
428
+ "value": "EUC-99990201-V1-00020000",
429
+ },
430
+ },
431
+ },
432
+ ],
433
+ },
434
+ {
435
+ serviceId: "<id>",
436
+ extendPaths: [
437
+ {
438
+ path: "$.nested.property",
439
+ value: {
440
+ "TaxClassificationRef": {
441
+ "value": "EUC-99990201-V1-00020000",
442
+ },
443
+ },
444
+ },
445
+ ],
446
+ },
447
+ ],
448
+ },
449
+ ],
450
+ meta: {
451
+ itemsOnPage: 50,
452
+ cursors: {
453
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
454
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
455
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
456
+ },
457
+ },
458
+ links: {
459
+ previous:
460
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
461
+ current: "https://unify.apideck.com/crm/companies",
462
+ next:
463
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
464
+ },
465
+ });
466
+ });
467
+
468
+ test("Billpayments Accounting Bill Payments Add", async () => {
469
+ const testHttpClient = createTestHTTPClient("accounting.billPaymentsAdd");
470
+
471
+ const apideck = new Apideck({
472
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
473
+ httpClient: testHttpClient,
474
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
475
+ });
476
+
477
+ const result = await apideck.accounting.billPayments.create({
478
+ consumerId: "test-consumer",
479
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
480
+ serviceId: "salesforce",
481
+ billPayment: {
482
+ currency: "USD",
483
+ currencyRate: 0.69,
484
+ totalAmount: 49.99,
485
+ reference: "123456",
486
+ paymentMethod: "cash",
487
+ paymentMethodReference: "123456",
488
+ paymentMethodId: "12345",
489
+ account: {
490
+ id: "123456",
491
+ nominalCode: "N091",
492
+ code: "453",
493
+ },
494
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
495
+ supplier: {
496
+ id: "12345",
497
+ displayName: "Windsurf Shop",
498
+ address: {
499
+ id: "123",
500
+ type: "primary",
501
+ string: "25 Spring Street, Blackburn, VIC 3130",
502
+ name: "HQ US",
503
+ line1: "Main street",
504
+ line2: "apt #",
505
+ line3: "Suite #",
506
+ line4: "delivery instructions",
507
+ streetNumber: "25",
508
+ city: "San Francisco",
509
+ state: "CA",
510
+ postalCode: "94104",
511
+ country: "US",
512
+ latitude: "40.759211",
513
+ longitude: "-73.984638",
514
+ county: "Santa Clara",
515
+ contactName: "Elon Musk",
516
+ salutation: "Mr",
517
+ phoneNumber: "111-111-1111",
518
+ fax: "122-111-1111",
519
+ email: "elon@musk.com",
520
+ website: "https://elonmusk.com",
521
+ notes: "Address notes or delivery instructions.",
522
+ rowVersion: "1-12345",
523
+ },
524
+ },
525
+ companyId: "12345",
526
+ reconciled: true,
527
+ status: "authorised",
528
+ type: "accounts_payable",
529
+ allocations: [
530
+ {
531
+ id: "12345",
532
+ type: "bill",
533
+ amount: 49.99,
534
+ allocationId: "123456",
535
+ },
536
+ {
537
+ id: "12345",
538
+ type: "bill",
539
+ amount: 49.99,
540
+ allocationId: "123456",
541
+ },
542
+ ],
543
+ note: "Some notes about this transaction",
544
+ number: "123456",
545
+ trackingCategories: [
546
+ {
547
+ id: "123456",
548
+ name: "New York",
549
+ },
550
+ {
551
+ id: "123456",
552
+ name: "New York",
553
+ },
554
+ ],
555
+ customFields: [
556
+ {
557
+ id: "2389328923893298",
558
+ name: "employee_level",
559
+ description: "Employee Level",
560
+ value: "Uses Salesforce and Marketo",
561
+ },
562
+ {
563
+ id: "2389328923893298",
564
+ name: "employee_level",
565
+ description: "Employee Level",
566
+ value: "Uses Salesforce and Marketo",
567
+ },
568
+ ],
569
+ rowVersion: "1-12345",
570
+ displayId: "123456",
571
+ passThrough: [
572
+ {
573
+ serviceId: "<id>",
574
+ extendPaths: [
575
+ {
576
+ path: "$.nested.property",
577
+ value: {
578
+ "TaxClassificationRef": {
579
+ "value": "EUC-99990201-V1-00020000",
580
+ },
581
+ },
582
+ },
583
+ {
584
+ path: "$.nested.property",
585
+ value: {
586
+ "TaxClassificationRef": {
587
+ "value": "EUC-99990201-V1-00020000",
588
+ },
589
+ },
590
+ },
591
+ {
592
+ path: "$.nested.property",
593
+ value: {
594
+ "TaxClassificationRef": {
595
+ "value": "EUC-99990201-V1-00020000",
596
+ },
597
+ },
598
+ },
599
+ ],
600
+ },
601
+ {
602
+ serviceId: "<id>",
603
+ extendPaths: [
604
+ {
605
+ path: "$.nested.property",
606
+ value: {
607
+ "TaxClassificationRef": {
608
+ "value": "EUC-99990201-V1-00020000",
609
+ },
610
+ },
611
+ },
612
+ ],
613
+ },
614
+ {
615
+ serviceId: "<id>",
616
+ extendPaths: [
617
+ {
618
+ path: "$.nested.property",
619
+ value: {
620
+ "TaxClassificationRef": {
621
+ "value": "EUC-99990201-V1-00020000",
622
+ },
623
+ },
624
+ },
625
+ ],
626
+ },
627
+ ],
628
+ },
629
+ });
630
+ expect(result.httpMeta.response.status).toBe(201);
631
+ expect(result.createBillPaymentResponse).toBeDefined();
632
+ expect(result.createBillPaymentResponse).toEqual({
633
+ statusCode: 200,
634
+ status: "OK",
635
+ service: "xero",
636
+ resource: "payments",
637
+ operation: "add",
638
+ data: {
639
+ id: "12345",
640
+ },
641
+ });
642
+ });
643
+
644
+ test("Billpayments Accounting Bill Payments One", async () => {
645
+ const testHttpClient = createTestHTTPClient("accounting.billPaymentsOne");
646
+
647
+ const apideck = new Apideck({
648
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
649
+ httpClient: testHttpClient,
650
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
651
+ });
652
+
653
+ const result = await apideck.accounting.billPayments.get({
654
+ id: "<id>",
655
+ consumerId: "test-consumer",
656
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
657
+ serviceId: "salesforce",
658
+ fields: "id,updated_at",
659
+ });
660
+ expect(result.httpMeta.response.status).toBe(200);
661
+ expect(result.getBillPaymentResponse).toBeDefined();
662
+ expect(result.getBillPaymentResponse).toEqual({
663
+ statusCode: 200,
664
+ status: "OK",
665
+ service: "xero",
666
+ resource: "payments",
667
+ operation: "one",
668
+ data: {
669
+ id: "12345",
670
+ downstreamId: "12345",
671
+ currency: "USD",
672
+ currencyRate: 0.69,
673
+ totalAmount: 49.99,
674
+ reference: "123456",
675
+ paymentMethod: "cash",
676
+ paymentMethodReference: "123456",
677
+ paymentMethodId: "12345",
678
+ account: {
679
+ id: "123456",
680
+ name: "Bank account",
681
+ nominalCode: "N091",
682
+ code: "453",
683
+ },
684
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
685
+ supplier: {
686
+ id: "12345",
687
+ displayId: "SUPP00101",
688
+ displayName: "Windsurf Shop",
689
+ companyName: "The boring company",
690
+ address: {
691
+ id: "123",
692
+ type: "primary",
693
+ string: "25 Spring Street, Blackburn, VIC 3130",
694
+ name: "HQ US",
695
+ line1: "Main street",
696
+ line2: "apt #",
697
+ line3: "Suite #",
698
+ line4: "delivery instructions",
699
+ streetNumber: "25",
700
+ city: "San Francisco",
701
+ state: "CA",
702
+ postalCode: "94104",
703
+ country: "US",
704
+ latitude: "40.759211",
705
+ longitude: "-73.984638",
706
+ county: "Santa Clara",
707
+ contactName: "Elon Musk",
708
+ salutation: "Mr",
709
+ phoneNumber: "111-111-1111",
710
+ fax: "122-111-1111",
711
+ email: "elon@musk.com",
712
+ website: "https://elonmusk.com",
713
+ notes: "Address notes or delivery instructions.",
714
+ rowVersion: "1-12345",
715
+ },
716
+ },
717
+ companyId: "12345",
718
+ reconciled: true,
719
+ status: "authorised",
720
+ type: "accounts_payable",
721
+ allocations: [
722
+ {
723
+ id: "12345",
724
+ type: "bill",
725
+ code: "N091",
726
+ amount: 49.99,
727
+ allocationId: "123456",
728
+ },
729
+ {
730
+ id: "12345",
731
+ type: "bill",
732
+ code: "N091",
733
+ amount: 49.99,
734
+ allocationId: "123456",
735
+ },
736
+ {
737
+ id: "12345",
738
+ type: "bill",
739
+ code: "N091",
740
+ amount: 49.99,
741
+ allocationId: "123456",
742
+ },
743
+ ],
744
+ note: "Some notes about this transaction",
745
+ number: "123456",
746
+ trackingCategories: [
747
+ {
748
+ id: "123456",
749
+ name: "New York",
750
+ },
751
+ {
752
+ id: "123456",
753
+ name: "New York",
754
+ },
755
+ ],
756
+ customFields: [
757
+ {
758
+ id: "2389328923893298",
759
+ name: "employee_level",
760
+ description: "Employee Level",
761
+ value: {},
762
+ },
763
+ {
764
+ id: "2389328923893298",
765
+ name: "employee_level",
766
+ description: "Employee Level",
767
+ value: {
768
+ "0": {},
769
+ },
770
+ },
771
+ ],
772
+ rowVersion: "1-12345",
773
+ displayId: "123456",
774
+ updatedBy: "12345",
775
+ createdBy: "12345",
776
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
777
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
778
+ passThrough: [
779
+ {
780
+ serviceId: "<id>",
781
+ extendPaths: [
782
+ {
783
+ path: "$.nested.property",
784
+ value: {
785
+ "TaxClassificationRef": {
786
+ "value": "EUC-99990201-V1-00020000",
787
+ },
788
+ },
789
+ },
790
+ ],
791
+ },
792
+ {
793
+ serviceId: "<id>",
794
+ extendPaths: [
795
+ {
796
+ path: "$.nested.property",
797
+ value: {
798
+ "TaxClassificationRef": {
799
+ "value": "EUC-99990201-V1-00020000",
800
+ },
801
+ },
802
+ },
803
+ ],
804
+ },
805
+ ],
806
+ },
807
+ });
808
+ });
809
+
810
+ test("Billpayments Accounting Bill Payments Update", async () => {
811
+ const testHttpClient = createTestHTTPClient("accounting.billPaymentsUpdate");
812
+
813
+ const apideck = new Apideck({
814
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
815
+ httpClient: testHttpClient,
816
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
817
+ });
818
+
819
+ const result = await apideck.accounting.billPayments.update({
820
+ id: "<id>",
821
+ consumerId: "test-consumer",
822
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
823
+ serviceId: "salesforce",
824
+ billPayment: {
825
+ currency: "USD",
826
+ currencyRate: 0.69,
827
+ totalAmount: 49.99,
828
+ reference: "123456",
829
+ paymentMethod: "cash",
830
+ paymentMethodReference: "123456",
831
+ paymentMethodId: "12345",
832
+ account: {
833
+ id: "123456",
834
+ nominalCode: "N091",
835
+ code: "453",
836
+ },
837
+ transactionDate: new Date("2021-05-01T12:00:00.000Z"),
838
+ supplier: {
839
+ id: "12345",
840
+ displayName: "Windsurf Shop",
841
+ address: {
842
+ id: "123",
843
+ type: "primary",
844
+ string: "25 Spring Street, Blackburn, VIC 3130",
845
+ name: "HQ US",
846
+ line1: "Main street",
847
+ line2: "apt #",
848
+ line3: "Suite #",
849
+ line4: "delivery instructions",
850
+ streetNumber: "25",
851
+ city: "San Francisco",
852
+ state: "CA",
853
+ postalCode: "94104",
854
+ country: "US",
855
+ latitude: "40.759211",
856
+ longitude: "-73.984638",
857
+ county: "Santa Clara",
858
+ contactName: "Elon Musk",
859
+ salutation: "Mr",
860
+ phoneNumber: "111-111-1111",
861
+ fax: "122-111-1111",
862
+ email: "elon@musk.com",
863
+ website: "https://elonmusk.com",
864
+ notes: "Address notes or delivery instructions.",
865
+ rowVersion: "1-12345",
866
+ },
867
+ },
868
+ companyId: "12345",
869
+ reconciled: true,
870
+ status: "authorised",
871
+ type: "accounts_payable",
872
+ allocations: [
873
+ {
874
+ id: "12345",
875
+ type: "bill",
876
+ amount: 49.99,
877
+ allocationId: "123456",
878
+ },
879
+ {
880
+ id: "12345",
881
+ type: "bill",
882
+ amount: 49.99,
883
+ allocationId: "123456",
884
+ },
885
+ {
886
+ id: "12345",
887
+ type: "bill",
888
+ amount: 49.99,
889
+ allocationId: "123456",
890
+ },
891
+ ],
892
+ note: "Some notes about this transaction",
893
+ number: "123456",
894
+ trackingCategories: [
895
+ {
896
+ id: "123456",
897
+ name: "New York",
898
+ },
899
+ {
900
+ id: "123456",
901
+ name: "New York",
902
+ },
903
+ ],
904
+ customFields: [
905
+ {
906
+ id: "2389328923893298",
907
+ name: "employee_level",
908
+ description: "Employee Level",
909
+ value: {
910
+ "0": {},
911
+ "1": {},
912
+ },
913
+ },
914
+ {
915
+ id: "2389328923893298",
916
+ name: "employee_level",
917
+ description: "Employee Level",
918
+ value: true,
919
+ },
920
+ ],
921
+ rowVersion: "1-12345",
922
+ displayId: "123456",
923
+ passThrough: [
924
+ {
925
+ serviceId: "<id>",
926
+ extendPaths: [
927
+ {
928
+ path: "$.nested.property",
929
+ value: {
930
+ "TaxClassificationRef": {
931
+ "value": "EUC-99990201-V1-00020000",
932
+ },
933
+ },
934
+ },
935
+ ],
936
+ },
937
+ {
938
+ serviceId: "<id>",
939
+ extendPaths: [
940
+ {
941
+ path: "$.nested.property",
942
+ value: {
943
+ "TaxClassificationRef": {
944
+ "value": "EUC-99990201-V1-00020000",
945
+ },
946
+ },
947
+ },
948
+ {
949
+ path: "$.nested.property",
950
+ value: {
951
+ "TaxClassificationRef": {
952
+ "value": "EUC-99990201-V1-00020000",
953
+ },
954
+ },
955
+ },
956
+ {
957
+ path: "$.nested.property",
958
+ value: {
959
+ "TaxClassificationRef": {
960
+ "value": "EUC-99990201-V1-00020000",
961
+ },
962
+ },
963
+ },
964
+ ],
965
+ },
966
+ {
967
+ serviceId: "<id>",
968
+ extendPaths: [
969
+ {
970
+ path: "$.nested.property",
971
+ value: {
972
+ "TaxClassificationRef": {
973
+ "value": "EUC-99990201-V1-00020000",
974
+ },
975
+ },
976
+ },
977
+ {
978
+ path: "$.nested.property",
979
+ value: {
980
+ "TaxClassificationRef": {
981
+ "value": "EUC-99990201-V1-00020000",
982
+ },
983
+ },
984
+ },
985
+ ],
986
+ },
987
+ ],
988
+ },
989
+ });
990
+ expect(result.httpMeta.response.status).toBe(200);
991
+ expect(result.updateBillPaymentResponse).toBeDefined();
992
+ expect(result.updateBillPaymentResponse).toEqual({
993
+ statusCode: 200,
994
+ status: "OK",
995
+ service: "xero",
996
+ resource: "payments",
997
+ operation: "update",
998
+ data: {
999
+ id: "12345",
1000
+ },
1001
+ });
1002
+ });
1003
+
1004
+ test("Billpayments Accounting Bill Payments Delete", async () => {
1005
+ const testHttpClient = createTestHTTPClient("accounting.billPaymentsDelete");
1006
+
1007
+ const apideck = new Apideck({
1008
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1009
+ httpClient: testHttpClient,
1010
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1011
+ });
1012
+
1013
+ const result = await apideck.accounting.billPayments.delete({
1014
+ id: "<id>",
1015
+ consumerId: "test-consumer",
1016
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1017
+ serviceId: "salesforce",
1018
+ });
1019
+ expect(result.httpMeta.response.status).toBe(200);
1020
+ expect(result.deleteBillPaymentResponse).toBeDefined();
1021
+ expect(result.deleteBillPaymentResponse).toEqual({
1022
+ statusCode: 200,
1023
+ status: "OK",
1024
+ service: "xero",
1025
+ resource: "payments",
1026
+ operation: "delete",
1027
+ data: {
1028
+ id: "12345",
1029
+ },
1030
+ });
1031
+ });