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