@apideck/unify 0.27.0 → 0.28.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 (132) hide show
  1. package/README.md +5 -5
  2. package/docs/sdks/companies/README.md +4 -4
  3. package/examples/README.md +26 -0
  4. package/examples/accountingTaxRatesList.example.ts +41 -0
  5. package/examples/package-lock.json +613 -0
  6. package/examples/package.json +18 -0
  7. package/funcs/crmCompaniesCreate.js +1 -1
  8. package/funcs/crmCompaniesCreate.js.map +1 -1
  9. package/funcs/crmCompaniesUpdate.js +1 -1
  10. package/funcs/crmCompaniesUpdate.js.map +1 -1
  11. package/jsr.json +1 -1
  12. package/lib/config.d.ts +4 -4
  13. package/lib/config.js +4 -4
  14. package/models/components/bankaccount.d.ts +5 -0
  15. package/models/components/bankaccount.d.ts.map +1 -1
  16. package/models/components/bankaccount.js +2 -0
  17. package/models/components/bankaccount.js.map +1 -1
  18. package/models/components/bankaccount1.d.ts +123 -0
  19. package/models/components/bankaccount1.d.ts.map +1 -0
  20. package/models/components/bankaccount1.js +128 -0
  21. package/models/components/bankaccount1.js.map +1 -0
  22. package/models/components/{company.d.ts → company1.d.ts} +32 -32
  23. package/models/components/company1.d.ts.map +1 -0
  24. package/models/components/{company.js → company1.js} +37 -37
  25. package/models/components/company1.js.map +1 -0
  26. package/models/components/companyinfo.d.ts +5 -0
  27. package/models/components/companyinfo.d.ts.map +1 -1
  28. package/models/components/companyinfo.js +4 -0
  29. package/models/components/companyinfo.js.map +1 -1
  30. package/models/components/getcompaniesresponse.d.ts +3 -3
  31. package/models/components/getcompaniesresponse.d.ts.map +1 -1
  32. package/models/components/getcompaniesresponse.js +3 -3
  33. package/models/components/getcompaniesresponse.js.map +1 -1
  34. package/models/components/getcompanyresponse.d.ts +3 -3
  35. package/models/components/getcompanyresponse.d.ts.map +1 -1
  36. package/models/components/getcompanyresponse.js +3 -3
  37. package/models/components/getcompanyresponse.js.map +1 -1
  38. package/models/components/index.d.ts +2 -1
  39. package/models/components/index.d.ts.map +1 -1
  40. package/models/components/index.js +2 -1
  41. package/models/components/index.js.map +1 -1
  42. package/models/components/supplier.d.ts +10 -0
  43. package/models/components/supplier.d.ts.map +1 -1
  44. package/models/components/supplier.js +4 -0
  45. package/models/components/supplier.js.map +1 -1
  46. package/models/errors/apierror.d.ts.map +1 -1
  47. package/models/errors/apierror.js +8 -2
  48. package/models/errors/apierror.js.map +1 -1
  49. package/models/errors/badrequestresponse.js +1 -1
  50. package/models/errors/badrequestresponse.js.map +1 -1
  51. package/models/errors/notfoundresponse.js +1 -1
  52. package/models/errors/notfoundresponse.js.map +1 -1
  53. package/models/errors/paymentrequiredresponse.js +1 -1
  54. package/models/errors/paymentrequiredresponse.js.map +1 -1
  55. package/models/errors/unauthorizedresponse.js +1 -1
  56. package/models/errors/unauthorizedresponse.js.map +1 -1
  57. package/models/errors/unprocessableresponse.js +1 -1
  58. package/models/errors/unprocessableresponse.js.map +1 -1
  59. package/models/operations/crmcompaniesadd.d.ts +2 -2
  60. package/models/operations/crmcompaniesadd.d.ts.map +1 -1
  61. package/models/operations/crmcompaniesadd.js +4 -4
  62. package/models/operations/crmcompaniesadd.js.map +1 -1
  63. package/models/operations/crmcompaniesupdate.d.ts +2 -2
  64. package/models/operations/crmcompaniesupdate.d.ts.map +1 -1
  65. package/models/operations/crmcompaniesupdate.js +4 -4
  66. package/models/operations/crmcompaniesupdate.js.map +1 -1
  67. package/package.json +1 -1
  68. package/src/__tests__/activities.test.ts +360 -9
  69. package/src/__tests__/apideckcompanies.test.ts +373 -9
  70. package/src/__tests__/apideckdepartments.test.ts +181 -9
  71. package/src/__tests__/applicants.test.ts +473 -9
  72. package/src/__tests__/applications.test.ts +189 -9
  73. package/src/__tests__/billpayments.test.ts +367 -9
  74. package/src/__tests__/bills.test.ts +500 -9
  75. package/src/__tests__/collectionticketcomments.test.ts +183 -7
  76. package/src/__tests__/collectiontickets.test.ts +191 -7
  77. package/src/__tests__/companies.test.ts +538 -9
  78. package/src/__tests__/connections.test.ts +409 -5
  79. package/src/__tests__/connectionsettings.test.ts +410 -5
  80. package/src/__tests__/contacts.test.ts +466 -9
  81. package/src/__tests__/creditnotes.test.ts +758 -87
  82. package/src/__tests__/customers.test.ts +513 -9
  83. package/src/__tests__/customobjects.test.ts +150 -9
  84. package/src/__tests__/customobjectschemas.test.ts +321 -9
  85. package/src/__tests__/departments.test.ts +173 -9
  86. package/src/__tests__/drivegroups.test.ts +181 -9
  87. package/src/__tests__/drives.test.ts +179 -9
  88. package/src/__tests__/employees.test.ts +829 -94
  89. package/src/__tests__/expenses.test.ts +332 -9
  90. package/src/__tests__/files.test.ts +106 -5
  91. package/src/__tests__/folders.test.ts +296 -13
  92. package/src/__tests__/invoiceitems.test.ts +272 -9
  93. package/src/__tests__/invoices.test.ts +673 -67
  94. package/src/__tests__/journalentries.test.ts +490 -8
  95. package/src/__tests__/leads.test.ts +446 -9
  96. package/src/__tests__/ledgeraccounts.test.ts +237 -8
  97. package/src/__tests__/locations.test.ts +298 -9
  98. package/src/__tests__/messages.test.ts +195 -9
  99. package/src/__tests__/notes.test.ts +191 -9
  100. package/src/__tests__/opportunities.test.ts +218 -9
  101. package/src/__tests__/payments.test.ts +312 -9
  102. package/src/__tests__/pipelines.test.ts +194 -9
  103. package/src/__tests__/purchaseorders.test.ts +773 -104
  104. package/src/__tests__/sharedlinks.test.ts +183 -9
  105. package/src/__tests__/subsidiaries.test.ts +183 -9
  106. package/src/__tests__/suppliers.test.ts +505 -9
  107. package/src/__tests__/taxrates.test.ts +232 -9
  108. package/src/__tests__/timeoffrequests.test.ts +210 -9
  109. package/src/__tests__/trackingcategories.test.ts +187 -7
  110. package/src/__tests__/uploadsessions.test.ts +78 -5
  111. package/src/__tests__/users.test.ts +356 -9
  112. package/src/funcs/crmCompaniesCreate.ts +1 -1
  113. package/src/funcs/crmCompaniesUpdate.ts +1 -1
  114. package/src/lib/config.ts +4 -4
  115. package/src/models/components/bankaccount.ts +7 -0
  116. package/src/models/components/bankaccount1.ts +207 -0
  117. package/src/models/components/{company.ts → company1.ts} +131 -128
  118. package/src/models/components/companyinfo.ts +9 -0
  119. package/src/models/components/getcompaniesresponse.ts +9 -9
  120. package/src/models/components/getcompanyresponse.ts +9 -9
  121. package/src/models/components/index.ts +2 -1
  122. package/src/models/components/supplier.ts +14 -0
  123. package/src/models/errors/apierror.ts +8 -2
  124. package/src/models/errors/badrequestresponse.ts +1 -1
  125. package/src/models/errors/notfoundresponse.ts +1 -1
  126. package/src/models/errors/paymentrequiredresponse.ts +1 -1
  127. package/src/models/errors/unauthorizedresponse.ts +1 -1
  128. package/src/models/errors/unprocessableresponse.ts +1 -1
  129. package/src/models/operations/crmcompaniesadd.ts +6 -6
  130. package/src/models/operations/crmcompaniesupdate.ts +6 -6
  131. package/models/components/company.d.ts.map +0 -1
  132. 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";
