@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,2173 @@
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("Invoices Accounting Invoices All", async () => {
10
+ const testHttpClient = createTestHTTPClient("accounting.invoicesAll");
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.invoices.list({
19
+ consumerId: "test-consumer",
20
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
21
+ serviceId: "salesforce",
22
+ filter: {
23
+ updatedSince: new Date("2020-09-30T07:43:32.000Z"),
24
+ createdSince: new Date("2020-09-30T07:43:32.000Z"),
25
+ number: "OIT00546",
26
+ },
27
+ sort: {
28
+ by: "updated_at",
29
+ direction: "desc",
30
+ },
31
+ passThrough: {
32
+ "search": "San Francisco",
33
+ },
34
+ fields: "id,updated_at",
35
+ });
36
+ expect(result.httpMeta.response.status).toBe(200);
37
+ expect(result.getInvoicesResponse).toBeDefined();
38
+ expect(result.getInvoicesResponse).toEqual({
39
+ statusCode: 200,
40
+ status: "OK",
41
+ service: "xero",
42
+ resource: "invoices",
43
+ operation: "all",
44
+ data: [
45
+ {
46
+ id: "12345",
47
+ downstreamId: "12345",
48
+ type: "service",
49
+ number: "OIT00546",
50
+ customer: {
51
+ id: "12345",
52
+ displayId: "CUST00101",
53
+ displayName: "Windsurf Shop",
54
+ companyName: "The boring company",
55
+ email: "boring@boring.com",
56
+ },
57
+ companyId: "12345",
58
+ invoiceDate: new Date("2020-09-30"),
59
+ dueDate: new Date("2020-09-30"),
60
+ terms: "Net 30 days",
61
+ poNumber: "90000117",
62
+ reference: "123456",
63
+ status: "draft",
64
+ invoiceSent: true,
65
+ currency: "USD",
66
+ currencyRate: 0.69,
67
+ taxInclusive: true,
68
+ subTotal: 27500,
69
+ totalTax: 2500,
70
+ taxCode: "1234",
71
+ discountPercentage: 5.5,
72
+ discountAmount: 25,
73
+ total: 27500,
74
+ balance: 27500,
75
+ deposit: 0,
76
+ customerMemo: "Thank you for your business and have a great day!",
77
+ trackingCategories: [
78
+ {
79
+ id: "123456",
80
+ name: "New York",
81
+ },
82
+ {
83
+ id: "123456",
84
+ name: "New York",
85
+ },
86
+ ],
87
+ lineItems: [
88
+ {
89
+ id: "12345",
90
+ rowId: "12345",
91
+ code: "120-C",
92
+ lineNumber: 1,
93
+ description:
94
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
95
+ type: "sales_item",
96
+ taxAmount: 27500,
97
+ totalAmount: 27500,
98
+ quantity: 1,
99
+ unitPrice: 27500.5,
100
+ unitOfMeasure: "pc.",
101
+ discountPercentage: 0.01,
102
+ discountAmount: 19.99,
103
+ locationId: "12345",
104
+ departmentId: "12345",
105
+ item: {
106
+ id: "12344",
107
+ code: "120-C",
108
+ name: "Model Y",
109
+ },
110
+ taxRate: {
111
+ id: "123456",
112
+ code: "N-T",
113
+ name: "GST on Purchases",
114
+ rate: 10,
115
+ },
116
+ trackingCategories: [
117
+ {
118
+ id: "123456",
119
+ name: "New York",
120
+ },
121
+ ],
122
+ ledgerAccount: {
123
+ id: "123456",
124
+ name: "Bank account",
125
+ nominalCode: "N091",
126
+ code: "453",
127
+ },
128
+ customFields: [
129
+ {
130
+ id: "2389328923893298",
131
+ name: "employee_level",
132
+ description: "Employee Level",
133
+ value: "Uses Salesforce and Marketo",
134
+ },
135
+ ],
136
+ rowVersion: "1-12345",
137
+ updatedBy: "12345",
138
+ createdBy: "12345",
139
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
140
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
141
+ },
142
+ {
143
+ id: "12345",
144
+ rowId: "12345",
145
+ code: "120-C",
146
+ lineNumber: 1,
147
+ description:
148
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
149
+ type: "sales_item",
150
+ taxAmount: 27500,
151
+ totalAmount: 27500,
152
+ quantity: 1,
153
+ unitPrice: 27500.5,
154
+ unitOfMeasure: "pc.",
155
+ discountPercentage: 0.01,
156
+ discountAmount: 19.99,
157
+ locationId: "12345",
158
+ departmentId: "12345",
159
+ item: {
160
+ id: "12344",
161
+ code: "120-C",
162
+ name: "Model Y",
163
+ },
164
+ taxRate: {
165
+ id: "123456",
166
+ code: "N-T",
167
+ name: "GST on Purchases",
168
+ rate: 10,
169
+ },
170
+ trackingCategories: [
171
+ {
172
+ id: "123456",
173
+ name: "New York",
174
+ },
175
+ {
176
+ id: "123456",
177
+ name: "New York",
178
+ },
179
+ ],
180
+ ledgerAccount: {
181
+ id: "123456",
182
+ name: "Bank account",
183
+ nominalCode: "N091",
184
+ code: "453",
185
+ },
186
+ customFields: [
187
+ {
188
+ id: "2389328923893298",
189
+ name: "employee_level",
190
+ description: "Employee Level",
191
+ value: "Uses Salesforce and Marketo",
192
+ },
193
+ {
194
+ id: "2389328923893298",
195
+ name: "employee_level",
196
+ description: "Employee Level",
197
+ value: {},
198
+ },
199
+ ],
200
+ rowVersion: "1-12345",
201
+ updatedBy: "12345",
202
+ createdBy: "12345",
203
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
204
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
205
+ },
206
+ {
207
+ id: "12345",
208
+ rowId: "12345",
209
+ code: "120-C",
210
+ lineNumber: 1,
211
+ description:
212
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
213
+ type: "sales_item",
214
+ taxAmount: 27500,
215
+ totalAmount: 27500,
216
+ quantity: 1,
217
+ unitPrice: 27500.5,
218
+ unitOfMeasure: "pc.",
219
+ discountPercentage: 0.01,
220
+ discountAmount: 19.99,
221
+ locationId: "12345",
222
+ departmentId: "12345",
223
+ item: {
224
+ id: "12344",
225
+ code: "120-C",
226
+ name: "Model Y",
227
+ },
228
+ taxRate: {
229
+ id: "123456",
230
+ code: "N-T",
231
+ name: "GST on Purchases",
232
+ rate: 10,
233
+ },
234
+ trackingCategories: [
235
+ {
236
+ id: "123456",
237
+ name: "New York",
238
+ },
239
+ ],
240
+ ledgerAccount: {
241
+ id: "123456",
242
+ name: "Bank account",
243
+ nominalCode: "N091",
244
+ code: "453",
245
+ },
246
+ customFields: [
247
+ {
248
+ id: "2389328923893298",
249
+ name: "employee_level",
250
+ description: "Employee Level",
251
+ value: {},
252
+ },
253
+ {
254
+ id: "2389328923893298",
255
+ name: "employee_level",
256
+ description: "Employee Level",
257
+ value: {},
258
+ },
259
+ {
260
+ id: "2389328923893298",
261
+ name: "employee_level",
262
+ description: "Employee Level",
263
+ value: "Uses Salesforce and Marketo",
264
+ },
265
+ ],
266
+ rowVersion: "1-12345",
267
+ updatedBy: "12345",
268
+ createdBy: "12345",
269
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
270
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
271
+ },
272
+ ],
273
+ billingAddress: {
274
+ id: "123",
275
+ type: "primary",
276
+ string: "25 Spring Street, Blackburn, VIC 3130",
277
+ name: "HQ US",
278
+ line1: "Main street",
279
+ line2: "apt #",
280
+ line3: "Suite #",
281
+ line4: "delivery instructions",
282
+ streetNumber: "25",
283
+ city: "San Francisco",
284
+ state: "CA",
285
+ postalCode: "94104",
286
+ country: "US",
287
+ latitude: "40.759211",
288
+ longitude: "-73.984638",
289
+ county: "Santa Clara",
290
+ contactName: "Elon Musk",
291
+ salutation: "Mr",
292
+ phoneNumber: "111-111-1111",
293
+ fax: "122-111-1111",
294
+ email: "elon@musk.com",
295
+ website: "https://elonmusk.com",
296
+ notes: "Address notes or delivery instructions.",
297
+ rowVersion: "1-12345",
298
+ },
299
+ shippingAddress: {
300
+ id: "123",
301
+ type: "primary",
302
+ string: "25 Spring Street, Blackburn, VIC 3130",
303
+ name: "HQ US",
304
+ line1: "Main street",
305
+ line2: "apt #",
306
+ line3: "Suite #",
307
+ line4: "delivery instructions",
308
+ streetNumber: "25",
309
+ city: "San Francisco",
310
+ state: "CA",
311
+ postalCode: "94104",
312
+ country: "US",
313
+ latitude: "40.759211",
314
+ longitude: "-73.984638",
315
+ county: "Santa Clara",
316
+ contactName: "Elon Musk",
317
+ salutation: "Mr",
318
+ phoneNumber: "111-111-1111",
319
+ fax: "122-111-1111",
320
+ email: "elon@musk.com",
321
+ website: "https://elonmusk.com",
322
+ notes: "Address notes or delivery instructions.",
323
+ rowVersion: "1-12345",
324
+ },
325
+ templateId: "123456",
326
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
327
+ paymentMethod: "cash",
328
+ channel: "email",
329
+ language: "EN",
330
+ accountingByRow: false,
331
+ bankAccount: {
332
+ bankName: "Monzo",
333
+ accountNumber: "123465",
334
+ accountName: "SPACEX LLC",
335
+ accountType: "credit_card",
336
+ iban: "CH2989144532982975332",
337
+ bic: "AUDSCHGGXXX",
338
+ routingNumber: "012345678",
339
+ bsbNumber: "062-001",
340
+ branchIdentifier: "001",
341
+ bankCode: "BNH",
342
+ currency: "USD",
343
+ },
344
+ ledgerAccount: {
345
+ id: "123456",
346
+ name: "Bank account",
347
+ nominalCode: "N091",
348
+ code: "453",
349
+ },
350
+ customFields: [
351
+ {
352
+ id: "2389328923893298",
353
+ name: "employee_level",
354
+ description: "Employee Level",
355
+ value: true,
356
+ },
357
+ ],
358
+ rowVersion: "1-12345",
359
+ updatedBy: "12345",
360
+ createdBy: "12345",
361
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
362
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
363
+ passThrough: [
364
+ {
365
+ serviceId: "<id>",
366
+ extendPaths: [
367
+ {
368
+ path: "$.nested.property",
369
+ value: {
370
+ "TaxClassificationRef": {
371
+ "value": "EUC-99990201-V1-00020000",
372
+ },
373
+ },
374
+ },
375
+ ],
376
+ },
377
+ {
378
+ serviceId: "<id>",
379
+ extendPaths: [
380
+ {
381
+ path: "$.nested.property",
382
+ value: {
383
+ "TaxClassificationRef": {
384
+ "value": "EUC-99990201-V1-00020000",
385
+ },
386
+ },
387
+ },
388
+ {
389
+ path: "$.nested.property",
390
+ value: {
391
+ "TaxClassificationRef": {
392
+ "value": "EUC-99990201-V1-00020000",
393
+ },
394
+ },
395
+ },
396
+ {
397
+ path: "$.nested.property",
398
+ value: {
399
+ "TaxClassificationRef": {
400
+ "value": "EUC-99990201-V1-00020000",
401
+ },
402
+ },
403
+ },
404
+ ],
405
+ },
406
+ ],
407
+ },
408
+ {
409
+ id: "12345",
410
+ downstreamId: "12345",
411
+ type: "service",
412
+ number: "OIT00546",
413
+ customer: {
414
+ id: "12345",
415
+ displayId: "CUST00101",
416
+ displayName: "Windsurf Shop",
417
+ companyName: "The boring company",
418
+ email: "boring@boring.com",
419
+ },
420
+ companyId: "12345",
421
+ invoiceDate: new Date("2020-09-30"),
422
+ dueDate: new Date("2020-09-30"),
423
+ terms: "Net 30 days",
424
+ poNumber: "90000117",
425
+ reference: "123456",
426
+ status: "draft",
427
+ invoiceSent: true,
428
+ currency: "USD",
429
+ currencyRate: 0.69,
430
+ taxInclusive: true,
431
+ subTotal: 27500,
432
+ totalTax: 2500,
433
+ taxCode: "1234",
434
+ discountPercentage: 5.5,
435
+ discountAmount: 25,
436
+ total: 27500,
437
+ balance: 27500,
438
+ deposit: 0,
439
+ customerMemo: "Thank you for your business and have a great day!",
440
+ trackingCategories: [
441
+ {
442
+ id: "123456",
443
+ name: "New York",
444
+ },
445
+ {
446
+ id: "123456",
447
+ name: "New York",
448
+ },
449
+ ],
450
+ lineItems: [
451
+ {
452
+ id: "12345",
453
+ rowId: "12345",
454
+ code: "120-C",
455
+ lineNumber: 1,
456
+ description:
457
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
458
+ type: "sales_item",
459
+ taxAmount: 27500,
460
+ totalAmount: 27500,
461
+ quantity: 1,
462
+ unitPrice: 27500.5,
463
+ unitOfMeasure: "pc.",
464
+ discountPercentage: 0.01,
465
+ discountAmount: 19.99,
466
+ locationId: "12345",
467
+ departmentId: "12345",
468
+ item: {
469
+ id: "12344",
470
+ code: "120-C",
471
+ name: "Model Y",
472
+ },
473
+ taxRate: {
474
+ id: "123456",
475
+ code: "N-T",
476
+ name: "GST on Purchases",
477
+ rate: 10,
478
+ },
479
+ trackingCategories: [
480
+ {
481
+ id: "123456",
482
+ name: "New York",
483
+ },
484
+ {
485
+ id: "123456",
486
+ name: "New York",
487
+ },
488
+ ],
489
+ ledgerAccount: {
490
+ id: "123456",
491
+ name: "Bank account",
492
+ nominalCode: "N091",
493
+ code: "453",
494
+ },
495
+ customFields: [
496
+ {
497
+ id: "2389328923893298",
498
+ name: "employee_level",
499
+ description: "Employee Level",
500
+ value: 10,
501
+ },
502
+ ],
503
+ rowVersion: "1-12345",
504
+ updatedBy: "12345",
505
+ createdBy: "12345",
506
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
507
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
508
+ },
509
+ {
510
+ id: "12345",
511
+ rowId: "12345",
512
+ code: "120-C",
513
+ lineNumber: 1,
514
+ description:
515
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
516
+ type: "sales_item",
517
+ taxAmount: 27500,
518
+ totalAmount: 27500,
519
+ quantity: 1,
520
+ unitPrice: 27500.5,
521
+ unitOfMeasure: "pc.",
522
+ discountPercentage: 0.01,
523
+ discountAmount: 19.99,
524
+ locationId: "12345",
525
+ departmentId: "12345",
526
+ item: {
527
+ id: "12344",
528
+ code: "120-C",
529
+ name: "Model Y",
530
+ },
531
+ taxRate: {
532
+ id: "123456",
533
+ code: "N-T",
534
+ name: "GST on Purchases",
535
+ rate: 10,
536
+ },
537
+ trackingCategories: [
538
+ {
539
+ id: "123456",
540
+ name: "New York",
541
+ },
542
+ {
543
+ id: "123456",
544
+ name: "New York",
545
+ },
546
+ {
547
+ id: "123456",
548
+ name: "New York",
549
+ },
550
+ ],
551
+ ledgerAccount: {
552
+ id: "123456",
553
+ name: "Bank account",
554
+ nominalCode: "N091",
555
+ code: "453",
556
+ },
557
+ customFields: [
558
+ {
559
+ id: "2389328923893298",
560
+ name: "employee_level",
561
+ description: "Employee Level",
562
+ value: {
563
+ "0": {},
564
+ },
565
+ },
566
+ ],
567
+ rowVersion: "1-12345",
568
+ updatedBy: "12345",
569
+ createdBy: "12345",
570
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
571
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
572
+ },
573
+ {
574
+ id: "12345",
575
+ rowId: "12345",
576
+ code: "120-C",
577
+ lineNumber: 1,
578
+ description:
579
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
580
+ type: "sales_item",
581
+ taxAmount: 27500,
582
+ totalAmount: 27500,
583
+ quantity: 1,
584
+ unitPrice: 27500.5,
585
+ unitOfMeasure: "pc.",
586
+ discountPercentage: 0.01,
587
+ discountAmount: 19.99,
588
+ locationId: "12345",
589
+ departmentId: "12345",
590
+ item: {
591
+ id: "12344",
592
+ code: "120-C",
593
+ name: "Model Y",
594
+ },
595
+ taxRate: {
596
+ id: "123456",
597
+ code: "N-T",
598
+ name: "GST on Purchases",
599
+ rate: 10,
600
+ },
601
+ trackingCategories: [
602
+ {
603
+ id: "123456",
604
+ name: "New York",
605
+ },
606
+ {
607
+ id: "123456",
608
+ name: "New York",
609
+ },
610
+ {
611
+ id: "123456",
612
+ name: "New York",
613
+ },
614
+ ],
615
+ ledgerAccount: {
616
+ id: "123456",
617
+ name: "Bank account",
618
+ nominalCode: "N091",
619
+ code: "453",
620
+ },
621
+ customFields: [
622
+ {
623
+ id: "2389328923893298",
624
+ name: "employee_level",
625
+ description: "Employee Level",
626
+ value: "Uses Salesforce and Marketo",
627
+ },
628
+ ],
629
+ rowVersion: "1-12345",
630
+ updatedBy: "12345",
631
+ createdBy: "12345",
632
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
633
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
634
+ },
635
+ ],
636
+ billingAddress: {
637
+ id: "123",
638
+ type: "primary",
639
+ string: "25 Spring Street, Blackburn, VIC 3130",
640
+ name: "HQ US",
641
+ line1: "Main street",
642
+ line2: "apt #",
643
+ line3: "Suite #",
644
+ line4: "delivery instructions",
645
+ streetNumber: "25",
646
+ city: "San Francisco",
647
+ state: "CA",
648
+ postalCode: "94104",
649
+ country: "US",
650
+ latitude: "40.759211",
651
+ longitude: "-73.984638",
652
+ county: "Santa Clara",
653
+ contactName: "Elon Musk",
654
+ salutation: "Mr",
655
+ phoneNumber: "111-111-1111",
656
+ fax: "122-111-1111",
657
+ email: "elon@musk.com",
658
+ website: "https://elonmusk.com",
659
+ notes: "Address notes or delivery instructions.",
660
+ rowVersion: "1-12345",
661
+ },
662
+ shippingAddress: {
663
+ id: "123",
664
+ type: "primary",
665
+ string: "25 Spring Street, Blackburn, VIC 3130",
666
+ name: "HQ US",
667
+ line1: "Main street",
668
+ line2: "apt #",
669
+ line3: "Suite #",
670
+ line4: "delivery instructions",
671
+ streetNumber: "25",
672
+ city: "San Francisco",
673
+ state: "CA",
674
+ postalCode: "94104",
675
+ country: "US",
676
+ latitude: "40.759211",
677
+ longitude: "-73.984638",
678
+ county: "Santa Clara",
679
+ contactName: "Elon Musk",
680
+ salutation: "Mr",
681
+ phoneNumber: "111-111-1111",
682
+ fax: "122-111-1111",
683
+ email: "elon@musk.com",
684
+ website: "https://elonmusk.com",
685
+ notes: "Address notes or delivery instructions.",
686
+ rowVersion: "1-12345",
687
+ },
688
+ templateId: "123456",
689
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
690
+ paymentMethod: "cash",
691
+ channel: "email",
692
+ language: "EN",
693
+ accountingByRow: false,
694
+ bankAccount: {
695
+ bankName: "Monzo",
696
+ accountNumber: "123465",
697
+ accountName: "SPACEX LLC",
698
+ accountType: "credit_card",
699
+ iban: "CH2989144532982975332",
700
+ bic: "AUDSCHGGXXX",
701
+ routingNumber: "012345678",
702
+ bsbNumber: "062-001",
703
+ branchIdentifier: "001",
704
+ bankCode: "BNH",
705
+ currency: "USD",
706
+ },
707
+ ledgerAccount: {
708
+ id: "123456",
709
+ name: "Bank account",
710
+ nominalCode: "N091",
711
+ code: "453",
712
+ },
713
+ customFields: [
714
+ {
715
+ id: "2389328923893298",
716
+ name: "employee_level",
717
+ description: "Employee Level",
718
+ value: "Uses Salesforce and Marketo",
719
+ },
720
+ {
721
+ id: "2389328923893298",
722
+ name: "employee_level",
723
+ description: "Employee Level",
724
+ value: true,
725
+ },
726
+ {
727
+ id: "2389328923893298",
728
+ name: "employee_level",
729
+ description: "Employee Level",
730
+ value: true,
731
+ },
732
+ ],
733
+ rowVersion: "1-12345",
734
+ updatedBy: "12345",
735
+ createdBy: "12345",
736
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
737
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
738
+ passThrough: [
739
+ {
740
+ serviceId: "<id>",
741
+ extendPaths: [
742
+ {
743
+ path: "$.nested.property",
744
+ value: {
745
+ "TaxClassificationRef": {
746
+ "value": "EUC-99990201-V1-00020000",
747
+ },
748
+ },
749
+ },
750
+ {
751
+ path: "$.nested.property",
752
+ value: {
753
+ "TaxClassificationRef": {
754
+ "value": "EUC-99990201-V1-00020000",
755
+ },
756
+ },
757
+ },
758
+ ],
759
+ },
760
+ {
761
+ serviceId: "<id>",
762
+ extendPaths: [
763
+ {
764
+ path: "$.nested.property",
765
+ value: {
766
+ "TaxClassificationRef": {
767
+ "value": "EUC-99990201-V1-00020000",
768
+ },
769
+ },
770
+ },
771
+ ],
772
+ },
773
+ ],
774
+ },
775
+ {
776
+ id: "12345",
777
+ downstreamId: "12345",
778
+ type: "service",
779
+ number: "OIT00546",
780
+ customer: {
781
+ id: "12345",
782
+ displayId: "CUST00101",
783
+ displayName: "Windsurf Shop",
784
+ companyName: "The boring company",
785
+ email: "boring@boring.com",
786
+ },
787
+ companyId: "12345",
788
+ invoiceDate: new Date("2020-09-30"),
789
+ dueDate: new Date("2020-09-30"),
790
+ terms: "Net 30 days",
791
+ poNumber: "90000117",
792
+ reference: "123456",
793
+ status: "draft",
794
+ invoiceSent: true,
795
+ currency: "USD",
796
+ currencyRate: 0.69,
797
+ taxInclusive: true,
798
+ subTotal: 27500,
799
+ totalTax: 2500,
800
+ taxCode: "1234",
801
+ discountPercentage: 5.5,
802
+ discountAmount: 25,
803
+ total: 27500,
804
+ balance: 27500,
805
+ deposit: 0,
806
+ customerMemo: "Thank you for your business and have a great day!",
807
+ trackingCategories: [
808
+ {
809
+ id: "123456",
810
+ name: "New York",
811
+ },
812
+ {
813
+ id: "123456",
814
+ name: "New York",
815
+ },
816
+ ],
817
+ lineItems: [
818
+ {
819
+ id: "12345",
820
+ rowId: "12345",
821
+ code: "120-C",
822
+ lineNumber: 1,
823
+ description:
824
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
825
+ type: "sales_item",
826
+ taxAmount: 27500,
827
+ totalAmount: 27500,
828
+ quantity: 1,
829
+ unitPrice: 27500.5,
830
+ unitOfMeasure: "pc.",
831
+ discountPercentage: 0.01,
832
+ discountAmount: 19.99,
833
+ locationId: "12345",
834
+ departmentId: "12345",
835
+ item: {
836
+ id: "12344",
837
+ code: "120-C",
838
+ name: "Model Y",
839
+ },
840
+ taxRate: {
841
+ id: "123456",
842
+ code: "N-T",
843
+ name: "GST on Purchases",
844
+ rate: 10,
845
+ },
846
+ trackingCategories: [
847
+ {
848
+ id: "123456",
849
+ name: "New York",
850
+ },
851
+ {
852
+ id: "123456",
853
+ name: "New York",
854
+ },
855
+ ],
856
+ ledgerAccount: {
857
+ id: "123456",
858
+ name: "Bank account",
859
+ nominalCode: "N091",
860
+ code: "453",
861
+ },
862
+ customFields: [
863
+ {
864
+ id: "2389328923893298",
865
+ name: "employee_level",
866
+ description: "Employee Level",
867
+ value: 10,
868
+ },
869
+ {
870
+ id: "2389328923893298",
871
+ name: "employee_level",
872
+ description: "Employee Level",
873
+ value: true,
874
+ },
875
+ {
876
+ id: "2389328923893298",
877
+ name: "employee_level",
878
+ description: "Employee Level",
879
+ value: "Uses Salesforce and Marketo",
880
+ },
881
+ ],
882
+ rowVersion: "1-12345",
883
+ updatedBy: "12345",
884
+ createdBy: "12345",
885
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
886
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
887
+ },
888
+ {
889
+ id: "12345",
890
+ rowId: "12345",
891
+ code: "120-C",
892
+ lineNumber: 1,
893
+ description:
894
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
895
+ type: "sales_item",
896
+ taxAmount: 27500,
897
+ totalAmount: 27500,
898
+ quantity: 1,
899
+ unitPrice: 27500.5,
900
+ unitOfMeasure: "pc.",
901
+ discountPercentage: 0.01,
902
+ discountAmount: 19.99,
903
+ locationId: "12345",
904
+ departmentId: "12345",
905
+ item: {
906
+ id: "12344",
907
+ code: "120-C",
908
+ name: "Model Y",
909
+ },
910
+ taxRate: {
911
+ id: "123456",
912
+ code: "N-T",
913
+ name: "GST on Purchases",
914
+ rate: 10,
915
+ },
916
+ trackingCategories: [
917
+ {
918
+ id: "123456",
919
+ name: "New York",
920
+ },
921
+ ],
922
+ ledgerAccount: {
923
+ id: "123456",
924
+ name: "Bank account",
925
+ nominalCode: "N091",
926
+ code: "453",
927
+ },
928
+ customFields: [
929
+ {
930
+ id: "2389328923893298",
931
+ name: "employee_level",
932
+ description: "Employee Level",
933
+ value: "Uses Salesforce and Marketo",
934
+ },
935
+ {
936
+ id: "2389328923893298",
937
+ name: "employee_level",
938
+ description: "Employee Level",
939
+ value: {},
940
+ },
941
+ {
942
+ id: "2389328923893298",
943
+ name: "employee_level",
944
+ description: "Employee Level",
945
+ value: {
946
+ "0": {},
947
+ "1": {},
948
+ "2": {},
949
+ },
950
+ },
951
+ ],
952
+ rowVersion: "1-12345",
953
+ updatedBy: "12345",
954
+ createdBy: "12345",
955
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
956
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
957
+ },
958
+ {
959
+ id: "12345",
960
+ rowId: "12345",
961
+ code: "120-C",
962
+ lineNumber: 1,
963
+ description:
964
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
965
+ type: "sales_item",
966
+ taxAmount: 27500,
967
+ totalAmount: 27500,
968
+ quantity: 1,
969
+ unitPrice: 27500.5,
970
+ unitOfMeasure: "pc.",
971
+ discountPercentage: 0.01,
972
+ discountAmount: 19.99,
973
+ locationId: "12345",
974
+ departmentId: "12345",
975
+ item: {
976
+ id: "12344",
977
+ code: "120-C",
978
+ name: "Model Y",
979
+ },
980
+ taxRate: {
981
+ id: "123456",
982
+ code: "N-T",
983
+ name: "GST on Purchases",
984
+ rate: 10,
985
+ },
986
+ trackingCategories: [
987
+ {
988
+ id: "123456",
989
+ name: "New York",
990
+ },
991
+ ],
992
+ ledgerAccount: {
993
+ id: "123456",
994
+ name: "Bank account",
995
+ nominalCode: "N091",
996
+ code: "453",
997
+ },
998
+ customFields: [
999
+ {
1000
+ id: "2389328923893298",
1001
+ name: "employee_level",
1002
+ description: "Employee Level",
1003
+ value: {},
1004
+ },
1005
+ {
1006
+ id: "2389328923893298",
1007
+ name: "employee_level",
1008
+ description: "Employee Level",
1009
+ value: {
1010
+ "0": {},
1011
+ "1": {},
1012
+ "2": {},
1013
+ },
1014
+ },
1015
+ {
1016
+ id: "2389328923893298",
1017
+ name: "employee_level",
1018
+ description: "Employee Level",
1019
+ value: {},
1020
+ },
1021
+ ],
1022
+ rowVersion: "1-12345",
1023
+ updatedBy: "12345",
1024
+ createdBy: "12345",
1025
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1026
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1027
+ },
1028
+ ],
1029
+ billingAddress: {
1030
+ id: "123",
1031
+ type: "primary",
1032
+ string: "25 Spring Street, Blackburn, VIC 3130",
1033
+ name: "HQ US",
1034
+ line1: "Main street",
1035
+ line2: "apt #",
1036
+ line3: "Suite #",
1037
+ line4: "delivery instructions",
1038
+ streetNumber: "25",
1039
+ city: "San Francisco",
1040
+ state: "CA",
1041
+ postalCode: "94104",
1042
+ country: "US",
1043
+ latitude: "40.759211",
1044
+ longitude: "-73.984638",
1045
+ county: "Santa Clara",
1046
+ contactName: "Elon Musk",
1047
+ salutation: "Mr",
1048
+ phoneNumber: "111-111-1111",
1049
+ fax: "122-111-1111",
1050
+ email: "elon@musk.com",
1051
+ website: "https://elonmusk.com",
1052
+ notes: "Address notes or delivery instructions.",
1053
+ rowVersion: "1-12345",
1054
+ },
1055
+ shippingAddress: {
1056
+ id: "123",
1057
+ type: "primary",
1058
+ string: "25 Spring Street, Blackburn, VIC 3130",
1059
+ name: "HQ US",
1060
+ line1: "Main street",
1061
+ line2: "apt #",
1062
+ line3: "Suite #",
1063
+ line4: "delivery instructions",
1064
+ streetNumber: "25",
1065
+ city: "San Francisco",
1066
+ state: "CA",
1067
+ postalCode: "94104",
1068
+ country: "US",
1069
+ latitude: "40.759211",
1070
+ longitude: "-73.984638",
1071
+ county: "Santa Clara",
1072
+ contactName: "Elon Musk",
1073
+ salutation: "Mr",
1074
+ phoneNumber: "111-111-1111",
1075
+ fax: "122-111-1111",
1076
+ email: "elon@musk.com",
1077
+ website: "https://elonmusk.com",
1078
+ notes: "Address notes or delivery instructions.",
1079
+ rowVersion: "1-12345",
1080
+ },
1081
+ templateId: "123456",
1082
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
1083
+ paymentMethod: "cash",
1084
+ channel: "email",
1085
+ language: "EN",
1086
+ accountingByRow: false,
1087
+ bankAccount: {
1088
+ bankName: "Monzo",
1089
+ accountNumber: "123465",
1090
+ accountName: "SPACEX LLC",
1091
+ accountType: "credit_card",
1092
+ iban: "CH2989144532982975332",
1093
+ bic: "AUDSCHGGXXX",
1094
+ routingNumber: "012345678",
1095
+ bsbNumber: "062-001",
1096
+ branchIdentifier: "001",
1097
+ bankCode: "BNH",
1098
+ currency: "USD",
1099
+ },
1100
+ ledgerAccount: {
1101
+ id: "123456",
1102
+ name: "Bank account",
1103
+ nominalCode: "N091",
1104
+ code: "453",
1105
+ },
1106
+ customFields: [
1107
+ {
1108
+ id: "2389328923893298",
1109
+ name: "employee_level",
1110
+ description: "Employee Level",
1111
+ value: "Uses Salesforce and Marketo",
1112
+ },
1113
+ ],
1114
+ rowVersion: "1-12345",
1115
+ updatedBy: "12345",
1116
+ createdBy: "12345",
1117
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1118
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1119
+ passThrough: [
1120
+ {
1121
+ serviceId: "<id>",
1122
+ extendPaths: [
1123
+ {
1124
+ path: "$.nested.property",
1125
+ value: {
1126
+ "TaxClassificationRef": {
1127
+ "value": "EUC-99990201-V1-00020000",
1128
+ },
1129
+ },
1130
+ },
1131
+ {
1132
+ path: "$.nested.property",
1133
+ value: {
1134
+ "TaxClassificationRef": {
1135
+ "value": "EUC-99990201-V1-00020000",
1136
+ },
1137
+ },
1138
+ },
1139
+ {
1140
+ path: "$.nested.property",
1141
+ value: {
1142
+ "TaxClassificationRef": {
1143
+ "value": "EUC-99990201-V1-00020000",
1144
+ },
1145
+ },
1146
+ },
1147
+ ],
1148
+ },
1149
+ {
1150
+ serviceId: "<id>",
1151
+ extendPaths: [
1152
+ {
1153
+ path: "$.nested.property",
1154
+ value: {
1155
+ "TaxClassificationRef": {
1156
+ "value": "EUC-99990201-V1-00020000",
1157
+ },
1158
+ },
1159
+ },
1160
+ ],
1161
+ },
1162
+ {
1163
+ serviceId: "<id>",
1164
+ extendPaths: [
1165
+ {
1166
+ path: "$.nested.property",
1167
+ value: {
1168
+ "TaxClassificationRef": {
1169
+ "value": "EUC-99990201-V1-00020000",
1170
+ },
1171
+ },
1172
+ },
1173
+ {
1174
+ path: "$.nested.property",
1175
+ value: {
1176
+ "TaxClassificationRef": {
1177
+ "value": "EUC-99990201-V1-00020000",
1178
+ },
1179
+ },
1180
+ },
1181
+ ],
1182
+ },
1183
+ ],
1184
+ },
1185
+ ],
1186
+ meta: {
1187
+ itemsOnPage: 50,
1188
+ cursors: {
1189
+ previous: "em9oby1jcm06OnBhZ2U6OjE=",
1190
+ current: "em9oby1jcm06OnBhZ2U6OjI=",
1191
+ next: "em9oby1jcm06OnBhZ2U6OjM=",
1192
+ },
1193
+ },
1194
+ links: {
1195
+ previous:
1196
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D",
1197
+ current: "https://unify.apideck.com/crm/companies",
1198
+ next:
1199
+ "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM",
1200
+ },
1201
+ });
1202
+ });
1203
+
1204
+ test("Invoices Accounting Invoices Add", async () => {
1205
+ const testHttpClient = createTestHTTPClient("accounting.invoicesAdd");
1206
+
1207
+ const apideck = new Apideck({
1208
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1209
+ httpClient: testHttpClient,
1210
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1211
+ });
1212
+
1213
+ const result = await apideck.accounting.invoices.create({
1214
+ consumerId: "test-consumer",
1215
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1216
+ serviceId: "salesforce",
1217
+ invoice: {
1218
+ type: "service",
1219
+ number: "OIT00546",
1220
+ customer: {
1221
+ id: "12345",
1222
+ displayName: "Windsurf Shop",
1223
+ email: "boring@boring.com",
1224
+ },
1225
+ companyId: "12345",
1226
+ invoiceDate: new Date("2020-09-30"),
1227
+ dueDate: new Date("2020-09-30"),
1228
+ terms: "Net 30 days",
1229
+ poNumber: "90000117",
1230
+ reference: "123456",
1231
+ status: "draft",
1232
+ invoiceSent: true,
1233
+ currency: "USD",
1234
+ currencyRate: 0.69,
1235
+ taxInclusive: true,
1236
+ subTotal: 27500,
1237
+ totalTax: 2500,
1238
+ taxCode: "1234",
1239
+ discountPercentage: 5.5,
1240
+ discountAmount: 25,
1241
+ total: 27500,
1242
+ balance: 27500,
1243
+ deposit: 0,
1244
+ customerMemo: "Thank you for your business and have a great day!",
1245
+ trackingCategories: [
1246
+ {
1247
+ id: "123456",
1248
+ name: "New York",
1249
+ },
1250
+ {
1251
+ id: "123456",
1252
+ name: "New York",
1253
+ },
1254
+ ],
1255
+ lineItems: [
1256
+ {
1257
+ id: "12345",
1258
+ rowId: "12345",
1259
+ code: "120-C",
1260
+ lineNumber: 1,
1261
+ description:
1262
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1263
+ type: "sales_item",
1264
+ taxAmount: 27500,
1265
+ totalAmount: 27500,
1266
+ quantity: 1,
1267
+ unitPrice: 27500.5,
1268
+ unitOfMeasure: "pc.",
1269
+ discountPercentage: 0.01,
1270
+ discountAmount: 19.99,
1271
+ locationId: "12345",
1272
+ departmentId: "12345",
1273
+ item: {
1274
+ id: "12344",
1275
+ code: "120-C",
1276
+ name: "Model Y",
1277
+ },
1278
+ taxRate: {
1279
+ id: "123456",
1280
+ rate: 10,
1281
+ },
1282
+ trackingCategories: [
1283
+ {
1284
+ id: "123456",
1285
+ name: "New York",
1286
+ },
1287
+ {
1288
+ id: "123456",
1289
+ name: "New York",
1290
+ },
1291
+ ],
1292
+ ledgerAccount: {
1293
+ id: "123456",
1294
+ nominalCode: "N091",
1295
+ code: "453",
1296
+ },
1297
+ customFields: [
1298
+ {
1299
+ id: "2389328923893298",
1300
+ name: "employee_level",
1301
+ description: "Employee Level",
1302
+ value: "Uses Salesforce and Marketo",
1303
+ },
1304
+ ],
1305
+ rowVersion: "1-12345",
1306
+ },
1307
+ {
1308
+ id: "12345",
1309
+ rowId: "12345",
1310
+ code: "120-C",
1311
+ lineNumber: 1,
1312
+ description:
1313
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1314
+ type: "sales_item",
1315
+ taxAmount: 27500,
1316
+ totalAmount: 27500,
1317
+ quantity: 1,
1318
+ unitPrice: 27500.5,
1319
+ unitOfMeasure: "pc.",
1320
+ discountPercentage: 0.01,
1321
+ discountAmount: 19.99,
1322
+ locationId: "12345",
1323
+ departmentId: "12345",
1324
+ item: {
1325
+ id: "12344",
1326
+ code: "120-C",
1327
+ name: "Model Y",
1328
+ },
1329
+ taxRate: {
1330
+ id: "123456",
1331
+ rate: 10,
1332
+ },
1333
+ trackingCategories: [
1334
+ {
1335
+ id: "123456",
1336
+ name: "New York",
1337
+ },
1338
+ {
1339
+ id: "123456",
1340
+ name: "New York",
1341
+ },
1342
+ {
1343
+ id: "123456",
1344
+ name: "New York",
1345
+ },
1346
+ ],
1347
+ ledgerAccount: {
1348
+ id: "123456",
1349
+ nominalCode: "N091",
1350
+ code: "453",
1351
+ },
1352
+ customFields: [
1353
+ {
1354
+ id: "2389328923893298",
1355
+ name: "employee_level",
1356
+ description: "Employee Level",
1357
+ value: "Uses Salesforce and Marketo",
1358
+ },
1359
+ {
1360
+ id: "2389328923893298",
1361
+ name: "employee_level",
1362
+ description: "Employee Level",
1363
+ value: 10,
1364
+ },
1365
+ {
1366
+ id: "2389328923893298",
1367
+ name: "employee_level",
1368
+ description: "Employee Level",
1369
+ value: "Uses Salesforce and Marketo",
1370
+ },
1371
+ ],
1372
+ rowVersion: "1-12345",
1373
+ },
1374
+ ],
1375
+ billingAddress: {
1376
+ id: "123",
1377
+ type: "primary",
1378
+ string: "25 Spring Street, Blackburn, VIC 3130",
1379
+ name: "HQ US",
1380
+ line1: "Main street",
1381
+ line2: "apt #",
1382
+ line3: "Suite #",
1383
+ line4: "delivery instructions",
1384
+ streetNumber: "25",
1385
+ city: "San Francisco",
1386
+ state: "CA",
1387
+ postalCode: "94104",
1388
+ country: "US",
1389
+ latitude: "40.759211",
1390
+ longitude: "-73.984638",
1391
+ county: "Santa Clara",
1392
+ contactName: "Elon Musk",
1393
+ salutation: "Mr",
1394
+ phoneNumber: "111-111-1111",
1395
+ fax: "122-111-1111",
1396
+ email: "elon@musk.com",
1397
+ website: "https://elonmusk.com",
1398
+ notes: "Address notes or delivery instructions.",
1399
+ rowVersion: "1-12345",
1400
+ },
1401
+ shippingAddress: {
1402
+ id: "123",
1403
+ type: "primary",
1404
+ string: "25 Spring Street, Blackburn, VIC 3130",
1405
+ name: "HQ US",
1406
+ line1: "Main street",
1407
+ line2: "apt #",
1408
+ line3: "Suite #",
1409
+ line4: "delivery instructions",
1410
+ streetNumber: "25",
1411
+ city: "San Francisco",
1412
+ state: "CA",
1413
+ postalCode: "94104",
1414
+ country: "US",
1415
+ latitude: "40.759211",
1416
+ longitude: "-73.984638",
1417
+ county: "Santa Clara",
1418
+ contactName: "Elon Musk",
1419
+ salutation: "Mr",
1420
+ phoneNumber: "111-111-1111",
1421
+ fax: "122-111-1111",
1422
+ email: "elon@musk.com",
1423
+ website: "https://elonmusk.com",
1424
+ notes: "Address notes or delivery instructions.",
1425
+ rowVersion: "1-12345",
1426
+ },
1427
+ templateId: "123456",
1428
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
1429
+ paymentMethod: "cash",
1430
+ channel: "email",
1431
+ language: "EN",
1432
+ accountingByRow: false,
1433
+ bankAccount: {
1434
+ bankName: "Monzo",
1435
+ accountNumber: "123465",
1436
+ accountName: "SPACEX LLC",
1437
+ accountType: "credit_card",
1438
+ iban: "CH2989144532982975332",
1439
+ bic: "AUDSCHGGXXX",
1440
+ routingNumber: "012345678",
1441
+ bsbNumber: "062-001",
1442
+ branchIdentifier: "001",
1443
+ bankCode: "BNH",
1444
+ currency: "USD",
1445
+ },
1446
+ ledgerAccount: {
1447
+ id: "123456",
1448
+ nominalCode: "N091",
1449
+ code: "453",
1450
+ },
1451
+ customFields: [
1452
+ {
1453
+ id: "2389328923893298",
1454
+ name: "employee_level",
1455
+ description: "Employee Level",
1456
+ value: {
1457
+ "0": "<value>",
1458
+ "1": "<value>",
1459
+ },
1460
+ },
1461
+ {
1462
+ id: "2389328923893298",
1463
+ name: "employee_level",
1464
+ description: "Employee Level",
1465
+ value: {
1466
+ "0": "<value>",
1467
+ "1": "<value>",
1468
+ "2": "<value>",
1469
+ },
1470
+ },
1471
+ {
1472
+ id: "2389328923893298",
1473
+ name: "employee_level",
1474
+ description: "Employee Level",
1475
+ value: true,
1476
+ },
1477
+ ],
1478
+ rowVersion: "1-12345",
1479
+ passThrough: [
1480
+ {
1481
+ serviceId: "<id>",
1482
+ extendPaths: [
1483
+ {
1484
+ path: "$.nested.property",
1485
+ value: {
1486
+ "TaxClassificationRef": {
1487
+ "value": "EUC-99990201-V1-00020000",
1488
+ },
1489
+ },
1490
+ },
1491
+ ],
1492
+ },
1493
+ ],
1494
+ },
1495
+ });
1496
+ expect(result.httpMeta.response.status).toBe(201);
1497
+ expect(result.createInvoiceResponse).toBeDefined();
1498
+ expect(result.createInvoiceResponse).toEqual({
1499
+ statusCode: 200,
1500
+ status: "OK",
1501
+ service: "xero",
1502
+ resource: "invoices",
1503
+ operation: "add",
1504
+ data: {
1505
+ id: "12345",
1506
+ downstreamId: "12345",
1507
+ },
1508
+ });
1509
+ });
1510
+
1511
+ test("Invoices Accounting Invoices One", async () => {
1512
+ const testHttpClient = createTestHTTPClient("accounting.invoicesOne");
1513
+
1514
+ const apideck = new Apideck({
1515
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1516
+ httpClient: testHttpClient,
1517
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1518
+ });
1519
+
1520
+ const result = await apideck.accounting.invoices.get({
1521
+ id: "<id>",
1522
+ consumerId: "test-consumer",
1523
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1524
+ serviceId: "salesforce",
1525
+ fields: "id,updated_at",
1526
+ });
1527
+ expect(result.httpMeta.response.status).toBe(200);
1528
+ expect(result.getInvoiceResponse).toBeDefined();
1529
+ expect(result.getInvoiceResponse).toEqual({
1530
+ statusCode: 200,
1531
+ status: "OK",
1532
+ service: "xero",
1533
+ resource: "invoices",
1534
+ operation: "one",
1535
+ data: {
1536
+ id: "12345",
1537
+ downstreamId: "12345",
1538
+ type: "service",
1539
+ number: "OIT00546",
1540
+ customer: {
1541
+ id: "12345",
1542
+ displayId: "CUST00101",
1543
+ displayName: "Windsurf Shop",
1544
+ companyName: "The boring company",
1545
+ email: "boring@boring.com",
1546
+ },
1547
+ companyId: "12345",
1548
+ invoiceDate: new Date("2020-09-30"),
1549
+ dueDate: new Date("2020-09-30"),
1550
+ terms: "Net 30 days",
1551
+ poNumber: "90000117",
1552
+ reference: "123456",
1553
+ status: "draft",
1554
+ invoiceSent: true,
1555
+ currency: "USD",
1556
+ currencyRate: 0.69,
1557
+ taxInclusive: true,
1558
+ subTotal: 27500,
1559
+ totalTax: 2500,
1560
+ taxCode: "1234",
1561
+ discountPercentage: 5.5,
1562
+ discountAmount: 25,
1563
+ total: 27500,
1564
+ balance: 27500,
1565
+ deposit: 0,
1566
+ customerMemo: "Thank you for your business and have a great day!",
1567
+ trackingCategories: [
1568
+ {
1569
+ id: "123456",
1570
+ name: "New York",
1571
+ },
1572
+ {
1573
+ id: "123456",
1574
+ name: "New York",
1575
+ },
1576
+ {
1577
+ id: "123456",
1578
+ name: "New York",
1579
+ },
1580
+ ],
1581
+ lineItems: [
1582
+ {
1583
+ id: "12345",
1584
+ rowId: "12345",
1585
+ code: "120-C",
1586
+ lineNumber: 1,
1587
+ description:
1588
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1589
+ type: "sales_item",
1590
+ taxAmount: 27500,
1591
+ totalAmount: 27500,
1592
+ quantity: 1,
1593
+ unitPrice: 27500.5,
1594
+ unitOfMeasure: "pc.",
1595
+ discountPercentage: 0.01,
1596
+ discountAmount: 19.99,
1597
+ locationId: "12345",
1598
+ departmentId: "12345",
1599
+ item: {
1600
+ id: "12344",
1601
+ code: "120-C",
1602
+ name: "Model Y",
1603
+ },
1604
+ taxRate: {
1605
+ id: "123456",
1606
+ code: "N-T",
1607
+ name: "GST on Purchases",
1608
+ rate: 10,
1609
+ },
1610
+ trackingCategories: [
1611
+ {
1612
+ id: "123456",
1613
+ name: "New York",
1614
+ },
1615
+ {
1616
+ id: "123456",
1617
+ name: "New York",
1618
+ },
1619
+ ],
1620
+ ledgerAccount: {
1621
+ id: "123456",
1622
+ name: "Bank account",
1623
+ nominalCode: "N091",
1624
+ code: "453",
1625
+ },
1626
+ customFields: [
1627
+ {
1628
+ id: "2389328923893298",
1629
+ name: "employee_level",
1630
+ description: "Employee Level",
1631
+ value: {
1632
+ "0": {},
1633
+ },
1634
+ },
1635
+ {
1636
+ id: "2389328923893298",
1637
+ name: "employee_level",
1638
+ description: "Employee Level",
1639
+ value: true,
1640
+ },
1641
+ ],
1642
+ rowVersion: "1-12345",
1643
+ updatedBy: "12345",
1644
+ createdBy: "12345",
1645
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1646
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1647
+ },
1648
+ {
1649
+ id: "12345",
1650
+ rowId: "12345",
1651
+ code: "120-C",
1652
+ lineNumber: 1,
1653
+ description:
1654
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1655
+ type: "sales_item",
1656
+ taxAmount: 27500,
1657
+ totalAmount: 27500,
1658
+ quantity: 1,
1659
+ unitPrice: 27500.5,
1660
+ unitOfMeasure: "pc.",
1661
+ discountPercentage: 0.01,
1662
+ discountAmount: 19.99,
1663
+ locationId: "12345",
1664
+ departmentId: "12345",
1665
+ item: {
1666
+ id: "12344",
1667
+ code: "120-C",
1668
+ name: "Model Y",
1669
+ },
1670
+ taxRate: {
1671
+ id: "123456",
1672
+ code: "N-T",
1673
+ name: "GST on Purchases",
1674
+ rate: 10,
1675
+ },
1676
+ trackingCategories: [
1677
+ {
1678
+ id: "123456",
1679
+ name: "New York",
1680
+ },
1681
+ ],
1682
+ ledgerAccount: {
1683
+ id: "123456",
1684
+ name: "Bank account",
1685
+ nominalCode: "N091",
1686
+ code: "453",
1687
+ },
1688
+ customFields: [
1689
+ {
1690
+ id: "2389328923893298",
1691
+ name: "employee_level",
1692
+ description: "Employee Level",
1693
+ value: {
1694
+ "0": {},
1695
+ },
1696
+ },
1697
+ ],
1698
+ rowVersion: "1-12345",
1699
+ updatedBy: "12345",
1700
+ createdBy: "12345",
1701
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1702
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1703
+ },
1704
+ ],
1705
+ billingAddress: {
1706
+ id: "123",
1707
+ type: "primary",
1708
+ string: "25 Spring Street, Blackburn, VIC 3130",
1709
+ name: "HQ US",
1710
+ line1: "Main street",
1711
+ line2: "apt #",
1712
+ line3: "Suite #",
1713
+ line4: "delivery instructions",
1714
+ streetNumber: "25",
1715
+ city: "San Francisco",
1716
+ state: "CA",
1717
+ postalCode: "94104",
1718
+ country: "US",
1719
+ latitude: "40.759211",
1720
+ longitude: "-73.984638",
1721
+ county: "Santa Clara",
1722
+ contactName: "Elon Musk",
1723
+ salutation: "Mr",
1724
+ phoneNumber: "111-111-1111",
1725
+ fax: "122-111-1111",
1726
+ email: "elon@musk.com",
1727
+ website: "https://elonmusk.com",
1728
+ notes: "Address notes or delivery instructions.",
1729
+ rowVersion: "1-12345",
1730
+ },
1731
+ shippingAddress: {
1732
+ id: "123",
1733
+ type: "primary",
1734
+ string: "25 Spring Street, Blackburn, VIC 3130",
1735
+ name: "HQ US",
1736
+ line1: "Main street",
1737
+ line2: "apt #",
1738
+ line3: "Suite #",
1739
+ line4: "delivery instructions",
1740
+ streetNumber: "25",
1741
+ city: "San Francisco",
1742
+ state: "CA",
1743
+ postalCode: "94104",
1744
+ country: "US",
1745
+ latitude: "40.759211",
1746
+ longitude: "-73.984638",
1747
+ county: "Santa Clara",
1748
+ contactName: "Elon Musk",
1749
+ salutation: "Mr",
1750
+ phoneNumber: "111-111-1111",
1751
+ fax: "122-111-1111",
1752
+ email: "elon@musk.com",
1753
+ website: "https://elonmusk.com",
1754
+ notes: "Address notes or delivery instructions.",
1755
+ rowVersion: "1-12345",
1756
+ },
1757
+ templateId: "123456",
1758
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
1759
+ paymentMethod: "cash",
1760
+ channel: "email",
1761
+ language: "EN",
1762
+ accountingByRow: false,
1763
+ bankAccount: {
1764
+ bankName: "Monzo",
1765
+ accountNumber: "123465",
1766
+ accountName: "SPACEX LLC",
1767
+ accountType: "credit_card",
1768
+ iban: "CH2989144532982975332",
1769
+ bic: "AUDSCHGGXXX",
1770
+ routingNumber: "012345678",
1771
+ bsbNumber: "062-001",
1772
+ branchIdentifier: "001",
1773
+ bankCode: "BNH",
1774
+ currency: "USD",
1775
+ },
1776
+ ledgerAccount: {
1777
+ id: "123456",
1778
+ name: "Bank account",
1779
+ nominalCode: "N091",
1780
+ code: "453",
1781
+ },
1782
+ customFields: [
1783
+ {
1784
+ id: "2389328923893298",
1785
+ name: "employee_level",
1786
+ description: "Employee Level",
1787
+ value: "Uses Salesforce and Marketo",
1788
+ },
1789
+ {
1790
+ id: "2389328923893298",
1791
+ name: "employee_level",
1792
+ description: "Employee Level",
1793
+ value: 10,
1794
+ },
1795
+ {
1796
+ id: "2389328923893298",
1797
+ name: "employee_level",
1798
+ description: "Employee Level",
1799
+ value: 10,
1800
+ },
1801
+ ],
1802
+ rowVersion: "1-12345",
1803
+ updatedBy: "12345",
1804
+ createdBy: "12345",
1805
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1806
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1807
+ passThrough: [
1808
+ {
1809
+ serviceId: "<id>",
1810
+ extendPaths: [
1811
+ {
1812
+ path: "$.nested.property",
1813
+ value: {
1814
+ "TaxClassificationRef": {
1815
+ "value": "EUC-99990201-V1-00020000",
1816
+ },
1817
+ },
1818
+ },
1819
+ {
1820
+ path: "$.nested.property",
1821
+ value: {
1822
+ "TaxClassificationRef": {
1823
+ "value": "EUC-99990201-V1-00020000",
1824
+ },
1825
+ },
1826
+ },
1827
+ ],
1828
+ },
1829
+ ],
1830
+ },
1831
+ });
1832
+ });
1833
+
1834
+ test("Invoices Accounting Invoices Update", async () => {
1835
+ const testHttpClient = createTestHTTPClient("accounting.invoicesUpdate");
1836
+
1837
+ const apideck = new Apideck({
1838
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1839
+ httpClient: testHttpClient,
1840
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1841
+ });
1842
+
1843
+ const result = await apideck.accounting.invoices.update({
1844
+ id: "<id>",
1845
+ consumerId: "test-consumer",
1846
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1847
+ serviceId: "salesforce",
1848
+ invoice: {
1849
+ type: "service",
1850
+ number: "OIT00546",
1851
+ customer: {
1852
+ id: "12345",
1853
+ displayName: "Windsurf Shop",
1854
+ email: "boring@boring.com",
1855
+ },
1856
+ companyId: "12345",
1857
+ invoiceDate: new Date("2020-09-30"),
1858
+ dueDate: new Date("2020-09-30"),
1859
+ terms: "Net 30 days",
1860
+ poNumber: "90000117",
1861
+ reference: "123456",
1862
+ status: "draft",
1863
+ invoiceSent: true,
1864
+ currency: "USD",
1865
+ currencyRate: 0.69,
1866
+ taxInclusive: true,
1867
+ subTotal: 27500,
1868
+ totalTax: 2500,
1869
+ taxCode: "1234",
1870
+ discountPercentage: 5.5,
1871
+ discountAmount: 25,
1872
+ total: 27500,
1873
+ balance: 27500,
1874
+ deposit: 0,
1875
+ customerMemo: "Thank you for your business and have a great day!",
1876
+ trackingCategories: [
1877
+ {
1878
+ id: "123456",
1879
+ name: "New York",
1880
+ },
1881
+ {
1882
+ id: "123456",
1883
+ name: "New York",
1884
+ },
1885
+ {
1886
+ id: "123456",
1887
+ name: "New York",
1888
+ },
1889
+ ],
1890
+ lineItems: [
1891
+ {
1892
+ id: "12345",
1893
+ rowId: "12345",
1894
+ code: "120-C",
1895
+ lineNumber: 1,
1896
+ description:
1897
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1898
+ type: "sales_item",
1899
+ taxAmount: 27500,
1900
+ totalAmount: 27500,
1901
+ quantity: 1,
1902
+ unitPrice: 27500.5,
1903
+ unitOfMeasure: "pc.",
1904
+ discountPercentage: 0.01,
1905
+ discountAmount: 19.99,
1906
+ locationId: "12345",
1907
+ departmentId: "12345",
1908
+ item: {
1909
+ id: "12344",
1910
+ code: "120-C",
1911
+ name: "Model Y",
1912
+ },
1913
+ taxRate: {
1914
+ id: "123456",
1915
+ rate: 10,
1916
+ },
1917
+ trackingCategories: [
1918
+ {
1919
+ id: "123456",
1920
+ name: "New York",
1921
+ },
1922
+ {
1923
+ id: "123456",
1924
+ name: "New York",
1925
+ },
1926
+ ],
1927
+ ledgerAccount: {
1928
+ id: "123456",
1929
+ nominalCode: "N091",
1930
+ code: "453",
1931
+ },
1932
+ customFields: [
1933
+ {
1934
+ id: "2389328923893298",
1935
+ name: "employee_level",
1936
+ description: "Employee Level",
1937
+ value: {},
1938
+ },
1939
+ {
1940
+ id: "2389328923893298",
1941
+ name: "employee_level",
1942
+ description: "Employee Level",
1943
+ value: true,
1944
+ },
1945
+ {
1946
+ id: "2389328923893298",
1947
+ name: "employee_level",
1948
+ description: "Employee Level",
1949
+ value: {},
1950
+ },
1951
+ ],
1952
+ rowVersion: "1-12345",
1953
+ },
1954
+ {
1955
+ id: "12345",
1956
+ rowId: "12345",
1957
+ code: "120-C",
1958
+ lineNumber: 1,
1959
+ description:
1960
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1961
+ type: "sales_item",
1962
+ taxAmount: 27500,
1963
+ totalAmount: 27500,
1964
+ quantity: 1,
1965
+ unitPrice: 27500.5,
1966
+ unitOfMeasure: "pc.",
1967
+ discountPercentage: 0.01,
1968
+ discountAmount: 19.99,
1969
+ locationId: "12345",
1970
+ departmentId: "12345",
1971
+ item: {
1972
+ id: "12344",
1973
+ code: "120-C",
1974
+ name: "Model Y",
1975
+ },
1976
+ taxRate: {
1977
+ id: "123456",
1978
+ rate: 10,
1979
+ },
1980
+ trackingCategories: [
1981
+ {
1982
+ id: "123456",
1983
+ name: "New York",
1984
+ },
1985
+ {
1986
+ id: "123456",
1987
+ name: "New York",
1988
+ },
1989
+ {
1990
+ id: "123456",
1991
+ name: "New York",
1992
+ },
1993
+ ],
1994
+ ledgerAccount: {
1995
+ id: "123456",
1996
+ nominalCode: "N091",
1997
+ code: "453",
1998
+ },
1999
+ customFields: [
2000
+ {
2001
+ id: "2389328923893298",
2002
+ name: "employee_level",
2003
+ description: "Employee Level",
2004
+ value: 10,
2005
+ },
2006
+ {
2007
+ id: "2389328923893298",
2008
+ name: "employee_level",
2009
+ description: "Employee Level",
2010
+ value: 10,
2011
+ },
2012
+ ],
2013
+ rowVersion: "1-12345",
2014
+ },
2015
+ ],
2016
+ billingAddress: {
2017
+ id: "123",
2018
+ type: "primary",
2019
+ string: "25 Spring Street, Blackburn, VIC 3130",
2020
+ name: "HQ US",
2021
+ line1: "Main street",
2022
+ line2: "apt #",
2023
+ line3: "Suite #",
2024
+ line4: "delivery instructions",
2025
+ streetNumber: "25",
2026
+ city: "San Francisco",
2027
+ state: "CA",
2028
+ postalCode: "94104",
2029
+ country: "US",
2030
+ latitude: "40.759211",
2031
+ longitude: "-73.984638",
2032
+ county: "Santa Clara",
2033
+ contactName: "Elon Musk",
2034
+ salutation: "Mr",
2035
+ phoneNumber: "111-111-1111",
2036
+ fax: "122-111-1111",
2037
+ email: "elon@musk.com",
2038
+ website: "https://elonmusk.com",
2039
+ notes: "Address notes or delivery instructions.",
2040
+ rowVersion: "1-12345",
2041
+ },
2042
+ shippingAddress: {
2043
+ id: "123",
2044
+ type: "primary",
2045
+ string: "25 Spring Street, Blackburn, VIC 3130",
2046
+ name: "HQ US",
2047
+ line1: "Main street",
2048
+ line2: "apt #",
2049
+ line3: "Suite #",
2050
+ line4: "delivery instructions",
2051
+ streetNumber: "25",
2052
+ city: "San Francisco",
2053
+ state: "CA",
2054
+ postalCode: "94104",
2055
+ country: "US",
2056
+ latitude: "40.759211",
2057
+ longitude: "-73.984638",
2058
+ county: "Santa Clara",
2059
+ contactName: "Elon Musk",
2060
+ salutation: "Mr",
2061
+ phoneNumber: "111-111-1111",
2062
+ fax: "122-111-1111",
2063
+ email: "elon@musk.com",
2064
+ website: "https://elonmusk.com",
2065
+ notes: "Address notes or delivery instructions.",
2066
+ rowVersion: "1-12345",
2067
+ },
2068
+ templateId: "123456",
2069
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
2070
+ paymentMethod: "cash",
2071
+ channel: "email",
2072
+ language: "EN",
2073
+ accountingByRow: false,
2074
+ bankAccount: {
2075
+ bankName: "Monzo",
2076
+ accountNumber: "123465",
2077
+ accountName: "SPACEX LLC",
2078
+ accountType: "credit_card",
2079
+ iban: "CH2989144532982975332",
2080
+ bic: "AUDSCHGGXXX",
2081
+ routingNumber: "012345678",
2082
+ bsbNumber: "062-001",
2083
+ branchIdentifier: "001",
2084
+ bankCode: "BNH",
2085
+ currency: "USD",
2086
+ },
2087
+ ledgerAccount: {
2088
+ id: "123456",
2089
+ nominalCode: "N091",
2090
+ code: "453",
2091
+ },
2092
+ customFields: [
2093
+ {
2094
+ id: "2389328923893298",
2095
+ name: "employee_level",
2096
+ description: "Employee Level",
2097
+ value: {
2098
+ "0": "<value>",
2099
+ "1": "<value>",
2100
+ "2": "<value>",
2101
+ },
2102
+ },
2103
+ ],
2104
+ rowVersion: "1-12345",
2105
+ passThrough: [
2106
+ {
2107
+ serviceId: "<id>",
2108
+ extendPaths: [
2109
+ {
2110
+ path: "$.nested.property",
2111
+ value: {
2112
+ "TaxClassificationRef": {
2113
+ "value": "EUC-99990201-V1-00020000",
2114
+ },
2115
+ },
2116
+ },
2117
+ {
2118
+ path: "$.nested.property",
2119
+ value: {
2120
+ "TaxClassificationRef": {
2121
+ "value": "EUC-99990201-V1-00020000",
2122
+ },
2123
+ },
2124
+ },
2125
+ ],
2126
+ },
2127
+ ],
2128
+ },
2129
+ });
2130
+ expect(result.httpMeta.response.status).toBe(200);
2131
+ expect(result.updateInvoiceResponse).toBeDefined();
2132
+ expect(result.updateInvoiceResponse).toEqual({
2133
+ statusCode: 200,
2134
+ status: "OK",
2135
+ service: "xero",
2136
+ resource: "invoices",
2137
+ operation: "update",
2138
+ data: {
2139
+ id: "12345",
2140
+ downstreamId: "12345",
2141
+ },
2142
+ });
2143
+ });
2144
+
2145
+ test("Invoices Accounting Invoices Delete", async () => {
2146
+ const testHttpClient = createTestHTTPClient("accounting.invoicesDelete");
2147
+
2148
+ const apideck = new Apideck({
2149
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
2150
+ httpClient: testHttpClient,
2151
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
2152
+ });
2153
+
2154
+ const result = await apideck.accounting.invoices.delete({
2155
+ id: "<id>",
2156
+ consumerId: "test-consumer",
2157
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
2158
+ serviceId: "salesforce",
2159
+ });
2160
+ expect(result.httpMeta.response.status).toBe(200);
2161
+ expect(result.deleteInvoiceResponse).toBeDefined();
2162
+ expect(result.deleteInvoiceResponse).toEqual({
2163
+ statusCode: 200,
2164
+ status: "OK",
2165
+ service: "xero",
2166
+ resource: "invoices",
2167
+ operation: "delete",
2168
+ data: {
2169
+ id: "12345",
2170
+ downstreamId: "12345",
2171
+ },
2172
+ });
2173
+ });