@apideck/unify 0.27.0 → 0.28.1

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 (192) hide show
  1. package/README.md +5 -5
  2. package/docs/sdks/categories/README.md +12 -0
  3. package/docs/sdks/companies/README.md +4 -4
  4. package/examples/README.md +26 -0
  5. package/examples/accountingTaxRatesList.example.ts +41 -0
  6. package/examples/package-lock.json +613 -0
  7. package/examples/package.json +18 -0
  8. package/funcs/accountingCategoriesGet.d.ts.map +1 -1
  9. package/funcs/accountingCategoriesGet.js +4 -2
  10. package/funcs/accountingCategoriesGet.js.map +1 -1
  11. package/funcs/accountingCategoriesList.d.ts.map +1 -1
  12. package/funcs/accountingCategoriesList.js +4 -2
  13. package/funcs/accountingCategoriesList.js.map +1 -1
  14. package/funcs/crmCompaniesCreate.js +1 -1
  15. package/funcs/crmCompaniesCreate.js.map +1 -1
  16. package/funcs/crmCompaniesUpdate.js +1 -1
  17. package/funcs/crmCompaniesUpdate.js.map +1 -1
  18. package/jsr.json +1 -1
  19. package/lib/config.d.ts +4 -4
  20. package/lib/config.js +4 -4
  21. package/models/components/balancesheetfilter.d.ts +5 -0
  22. package/models/components/balancesheetfilter.d.ts.map +1 -1
  23. package/models/components/balancesheetfilter.js +4 -0
  24. package/models/components/balancesheetfilter.js.map +1 -1
  25. package/models/components/bankaccount.d.ts +5 -0
  26. package/models/components/bankaccount.d.ts.map +1 -1
  27. package/models/components/bankaccount.js +2 -0
  28. package/models/components/bankaccount.js.map +1 -1
  29. package/models/components/bankaccount1.d.ts +123 -0
  30. package/models/components/bankaccount1.d.ts.map +1 -0
  31. package/models/components/bankaccount1.js +128 -0
  32. package/models/components/bankaccount1.js.map +1 -0
  33. package/models/components/categoriesfilter.d.ts +67 -0
  34. package/models/components/categoriesfilter.d.ts.map +1 -0
  35. package/models/components/categoriesfilter.js +82 -0
  36. package/models/components/categoriesfilter.js.map +1 -0
  37. package/models/components/category.d.ts +39 -0
  38. package/models/components/category.d.ts.map +1 -1
  39. package/models/components/category.js +26 -1
  40. package/models/components/category.js.map +1 -1
  41. package/models/components/{company.d.ts → company1.d.ts} +32 -32
  42. package/models/components/company1.d.ts.map +1 -0
  43. package/models/components/{company.js → company1.js} +37 -37
  44. package/models/components/company1.js.map +1 -0
  45. package/models/components/companyinfo.d.ts +5 -0
  46. package/models/components/companyinfo.d.ts.map +1 -1
  47. package/models/components/companyinfo.js +4 -0
  48. package/models/components/companyinfo.js.map +1 -1
  49. package/models/components/connection.d.ts +13 -13
  50. package/models/components/connection.d.ts.map +1 -1
  51. package/models/components/connection.js +16 -17
  52. package/models/components/connection.js.map +1 -1
  53. package/models/components/customfield.d.ts +37 -38
  54. package/models/components/customfield.d.ts.map +1 -1
  55. package/models/components/customfield.js +25 -54
  56. package/models/components/customfield.js.map +1 -1
  57. package/models/components/getcompaniesresponse.d.ts +3 -3
  58. package/models/components/getcompaniesresponse.d.ts.map +1 -1
  59. package/models/components/getcompaniesresponse.js +3 -3
  60. package/models/components/getcompaniesresponse.js.map +1 -1
  61. package/models/components/getcompanyresponse.d.ts +3 -3
  62. package/models/components/getcompanyresponse.d.ts.map +1 -1
  63. package/models/components/getcompanyresponse.js +3 -3
  64. package/models/components/getcompanyresponse.js.map +1 -1
  65. package/models/components/index.d.ts +3 -1
  66. package/models/components/index.d.ts.map +1 -1
  67. package/models/components/index.js +3 -1
  68. package/models/components/index.js.map +1 -1
  69. package/models/components/invoicelineitem.d.ts +10 -0
  70. package/models/components/invoicelineitem.d.ts.map +1 -1
  71. package/models/components/invoicelineitem.js +8 -0
  72. package/models/components/invoicelineitem.js.map +1 -1
  73. package/models/components/profitandlossfilter.d.ts +5 -0
  74. package/models/components/profitandlossfilter.d.ts.map +1 -1
  75. package/models/components/profitandlossfilter.js +4 -0
  76. package/models/components/profitandlossfilter.js.map +1 -1
  77. package/models/components/simpleformfieldoption.d.ts +13 -13
  78. package/models/components/simpleformfieldoption.d.ts.map +1 -1
  79. package/models/components/simpleformfieldoption.js +16 -16
  80. package/models/components/simpleformfieldoption.js.map +1 -1
  81. package/models/components/supplier.d.ts +10 -0
  82. package/models/components/supplier.d.ts.map +1 -1
  83. package/models/components/supplier.js +4 -0
  84. package/models/components/supplier.js.map +1 -1
  85. package/models/errors/apierror.d.ts.map +1 -1
  86. package/models/errors/apierror.js +8 -2
  87. package/models/errors/apierror.js.map +1 -1
  88. package/models/errors/badrequestresponse.js +1 -1
  89. package/models/errors/badrequestresponse.js.map +1 -1
  90. package/models/errors/notfoundresponse.js +1 -1
  91. package/models/errors/notfoundresponse.js.map +1 -1
  92. package/models/errors/paymentrequiredresponse.js +1 -1
  93. package/models/errors/paymentrequiredresponse.js.map +1 -1
  94. package/models/errors/unauthorizedresponse.js +1 -1
  95. package/models/errors/unauthorizedresponse.js.map +1 -1
  96. package/models/errors/unprocessableresponse.js +1 -1
  97. package/models/errors/unprocessableresponse.js.map +1 -1
  98. package/models/operations/accountingcategoriesall.d.ts +5 -0
  99. package/models/operations/accountingcategoriesall.d.ts.map +1 -1
  100. package/models/operations/accountingcategoriesall.js +2 -0
  101. package/models/operations/accountingcategoriesall.js.map +1 -1
  102. package/models/operations/accountingcategoriesone.d.ts +5 -0
  103. package/models/operations/accountingcategoriesone.d.ts.map +1 -1
  104. package/models/operations/accountingcategoriesone.js +2 -0
  105. package/models/operations/accountingcategoriesone.js.map +1 -1
  106. package/models/operations/crmcompaniesadd.d.ts +2 -2
  107. package/models/operations/crmcompaniesadd.d.ts.map +1 -1
  108. package/models/operations/crmcompaniesadd.js +4 -4
  109. package/models/operations/crmcompaniesadd.js.map +1 -1
  110. package/models/operations/crmcompaniesupdate.d.ts +2 -2
  111. package/models/operations/crmcompaniesupdate.d.ts.map +1 -1
  112. package/models/operations/crmcompaniesupdate.js +4 -4
  113. package/models/operations/crmcompaniesupdate.js.map +1 -1
  114. package/package.json +2 -2
  115. package/src/__tests__/activities.test.ts +364 -13
  116. package/src/__tests__/apideckcompanies.test.ts +373 -9
  117. package/src/__tests__/apideckdepartments.test.ts +181 -9
  118. package/src/__tests__/applicants.test.ts +473 -9
  119. package/src/__tests__/applications.test.ts +189 -9
  120. package/src/__tests__/bankfeedaccounts.test.ts +4 -4
  121. package/src/__tests__/billpayments.test.ts +378 -20
  122. package/src/__tests__/bills.test.ts +500 -9
  123. package/src/__tests__/collectionticketcomments.test.ts +183 -7
  124. package/src/__tests__/collectiontickets.test.ts +191 -7
  125. package/src/__tests__/companies.test.ts +607 -78
  126. package/src/__tests__/connections.test.ts +409 -5
  127. package/src/__tests__/connectionsettings.test.ts +410 -5
  128. package/src/__tests__/contacts.test.ts +470 -13
  129. package/src/__tests__/creditnotes.test.ts +819 -148
  130. package/src/__tests__/customers.test.ts +517 -13
  131. package/src/__tests__/customobjects.test.ts +150 -9
  132. package/src/__tests__/customobjectschemas.test.ts +321 -9
  133. package/src/__tests__/departments.test.ts +173 -9
  134. package/src/__tests__/drivegroups.test.ts +181 -9
  135. package/src/__tests__/drives.test.ts +179 -9
  136. package/src/__tests__/employees.test.ts +829 -94
  137. package/src/__tests__/expenses.test.ts +338 -15
  138. package/src/__tests__/files.test.ts +106 -5
  139. package/src/__tests__/folders.test.ts +296 -13
  140. package/src/__tests__/invoiceitems.test.ts +272 -9
  141. package/src/__tests__/invoices.test.ts +695 -89
  142. package/src/__tests__/journalentries.test.ts +490 -8
  143. package/src/__tests__/leads.test.ts +450 -13
  144. package/src/__tests__/ledgeraccounts.test.ts +248 -19
  145. package/src/__tests__/locations.test.ts +298 -9
  146. package/src/__tests__/messages.test.ts +195 -9
  147. package/src/__tests__/notes.test.ts +191 -9
  148. package/src/__tests__/opportunities.test.ts +218 -9
  149. package/src/__tests__/payments.test.ts +323 -20
  150. package/src/__tests__/pipelines.test.ts +194 -9
  151. package/src/__tests__/purchaseorders.test.ts +847 -178
  152. package/src/__tests__/sharedlinks.test.ts +183 -9
  153. package/src/__tests__/subsidiaries.test.ts +183 -9
  154. package/src/__tests__/suppliers.test.ts +509 -13
  155. package/src/__tests__/taxrates.test.ts +235 -12
  156. package/src/__tests__/timeoffrequests.test.ts +210 -9
  157. package/src/__tests__/trackingcategories.test.ts +187 -7
  158. package/src/__tests__/uploadsessions.test.ts +78 -5
  159. package/src/__tests__/users.test.ts +356 -9
  160. package/src/funcs/accountingCategoriesGet.ts +15 -5
  161. package/src/funcs/accountingCategoriesList.ts +17 -7
  162. package/src/funcs/crmCompaniesCreate.ts +1 -1
  163. package/src/funcs/crmCompaniesUpdate.ts +1 -1
  164. package/src/lib/config.ts +4 -4
  165. package/src/models/components/balancesheetfilter.ts +9 -0
  166. package/src/models/components/bankaccount.ts +7 -0
  167. package/src/models/components/bankaccount1.ts +207 -0
  168. package/src/models/components/categoriesfilter.ts +104 -0
  169. package/src/models/components/category.ts +39 -0
  170. package/src/models/components/{company.ts → company1.ts} +131 -128
  171. package/src/models/components/companyinfo.ts +9 -0
  172. package/src/models/components/connection.ts +27 -20
  173. package/src/models/components/customfield.ts +51 -83
  174. package/src/models/components/getcompaniesresponse.ts +9 -9
  175. package/src/models/components/getcompanyresponse.ts +9 -9
  176. package/src/models/components/index.ts +3 -1
  177. package/src/models/components/invoicelineitem.ts +18 -0
  178. package/src/models/components/profitandlossfilter.ts +9 -0
  179. package/src/models/components/simpleformfieldoption.ts +21 -18
  180. package/src/models/components/supplier.ts +14 -0
  181. package/src/models/errors/apierror.ts +8 -2
  182. package/src/models/errors/badrequestresponse.ts +1 -1
  183. package/src/models/errors/notfoundresponse.ts +1 -1
  184. package/src/models/errors/paymentrequiredresponse.ts +1 -1
  185. package/src/models/errors/unauthorizedresponse.ts +1 -1
  186. package/src/models/errors/unprocessableresponse.ts +1 -1
  187. package/src/models/operations/accountingcategoriesall.ts +7 -0
  188. package/src/models/operations/accountingcategoriesone.ts +7 -0
  189. package/src/models/operations/crmcompaniesadd.ts +6 -6
  190. package/src/models/operations/crmcompaniesupdate.ts +6 -6
  191. package/models/components/company.d.ts.map +0 -1
  192. package/models/components/company.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
