@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 { createTestHTTPClient } from "./testclient.js";
8
8
 
@@ -954,14 +954,682 @@ test("Creditnotes Accounting Credit Notes All", async () => {
954
954
  });
955
955
  });
956
956
 
957
- it.skip("Creditnotes Accounting Credit Notes Add", async () => {
958
- assert.fail(
959
- "incomplete test found please make sure to address the following errors: [`workflow step accounting.creditNotesAdd.test referencing operation accounting.creditNotesAdd with expression in requestBody with type not currently supported`]",
960
- );
957
+ test("Creditnotes Accounting Credit Notes Add", async () => {
958
+ const testHttpClient = createTestHTTPClient("accounting.creditNotesAdd");
959
+
960
+ const apideck = new Apideck({
961
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
962
+ httpClient: testHttpClient,
963
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
964
+ });
965
+
966
+ const result = await apideck.accounting.creditNotes.create({
967
+ consumerId: "test-consumer",
968
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
969
+ serviceId: "salesforce",
970
+ creditNote: {
971
+ number: "OIT00546",
972
+ customer: {
973
+ id: "12345",
974
+ displayName: "Windsurf Shop",
975
+ email: "boring@boring.com",
976
+ },
977
+ companyId: "12345",
978
+ currency: "USD",
979
+ currencyRate: 0.69,
980
+ taxInclusive: true,
981
+ subTotal: 27500,
982
+ totalAmount: 49.99,
983
+ totalTax: 2500,
984
+ taxCode: "1234",
985
+ balance: 27500,
986
+ remainingCredit: 27500,
987
+ status: "authorised",
988
+ reference: "123456",
989
+ dateIssued: new Date("2021-05-01T12:00:00.000Z"),
990
+ datePaid: new Date("2021-05-01T12:00:00.000Z"),
991
+ type: "accounts_receivable_credit",
992
+ account: {
993
+ id: "123456",
994
+ nominalCode: "N091",
995
+ code: "453",
996
+ },
997
+ lineItems: [
998
+ {
999
+ id: "12345",
1000
+ rowId: "12345",
1001
+ code: "120-C",
1002
+ lineNumber: 1,
1003
+ description:
1004
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1005
+ type: "sales_item",
1006
+ taxAmount: 27500,
1007
+ totalAmount: 27500,
1008
+ quantity: 1,
1009
+ unitPrice: 27500.5,
1010
+ unitOfMeasure: "pc.",
1011
+ discountPercentage: 0.01,
1012
+ discountAmount: 19.99,
1013
+ locationId: "12345",
1014
+ departmentId: "12345",
1015
+ item: {
1016
+ id: "12344",
1017
+ code: "120-C",
1018
+ name: "Model Y",
1019
+ },
1020
+ taxRate: {
1021
+ id: "123456",
1022
+ rate: 10,
1023
+ },
1024
+ trackingCategories: [
1025
+ {
1026
+ id: "123456",
1027
+ name: "New York",
1028
+ },
1029
+ {
1030
+ id: "123456",
1031
+ name: "New York",
1032
+ },
1033
+ ],
1034
+ ledgerAccount: {
1035
+ id: "123456",
1036
+ nominalCode: "N091",
1037
+ code: "453",
1038
+ },
1039
+ customFields: [
1040
+ {
1041
+ id: "2389328923893298",
1042
+ name: "employee_level",
1043
+ description: "Employee Level",
1044
+ value: "Uses Salesforce and Marketo",
1045
+ },
1046
+ {
1047
+ id: "2389328923893298",
1048
+ name: "employee_level",
1049
+ description: "Employee Level",
1050
+ value: "Uses Salesforce and Marketo",
1051
+ },
1052
+ ],
1053
+ rowVersion: "1-12345",
1054
+ },
1055
+ {
1056
+ id: "12345",
1057
+ rowId: "12345",
1058
+ code: "120-C",
1059
+ lineNumber: 1,
1060
+ description:
1061
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1062
+ type: "sales_item",
1063
+ taxAmount: 27500,
1064
+ totalAmount: 27500,
1065
+ quantity: 1,
1066
+ unitPrice: 27500.5,
1067
+ unitOfMeasure: "pc.",
1068
+ discountPercentage: 0.01,
1069
+ discountAmount: 19.99,
1070
+ locationId: "12345",
1071
+ departmentId: "12345",
1072
+ item: {
1073
+ id: "12344",
1074
+ code: "120-C",
1075
+ name: "Model Y",
1076
+ },
1077
+ taxRate: {
1078
+ id: "123456",
1079
+ rate: 10,
1080
+ },
1081
+ trackingCategories: [
1082
+ {
1083
+ id: "123456",
1084
+ name: "New York",
1085
+ },
1086
+ {
1087
+ id: "123456",
1088
+ name: "New York",
1089
+ },
1090
+ {
1091
+ id: "123456",
1092
+ name: "New York",
1093
+ },
1094
+ ],
1095
+ ledgerAccount: {
1096
+ id: "123456",
1097
+ nominalCode: "N091",
1098
+ code: "453",
1099
+ },
1100
+ customFields: [
1101
+ {
1102
+ id: "2389328923893298",
1103
+ name: "employee_level",
1104
+ description: "Employee Level",
1105
+ value: "Uses Salesforce and Marketo",
1106
+ },
1107
+ {
1108
+ id: "2389328923893298",
1109
+ name: "employee_level",
1110
+ description: "Employee Level",
1111
+ value: 10,
1112
+ },
1113
+ {
1114
+ id: "2389328923893298",
1115
+ name: "employee_level",
1116
+ description: "Employee Level",
1117
+ value: "Uses Salesforce and Marketo",
1118
+ },
1119
+ ],
1120
+ rowVersion: "1-12345",
1121
+ },
1122
+ ],
1123
+ allocations: [
1124
+ {
1125
+ id: "123456",
1126
+ amount: 49.99,
1127
+ allocationId: "123456",
1128
+ },
1129
+ {
1130
+ id: "123456",
1131
+ amount: 49.99,
1132
+ allocationId: "123456",
1133
+ },
1134
+ {
1135
+ id: "123456",
1136
+ amount: 49.99,
1137
+ allocationId: "123456",
1138
+ },
1139
+ ],
1140
+ note: "Some notes about this credit note",
1141
+ terms: "Some terms about this credit note",
1142
+ billingAddress: {
1143
+ id: "123",
1144
+ type: "primary",
1145
+ string: "25 Spring Street, Blackburn, VIC 3130",
1146
+ name: "HQ US",
1147
+ line1: "Main street",
1148
+ line2: "apt #",
1149
+ line3: "Suite #",
1150
+ line4: "delivery instructions",
1151
+ streetNumber: "25",
1152
+ city: "San Francisco",
1153
+ state: "CA",
1154
+ postalCode: "94104",
1155
+ country: "US",
1156
+ latitude: "40.759211",
1157
+ longitude: "-73.984638",
1158
+ county: "Santa Clara",
1159
+ contactName: "Elon Musk",
1160
+ salutation: "Mr",
1161
+ phoneNumber: "111-111-1111",
1162
+ fax: "122-111-1111",
1163
+ email: "elon@musk.com",
1164
+ website: "https://elonmusk.com",
1165
+ notes: "Address notes or delivery instructions.",
1166
+ rowVersion: "1-12345",
1167
+ },
1168
+ shippingAddress: {
1169
+ id: "123",
1170
+ type: "primary",
1171
+ string: "25 Spring Street, Blackburn, VIC 3130",
1172
+ name: "HQ US",
1173
+ line1: "Main street",
1174
+ line2: "apt #",
1175
+ line3: "Suite #",
1176
+ line4: "delivery instructions",
1177
+ streetNumber: "25",
1178
+ city: "San Francisco",
1179
+ state: "CA",
1180
+ postalCode: "94104",
1181
+ country: "US",
1182
+ latitude: "40.759211",
1183
+ longitude: "-73.984638",
1184
+ county: "Santa Clara",
1185
+ contactName: "Elon Musk",
1186
+ salutation: "Mr",
1187
+ phoneNumber: "111-111-1111",
1188
+ fax: "122-111-1111",
1189
+ email: "elon@musk.com",
1190
+ website: "https://elonmusk.com",
1191
+ notes: "Address notes or delivery instructions.",
1192
+ rowVersion: "1-12345",
1193
+ },
1194
+ trackingCategories: [
1195
+ {
1196
+ id: "123456",
1197
+ name: "New York",
1198
+ },
1199
+ {
1200
+ id: "123456",
1201
+ name: "New York",
1202
+ },
1203
+ {
1204
+ id: "123456",
1205
+ name: "New York",
1206
+ },
1207
+ ],
1208
+ customFields: [
1209
+ {
1210
+ id: "2389328923893298",
1211
+ name: "employee_level",
1212
+ description: "Employee Level",
1213
+ value: [
1214
+ "<value>",
1215
+ "<value>",
1216
+ "<value>",
1217
+ ],
1218
+ },
1219
+ {
1220
+ id: "2389328923893298",
1221
+ name: "employee_level",
1222
+ description: "Employee Level",
1223
+ value: true,
1224
+ },
1225
+ ],
1226
+ rowVersion: "1-12345",
1227
+ passThrough: [
1228
+ {
1229
+ serviceId: "<id>",
1230
+ extendPaths: [
1231
+ {
1232
+ path: "$.nested.property",
1233
+ value: {
1234
+ "TaxClassificationRef": {
1235
+ "value": "EUC-99990201-V1-00020000",
1236
+ },
1237
+ },
1238
+ },
1239
+ ],
1240
+ },
1241
+ ],
1242
+ },
1243
+ });
1244
+ expect(result.httpMeta.response.status).toBe(201);
1245
+ expect(result.createCreditNoteResponse).toBeDefined();
1246
+ expect(result.createCreditNoteResponse).toEqual({
1247
+ statusCode: 200,
1248
+ status: "OK",
1249
+ service: "xero",
1250
+ resource: "credit-notes",
1251
+ operation: "add",
1252
+ data: {
1253
+ id: "12345",
1254
+ },
1255
+ });
1256
+ });
1257
+
1258
+ test("Creditnotes Accounting Credit Notes One", async () => {
1259
+ const testHttpClient = createTestHTTPClient("accounting.creditNotesOne");
1260
+
1261
+ const apideck = new Apideck({
1262
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
1263
+ httpClient: testHttpClient,
1264
+ apiKey: process.env["APIDECK_API_KEY"] ?? "value",
1265
+ });
1266
+
1267
+ const result = await apideck.accounting.creditNotes.get({
1268
+ id: "<id>",
1269
+ consumerId: "test-consumer",
1270
+ appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1271
+ serviceId: "salesforce",
1272
+ fields: "id,updated_at",
1273
+ });
1274
+ expect(result.httpMeta.response.status).toBe(200);
1275
+ expect(result.getCreditNoteResponse).toBeDefined();
1276
+ expect(result.getCreditNoteResponse).toEqual({
1277
+ statusCode: 200,
1278
+ status: "OK",
1279
+ service: "xero",
1280
+ resource: "credit-notes",
1281
+ operation: "one",
1282
+ data: {
1283
+ id: "123456",
1284
+ number: "OIT00546",
1285
+ customer: {
1286
+ id: "12345",
1287
+ displayId: "CUST00101",
1288
+ displayName: "Windsurf Shop",
1289
+ companyName: "The boring company",
1290
+ email: "boring@boring.com",
1291
+ },
1292
+ companyId: "12345",
1293
+ currency: "USD",
1294
+ currencyRate: 0.69,
1295
+ taxInclusive: true,
1296
+ subTotal: 27500,
1297
+ totalAmount: 49.99,
1298
+ totalTax: 2500,
1299
+ taxCode: "1234",
1300
+ balance: 27500,
1301
+ remainingCredit: 27500,
1302
+ status: "authorised",
1303
+ reference: "123456",
1304
+ dateIssued: new Date("2021-05-01T12:00:00.000Z"),
1305
+ datePaid: new Date("2021-05-01T12:00:00.000Z"),
1306
+ type: "accounts_receivable_credit",
1307
+ account: {
1308
+ id: "123456",
1309
+ name: "Bank account",
1310
+ nominalCode: "N091",
1311
+ code: "453",
1312
+ },
1313
+ lineItems: [
1314
+ {
1315
+ id: "12345",
1316
+ rowId: "12345",
1317
+ code: "120-C",
1318
+ lineNumber: 1,
1319
+ description:
1320
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1321
+ type: "sales_item",
1322
+ taxAmount: 27500,
1323
+ totalAmount: 27500,
1324
+ quantity: 1,
1325
+ unitPrice: 27500.5,
1326
+ unitOfMeasure: "pc.",
1327
+ discountPercentage: 0.01,
1328
+ discountAmount: 19.99,
1329
+ locationId: "12345",
1330
+ departmentId: "12345",
1331
+ item: {
1332
+ id: "12344",
1333
+ code: "120-C",
1334
+ name: "Model Y",
1335
+ },
1336
+ taxRate: {
1337
+ id: "123456",
1338
+ code: "N-T",
1339
+ name: "GST on Purchases",
1340
+ rate: 10,
1341
+ },
1342
+ trackingCategories: [
1343
+ {
1344
+ id: "123456",
1345
+ name: "New York",
1346
+ },
1347
+ {
1348
+ id: "123456",
1349
+ name: "New York",
1350
+ },
1351
+ ],
1352
+ ledgerAccount: {
1353
+ id: "123456",
1354
+ name: "Bank account",
1355
+ nominalCode: "N091",
1356
+ code: "453",
1357
+ },
1358
+ customFields: [
1359
+ {
1360
+ id: "2389328923893298",
1361
+ name: "employee_level",
1362
+ description: "Employee Level",
1363
+ value: {},
1364
+ },
1365
+ {
1366
+ id: "2389328923893298",
1367
+ name: "employee_level",
1368
+ description: "Employee Level",
1369
+ value: [
1370
+ {},
1371
+ ],
1372
+ },
1373
+ ],
1374
+ rowVersion: "1-12345",
1375
+ updatedBy: "12345",
1376
+ createdBy: "12345",
1377
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1378
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1379
+ },
1380
+ {
1381
+ id: "12345",
1382
+ rowId: "12345",
1383
+ code: "120-C",
1384
+ lineNumber: 1,
1385
+ description:
1386
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1387
+ type: "sales_item",
1388
+ taxAmount: 27500,
1389
+ totalAmount: 27500,
1390
+ quantity: 1,
1391
+ unitPrice: 27500.5,
1392
+ unitOfMeasure: "pc.",
1393
+ discountPercentage: 0.01,
1394
+ discountAmount: 19.99,
1395
+ locationId: "12345",
1396
+ departmentId: "12345",
1397
+ item: {
1398
+ id: "12344",
1399
+ code: "120-C",
1400
+ name: "Model Y",
1401
+ },
1402
+ taxRate: {
1403
+ id: "123456",
1404
+ code: "N-T",
1405
+ name: "GST on Purchases",
1406
+ rate: 10,
1407
+ },
1408
+ trackingCategories: [
1409
+ {
1410
+ id: "123456",
1411
+ name: "New York",
1412
+ },
1413
+ {
1414
+ id: "123456",
1415
+ name: "New York",
1416
+ },
1417
+ ],
1418
+ ledgerAccount: {
1419
+ id: "123456",
1420
+ name: "Bank account",
1421
+ nominalCode: "N091",
1422
+ code: "453",
1423
+ },
1424
+ customFields: [
1425
+ {
1426
+ id: "2389328923893298",
1427
+ name: "employee_level",
1428
+ description: "Employee Level",
1429
+ value: 10,
1430
+ },
1431
+ ],
1432
+ rowVersion: "1-12345",
1433
+ updatedBy: "12345",
1434
+ createdBy: "12345",
1435
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1436
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1437
+ },
1438
+ {
1439
+ id: "12345",
1440
+ rowId: "12345",
1441
+ code: "120-C",
1442
+ lineNumber: 1,
1443
+ description:
1444
+ "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
1445
+ type: "sales_item",
1446
+ taxAmount: 27500,
1447
+ totalAmount: 27500,
1448
+ quantity: 1,
1449
+ unitPrice: 27500.5,
1450
+ unitOfMeasure: "pc.",
1451
+ discountPercentage: 0.01,
1452
+ discountAmount: 19.99,
1453
+ locationId: "12345",
1454
+ departmentId: "12345",
1455
+ item: {
1456
+ id: "12344",
1457
+ code: "120-C",
1458
+ name: "Model Y",
1459
+ },
1460
+ taxRate: {
1461
+ id: "123456",
1462
+ code: "N-T",
1463
+ name: "GST on Purchases",
1464
+ rate: 10,
1465
+ },
1466
+ trackingCategories: [
1467
+ {
1468
+ id: "123456",
1469
+ name: "New York",
1470
+ },
1471
+ {
1472
+ id: "123456",
1473
+ name: "New York",
1474
+ },
1475
+ {
1476
+ id: "123456",
1477
+ name: "New York",
1478
+ },
1479
+ ],
1480
+ ledgerAccount: {
1481
+ id: "123456",
1482
+ name: "Bank account",
1483
+ nominalCode: "N091",
1484
+ code: "453",
1485
+ },
1486
+ customFields: [
1487
+ {
1488
+ id: "2389328923893298",
1489
+ name: "employee_level",
1490
+ description: "Employee Level",
1491
+ value: {},
1492
+ },
1493
+ {
1494
+ id: "2389328923893298",
1495
+ name: "employee_level",
1496
+ description: "Employee Level",
1497
+ value: 10,
1498
+ },
1499
+ ],
1500
+ rowVersion: "1-12345",
1501
+ updatedBy: "12345",
1502
+ createdBy: "12345",
1503
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1504
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1505
+ },
1506
+ ],
1507
+ allocations: [
1508
+ {
1509
+ id: "123456",
1510
+ code: "N091",
1511
+ amount: 49.99,
1512
+ allocationId: "123456",
1513
+ },
1514
+ ],
1515
+ note: "Some notes about this credit note",
1516
+ terms: "Some terms about this credit note",
1517
+ billingAddress: {
1518
+ id: "123",
1519
+ type: "primary",
1520
+ string: "25 Spring Street, Blackburn, VIC 3130",
1521
+ name: "HQ US",
1522
+ line1: "Main street",
1523
+ line2: "apt #",
1524
+ line3: "Suite #",
1525
+ line4: "delivery instructions",
1526
+ streetNumber: "25",
1527
+ city: "San Francisco",
1528
+ state: "CA",
1529
+ postalCode: "94104",
1530
+ country: "US",
1531
+ latitude: "40.759211",
1532
+ longitude: "-73.984638",
1533
+ county: "Santa Clara",
1534
+ contactName: "Elon Musk",
1535
+ salutation: "Mr",
1536
+ phoneNumber: "111-111-1111",
1537
+ fax: "122-111-1111",
1538
+ email: "elon@musk.com",
1539
+ website: "https://elonmusk.com",
1540
+ notes: "Address notes or delivery instructions.",
1541
+ rowVersion: "1-12345",
1542
+ },
1543
+ shippingAddress: {
1544
+ id: "123",
1545
+ type: "primary",
1546
+ string: "25 Spring Street, Blackburn, VIC 3130",
1547
+ name: "HQ US",
1548
+ line1: "Main street",
1549
+ line2: "apt #",
1550
+ line3: "Suite #",
1551
+ line4: "delivery instructions",
1552
+ streetNumber: "25",
1553
+ city: "San Francisco",
1554
+ state: "CA",
1555
+ postalCode: "94104",
1556
+ country: "US",
1557
+ latitude: "40.759211",
1558
+ longitude: "-73.984638",
1559
+ county: "Santa Clara",
1560
+ contactName: "Elon Musk",
1561
+ salutation: "Mr",
1562
+ phoneNumber: "111-111-1111",
1563
+ fax: "122-111-1111",
1564
+ email: "elon@musk.com",
1565
+ website: "https://elonmusk.com",
1566
+ notes: "Address notes or delivery instructions.",
1567
+ rowVersion: "1-12345",
1568
+ },
1569
+ trackingCategories: [
1570
+ {
1571
+ id: "123456",
1572
+ name: "New York",
1573
+ },
1574
+ ],
1575
+ customFields: [
1576
+ {
1577
+ id: "2389328923893298",
1578
+ name: "employee_level",
1579
+ description: "Employee Level",
1580
+ value: [
1581
+ "<value>",
1582
+ ],
1583
+ },
1584
+ {
1585
+ id: "2389328923893298",
1586
+ name: "employee_level",
1587
+ description: "Employee Level",
1588
+ value: [
1589
+ "<value>",
1590
+ "<value>",
1591
+ ],
1592
+ },
1593
+ ],
1594
+ rowVersion: "1-12345",
1595
+ updatedBy: "12345",
1596
+ createdBy: "12345",
1597
+ updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1598
+ createdAt: new Date("2020-09-30T07:43:32.000Z"),
1599
+ passThrough: [
1600
+ {
1601
+ serviceId: "<id>",
1602
+ extendPaths: [
1603
+ {
1604
+ path: "$.nested.property",
1605
+ value: {
1606
+ "TaxClassificationRef": {
1607
+ "value": "EUC-99990201-V1-00020000",
1608
+ },
1609
+ },
1610
+ },
1611
+ ],
1612
+ },
1613
+ {
1614
+ serviceId: "<id>",
1615
+ extendPaths: [
1616
+ {
1617
+ path: "$.nested.property",
1618
+ value: {
1619
+ "TaxClassificationRef": {
1620
+ "value": "EUC-99990201-V1-00020000",
1621
+ },
1622
+ },
1623
+ },
1624
+ ],
1625
+ },
1626
+ ],
1627
+ },
1628
+ });
961
1629
  });
962
1630
 
963
- test("Creditnotes Accounting Credit Notes One", async () => {
964
- const testHttpClient = createTestHTTPClient("accounting.creditNotesOne");
1631
+ test("Creditnotes Accounting Credit Notes Update", async () => {
1632
+ const testHttpClient = createTestHTTPClient("accounting.creditNotesUpdate");
965
1633
 
966
1634
  const apideck = new Apideck({
967
1635
  serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
@@ -969,29 +1637,16 @@ test("Creditnotes Accounting Credit Notes One", async () => {
969
1637
  apiKey: process.env["APIDECK_API_KEY"] ?? "value",
970
1638
  });
971
1639
 
972
- const result = await apideck.accounting.creditNotes.get({
1640
+ const result = await apideck.accounting.creditNotes.update({
973
1641
  id: "<id>",
974
1642
  consumerId: "test-consumer",
975
1643
  appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
976
1644
  serviceId: "salesforce",
977
- fields: "id,updated_at",
978
- });
979
- expect(result.httpMeta.response.status).toBe(200);
980
- expect(result.getCreditNoteResponse).toBeDefined();
981
- expect(result.getCreditNoteResponse).toEqual({
982
- statusCode: 200,
983
- status: "OK",
984
- service: "xero",
985
- resource: "credit-notes",
986
- operation: "one",
987
- data: {
988
- id: "123456",
1645
+ creditNote: {
989
1646
  number: "OIT00546",
990
1647
  customer: {
991
1648
  id: "12345",
992
- displayId: "CUST00101",
993
1649
  displayName: "Windsurf Shop",
994
- companyName: "The boring company",
995
1650
  email: "boring@boring.com",
996
1651
  },
997
1652
  companyId: "12345",
@@ -1011,7 +1666,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1011
1666
  type: "accounts_receivable_credit",
1012
1667
  account: {
1013
1668
  id: "123456",
1014
- name: "Bank account",
1015
1669
  nominalCode: "N091",
1016
1670
  code: "453",
1017
1671
  },
@@ -1040,8 +1694,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1040
1694
  },
1041
1695
  taxRate: {
1042
1696
  id: "123456",
1043
- code: "N-T",
1044
- name: "GST on Purchases",
1045
1697
  rate: 10,
1046
1698
  },
1047
1699
  trackingCategories: [
@@ -1056,7 +1708,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1056
1708
  ],
1057
1709
  ledgerAccount: {
1058
1710
  id: "123456",
1059
- name: "Bank account",
1060
1711
  nominalCode: "N091",
1061
1712
  code: "453",
1062
1713
  },
@@ -1065,22 +1716,19 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1065
1716
  id: "2389328923893298",
1066
1717
  name: "employee_level",
1067
1718
  description: "Employee Level",
1068
- value: {},
1719
+ value: [
1720
+ {},
1721
+ {},
1722
+ ],
1069
1723
  },
1070
1724
  {
1071
1725
  id: "2389328923893298",
1072
1726
  name: "employee_level",
1073
1727
  description: "Employee Level",
1074
- value: [
1075
- {},
1076
- ],
1728
+ value: true,
1077
1729
  },
1078
1730
  ],
1079
1731
  rowVersion: "1-12345",
1080
- updatedBy: "12345",
1081
- createdBy: "12345",
1082
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1083
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1084
1732
  },
1085
1733
  {
1086
1734
  id: "12345",
@@ -1106,8 +1754,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1106
1754
  },
1107
1755
  taxRate: {
1108
1756
  id: "123456",
1109
- code: "N-T",
1110
- name: "GST on Purchases",
1111
1757
  rate: 10,
1112
1758
  },
1113
1759
  trackingCategories: [
@@ -1119,10 +1765,13 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1119
1765
  id: "123456",
1120
1766
  name: "New York",
1121
1767
  },
1768
+ {
1769
+ id: "123456",
1770
+ name: "New York",
1771
+ },
1122
1772
  ],
1123
1773
  ledgerAccount: {
1124
1774
  id: "123456",
1125
- name: "Bank account",
1126
1775
  nominalCode: "N091",
1127
1776
  code: "453",
1128
1777
  },
@@ -1131,14 +1780,12 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1131
1780
  id: "2389328923893298",
1132
1781
  name: "employee_level",
1133
1782
  description: "Employee Level",
1134
- value: 10,
1783
+ value: [
1784
+ {},
1785
+ ],
1135
1786
  },
1136
1787
  ],
1137
1788
  rowVersion: "1-12345",
1138
- updatedBy: "12345",
1139
- createdBy: "12345",
1140
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1141
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1142
1789
  },
1143
1790
  {
1144
1791
  id: "12345",
@@ -1164,8 +1811,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1164
1811
  },
1165
1812
  taxRate: {
1166
1813
  id: "123456",
1167
- code: "N-T",
1168
- name: "GST on Purchases",
1169
1814
  rate: 10,
1170
1815
  },
1171
1816
  trackingCategories: [
@@ -1173,18 +1818,9 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1173
1818
  id: "123456",
1174
1819
  name: "New York",
1175
1820
  },
1176
- {
1177
- id: "123456",
1178
- name: "New York",
1179
- },
1180
- {
1181
- id: "123456",
1182
- name: "New York",
1183
- },
1184
1821
  ],
1185
1822
  ledgerAccount: {
1186
1823
  id: "123456",
1187
- name: "Bank account",
1188
1824
  nominalCode: "N091",
1189
1825
  code: "453",
1190
1826
  },
@@ -1193,26 +1829,25 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1193
1829
  id: "2389328923893298",
1194
1830
  name: "employee_level",
1195
1831
  description: "Employee Level",
1196
- value: {},
1197
- },
1198
- {
1199
- id: "2389328923893298",
1200
- name: "employee_level",
1201
- description: "Employee Level",
1202
- value: 10,
1832
+ value: "Uses Salesforce and Marketo",
1203
1833
  },
1204
1834
  ],
1205
1835
  rowVersion: "1-12345",
1206
- updatedBy: "12345",
1207
- createdBy: "12345",
1208
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1209
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1210
1836
  },
1211
1837
  ],
1212
1838
  allocations: [
1213
1839
  {
1214
1840
  id: "123456",
1215
- code: "N091",
1841
+ amount: 49.99,
1842
+ allocationId: "123456",
1843
+ },
1844
+ {
1845
+ id: "123456",
1846
+ amount: 49.99,
1847
+ allocationId: "123456",
1848
+ },
1849
+ {
1850
+ id: "123456",
1216
1851
  amount: 49.99,
1217
1852
  allocationId: "123456",
1218
1853
  },
@@ -1276,31 +1911,24 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1276
1911
  id: "123456",
1277
1912
  name: "New York",
1278
1913
  },
1279
- ],
1280
- customFields: [
1281
1914
  {
1282
- id: "2389328923893298",
1283
- name: "employee_level",
1284
- description: "Employee Level",
1285
- value: [
1286
- "<value>",
1287
- ],
1915
+ id: "123456",
1916
+ name: "New York",
1917
+ },
1918
+ {
1919
+ id: "123456",
1920
+ name: "New York",
1288
1921
  },
1922
+ ],
1923
+ customFields: [
1289
1924
  {
1290
1925
  id: "2389328923893298",
1291
1926
  name: "employee_level",
1292
1927
  description: "Employee Level",
1293
- value: [
1294
- "<value>",
1295
- "<value>",
1296
- ],
1928
+ value: true,
1297
1929
  },
1298
1930
  ],