@@ -1202,14 +1202,638 @@ 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
- );
1205
+ test("Invoices Accounting Invoices Add", async () => {
1206
+ const testHttpClient = createTestHTTPClient("accounting.invoicesAdd");
1207
+
1208
+ const apideck = new Apideck({
1209
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1210
+ httpClient: testHttpClient,
1211
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1212
+ });
1213
+
1214
+ const result = await apideck.accounting.invoices.create({
1215
+ consumerId: "test-consumer",
1216
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1217
+ serviceId: "salesforce",
1218
+ invoice: {
1219
+ type: "service",
1220
+ number: "OIT00546",
1221
+ customer: {
1222
+ id: "12345",
1223
+ displayName: "Windsurf Shop",
1224
+ email: "boring@boring.com",
1225
+ },
1226
+ companyId: "12345",
1227
+ invoiceDate: new RFCDate("2020-09-30"),
1228
+ dueDate: new RFCDate("2020-09-30"),
1229
+ terms: "Net 30 days",
1230
+ poNumber: "90000117",
1231
+ reference: "123456",
1232
+ status: "draft",
1233
+ invoiceSent: true,
1234
+ currency: "USD",
1235
+ currencyRate: 0.69,
1236
+ taxInclusive: true,
1237
+ subTotal: 27500,
1238
+ totalTax: 2500,
1239
+ taxCode: "1234",
1240
+ discountPercentage: 5.5,
1241
+ discountAmount: 25,
1242
+ total: 27500,
1243
+ balance: 27500,
1244
+ deposit: 0,
1245
+ customerMemo: "Thank you for your business and have a great day!",
1246
+ trackingCategories: [
1247
+ {
1248
+ id: "123456",
1249
+ name: "New York",
1250
+ },
1251
+ {
1252
+ id: "123456",
1253
+ name: "New York",
1254
+ },
1255
+ ],
1256
+ lineItems: [
1257
+ {
1258
+ id: "12345",
1259
+ rowId: "12345",
1260
+ code: "120-C",
1261
+ lineNumber: 1,
1262
+ description:
1263
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1264
+ type: "sales_item",
1265
+ taxAmount: 27500,
1266
+ totalAmount: 27500,
1267
+ quantity: 1,
1268
+ unitPrice: 27500.5,
1269
+ unitOfMeasure: "pc.",
1270
+ discountPercentage: 0.01,
1271
+ discountAmount: 19.99,
1272
+ locationId: "12345",
1273
+ departmentId: "12345",
1274
+ item: {
1275
+ id: "12344",
1276
+ code: "120-C",
1277
+ name: "Model Y",
1278
+ },
1279
+ taxRate: {
1280
+ id: "123456",
1281
+ rate: 10,
1282
+ },
1283
+ trackingCategories: [
1284
+ {
1285
+ id: "123456",
1286
+ name: "New York",
1287
+ },
1288
+ {
1289
+ id: "123456",
1290
+ name: "New York",
1291
+ },
1292
+ ],
1293
+ ledgerAccount: {
1294
+ id: "123456",
1295
+ nominalCode: "N091",
1296
+ code: "453",
1297
+ },
1298
+ customFields: [
1299
+ {
1300
+ id: "2389328923893298",
1301
+ name: "employee_level",
1302
+ description: "Employee Level",
1303
+ value: "Uses Salesforce and Marketo",
1304
+ },
1305
+ ],
1306
+ rowVersion: "1-12345",
1307
+ },
1308
+ {
1309
+ id: "12345",
1310
+ rowId: "12345",
1311
+ code: "120-C",
1312
+ lineNumber: 1,
1313
+ description:
1314
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1315
+ type: "sales_item",
1316
+ taxAmount: 27500,
1317
+ totalAmount: 27500,
1318
+ quantity: 1,
1319
+ unitPrice: 27500.5,
1320
+ unitOfMeasure: "pc.",
1321
+ discountPercentage: 0.01,
1322
+ discountAmount: 19.99,
1323
+ locationId: "12345",
1324
+ departmentId: "12345",
1325
+ item: {
1326
+ id: "12344",
1327
+ code: "120-C",
1328
+ name: "Model Y",
1329
+ },
1330
+ taxRate: {
1331
+ id: "123456",
1332
+ rate: 10,
1333
+ },
1334
+ trackingCategories: [
1335
+ {
1336
+ id: "123456",
1337
+ name: "New York",
1338
+ },
1339
+ {
1340
+ id: "123456",
1341
+ name: "New York",
1342
+ },
1343
+ {
1344
+ id: "123456",
1345
+ name: "New York",
1346
+ },
1347
+ ],
1348
+ ledgerAccount: {
1349
+ id: "123456",
1350
+ nominalCode: "N091",
1351
+ code: "453",
1352
+ },
1353
+ customFields: [
1354
+ {
1355
+ id: "2389328923893298",
1356
+ name: "employee_level",
1357
+ description: "Employee Level",
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",
1371
+ },
1372
+ ],
1373
+ rowVersion: "1-12345",
1374
+ },
1375
+ ],
1376
+ billingAddress: {
1377
+ id: "123",
1378
+ type: "primary",
1379
+ string: "25 Spring Street, Blackburn, VIC 3130",
1380
+ name: "HQ US",
1381
+ line1: "Main street",
1382
+ line2: "apt #",
1383
+ line3: "Suite #",
1384
+ line4: "delivery instructions",
1385
+ streetNumber: "25",
1386
+ city: "San Francisco",
1387
+ state: "CA",
1388
+ postalCode: "94104",
1389
+ country: "US",
1390
+ latitude: "40.759211",
1391
+ longitude: "-73.984638",
1392
+ county: "Santa Clara",
1393
+ contactName: "Elon Musk",
1394
+ salutation: "Mr",
1395
+ phoneNumber: "111-111-1111",
1396
+ fax: "122-111-1111",
1397
+ email: "elon@musk.com",
1398
+ website: "https://elonmusk.com",
1399
+ notes: "Address notes or delivery instructions.",
1400
+ rowVersion: "1-12345",
1401
+ },
1402
+ shippingAddress: {
1403
+ id: "123",
1404
+ type: "primary",
1405
+ string: "25 Spring Street, Blackburn, VIC 3130",
1406
+ name: "HQ US",
1407
+ line1: "Main street",
1408
+ line2: "apt #",
1409
+ line3: "Suite #",
1410
+ line4: "delivery instructions",
1411
+ streetNumber: "25",
1412
+ city: "San Francisco",
1413
+ state: "CA",
1414
+ postalCode: "94104",
1415
+ country: "US",
1416
+ latitude: "40.759211",
1417
+ longitude: "-73.984638",
1418
+ county: "Santa Clara",
1419
+ contactName: "Elon Musk",
1420
+ salutation: "Mr",
1421
+ phoneNumber: "111-111-1111",
1422
+ fax: "122-111-1111",
1423
+ email: "elon@musk.com",
1424
+ website: "https://elonmusk.com",
1425
+ notes: "Address notes or delivery instructions.",
1426
+ rowVersion: "1-12345",
1427
+ },
1428
+ templateId: "123456",
1429
+ sourceDocumentUrl: "https://www.invoicesolution.com/invoice/123456",
1430
+ paymentMethod: "cash",
1431
+ channel: "email",
1432
+ language: "EN",
1433
+ accountingByRow: false,
1434
+ bankAccount: {
1435
+ bankName: "Monzo",
1436
+ accountNumber: "123465",
1437
+ accountName: "SPACEX LLC",
1438
+ accountType: "credit_card",
1439
+ iban: "CH2989144532982975332",
1440
+ bic: "AUDSCHGGXXX",
1441
+ routingNumber: "012345678",
1442
+ bsbNumber: "062-001",
1443
+ branchIdentifier: "001",
1444
+ bankCode: "BNH",
1445
+ currency: "USD",
1446
+ },
1447
+ ledgerAccount: {
1448
+ id: "123456",
1449
+ nominalCode: "N091",
1450
+ code: "453",
1451
+ },
1452
+ customFields: [
1453
+ {
1454
+ id: "2389328923893298",
1455
+ name: "employee_level",
1456
+ description: "Employee Level",
1457
+ value: [
1458
+ "<value>",
1459
+ "<value>",
1460
+ ],
1461
+ },
1462
+ {
1463
+ id: "2389328923893298",
1464
+ name: "employee_level",
1465
+ description: "Employee Level",
1466
+ value: [
1467
+ "<value>",
1468
+ "<value>",
1469
+ "<value>",
1470
+ ],
1471
+ },
1472
+ {
1473
+ id: "2389328923893298",
1474
+ name: "employee_level",
1475
+ description: "Employee Level",
1476
+ value: true,
1477
+ },
1478
+ ],
1479
+ rowVersion: "1-12345",
1480
+ passThrough: [
1481
+ {
1482
+ serviceId: "<id>",
1483
+ extendPaths: [
1484
+ {
1485
+ path: "$.nested.property",
1486
+ value: {
1487
+ "TaxClassificationRef": {
1488
+ "value": "EUC-99990201-V1-00020000",
1489
+ },
1490
+ },
1491
+ },
1492
+ ],
1493
+ },
1494
+ ],
1495
+ },
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
+ });
1510
+ });
1511
+
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
+ {},
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
+ {},
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
+ });
1209
1833
  });