- import { assert, expect, it, test } from "vitest";
5
+ import { expect, test } from "vitest";
6
6
  import { Apideck } from "../index.js";
7
7
  import { RFCDate } from "../types/index.js";
8
8
  import { createTestHTTPClient } from "./testclient.js";
@@ -560,9 +560,9 @@ test("Invoices Accounting Invoices All", async () => {
560
560
  id: "2389328923893298",
561
561
  name: "employee_level",
562
562
  description: "Employee Level",
563
- value: [
564
- {},
565
- ],
563
+ value: {
564
+ "0": {},
565
+ },
566
566
  },
567
567
  ],
568
568
  rowVersion: "1-12345",
@@ -943,11 +943,11 @@ test("Invoices Accounting Invoices All", async () => {
943
943
  id: "2389328923893298",
944
944
  name: "employee_level",
945
945
  description: "Employee Level",
946
- value: [
947
- {},
948
- {},
949
- {},
950
- ],
946
+ value: {
947
+ "0": {},
948
+ "1": {},
949
+ "2": {},
950
+ },
951
951
  },
952
952
  ],
953
953
  rowVersion: "1-12345",
@@ -1007,11 +1007,11 @@ test("Invoices Accounting Invoices All", async () => {
1007
1007
  id: "2389328923893298",
1008
1008
  name: "employee_level",
1009
1009
  description: "Employee Level",
1010
- value: [
1011
- {},
1012
- {},
1013
- {},
1014
- ],
1010
+ value: {
1011
+ "0": {},
1012
+ "1": {},
1013
+ "2": {},
1014
+ },
1015
1015
  },
1016
1016
  {
1017
1017
  id: "2389328923893298",
@@ -1202,14 +1202,8 @@ test("Invoices Accounting Invoices All", async () => {
1202
1202
  });
1203
1203
  });