1299
1931
  rowVersion: "1-12345",
1300
- updatedBy: "12345",
1301
- createdBy: "12345",
1302
- updatedAt: new Date("2020-09-30T07:43:32.000Z"),
1303
- createdAt: new Date("2020-09-30T07:43:32.000Z"),
1304
1932
  passThrough: [
1305
1933
  {
1306
1934
  serviceId: "<id>",
@@ -1313,6 +1941,43 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1313
1941
  },
1314
1942
  },
1315
1943
  },
1944
+ {
1945
+ path: "$.nested.property",
1946
+ value: {
1947
+ "TaxClassificationRef": {
1948
+ "value": "EUC-99990201-V1-00020000",
1949
+ },
1950
+ },
1951
+ },
1952
+ {
1953
+ path: "$.nested.property",
1954
+ value: {
1955
+ "TaxClassificationRef": {
1956
+ "value": "EUC-99990201-V1-00020000",
1957
+ },
1958
+ },
1959
+ },
1960
+ ],
1961
+ },
1962
+ {
1963
+ serviceId: "<id>",
1964
+ extendPaths: [
1965
+ {
1966
+ path: "$.nested.property",
1967
+ value: {
1968
+ "TaxClassificationRef": {
1969
+ "value": "EUC-99990201-V1-00020000",
1970
+ },
1971
+ },
1972
+ },
1973
+ {
1974
+ path: "$.nested.property",
1975
+ value: {
1976
+ "TaxClassificationRef": {
1977
+ "value": "EUC-99990201-V1-00020000",
1978
+ },
1979
+ },
1980
+ },
1316
1981
  ],
1317
1982
  },
