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