1204
1204
 
1205
- it.skip("Invoices Accounting Invoices Add", async () => {
1206
- assert.fail(
1207
- "incomplete test found please make sure to address the following errors: [`workflow step accounting.invoicesAdd.test referencing operation accounting.invoicesAdd with expression in requestBody with type not currently supported`]",
1208
- );
1209
- });
1210
-
1211
- test("Invoices Accounting Invoices One", async () => {
1212
- const testHttpClient = createTestHTTPClient("accounting.invoicesOne");
1205
+ test("Invoices Accounting Invoices Add", async () => {
1206
+ const testHttpClient = createTestHTTPClient("accounting.invoicesAdd");
1213
1207
 
1214
1208
  const apideck = new Apideck({
1215
1209
  serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
@@ -1217,31 +1211,16 @@ test("Invoices Accounting Invoices One", async () => {
1217
1211
  apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1218
1212
  });
1219
1213
 
1220
- const result = await apideck.accounting.invoices.get({
1221
- id: "<id>",
1214
+ const result = await apideck.accounting.invoices.create({
1222
1215
  consumerId: "test-consumer",
1223
1216
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1224
1217
  serviceId: "salesforce",
1225
- fields: "id,updated_at",
1226
- });
1227
- expect(result.httpMeta.response.status).toBe(200);
1228
- expect(result.getInvoiceResponse).toBeDefined();
1229
- expect(result.getInvoiceResponse).toEqual({
1230
- statusCode: 200,
1231
- status: "OK",
1232
- service: "xero",
1233
- resource: "invoices",
1234
- operation: "one",
1235
- data: {
1236
- id: "12345",
1237
- downstreamId: "12345",
1218
+ invoice: {
1238
1219
  type: "service",
1239
1220
  number: "OIT00546",
1240
1221
  customer: {
1241
1222
  id: "12345",
1242
- displayId: "CUST00101",
1243
1223
  displayName: "Windsurf Shop",
1244
- companyName: "The boring company",
1245
1224
  email: "boring@boring.com",
1246
1225
  },
1247
1226
  companyId: "12345",
@@ -1273,10 +1252,6 @@ test("Invoices Accounting Invoices One", async () => {
1273
1252
  id: "123456",
1274
1253
  name: "New York",
1275
1254
  },
1276
- {
1277
- id: "123456",
1278
- name: "New York",
1279
- },
1280
1255
  ],
1281
1256
  lineItems: [
1282
1257
  {
@@ -1303,8 +1278,6 @@ test("Invoices Accounting Invoices One", async () => {
1303
1278
  },
1304
1279
  taxRate: {
1305
1280
  id: "123456",
1306
- code: "N-T",
1307
- name: "GST on Purchases",
1308
1281
  rate: 10,
1309
1282
  },
1310
1283
  trackingCategories: [
@@ -1319,7 +1292,6 @@ test("Invoices Accounting Invoices One", async () => {
1319
1292
  ],
1320
1293
  ledgerAccount: {
1321
1294
  id: "123456",
1322
- name: "Bank account",
1323
1295
  nominalCode: "N091",
1324
1296
  code: "453",
1325
1297
  },
@@ -1328,22 +1300,10 @@ test("Invoices Accounting Invoices One", async () => {
1328
1300
  id: "2389328923893298",
1329
1301
  name: "employee_level",
1330
1302
  description: "Employee Level",
1331
- value: [
1332
- {},
1333
- ],
1334
- },
1335
- {
1336
- id: "2389328923893298",
1337
- name: "employee_level",
1338
- description: "Employee Level",
1339
- value: true,
1303
+ value: "Uses Salesforce and Marketo",
1340
1304
  },
1341
1305
  ],
1342
1306
  rowVersion: "1-12345",
1343
- updatedBy: "12345",
1344
- createdBy: "12345",
1345
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1346
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1347
1307
  },
1348
1308
  {
1349
1309
  id: "12345",
@@ -1369,8 +1329,6 @@ test("Invoices Accounting Invoices One", async () => {
1369
1329
  },
1370
1330
  taxRate: {
1371
1331
  id: "123456",
1372
- code: "N-T",
1373
- name: "GST on Purchases",
1374
1332
  rate: 10,
1375
1333
  },
1376
1334
  trackingCategories: [
@@ -1378,10 +1336,17 @@ test("Invoices Accounting Invoices One", async () => {
1378
1336
  id: "123456",
1379
1337
  name: "New York",
1380
1338
  },
1339
+ {
1340
+ id: "123456",
1341
+ name: "New York",
1342
+ },
1343
+ {
1344
+ id: "123456",
1345
+ name: "New York",
1346
+ },
1381
1347
  ],
1382
1348
  ledgerAccount: {
1383
1349
  id: "123456",
1384
- name: "Bank account",
1385
1350
  nominalCode: "N091",
1386
1351
  code: "453",
1387
1352
  },
@@ -1390,16 +1355,22 @@ test("Invoices Accounting Invoices One", async () => {
1390
1355
  id: "2389328923893298",
1391
1356
  name: "employee_level",
1392
1357
  description: "Employee Level",
1393
- value: [
1394
- {},
1395
- ],
1358
+ value: "Uses Salesforce and Marketo",
1359
+ },
1360
+ {
1361
+ id: "2389328923893298",
1362
+ name: "employee_level",
1363
+ description: "Employee Level",
1364
+ value: 10,
1365
+ },
1366
+ {
1367
+ id: "2389328923893298",
1368
+ name: "employee_level",
1369
+ description: "Employee Level",
1370
+ value: "Uses Salesforce and Marketo",
1396
1371
  },
1397
1372
  ],
1398
1373
  rowVersion: "1-12345",
1399
- updatedBy: "12345",
1400
- createdBy: "12345",
1401
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1402
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1403
1374
  },
1404
1375
  ],
1405
1376
  billingAddress: {
@@ -1475,7 +1446,6 @@ test("Invoices Accounting Invoices One", async () => {
1475
1446
  },
1476
1447
  ledgerAccount: {
1477
1448
  id: "123456",
1478
- name: "Bank account",
1479
1449
  nominalCode: "N091",
1480
1450
  code: "453",
1481
1451
  },
@@ -1484,26 +1454,29 @@ test("Invoices Accounting Invoices One", async () => {
1484
1454
  id: "2389328923893298",
1485
1455
  name: "employee_level",
1486
1456
  description: "Employee Level",
1487
- value: "Uses Salesforce and Marketo",
1457
+ value: {
1458
+ "0": "<value>",
1459
+ "1": "<value>",
1460
+ },
1488
1461
  },
1489
1462
  {
1490
1463
  id: "2389328923893298",
1491
1464
  name: "employee_level",
1492
1465
  description: "Employee Level",
1493
- value: 10,
1466
+ value: {
1467
+ "0": "<value>",
1468
+ "1": "<value>",
1469
+ "2": "<value>",
1470
+ },
1494
1471
  },
1495
1472
  {
1496
1473
  id: "2389328923893298",
1497
1474
  name: "employee_level",
1498
1475
  description: "Employee Level",
1499
- value: 10,
1476
+ value: true,
1500
1477
  },
1501
1478
  ],
1502
1479
  rowVersion: "1-12345",
1503
- updatedBy: "12345",
1504
- createdBy: "12345",
1505
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1506
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1507
1480
  passThrough: [
1508
1481
  {
1509
1482
  serviceId: "<id>",
@@ -1516,25 +1489,658 @@ test("Invoices Accounting Invoices One", async () => {
1516
1489
  },
1517
1490
  },
1518
1491
  },
1519
- {
1520
- path: "$.nested.property",
1521
- value: {
1522
- "TaxClassificationRef": {
1523
- "value": "EUC-99990201-V1-00020000",
1524
- },
1525
- },
1526
- },
1527
1492
  ],
1528
1493
  },
1529
1494
  ],
1530
1495
  },
1531
1496
  });
1497
+ expect(result.httpMeta.response.status).toBe(201);
1498
+ expect(result.createInvoiceResponse).toBeDefined();
1499
+ expect(result.createInvoiceResponse).toEqual({
1500
+ statusCode: 200,
1501
+ status: "OK",
1502
+ service: "xero",
1503
+ resource: "invoices",
1504
+ operation: "add",
1505
+ data: {
1506
+ id: "12345",
1507
+ downstreamId: "12345",
1508
+ },
1509
+ });
1532
1510
  });
1533
1511
 
1534
- it.skip("Invoices Accounting Invoices Update", async () => {
1535
- assert.fail(
1536
- "incomplete test found please make sure to address the following errors: [`workflow step accounting.invoicesUpdate.test referencing operation accounting.invoicesUpdate with expression in requestBody with type not currently supported`, `workflow step accounting.invoicesUpdate.test referencing operation accounting.invoicesUpdate with expression in requestBody with type not currently supported`]",
1537
- );
1512
+ test("Invoices Accounting Invoices One", async () => {
1513
+ const testHttpClient = createTestHTTPClient("accounting.invoicesOne");
1514
+
1515
+ const apideck = new Apideck({
1516
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1517
+ httpClient: testHttpClient,
1518
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1519
+ });
1520
+
1521
+ const result = await apideck.accounting.invoices.get({
1522
+ id: "<id>",
1523
+ consumerId: "test-consumer",
1524
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1525
+ serviceId: "salesforce",
1526
+ fields: "id,updated_at",
1527
+ });
1528
+ expect(result.httpMeta.response.status).toBe(200);
1529
+ expect(result.getInvoiceResponse).toBeDefined();
1530
+ expect(result.getInvoiceResponse).toEqual({
1531
+ statusCode: 200,
1532
+ status: "OK",
1533
+ service: "xero",
1534
+ resource: "invoices",
1535
+ operation: "one",
1536
+ data: {
1537
+ id: "12345",
1538
+ downstreamId: "12345",
1539
+ type: "service",
1540
+ number: "OIT00546",
1541
+ customer: {
1542
+ id: "12345",
1543
+ displayId: "CUST00101",
1544
+ displayName: "Windsurf Shop",
1545
+ companyName: "The boring company",
1546
+ email: "boring@boring.com",
1547
+ },
1548
+ companyId: "12345",
1549
+ invoiceDate: new RFCDate("2020-09-30"),
1550
+ dueDate: new RFCDate("2020-09-30"),
1551
+ terms: "Net 30 days",
1552
+ poNumber: "90000117",
1553
+ reference: "123456",
1554
+ status: "draft",
1555
+ invoiceSent: true,
1556
+ currency: "USD",
1557
+ currencyRate: 0.69,
1558
+ taxInclusive: true,
1559
+ subTotal: 27500,
1560
+ totalTax: 2500,
1561
+ taxCode: "1234",
1562
+ discountPercentage: 5.5,
1563
+ discountAmount: 25,
1564
+ total: 27500,
1565
+ balance: 27500,
1566
+ deposit: 0,
1567
+ customerMemo: "Thank you for your business and have a great day!",
1568
+ trackingCategories: [
1569
+ {
1570
+ id: "123456",
1571
+ name: "New York",
1572
+ },
1573
+ {
1574
+ id: "123456",
1575
+ name: "New York",
1576
+ },
1577
+ {
1578
+ id: "123456",
1579
+ name: "New York",
1580
+ },
1581
+ ],
1582
+ lineItems: [
1583
+ {
1584
+ id: "12345",
1585
+ rowId: "12345",
1586
+ code: "120-C",
1587
+ lineNumber: 1,
1588
+ description:
1589
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1590
+ type: "sales_item",
1591
+ taxAmount: 27500,
1592
+ totalAmount: 27500,
1593
+ quantity: 1,
1594
+ unitPrice: 27500.5,
1595
+ unitOfMeasure: "pc.",
1596
+ discountPercentage: 0.01,
1597
+ discountAmount: 19.99,
1598
+ locationId: "12345",
1599
+ departmentId: "12345",
1600
+ item: {
1601
+ id: "12344",
1602
+ code: "120-C",
1603
+ name: "Model Y",
1604
+ },
1605
+ taxRate: {
1606
+ id: "123456",
1607
+ code: "N-T",
1608
+ name: "GST on Purchases",
1609
+ rate: 10,
1610
+ },
1611
+ trackingCategories: [
1612
+ {
1613
+ id: "123456",
1614
+ name: "New York",
1615
+ },
1616
+ {
1617
+ id: "123456",
1618
+ name: "New York",
1619
+ },
1620
+ ],
1621
+ ledgerAccount: {
1622
+ id: "123456",
1623
+ name: "Bank account",
1624
+ nominalCode: "N091",
1625
+ code: "453",
1626
+ },
1627
+ customFields: [
1628
+ {
1629
+ id: "2389328923893298",
1630
+ name: "employee_level",
1631
+ description: "Employee Level",
1632
+ value: {
1633
+ "0": {},
1634
+ },
1635
+ },
1636
+ {
1637
+ id: "2389328923893298",
1638
+ name: "employee_level",
1639
+ description: "Employee Level",
1640
+ value: true,
1641
+ },
1642
+ ],
1643
+ rowVersion: "1-12345",
1644
+ updatedBy: "12345",
1645
+ createdBy: "12345",
1646
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1647
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1648
+ },
1649
+ {
1650
+ id: "12345",
1651
+ rowId: "12345",
1652
+ code: "120-C",
1653
+ lineNumber: 1,
1654
+ description:
1655
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1656
+ type: "sales_item",
1657
+ taxAmount: 27500,
1658
+ totalAmount: 27500,
1659
+ quantity: 1,
1660
+ unitPrice: 27500.5,
1661
+ unitOfMeasure: "pc.",
1662
+ discountPercentage: 0.01,
1663
+ discountAmount: 19.99,
1664
+ locationId: "12345",
1665
+ departmentId: "12345",
1666
+ item: {
1667
+ id: "12344",
1668
+ code: "120-C",
1669
+ name: "Model Y",
1670
+ },
1671
+ taxRate: {
1672
+ id: "123456",
1673
+ code: "N-T",
1674
+ name: "GST on Purchases",
1675
+ rate: 10,
1676
+ },
1677
+ trackingCategories: [
1678
+ {
1679
+ id: "123456",
1680
+ name: "New York",
1681
+ },
1682
+ ],
1683
+ ledgerAccount: {
1684
+ id: "123456",
1685
+ name: "Bank account",
1686
+ nominalCode: "N091",
1687
+ code: "453",
1688
+ },
1689
+ customFields: [
1690
+ {
1691
+ id: "2389328923893298",
1692
+ name: "employee_level",
1693
+ description: "Employee Level",
1694
+ value: {
1695
+ "0": {},
1696
+ },
1697
+ },
1698
+ ],
1699
+ rowVersion: "1-12345",
1700
+ updatedBy: "12345",
1701
+ createdBy: "12345",
1702
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1703
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1704
+ },
1705
+ ],
1706
+ billingAddress: {
1707
+ id: "123",
1708
+ type: "primary",
1709
+ string: "25 Spring Street, Blackburn, VIC 3130",
1710
+ name: "HQ US",
1711
+ line1: "Main street",
1712
+ line2: "apt #",
1713
+ line3: "Suite #",
1714
+ line4: "delivery instructions",
1715
+ streetNumber: "25",
1716
+ city: "San Francisco",
1717
+ state: "CA",
1718
+ postalCode: "94104",
1719
+ country: "US",
1720
+ latitude: "40.759211",
1721
+ longitude: "-73.984638",
1722
+ county: "Santa Clara",
1723
+ contactName: "Elon Musk",
1724
+ salutation: "Mr",
1725
+ phoneNumber: "111-111-1111",
1726
+ fax: "122-111-1111",
1727
+ email: "elon@musk.com",
1728
+ website: "https://elonmusk.com",
1729
+ notes: "Address notes or delivery instructions.",
1730
+ rowVersion: "1-12345",
1731
+ },
1732
+ shippingAddress: {
1733
+ id: "123",
1734
+ type: "primary",
1735
+ string: "25 Spring Street, Blackburn, VIC 3130",
1736
+ name: "HQ US",
1737
+ line1: "Main street",
1738
+ line2: "apt #",
1739
+ line3: "Suite #",
1740
+ line4: "delivery instructions",
1741
+ streetNumber: "25",
1742
+ city: "San Francisco",
1743
+ state: "CA",
1744
+ postalCode: "94104",
1745
+ country: "US",
1746
+ latitude: "40.759211",
1747
+ longitude: "-73.984638",
1748
+ county: "Santa Clara",
1749
+ contactName: "Elon Musk",
1750
+ salutation: "Mr",
1751
+ phoneNumber: "111-111-1111",
1752
+ fax: "122-111-1111",
1753
+ email: "elon@musk.com",
1754
+ website: "https://elonmusk.com",
1755
+ notes: "Address notes or delivery instructions.",
1756
+ rowVersion: "1-12345",
1757
+ },
1758
+ templateId: "123456",
1759
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
1760
+ paymentMethod: "cash",
1761
+ channel: "email",
1762
+ language: "EN",
1763
+ accountingByRow: false,
1764
+ bankAccount: {
1765
+ bankName: "Monzo",
1766
+ accountNumber: "123465",
1767
+ accountName: "SPACEX LLC",
1768
+ accountType: "credit_card",
1769
+ iban: "CH2989144532982975332",
1770
+ bic: "AUDSCHGGXXX",
1771
+ routingNumber: "012345678",
1772
+ bsbNumber: "062-001",
1773
+ branchIdentifier: "001",
1774
+ bankCode: "BNH",
1775
+ currency: "USD",
1776
+ },
1777
+ ledgerAccount: {
1778
+ id: "123456",
1779
+ name: "Bank account",
1780
+ nominalCode: "N091",
1781
+ code: "453",
1782
+ },
1783
+ customFields: [
1784
+ {
1785
+ id: "2389328923893298",
1786
+ name: "employee_level",
1787
+ description: "Employee Level",
1788
+ value: "Uses Salesforce and Marketo",
1789
+ },
1790
+ {
1791
+ id: "2389328923893298",
1792
+ name: "employee_level",
1793
+ description: "Employee Level",
1794
+ value: 10,
1795
+ },
1796
+ {
1797
+ id: "2389328923893298",
1798
+ name: "employee_level",
1799
+ description: "Employee Level",
1800
+ value: 10,
1801
+ },
1802
+ ],
1803
+ rowVersion: "1-12345",
1804
+ updatedBy: "12345",
1805
+ createdBy: "12345",
1806
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1807
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1808
+ passThrough: [
1809
+ {
1810
+ serviceId: "<id>",
1811
+ extendPaths: [
1812
+ {
1813
+ path: "$.nested.property",
1814
+ value: {
1815
+ "TaxClassificationRef": {
1816
+ "value": "EUC-99990201-V1-00020000",
1817
+ },
1818
+ },
1819
+ },
1820
+ {
1821
+ path: "$.nested.property",
1822
+ value: {
1823
+ "TaxClassificationRef": {
1824
+ "value": "EUC-99990201-V1-00020000",
1825
+ },
1826
+ },
1827
+ },
1828
+ ],
1829
+ },
1830
+ ],
1831
+ },
1832
+ });
1833
+ });
1834
+
1835
+ test("Invoices Accounting Invoices Update", async () => {
1836
+ const testHttpClient = createTestHTTPClient("accounting.invoicesUpdate");
1837
+
1838
+ const apideck = new Apideck({
1839
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1840
+ httpClient: testHttpClient,
1841
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1842
+ });
1843
+
1844
+ const result = await apideck.accounting.invoices.update({
1845
+ id: "<id>",
1846
+ consumerId: "test-consumer",
1847
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1848
+ serviceId: "salesforce",
1849
+ invoice: {
1850
+ type: "service",
1851
+ number: "OIT00546",
1852
+ customer: {
1853
+ id: "12345",
1854
+ displayName: "Windsurf Shop",
1855
+ email: "boring@boring.com",
1856
+ },
1857
+ companyId: "12345",
1858
+ invoiceDate: new RFCDate("2020-09-30"),
1859
+ dueDate: new RFCDate("2020-09-30"),
1860
+ terms: "Net 30 days",
1861
+ poNumber: "90000117",
1862
+ reference: "123456",
1863
+ status: "draft",
1864
+ invoiceSent: true,
1865
+ currency: "USD",
1866
+ currencyRate: 0.69,
1867
+ taxInclusive: true,
1868
+ subTotal: 27500,
1869
+ totalTax: 2500,
1870
+ taxCode: "1234",
1871
+ discountPercentage: 5.5,
1872
+ discountAmount: 25,
1873
+ total: 27500,
1874
+ balance: 27500,
1875
+ deposit: 0,
1876
+ customerMemo: "Thank you for your business and have a great day!",
1877
+ trackingCategories: [
1878
+ {
1879
+ id: "123456",
1880
+ name: "New York",
1881
+ },
1882
+ {
1883
+ id: "123456",
1884
+ name: "New York",
1885
+ },
1886
+ {
1887
+ id: "123456",
1888
+ name: "New York",
1889
+ },
1890
+ ],
1891
+ lineItems: [
1892
+ {
1893
+ id: "12345",
1894
+ rowId: "12345",
1895
+ code: "120-C",
1896
+ lineNumber: 1,
1897
+ description:
1898
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1899
+ type: "sales_item",
1900
+ taxAmount: 27500,
1901
+ totalAmount: 27500,
1902
+ quantity: 1,
1903
+ unitPrice: 27500.5,
1904
+ unitOfMeasure: "pc.",
1905
+ discountPercentage: 0.01,
1906
+ discountAmount: 19.99,
1907
+ locationId: "12345",
1908
+ departmentId: "12345",
1909
+ item: {
1910
+ id: "12344",
1911
+ code: "120-C",
1912
+ name: "Model Y",
1913
+ },
1914
+ taxRate: {
1915
+ id: "123456",
1916
+ rate: 10,
1917
+ },
1918
+ trackingCategories: [
1919
+ {
1920
+ id: "123456",
1921
+ name: "New York",
1922
+ },
1923
+ {
1924
+ id: "123456",
1925
+ name: "New York",
1926
+ },
1927
+ ],
1928
+ ledgerAccount: {
1929
+ id: "123456",
1930
+ nominalCode: "N091",
1931
+ code: "453",
1932
+ },
1933
+ customFields: [
1934
+ {
1935
+ id: "2389328923893298",
1936
+ name: "employee_level",
1937
+ description: "Employee Level",
1938
+ value: {},
1939
+ },
1940
+ {
1941
+ id: "2389328923893298",
1942
+ name: "employee_level",
1943
+ description: "Employee Level",
1944
+ value: true,
1945
+ },
1946
+ {
1947
+ id: "2389328923893298",
1948
+ name: "employee_level",
1949
+ description: "Employee Level",
1950
+ value: {},
1951
+ },
1952
+ ],
1953
+ rowVersion: "1-12345",
1954
+ },
1955
+ {
1956
+ id: "12345",
1957
+ rowId: "12345",
1958
+ code: "120-C",
1959
+ lineNumber: 1,
1960
+ description:
1961
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1962
+ type: "sales_item",
1963
+ taxAmount: 27500,
1964
+ totalAmount: 27500,
1965
+ quantity: 1,
1966
+ unitPrice: 27500.5,
1967
+ unitOfMeasure: "pc.",
1968
+ discountPercentage: 0.01,
1969
+ discountAmount: 19.99,
1970
+ locationId: "12345",
1971
+ departmentId: "12345",
1972
+ item: {
1973
+ id: "12344",
1974
+ code: "120-C",
1975
+ name: "Model Y",
1976
+ },
1977
+ taxRate: {
1978
+ id: "123456",
1979
+ rate: 10,
1980
+ },
1981
+ trackingCategories: [
1982
+ {
1983
+ id: "123456",
1984
+ name: "New York",
1985
+ },
1986
+ {
1987
+ id: "123456",
1988
+ name: "New York",
1989
+ },
1990
+ {
1991
+ id: "123456",
1992
+ name: "New York",
1993
+ },
1994
+ ],
1995
+ ledgerAccount: {
1996
+ id: "123456",
1997
+ nominalCode: "N091",
1998
+ code: "453",
1999
+ },
2000
+ customFields: [
2001
+ {
2002
+ id: "2389328923893298",
2003
+ name: "employee_level",
2004
+ description: "Employee Level",
2005
+ value: 10,
2006
+ },
2007
+ {
2008
+ id: "2389328923893298",
2009
+ name: "employee_level",
2010
+ description: "Employee Level",
2011
+ value: 10,
2012
+ },
2013
+ ],
2014
+ rowVersion: "1-12345",
2015
+ },
2016
+ ],
2017
+ billingAddress: {
2018
+ id: "123",
2019
+ type: "primary",
2020
+ string: "25 Spring Street, Blackburn, VIC 3130",
2021
+ name: "HQ US",
2022
+ line1: "Main street",
2023
+ line2: "apt #",
2024
+ line3: "Suite #",
2025
+ line4: "delivery instructions",
2026
+ streetNumber: "25",
2027
+ city: "San Francisco",
2028
+ state: "CA",
2029
+ postalCode: "94104",
2030
+ country: "US",
2031
+ latitude: "40.759211",
2032
+ longitude: "-73.984638",
2033
+ county: "Santa Clara",
2034
+ contactName: "Elon Musk",
2035
+ salutation: "Mr",
2036
+ phoneNumber: "111-111-1111",
2037
+ fax: "122-111-1111",
2038
+ email: "elon@musk.com",
2039
+ website: "https://elonmusk.com",
2040
+ notes: "Address notes or delivery instructions.",
2041
+ rowVersion: "1-12345",
2042
+ },
2043
+ shippingAddress: {
2044
+ id: "123",
2045
+ type: "primary",
2046
+ string: "25 Spring Street, Blackburn, VIC 3130",
2047
+ name: "HQ US",
2048
+ line1: "Main street",
2049
+ line2: "apt #",
2050
+ line3: "Suite #",
2051
+ line4: "delivery instructions",
2052
+ streetNumber: "25",
2053
+ city: "San Francisco",
2054
+ state: "CA",
2055
+ postalCode: "94104",
2056
+ country: "US",
2057
+ latitude: "40.759211",
2058
+ longitude: "-73.984638",
2059
+ county: "Santa Clara",
2060
+ contactName: "Elon Musk",
2061
+ salutation: "Mr",
2062
+ phoneNumber: "111-111-1111",
2063
+ fax: "122-111-1111",
2064
+ email: "elon@musk.com",
2065
+ website: "https://elonmusk.com",
2066
+ notes: "Address notes or delivery instructions.",
2067
+ rowVersion: "1-12345",
2068
+ },
2069
+ templateId: "123456",
2070
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
2071
+ paymentMethod: "cash",
2072
+ channel: "email",
2073
+ language: "EN",
2074
+ accountingByRow: false,
2075
+ bankAccount: {
2076
+ bankName: "Monzo",
2077
+ accountNumber: "123465",
2078
+ accountName: "SPACEX LLC",
2079
+ accountType: "credit_card",
2080
+ iban: "CH2989144532982975332",
2081
+ bic: "AUDSCHGGXXX",
2082
+ routingNumber: "012345678",
2083
+ bsbNumber: "062-001",
2084
+ branchIdentifier: "001",
2085
+ bankCode: "BNH",
2086
+ currency: "USD",
2087
+ },
2088
+ ledgerAccount: {
2089
+ id: "123456",
2090
+ nominalCode: "N091",
2091
+ code: "453",
2092
+ },
2093
+ customFields: [
2094
+ {
2095
+ id: "2389328923893298",
2096
+ name: "employee_level",
2097
+ description: "Employee Level",
2098
+ value: {
2099
+ "0": "<value>",
2100
+ "1": "<value>",
2101
+ "2": "<value>",
2102
+ },
2103
+ },
2104
+ ],
2105
+ rowVersion: "1-12345",
2106
+ passThrough: [
2107
+ {
2108
+ serviceId: "<id>",
2109
+ extendPaths: [
2110
+ {
2111
+ path: "$.nested.property",
2112
+ value: {
2113
+ "TaxClassificationRef": {
2114
+ "value": "EUC-99990201-V1-00020000",
2115
+ },
2116
+ },
2117
+ },
2118
+ {
2119
+ path: "$.nested.property",
2120
+ value: {
2121
+ "TaxClassificationRef": {
2122
+ "value": "EUC-99990201-V1-00020000",
2123
+ },
2124
+ },
2125
+ },
2126
+ ],
2127
+ },
2128
+ ],
2129
+ },
2130
+ });
2131
+ expect(result.httpMeta.response.status).toBe(200);
2132
+ expect(result.updateInvoiceResponse).toBeDefined();
2133
+ expect(result.updateInvoiceResponse).toEqual({
2134
+ statusCode: 200,
2135
+ status: "OK",
2136
+ service: "xero",
2137
+ resource: "invoices",
2138
+ operation: "update",
2139
+ data: {
2140
+ id: "12345",
2141
+ downstreamId: "12345",
2142
+ },
2143
+ });
1538
2144
  });
1539
2145
 
1540
2146
  test("Invoices Accounting Invoices Delete", async () => {