1318
1983
  {
@@ -1331,12 +1996,18 @@ test("Creditnotes Accounting Credit Notes One", async () => {
1331
1996
  ],
1332
1997
  },
1333
1998
  });
1334
- });
1335
-
1336
- it.skip("Creditnotes Accounting Credit Notes Update", async () => {
1337
- assert.fail(
1338
- "incomplete test found please make sure to address the following errors: [`workflow step accounting.creditNotesUpdate.test referencing operation accounting.creditNotesUpdate with expression in requestBody with type not currently supported`, `workflow step accounting.creditNotesUpdate.test referencing operation accounting.creditNotesUpdate with expression in requestBody with type not currently supported`, `workflow step accounting.creditNotesUpdate.test referencing operation accounting.creditNotesUpdate with expression in requestBody with type not currently supported`, `workflow step accounting.creditNotesUpdate.test referencing operation accounting.creditNotesUpdate with expression in requestBody with type not currently supported`, `workflow step accounting.creditNotesUpdate.test referencing operation accounting.creditNotesUpdate with expression in requestBody with type not currently supported`, `workflow step accounting.creditNotesUpdate.test referencing operation accounting.creditNotesUpdate with expression in requestBody with type not currently supported`]",
1339
- );
1999
+ expect(result.httpMeta.response.status).toBe(200);
2000
+ expect(result.updateCreditNoteResponse).toBeDefined();
2001
+ expect(result.updateCreditNoteResponse).toEqual({
2002
+ statusCode: 200,
2003
+ status: "OK",
2004
+ service: "xero",
2005
+ resource: "credit-notes",
2006
+ operation: "update",
2007
+ data: {
2008
+ id: "12345",
2009
+ },
2010
+ });
1340
2011
  });
1341
2012
 
1342
2013
  test("Creditnotes Accounting Credit Notes Delete", async () => {