1210
1834
 
1211
- test("Invoices Accounting Invoices One", async () => {
1212
- const testHttpClient = createTestHTTPClient("accounting.invoicesOne");
1835
+ test("Invoices Accounting Invoices Update", async () => {
1836
+ const testHttpClient = createTestHTTPClient("accounting.invoicesUpdate");
1213
1837
 
1214
1838
  const apideck = new Apideck({
1215
1839
  serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
@@ -1217,31 +1841,17 @@ test("Invoices Accounting Invoices One", async () => {
1217
1841
  apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1218
1842
  });
1219
1843
 
1220
- const result = await apideck.accounting.invoices.get({
1844
+ const result = await apideck.accounting.invoices.update({
1221
1845
  id: "<id>",
1222
1846
  consumerId: "test-consumer",
1223
1847
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1224
1848
  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",
1849
+ invoice: {
1238
1850
  type: "service",
1239
1851
  number: "OIT00546",
1240
1852
  customer: {
1241
1853
  id: "12345",
1242
- displayId: "CUST00101",
1243
1854
  displayName: "Windsurf Shop",
1244
- companyName: "The boring company",
1245
1855
  email: "boring@boring.com",
1246
1856
  },
1247
1857
  companyId: "12345",
@@ -1303,8 +1913,6 @@ test("Invoices Accounting Invoices One", async () => {
1303
1913
  },
1304
1914
  taxRate: {
1305
1915
  id: "123456",
1306
- code: "N-T",
1307
- name: "GST on Purchases",
1308
1916
  rate: 10,
1309
1917
  },
1310
1918
  trackingCategories: [
@@ -1319,7 +1927,6 @@ test("Invoices Accounting Invoices One", async () => {
1319
1927
  ],
1320
1928
  ledgerAccount: {
1321
1929
  id: "123456",
1322
- name: "Bank account",
1323
1930
  nominalCode: "N091",
1324
1931
  code: "453",
1325
1932
  },
@@ -1328,9 +1935,7 @@ test("Invoices Accounting Invoices One", async () => {
1328
1935
  id: "2389328923893298",
1329
1936
  name: "employee_level",
1330
1937
  description: "Employee Level",
1331
- value: [
1332
- {},
1333
- ],
1938
+ value: {},
1334
1939
  },
1335
1940
  {
1336
1941
  id: "2389328923893298",
@@ -1338,12 +1943,14 @@ test("Invoices Accounting Invoices One", async () => {
1338
1943
  description: "Employee Level",
1339
1944
  value: true,
1340
1945
  },
1946
+ {
1947
+ id: "2389328923893298",
1948
+ name: "employee_level",
1949
+ description: "Employee Level",
1950
+ value: {},
1951
+ },
1341
1952
  ],
1342
1953
  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
1954
  },
1348
1955
  {
1349
1956
  id: "12345",
@@ -1369,8 +1976,6 @@ test("Invoices Accounting Invoices One", async () => {
1369
1976
  },
1370
1977
  taxRate: {
1371
1978
  id: "123456",
1372
- code: "N-T",
1373
- name: "GST on Purchases",
1374
1979
  rate: 10,
1375
1980
  },
1376
1981
  trackingCategories: [
@@ -1378,10 +1983,17 @@ test("Invoices Accounting Invoices One", async () => {
1378
1983
  id: "123456",
1379
1984
  name: "New York",
1380
1985
  },
1986
+ {
1987
+ id: "123456",
1988
+ name: "New York",
1989
+ },
1990
+ {
1991
+ id: "123456",
1992
+ name: "New York",
1993
+ },
1381
1994
  ],
1382
1995
  ledgerAccount: {
1383
1996
  id: "123456",
1384
- name: "Bank account",
1385
1997
  nominalCode: "N091",
1386
1998
  code: "453",
1387
1999
  },
@@ -1390,16 +2002,16 @@ test("Invoices Accounting Invoices One", async () => {
1390
2002
  id: "2389328923893298",
1391
2003
  name: "employee_level",
1392
2004
  description: "Employee Level",
1393
- value: [
1394
- {},
1395
- ],
2005
+ value: 10,
2006
+ },
2007
+ {
2008
+ id: "2389328923893298",
2009
+ name: "employee_level",
2010
+ description: "Employee Level",
2011
+ value: 10,
1396
2012
  },
1397
2013
  ],
1398
2014
  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
2015
  },
1404
2016
  ],
1405
2017
  billingAddress: {
@@ -1475,7 +2087,6 @@ test("Invoices Accounting Invoices One", async () => {
1475
2087
  },
1476
2088
  ledgerAccount: {
1477
2089
  id: "123456",
1478
- name: "Bank account",
1479
2090
  nominalCode: "N091",
1480
2091
  code: "453",
1481
2092
  },
@@ -1484,26 +2095,14 @@ test("Invoices Accounting Invoices One", async () => {
1484
2095
  id: "2389328923893298",
1485
2096
  name: "employee_level",
1486
2097
  description: "Employee Level",
1487
- value: "Uses Salesforce and Marketo",
1488
- },
1489
- {
1490
- id: "2389328923893298",
1491
- name: "employee_level",
1492
- description: "Employee Level",
1493
- value: 10,
1494
- },
1495
- {
1496
- id: "2389328923893298",
1497
- name: "employee_level",
1498
- description: "Employee Level",
1499
- value: 10,
2098
+ value: [
2099
+ "<value>",
2100
+ "<value>",
2101
+ "<value>",
2102
+ ],
1500
2103
  },
1501
2104
  ],
1502
2105
  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
2106
  passThrough: [
1508
2107
  {
1509
2108
  serviceId: "<id>",
@@ -1529,12 +2128,19 @@ test("Invoices Accounting Invoices One", async () => {
1529
2128
  ],
1530
2129
  },
1531
2130
  });
1532
- });
1533
-
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
- );
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 () => {