@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,1574 @@
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("Suppliers Accounting Suppliers All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.suppliersAll");
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.suppliers.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ companyName: "SpaceX",
24
+ displayName: "Elon Musk",
25
+ firstName: "Elon",
26
+ lastName: "Musk",
27
+ email: "elon@musk.com",
28
+ updatedSince: new Date("2020-09-30T07:43:32.000Z"),
29
+ },
30
+ sort: {
31
+ by: "updated_at",
32
+ direction: "desc",
33
+ },
34
+ passThrough: {
35
+ "search": "San Francisco",
36
+ },
37
+ fields: "id,updated_at",
38
+ });
39
+ expect(result.httpMeta.response.status).toBe(200);
40
+ expect(result.getSuppliersResponse).toBeDefined();
41
+ expect(result.getSuppliersResponse).toEqual({
42
+ statusCode: 200,
43
+ status: "OK",
44
+ service: "xero",
45
+ resource: "suppliers",
46
+ operation: "all",
47
+ data: [
48
+ {
49
+ id: "12345",
50
+ downstreamId: "12345",
51
+ displayId: "EMP00101",
52
+ displayName: "Windsurf Shop",
53
+ companyName: "SpaceX",
54
+ companyId: "12345",
55
+ title: "CEO",
56
+ firstName: "Elon",
57
+ middleName: "D.",
58
+ lastName: "Musk",
59
+ suffix: "Jr.",
60
+ individual: true,
61
+ addresses: [
62
+ {
63
+ id: "123",
64
+ type: "primary",
65
+ string: "25 Spring Street, Blackburn, VIC 3130",
66
+ name: "HQ US",
67
+ line1: "Main street",
68
+ line2: "apt #",
69
+ line3: "Suite #",
70
+ line4: "delivery instructions",
71
+ streetNumber: "25",
72
+ city: "San Francisco",
73
+ state: "CA",
74
+ postalCode: "94104",
75
+ country: "US",
76
+ latitude: "40.759211",
77
+ longitude: "-73.984638",
78
+ county: "Santa Clara",
79
+ contactName: "Elon Musk",
80
+ salutation: "Mr",
81
+ phoneNumber: "111-111-1111",
82
+ fax: "122-111-1111",
83
+ email: "elon@musk.com",
84
+ website: "https://elonmusk.com",
85
+ notes: "Address notes or delivery instructions.",
86
+ rowVersion: "1-12345",
87
+ },
88
+ {
89
+ id: "123",
90
+ type: "primary",
91
+ string: "25 Spring Street, Blackburn, VIC 3130",
92
+ name: "HQ US",
93
+ line1: "Main street",
94
+ line2: "apt #",
95
+ line3: "Suite #",
96
+ line4: "delivery instructions",
97
+ streetNumber: "25",
98
+ city: "San Francisco",
99
+ state: "CA",
100
+ postalCode: "94104",
101
+ country: "US",
102
+ latitude: "40.759211",
103
+ longitude: "-73.984638",
104
+ county: "Santa Clara",
105
+ contactName: "Elon Musk",
106
+ salutation: "Mr",
107
+ phoneNumber: "111-111-1111",
108
+ fax: "122-111-1111",
109
+ email: "elon@musk.com",
110
+ website: "https://elonmusk.com",
111
+ notes: "Address notes or delivery instructions.",
112
+ rowVersion: "1-12345",
113
+ },
114
+ ],
115
+ phoneNumbers: [
116
+ {
117
+ id: "12345",
118
+ countryCode: "1",
119
+ areaCode: "323",
120
+ number: "111-111-1111",
121
+ extension: "105",
122
+ type: "primary",
123
+ },
124
+ {
125
+ id: "12345",
126
+ countryCode: "1",
127
+ areaCode: "323",
128
+ number: "111-111-1111",
129
+ extension: "105",
130
+ type: "primary",
131
+ },
132
+ {
133
+ id: "12345",
134
+ countryCode: "1",
135
+ areaCode: "323",
136
+ number: "111-111-1111",
137
+ extension: "105",
138
+ type: "primary",
139
+ },
140
+ ],
141
+ emails: [
142
+ {
143
+ id: "123",
144
+ email: "elon@musk.com",
145
+ type: "primary",
146
+ },
147
+ ],
148
+ websites: [
149
+ {
150
+ id: "12345",
151
+ url: "http://example.com",
152
+ type: "primary",
153
+ },
154
+ ],
155
+ bankAccounts: [
156
+ {
157
+ bankName: "Monzo",
158
+ accountNumber: "123465",
159
+ accountName: "SPACEX LLC",
160
+ accountType: "credit_card",
161
+ iban: "CH2989144532982975332",
162
+ bic: "AUDSCHGGXXX",
163
+ routingNumber: "012345678",
164
+ bsbNumber: "062-001",
165
+ branchIdentifier: "001",
166
+ bankCode: "BNH",
167
+ currency: "USD",
168
+ },
169
+ ],
170
+ notes: "Some notes about this supplier",
171
+ taxRate: {
172
+ id: "123456",
173
+ code: "N-T",
174
+ name: "GST on Purchases",
175
+ rate: 10,
176
+ },
177
+ taxNumber: "US123945459",
178
+ currency: "USD",
179
+ account: {
180
+ id: "123456",
181
+ name: "Bank account",
182
+ nominalCode: "N091",
183
+ code: "453",
184
+ },
185
+ status: "active",
186
+ paymentMethod: "cash",
187
+ channel: "email",
188
+ customFields: [
189
+ {
190
+ id: "2389328923893298",
191
+ name: "employee_level",
192
+ description: "Employee Level",
193
+ value: {},
194
+ },
195
+ {
196
+ id: "2389328923893298",
197
+ name: "employee_level",
198
+ description: "Employee Level",
199
+ value: "Uses Salesforce and Marketo",
200
+ },
201
+ ],
202
+ updatedBy: "12345",
203
+ createdBy: "12345",
204
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
205
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
206
+ rowVersion: "1-12345",
207
+ passThrough: [
208
+ {
209
+ serviceId: "<id>",
210
+ extendPaths: [
211
+ {
212
+ path: "$.nested.property",
213
+ value: {
214
+ "TaxClassificationRef": {
215
+ "value": "EUC-99990201-V1-00020000",
216
+ },
217
+ },
218
+ },
219
+ ],
220
+ },
221
+ {
222
+ serviceId: "<id>",
223
+ extendPaths: [
224
+ {
225
+ path: "$.nested.property",
226
+ value: {
227
+ "TaxClassificationRef": {
228
+ "value": "EUC-99990201-V1-00020000",
229
+ },
230
+ },
231
+ },
232
+ ],
233
+ },
234
+ {
235
+ serviceId: "<id>",
236
+ extendPaths: [
237
+ {
238
+ path: "$.nested.property",
239
+ value: {
240
+ "TaxClassificationRef": {
241
+ "value": "EUC-99990201-V1-00020000",
242
+ },
243
+ },
244
+ },
245
+ {
246
+ path: "$.nested.property",
247
+ value: {
248
+ "TaxClassificationRef": {
249
+ "value": "EUC-99990201-V1-00020000",
250
+ },
251
+ },
252
+ },
253
+ {
254
+ path: "$.nested.property",
255
+ value: {
256
+ "TaxClassificationRef": {
257
+ "value": "EUC-99990201-V1-00020000",
258
+ },
259
+ },
260
+ },
261
+ ],
262
+ },
263
+ ],
264
+ subsidiaryId: "12345",
265
+ },
266
+ {
267
+ id: "12345",
268
+ downstreamId: "12345",
269
+ displayId: "EMP00101",
270
+ displayName: "Windsurf Shop",
271
+ companyName: "SpaceX",
272
+ companyId: "12345",
273
+ title: "CEO",
274
+ firstName: "Elon",
275
+ middleName: "D.",
276
+ lastName: "Musk",
277
+ suffix: "Jr.",
278
+ individual: true,
279
+ addresses: [
280
+ {
281
+ id: "123",
282
+ type: "primary",
283
+ string: "25 Spring Street, Blackburn, VIC 3130",
284
+ name: "HQ US",
285
+ line1: "Main street",
286
+ line2: "apt #",
287
+ line3: "Suite #",
288
+ line4: "delivery instructions",
289
+ streetNumber: "25",
290
+ city: "San Francisco",
291
+ state: "CA",
292
+ postalCode: "94104",
293
+ country: "US",
294
+ latitude: "40.759211",
295
+ longitude: "-73.984638",
296
+ county: "Santa Clara",
297
+ contactName: "Elon Musk",
298
+ salutation: "Mr",
299
+ phoneNumber: "111-111-1111",
300
+ fax: "122-111-1111",
301
+ email: "elon@musk.com",
302
+ website: "https://elonmusk.com",
303
+ notes: "Address notes or delivery instructions.",
304
+ rowVersion: "1-12345",
305
+ },
306
+ {
307
+ id: "123",
308
+ type: "primary",
309
+ string: "25 Spring Street, Blackburn, VIC 3130",
310
+ name: "HQ US",
311
+ line1: "Main street",
312
+ line2: "apt #",
313
+ line3: "Suite #",
314
+ line4: "delivery instructions",
315
+ streetNumber: "25",
316
+ city: "San Francisco",
317
+ state: "CA",
318
+ postalCode: "94104",
319
+ country: "US",
320
+ latitude: "40.759211",
321
+ longitude: "-73.984638",
322
+ county: "Santa Clara",
323
+ contactName: "Elon Musk",
324
+ salutation: "Mr",
325
+ phoneNumber: "111-111-1111",
326
+ fax: "122-111-1111",
327
+ email: "elon@musk.com",
328
+ website: "https://elonmusk.com",
329
+ notes: "Address notes or delivery instructions.",
330
+ rowVersion: "1-12345",
331
+ },
332
+ ],
333
+ phoneNumbers: [
334
+ {
335
+ id: "12345",
336
+ countryCode: "1",
337
+ areaCode: "323",
338
+ number: "111-111-1111",
339
+ extension: "105",
340
+ type: "primary",
341
+ },
342
+ {
343
+ id: "12345",
344
+ countryCode: "1",
345
+ areaCode: "323",
346
+ number: "111-111-1111",
347
+ extension: "105",
348
+ type: "primary",
349
+ },
350
+ ],
351
+ emails: [
352
+ {
353
+ id: "123",
354
+ email: "elon@musk.com",
355
+ type: "primary",
356
+ },
357
+ ],
358
+ websites: [
359
+ {
360
+ id: "12345",
361
+ url: "http://example.com",
362
+ type: "primary",
363
+ },
364
+ ],
365
+ bankAccounts: [
366
+ {
367
+ bankName: "Monzo",
368
+ accountNumber: "123465",
369
+ accountName: "SPACEX LLC",
370
+ accountType: "credit_card",
371
+ iban: "CH2989144532982975332",
372
+ bic: "AUDSCHGGXXX",
373
+ routingNumber: "012345678",
374
+ bsbNumber: "062-001",
375
+ branchIdentifier: "001",
376
+ bankCode: "BNH",
377
+ currency: "USD",
378
+ },
379
+ {
380
+ bankName: "Monzo",
381
+ accountNumber: "123465",
382
+ accountName: "SPACEX LLC",
383
+ accountType: "credit_card",
384
+ iban: "CH2989144532982975332",
385
+ bic: "AUDSCHGGXXX",
386
+ routingNumber: "012345678",
387
+ bsbNumber: "062-001",
388
+ branchIdentifier: "001",
389
+ bankCode: "BNH",
390
+ currency: "USD",
391
+ },
392
+ ],
393
+ notes: "Some notes about this supplier",
394
+ taxRate: {
395
+ id: "123456",
396
+ code: "N-T",
397
+ name: "GST on Purchases",
398
+ rate: 10,
399
+ },
400
+ taxNumber: "US123945459",
401
+ currency: "USD",
402
+ account: {
403
+ id: "123456",
404
+ name: "Bank account",
405
+ nominalCode: "N091",
406
+ code: "453",
407
+ },
408
+ status: "active",
409
+ paymentMethod: "cash",
410
+ channel: "email",
411
+ customFields: [
412
+ {
413
+ id: "2389328923893298",
414
+ name: "employee_level",
415
+ description: "Employee Level",
416
+ value: "Uses Salesforce and Marketo",
417
+ },
418
+ {
419
+ id: "2389328923893298",
420
+ name: "employee_level",
421
+ description: "Employee Level",
422
+ value: {
423
+ "0": {},
424
+ "1": {},
425
+ },
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
+ passThrough: [
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
+ path: "$.nested.property",
447
+ value: {
448
+ "TaxClassificationRef": {
449
+ "value": "EUC-99990201-V1-00020000",
450
+ },
451
+ },
452
+ },
453
+ ],
454
+ },
455
+ {
456
+ serviceId: "<id>",
457
+ extendPaths: [
458
+ {
459
+ path: "$.nested.property",
460
+ value: {
461
+ "TaxClassificationRef": {
462
+ "value": "EUC-99990201-V1-00020000",
463
+ },
464
+ },
465
+ },
466
+ ],
467
+ },
468
+ {
469
+ serviceId: "<id>",
470
+ extendPaths: [
471
+ {
472
+ path: "$.nested.property",
473
+ value: {
474
+ "TaxClassificationRef": {
475
+ "value": "EUC-99990201-V1-00020000",
476
+ },
477
+ },
478
+ },
479
+ ],
480
+ },
481
+ ],
482
+ subsidiaryId: "12345",
483
+ },
484
+ {
485
+ id: "12345",
486
+ downstreamId: "12345",
487
+ displayId: "EMP00101",
488
+ displayName: "Windsurf Shop",
489
+ companyName: "SpaceX",
490
+ companyId: "12345",
491
+ title: "CEO",
492
+ firstName: "Elon",
493
+ middleName: "D.",
494
+ lastName: "Musk",
495
+ suffix: "Jr.",
496
+ individual: true,
497
+ addresses: [
498
+ {
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
+ id: "123",
526
+ type: "primary",
527
+ string: "25 Spring Street, Blackburn, VIC 3130",
528
+ name: "HQ US",
529
+ line1: "Main street",
530
+ line2: "apt #",
531
+ line3: "Suite #",
532
+ line4: "delivery instructions",
533
+ streetNumber: "25",
534
+ city: "San Francisco",
535
+ state: "CA",
536
+ postalCode: "94104",
537
+ country: "US",
538
+ latitude: "40.759211",
539
+ longitude: "-73.984638",
540
+ county: "Santa Clara",
541
+ contactName: "Elon Musk",
542
+ salutation: "Mr",
543
+ phoneNumber: "111-111-1111",
544
+ fax: "122-111-1111",
545
+ email: "elon@musk.com",
546
+ website: "https://elonmusk.com",
547
+ notes: "Address notes or delivery instructions.",
548
+ rowVersion: "1-12345",
549
+ },
550
+ {
551
+ id: "123",
552
+ type: "primary",
553
+ string: "25 Spring Street, Blackburn, VIC 3130",
554
+ name: "HQ US",
555
+ line1: "Main street",
556
+ line2: "apt #",
557
+ line3: "Suite #",
558
+ line4: "delivery instructions",
559
+ streetNumber: "25",
560
+ city: "San Francisco",
561
+ state: "CA",
562
+ postalCode: "94104",
563
+ country: "US",
564
+ latitude: "40.759211",
565
+ longitude: "-73.984638",
566
+ county: "Santa Clara",
567
+ contactName: "Elon Musk",
568
+ salutation: "Mr",
569
+ phoneNumber: "111-111-1111",
570
+ fax: "122-111-1111",
571
+ email: "elon@musk.com",
572
+ website: "https://elonmusk.com",
573
+ notes: "Address notes or delivery instructions.",
574
+ rowVersion: "1-12345",
575
+ },
576
+ ],
577
+ phoneNumbers: [
578
+ {
579
+ id: "12345",
580
+ countryCode: "1",
581
+ areaCode: "323",
582
+ number: "111-111-1111",
583
+ extension: "105",
584
+ type: "primary",
585
+ },
586
+ ],
587
+ emails: [
588
+ {
589
+ id: "123",
590
+ email: "elon@musk.com",
591
+ type: "primary",
592
+ },
593
+ {
594
+ id: "123",
595
+ email: "elon@musk.com",
596
+ type: "primary",
597
+ },
598
+ {
599
+ id: "123",
600
+ email: "elon@musk.com",
601
+ type: "primary",
602
+ },
603
+ ],
604
+ websites: [
605
+ {
606
+ id: "12345",
607
+ url: "http://example.com",
608
+ type: "primary",
609
+ },
610
+ {
611
+ id: "12345",
612
+ url: "http://example.com",
613
+ type: "primary",
614
+ },
615
+ ],
616
+ bankAccounts: [
617
+ {
618
+ bankName: "Monzo",
619
+ accountNumber: "123465",
620
+ accountName: "SPACEX LLC",
621
+ accountType: "credit_card",
622
+ iban: "CH2989144532982975332",
623
+ bic: "AUDSCHGGXXX",
624
+ routingNumber: "012345678",
625
+ bsbNumber: "062-001",
626
+ branchIdentifier: "001",
627
+ bankCode: "BNH",
628
+ currency: "USD",
629
+ },
630
+ {
631
+ bankName: "Monzo",
632
+ accountNumber: "123465",
633
+ accountName: "SPACEX LLC",
634
+ accountType: "credit_card",
635
+ iban: "CH2989144532982975332",
636
+ bic: "AUDSCHGGXXX",
637
+ routingNumber: "012345678",
638
+ bsbNumber: "062-001",
639
+ branchIdentifier: "001",
640
+ bankCode: "BNH",
641
+ currency: "USD",
642
+ },
643
+ {
644
+ bankName: "Monzo",
645
+ accountNumber: "123465",
646
+ accountName: "SPACEX LLC",
647
+ accountType: "credit_card",
648
+ iban: "CH2989144532982975332",
649
+ bic: "AUDSCHGGXXX",
650
+ routingNumber: "012345678",
651
+ bsbNumber: "062-001",
652
+ branchIdentifier: "001",
653
+ bankCode: "BNH",
654
+ currency: "USD",
655
+ },
656
+ ],
657
+ notes: "Some notes about this supplier",
658
+ taxRate: {
659
+ id: "123456",
660
+ code: "N-T",
661
+ name: "GST on Purchases",
662
+ rate: 10,
663
+ },
664
+ taxNumber: "US123945459",
665
+ currency: "USD",
666
+ account: {
667
+ id: "123456",
668
+ name: "Bank account",
669
+ nominalCode: "N091",
670
+ code: "453",
671
+ },
672
+ status: "active",
673
+ paymentMethod: "cash",
674
+ channel: "email",
675
+ customFields: [
676
+ {
677
+ id: "2389328923893298",
678
+ name: "employee_level",
679
+ description: "Employee Level",
680
+ value: "Uses Salesforce and Marketo",
681
+ },
682
+ ],
683
+ updatedBy: "12345",
684
+ createdBy: "12345",
685
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
686
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
687
+ rowVersion: "1-12345",
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
+ },
723
+ {
724
+ serviceId: "<id>",
725
+ extendPaths: [
726
+ {
727
+ path: "$.nested.property",
728
+ value: {
729
+ "TaxClassificationRef": {
730
+ "value": "EUC-99990201-V1-00020000",
731
+ },
732
+ },
733
+ },
734
+ {
735
+ path: "$.nested.property",
736
+ value: {
737
+ "TaxClassificationRef": {
738
+ "value": "EUC-99990201-V1-00020000",
739
+ },
740
+ },
741
+ },
742
+ ],
743
+ },
744
+ ],
745
+ subsidiaryId: "12345",
746
+ },
747
+ ],
748
+ meta: {
749
+ itemsOnPage: 50,
750
+ cursors: {
751
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
752
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
753
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
754
+ },
755
+ },
756
+ links: {
757
+ previous:
758
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
759
+ current: "https://unify.apideck.com/crm/companies",
760
+ next:
761
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
762
+ },
763
+ });
764
+ });
765
+
766
+ test("Suppliers Accounting Suppliers Add", async () => {
767
+ const testHttpClient = createTestHTTPClient("accounting.suppliersAdd");
768
+
769
+ const apideck = new Apideck({
770
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
771
+ httpClient: testHttpClient,
772
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
773
+ });
774
+
775
+ const result = await apideck.accounting.suppliers.create({
776
+ consumerId: "test-consumer",
777
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
778
+ serviceId: "salesforce",
779
+ supplier: {
780
+ displayId: "EMP00101",
781
+ displayName: "Windsurf Shop",
782
+ companyName: "SpaceX",
783
+ companyId: "12345",
784
+ title: "CEO",
785
+ firstName: "Elon",
786
+ middleName: "D.",
787
+ lastName: "Musk",
788
+ suffix: "Jr.",
789
+ individual: true,
790
+ addresses: [
791
+ {
792
+ id: "123",
793
+ type: "primary",
794
+ string: "25 Spring Street, Blackburn, VIC 3130",
795
+ name: "HQ US",
796
+ line1: "Main street",
797
+ line2: "apt #",
798
+ line3: "Suite #",
799
+ line4: "delivery instructions",
800
+ streetNumber: "25",
801
+ city: "San Francisco",
802
+ state: "CA",
803
+ postalCode: "94104",
804
+ country: "US",
805
+ latitude: "40.759211",
806
+ longitude: "-73.984638",
807
+ county: "Santa Clara",
808
+ contactName: "Elon Musk",
809
+ salutation: "Mr",
810
+ phoneNumber: "111-111-1111",
811
+ fax: "122-111-1111",
812
+ email: "elon@musk.com",
813
+ website: "https://elonmusk.com",
814
+ notes: "Address notes or delivery instructions.",
815
+ rowVersion: "1-12345",
816
+ },
817
+ {
818
+ id: "123",
819
+ type: "primary",
820
+ string: "25 Spring Street, Blackburn, VIC 3130",
821
+ name: "HQ US",
822
+ line1: "Main street",
823
+ line2: "apt #",
824
+ line3: "Suite #",
825
+ line4: "delivery instructions",
826
+ streetNumber: "25",
827
+ city: "San Francisco",
828
+ state: "CA",
829
+ postalCode: "94104",
830
+ country: "US",
831
+ latitude: "40.759211",
832
+ longitude: "-73.984638",
833
+ county: "Santa Clara",
834
+ contactName: "Elon Musk",
835
+ salutation: "Mr",
836
+ phoneNumber: "111-111-1111",
837
+ fax: "122-111-1111",
838
+ email: "elon@musk.com",
839
+ website: "https://elonmusk.com",
840
+ notes: "Address notes or delivery instructions.",
841
+ rowVersion: "1-12345",
842
+ },
843
+ ],
844
+ phoneNumbers: [
845
+ {
846
+ id: "12345",
847
+ countryCode: "1",
848
+ areaCode: "323",
849
+ number: "111-111-1111",
850
+ extension: "105",
851
+ type: "primary",
852
+ },
853
+ {
854
+ id: "12345",
855
+ countryCode: "1",
856
+ areaCode: "323",
857
+ number: "111-111-1111",
858
+ extension: "105",
859
+ type: "primary",
860
+ },
861
+ ],
862
+ emails: [
863
+ {
864
+ id: "123",
865
+ email: "elon@musk.com",
866
+ type: "primary",
867
+ },
868
+ {
869
+ id: "123",
870
+ email: "elon@musk.com",
871
+ type: "primary",
872
+ },
873
+ ],
874
+ websites: [
875
+ {
876
+ id: "12345",
877
+ url: "http://example.com",
878
+ type: "primary",
879
+ },
880
+ ],
881
+ bankAccounts: [
882
+ {
883
+ bankName: "Monzo",
884
+ accountNumber: "123465",
885
+ accountName: "SPACEX LLC",
886
+ accountType: "credit_card",
887
+ iban: "CH2989144532982975332",
888
+ bic: "AUDSCHGGXXX",
889
+ routingNumber: "012345678",
890
+ bsbNumber: "062-001",
891
+ branchIdentifier: "001",
892
+ bankCode: "BNH",
893
+ currency: "USD",
894
+ },
895
+ ],
896
+ notes: "Some notes about this supplier",
897
+ taxRate: {
898
+ id: "123456",
899
+ rate: 10,
900
+ },
901
+ taxNumber: "US123945459",
902
+ currency: "USD",
903
+ account: {
904
+ id: "123456",
905
+ nominalCode: "N091",
906
+ code: "453",
907
+ },
908
+ status: "active",
909
+ paymentMethod: "cash",
910
+ channel: "email",
911
+ customFields: [
912
+ {
913
+ id: "2389328923893298",
914
+ name: "employee_level",
915
+ description: "Employee Level",
916
+ value: {},
917
+ },
918
+ {
919
+ id: "2389328923893298",
920
+ name: "employee_level",
921
+ description: "Employee Level",
922
+ value: 10,
923
+ },
924
+ {
925
+ id: "2389328923893298",
926
+ name: "employee_level",
927
+ description: "Employee Level",
928
+ value: "Uses Salesforce and Marketo",
929
+ },
930
+ ],
931
+ rowVersion: "1-12345",
932
+ passThrough: [
933
+ {
934
+ serviceId: "<id>",
935
+ extendPaths: [
936
+ {
937
+ path: "$.nested.property",
938
+ value: {
939
+ "TaxClassificationRef": {
940
+ "value": "EUC-99990201-V1-00020000",
941
+ },
942
+ },
943
+ },
944
+ {
945
+ path: "$.nested.property",
946
+ value: {
947
+ "TaxClassificationRef": {
948
+ "value": "EUC-99990201-V1-00020000",
949
+ },
950
+ },
951
+ },
952
+ {
953
+ path: "$.nested.property",
954
+ value: {
955
+ "TaxClassificationRef": {
956
+ "value": "EUC-99990201-V1-00020000",
957
+ },
958
+ },
959
+ },
960
+ ],
961
+ },
962
+ {
963
+ serviceId: "<id>",
964
+ extendPaths: [
965
+ {
966
+ path: "$.nested.property",
967
+ value: {
968
+ "TaxClassificationRef": {
969
+ "value": "EUC-99990201-V1-00020000",
970
+ },
971
+ },
972
+ },
973
+ {
974
+ path: "$.nested.property",
975
+ value: {
976
+ "TaxClassificationRef": {
977
+ "value": "EUC-99990201-V1-00020000",
978
+ },
979
+ },
980
+ },
981
+ ],
982
+ },
983
+ {
984
+ serviceId: "<id>",
985
+ extendPaths: [
986
+ {
987
+ path: "$.nested.property",
988
+ value: {
989
+ "TaxClassificationRef": {
990
+ "value": "EUC-99990201-V1-00020000",
991
+ },
992
+ },
993
+ },
994
+ {
995
+ path: "$.nested.property",
996
+ value: {
997
+ "TaxClassificationRef": {
998
+ "value": "EUC-99990201-V1-00020000",
999
+ },
1000
+ },
1001
+ },
1002
+ {
1003
+ path: "$.nested.property",
1004
+ value: {
1005
+ "TaxClassificationRef": {
1006
+ "value": "EUC-99990201-V1-00020000",
1007
+ },
1008
+ },
1009
+ },
1010
+ ],
1011
+ },
1012
+ ],
1013
+ subsidiaryId: "12345",
1014
+ },
1015
+ });
1016
+ expect(result.httpMeta.response.status).toBe(201);
1017
+ expect(result.createSupplierResponse).toBeDefined();
1018
+ expect(result.createSupplierResponse).toEqual({
1019
+ statusCode: 200,
1020
+ status: "OK",
1021
+ service: "xero",
1022
+ resource: "payments",
1023
+ operation: "add",
1024
+ data: {
1025
+ id: "12345",
1026
+ },
1027
+ });
1028
+ });
1029
+
1030
+ test("Suppliers Accounting Suppliers One", async () => {
1031
+ const testHttpClient = createTestHTTPClient("accounting.suppliersOne");
1032
+
1033
+ const apideck = new Apideck({
1034
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1035
+ httpClient: testHttpClient,
1036
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1037
+ });
1038
+
1039
+ const result = await apideck.accounting.suppliers.get({
1040
+ id: "<id>",
1041
+ consumerId: "test-consumer",
1042
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1043
+ serviceId: "salesforce",
1044
+ fields: "id,updated_at",
1045
+ });
1046
+ expect(result.httpMeta.response.status).toBe(200);
1047
+ expect(result.getSupplierResponse).toBeDefined();
1048
+ expect(result.getSupplierResponse).toEqual({
1049
+ statusCode: 200,
1050
+ status: "OK",
1051
+ service: "xero",
1052
+ resource: "suppliers",
1053
+ operation: "one",
1054
+ data: {
1055
+ id: "12345",
1056
+ downstreamId: "12345",
1057
+ displayId: "EMP00101",
1058
+ displayName: "Windsurf Shop",
1059
+ companyName: "SpaceX",
1060
+ companyId: "12345",
1061
+ title: "CEO",
1062
+ firstName: "Elon",
1063
+ middleName: "D.",
1064
+ lastName: "Musk",
1065
+ suffix: "Jr.",
1066
+ individual: true,
1067
+ addresses: [
1068
+ {
1069
+ id: "123",
1070
+ type: "primary",
1071
+ string: "25 Spring Street, Blackburn, VIC 3130",
1072
+ name: "HQ US",
1073
+ line1: "Main street",
1074
+ line2: "apt #",
1075
+ line3: "Suite #",
1076
+ line4: "delivery instructions",
1077
+ streetNumber: "25",
1078
+ city: "San Francisco",
1079
+ state: "CA",
1080
+ postalCode: "94104",
1081
+ country: "US",
1082
+ latitude: "40.759211",
1083
+ longitude: "-73.984638",
1084
+ county: "Santa Clara",
1085
+ contactName: "Elon Musk",
1086
+ salutation: "Mr",
1087
+ phoneNumber: "111-111-1111",
1088
+ fax: "122-111-1111",
1089
+ email: "elon@musk.com",
1090
+ website: "https://elonmusk.com",
1091
+ notes: "Address notes or delivery instructions.",
1092
+ rowVersion: "1-12345",
1093
+ },
1094
+ {
1095
+ id: "123",
1096
+ type: "primary",
1097
+ string: "25 Spring Street, Blackburn, VIC 3130",
1098
+ name: "HQ US",
1099
+ line1: "Main street",
1100
+ line2: "apt #",
1101
+ line3: "Suite #",
1102
+ line4: "delivery instructions",
1103
+ streetNumber: "25",
1104
+ city: "San Francisco",
1105
+ state: "CA",
1106
+ postalCode: "94104",
1107
+ country: "US",
1108
+ latitude: "40.759211",
1109
+ longitude: "-73.984638",
1110
+ county: "Santa Clara",
1111
+ contactName: "Elon Musk",
1112
+ salutation: "Mr",
1113
+ phoneNumber: "111-111-1111",
1114
+ fax: "122-111-1111",
1115
+ email: "elon@musk.com",
1116
+ website: "https://elonmusk.com",
1117
+ notes: "Address notes or delivery instructions.",
1118
+ rowVersion: "1-12345",
1119
+ },
1120
+ {
1121
+ id: "123",
1122
+ type: "primary",
1123
+ string: "25 Spring Street, Blackburn, VIC 3130",
1124
+ name: "HQ US",
1125
+ line1: "Main street",
1126
+ line2: "apt #",
1127
+ line3: "Suite #",
1128
+ line4: "delivery instructions",
1129
+ streetNumber: "25",
1130
+ city: "San Francisco",
1131
+ state: "CA",
1132
+ postalCode: "94104",
1133
+ country: "US",
1134
+ latitude: "40.759211",
1135
+ longitude: "-73.984638",
1136
+ county: "Santa Clara",
1137
+ contactName: "Elon Musk",
1138
+ salutation: "Mr",
1139
+ phoneNumber: "111-111-1111",
1140
+ fax: "122-111-1111",
1141
+ email: "elon@musk.com",
1142
+ website: "https://elonmusk.com",
1143
+ notes: "Address notes or delivery instructions.",
1144
+ rowVersion: "1-12345",
1145
+ },
1146
+ ],
1147
+ phoneNumbers: [
1148
+ {
1149
+ id: "12345",
1150
+ countryCode: "1",
1151
+ areaCode: "323",
1152
+ number: "111-111-1111",
1153
+ extension: "105",
1154
+ type: "primary",
1155
+ },
1156
+ {
1157
+ id: "12345",
1158
+ countryCode: "1",
1159
+ areaCode: "323",
1160
+ number: "111-111-1111",
1161
+ extension: "105",
1162
+ type: "primary",
1163
+ },
1164
+ ],
1165
+ emails: [
1166
+ {
1167
+ id: "123",
1168
+ email: "elon@musk.com",
1169
+ type: "primary",
1170
+ },
1171
+ {
1172
+ id: "123",
1173
+ email: "elon@musk.com",
1174
+ type: "primary",
1175
+ },
1176
+ ],
1177
+ websites: [
1178
+ {
1179
+ id: "12345",
1180
+ url: "http://example.com",
1181
+ type: "primary",
1182
+ },
1183
+ {
1184
+ id: "12345",
1185
+ url: "http://example.com",
1186
+ type: "primary",
1187
+ },
1188
+ ],
1189
+ bankAccounts: [
1190
+ {
1191
+ bankName: "Monzo",
1192
+ accountNumber: "123465",
1193
+ accountName: "SPACEX LLC",
1194
+ accountType: "credit_card",
1195
+ iban: "CH2989144532982975332",
1196
+ bic: "AUDSCHGGXXX",
1197
+ routingNumber: "012345678",
1198
+ bsbNumber: "062-001",
1199
+ branchIdentifier: "001",
1200
+ bankCode: "BNH",
1201
+ currency: "USD",
1202
+ },
1203
+ {
1204
+ bankName: "Monzo",
1205
+ accountNumber: "123465",
1206
+ accountName: "SPACEX LLC",
1207
+ accountType: "credit_card",
1208
+ iban: "CH2989144532982975332",
1209
+ bic: "AUDSCHGGXXX",
1210
+ routingNumber: "012345678",
1211
+ bsbNumber: "062-001",
1212
+ branchIdentifier: "001",
1213
+ bankCode: "BNH",
1214
+ currency: "USD",
1215
+ },
1216
+ {
1217
+ bankName: "Monzo",
1218
+ accountNumber: "123465",
1219
+ accountName: "SPACEX LLC",
1220
+ accountType: "credit_card",
1221
+ iban: "CH2989144532982975332",
1222
+ bic: "AUDSCHGGXXX",
1223
+ routingNumber: "012345678",
1224
+ bsbNumber: "062-001",
1225
+ branchIdentifier: "001",
1226
+ bankCode: "BNH",
1227
+ currency: "USD",
1228
+ },
1229
+ ],
1230
+ notes: "Some notes about this supplier",
1231
+ taxRate: {
1232
+ id: "123456",
1233
+ code: "N-T",
1234
+ name: "GST on Purchases",
1235
+ rate: 10,
1236
+ },
1237
+ taxNumber: "US123945459",
1238
+ currency: "USD",
1239
+ account: {
1240
+ id: "123456",
1241
+ name: "Bank account",
1242
+ nominalCode: "N091",
1243
+ code: "453",
1244
+ },
1245
+ status: "active",
1246
+ paymentMethod: "cash",
1247
+ channel: "email",
1248
+ customFields: [
1249
+ {
1250
+ id: "2389328923893298",
1251
+ name: "employee_level",
1252
+ description: "Employee Level",
1253
+ value: true,
1254
+ },
1255
+ {
1256
+ id: "2389328923893298",
1257
+ name: "employee_level",
1258
+ description: "Employee Level",
1259
+ value: 10,
1260
+ },
1261
+ ],
1262
+ updatedBy: "12345",
1263
+ createdBy: "12345",
1264
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1265
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1266
+ rowVersion: "1-12345",
1267
+ passThrough: [
1268
+ {
1269
+ serviceId: "<id>",
1270
+ extendPaths: [
1271
+ {
1272
+ path: "$.nested.property",
1273
+ value: {
1274
+ "TaxClassificationRef": {
1275
+ "value": "EUC-99990201-V1-00020000",
1276
+ },
1277
+ },
1278
+ },
1279
+ {
1280
+ path: "$.nested.property",
1281
+ value: {
1282
+ "TaxClassificationRef": {
1283
+ "value": "EUC-99990201-V1-00020000",
1284
+ },
1285
+ },
1286
+ },
1287
+ {
1288
+ path: "$.nested.property",
1289
+ value: {
1290
+ "TaxClassificationRef": {
1291
+ "value": "EUC-99990201-V1-00020000",
1292
+ },
1293
+ },
1294
+ },
1295
+ ],
1296
+ },
1297
+ ],
1298
+ subsidiaryId: "12345",
1299
+ },
1300
+ });
1301
+ });
1302
+
1303
+ test("Suppliers Accounting Suppliers Update", async () => {
1304
+ const testHttpClient = createTestHTTPClient("accounting.suppliersUpdate");
1305
+
1306
+ const apideck = new Apideck({
1307
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1308
+ httpClient: testHttpClient,
1309
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1310
+ });
1311
+
1312
+ const result = await apideck.accounting.suppliers.update({
1313
+ id: "<id>",
1314
+ consumerId: "test-consumer",
1315
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1316
+ serviceId: "salesforce",
1317
+ supplier: {
1318
+ displayId: "EMP00101",
1319
+ displayName: "Windsurf Shop",
1320
+ companyName: "SpaceX",
1321
+ companyId: "12345",
1322
+ title: "CEO",
1323
+ firstName: "Elon",
1324
+ middleName: "D.",
1325
+ lastName: "Musk",
1326
+ suffix: "Jr.",
1327
+ individual: true,
1328
+ addresses: [
1329
+ {
1330
+ id: "123",
1331
+ type: "primary",
1332
+ string: "25 Spring Street, Blackburn, VIC 3130",
1333
+ name: "HQ US",
1334
+ line1: "Main street",
1335
+ line2: "apt #",
1336
+ line3: "Suite #",
1337
+ line4: "delivery instructions",
1338
+ streetNumber: "25",
1339
+ city: "San Francisco",
1340
+ state: "CA",
1341
+ postalCode: "94104",
1342
+ country: "US",
1343
+ latitude: "40.759211",
1344
+ longitude: "-73.984638",
1345
+ county: "Santa Clara",
1346
+ contactName: "Elon Musk",
1347
+ salutation: "Mr",
1348
+ phoneNumber: "111-111-1111",
1349
+ fax: "122-111-1111",
1350
+ email: "elon@musk.com",
1351
+ website: "https://elonmusk.com",
1352
+ notes: "Address notes or delivery instructions.",
1353
+ rowVersion: "1-12345",
1354
+ },
1355
+ {
1356
+ id: "123",
1357
+ type: "primary",
1358
+ string: "25 Spring Street, Blackburn, VIC 3130",
1359
+ name: "HQ US",
1360
+ line1: "Main street",
1361
+ line2: "apt #",
1362
+ line3: "Suite #",
1363
+ line4: "delivery instructions",
1364
+ streetNumber: "25",
1365
+ city: "San Francisco",
1366
+ state: "CA",
1367
+ postalCode: "94104",
1368
+ country: "US",
1369
+ latitude: "40.759211",
1370
+ longitude: "-73.984638",
1371
+ county: "Santa Clara",
1372
+ contactName: "Elon Musk",
1373
+ salutation: "Mr",
1374
+ phoneNumber: "111-111-1111",
1375
+ fax: "122-111-1111",
1376
+ email: "elon@musk.com",
1377
+ website: "https://elonmusk.com",
1378
+ notes: "Address notes or delivery instructions.",
1379
+ rowVersion: "1-12345",
1380
+ },
1381
+ {
1382
+ id: "123",
1383
+ type: "primary",
1384
+ string: "25 Spring Street, Blackburn, VIC 3130",
1385
+ name: "HQ US",
1386
+ line1: "Main street",
1387
+ line2: "apt #",
1388
+ line3: "Suite #",
1389
+ line4: "delivery instructions",
1390
+ streetNumber: "25",
1391
+ city: "San Francisco",
1392
+ state: "CA",
1393
+ postalCode: "94104",
1394
+ country: "US",
1395
+ latitude: "40.759211",
1396
+ longitude: "-73.984638",
1397
+ county: "Santa Clara",
1398
+ contactName: "Elon Musk",
1399
+ salutation: "Mr",
1400
+ phoneNumber: "111-111-1111",
1401
+ fax: "122-111-1111",
1402
+ email: "elon@musk.com",
1403
+ website: "https://elonmusk.com",
1404
+ notes: "Address notes or delivery instructions.",
1405
+ rowVersion: "1-12345",
1406
+ },
1407
+ ],
1408
+ phoneNumbers: [
1409
+ {
1410
+ id: "12345",
1411
+ countryCode: "1",
1412
+ areaCode: "323",
1413
+ number: "111-111-1111",
1414
+ extension: "105",
1415
+ type: "primary",
1416
+ },
1417
+ {
1418
+ id: "12345",
1419
+ countryCode: "1",
1420
+ areaCode: "323",
1421
+ number: "111-111-1111",
1422
+ extension: "105",
1423
+ type: "primary",
1424
+ },
1425
+ ],
1426
+ emails: [
1427
+ {
1428
+ id: "123",
1429
+ email: "elon@musk.com",
1430
+ type: "primary",
1431
+ },
1432
+ {
1433
+ id: "123",
1434
+ email: "elon@musk.com",
1435
+ type: "primary",
1436
+ },
1437
+ ],
1438
+ websites: [
1439
+ {
1440
+ id: "12345",
1441
+ url: "http://example.com",
1442
+ type: "primary",
1443
+ },
1444
+ {
1445
+ id: "12345",
1446
+ url: "http://example.com",
1447
+ type: "primary",
1448
+ },
1449
+ {
1450
+ id: "12345",
1451
+ url: "http://example.com",
1452
+ type: "primary",
1453
+ },
1454
+ ],
1455
+ bankAccounts: [
1456
+ {
1457
+ bankName: "Monzo",
1458
+ accountNumber: "123465",
1459
+ accountName: "SPACEX LLC",
1460
+ accountType: "credit_card",
1461
+ iban: "CH2989144532982975332",
1462
+ bic: "AUDSCHGGXXX",
1463
+ routingNumber: "012345678",
1464
+ bsbNumber: "062-001",
1465
+ branchIdentifier: "001",
1466
+ bankCode: "BNH",
1467
+ currency: "USD",
1468
+ },
1469
+ {
1470
+ bankName: "Monzo",
1471
+ accountNumber: "123465",
1472
+ accountName: "SPACEX LLC",
1473
+ accountType: "credit_card",
1474
+ iban: "CH2989144532982975332",
1475
+ bic: "AUDSCHGGXXX",
1476
+ routingNumber: "012345678",
1477
+ bsbNumber: "062-001",
1478
+ branchIdentifier: "001",
1479
+ bankCode: "BNH",
1480
+ currency: "USD",
1481
+ },
1482
+ ],
1483
+ notes: "Some notes about this supplier",
1484
+ taxRate: {
1485
+ id: "123456",
1486
+ rate: 10,
1487
+ },
1488
+ taxNumber: "US123945459",
1489
+ currency: "USD",
1490
+ account: {
1491
+ id: "123456",
1492
+ nominalCode: "N091",
1493
+ code: "453",
1494
+ },
1495
+ status: "active",
1496
+ paymentMethod: "cash",
1497
+ channel: "email",
1498
+ customFields: [
1499
+ {
1500
+ id: "2389328923893298",
1501
+ name: "employee_level",
1502
+ description: "Employee Level",
1503
+ value: {},
1504
+ },
1505
+ {
1506
+ id: "2389328923893298",
1507
+ name: "employee_level",
1508
+ description: "Employee Level",
1509
+ value: {
1510
+ "0": {},
1511
+ },
1512
+ },
1513
+ ],
1514
+ rowVersion: "1-12345",
1515
+ passThrough: [
1516
+ {
1517
+ serviceId: "<id>",
1518
+ extendPaths: [
1519
+ {
1520
+ path: "$.nested.property",
1521
+ value: {
1522
+ "TaxClassificationRef": {
1523
+ "value": "EUC-99990201-V1-00020000",
1524
+ },
1525
+ },
1526
+ },
1527
+ ],
1528
+ },
1529
+ ],
1530
+ subsidiaryId: "12345",
1531
+ },
1532
+ });
1533
+ expect(result.httpMeta.response.status).toBe(200);
1534
+ expect(result.updateSupplierResponse).toBeDefined();
1535
+ expect(result.updateSupplierResponse).toEqual({
1536
+ statusCode: 200,
1537
+ status: "OK",
1538
+ service: "xero",
1539
+ resource: "suppliers",
1540
+ operation: "update",
1541
+ data: {
1542
+ id: "12345",
1543
+ },
1544
+ });
1545
+ });
1546
+
1547
+ test("Suppliers Accounting Suppliers Delete", async () => {
1548
+ const testHttpClient = createTestHTTPClient("accounting.suppliersDelete");
1549
+
1550
+ const apideck = new Apideck({
1551
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1552
+ httpClient: testHttpClient,
1553
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1554
+ });
1555
+
1556
+ const result = await apideck.accounting.suppliers.delete({
1557
+ id: "<id>",
1558
+ consumerId: "test-consumer",
1559
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1560
+ serviceId: "salesforce",
1561
+ });
1562
+ expect(result.httpMeta.response.status).toBe(200);
1563
+ expect(result.deleteSupplierResponse).toBeDefined();
1564
+ expect(result.deleteSupplierResponse).toEqual({
1565
+ statusCode: 200,
1566
+ status: "OK",
1567
+ service: "xero",
1568
+ resource: "suppliers",
1569
+ operation: "delete",
1570
+ data: {
1571
+ id: "12345",
1572
+ },
1573
+ });
1574
+ });