@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.
- package/README.md +5 -5
- package/docs/sdks/categories/README.md +12 -0
- package/docs/sdks/companies/README.md +4 -4
- package/examples/README.md +26 -0
- package/examples/accountingTaxRatesList.example.ts +41 -0
- package/examples/package-lock.json +613 -0
- package/examples/package.json +18 -0
- package/funcs/accountingCategoriesGet.d.ts.map +1 -1
- package/funcs/accountingCategoriesGet.js +4 -2
- package/funcs/accountingCategoriesGet.js.map +1 -1
- package/funcs/accountingCategoriesList.d.ts.map +1 -1
- package/funcs/accountingCategoriesList.js +4 -2
- package/funcs/accountingCategoriesList.js.map +1 -1
- package/funcs/crmCompaniesCreate.js +1 -1
- package/funcs/crmCompaniesCreate.js.map +1 -1
- package/funcs/crmCompaniesUpdate.js +1 -1
- package/funcs/crmCompaniesUpdate.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/models/components/balancesheetfilter.d.ts +5 -0
- package/models/components/balancesheetfilter.d.ts.map +1 -1
- package/models/components/balancesheetfilter.js +4 -0
- package/models/components/balancesheetfilter.js.map +1 -1
- package/models/components/bankaccount.d.ts +5 -0
- package/models/components/bankaccount.d.ts.map +1 -1
- package/models/components/bankaccount.js +2 -0
- package/models/components/bankaccount.js.map +1 -1
- package/models/components/bankaccount1.d.ts +123 -0
- package/models/components/bankaccount1.d.ts.map +1 -0
- package/models/components/bankaccount1.js +128 -0
- package/models/components/bankaccount1.js.map +1 -0
- package/models/components/categoriesfilter.d.ts +67 -0
- package/models/components/categoriesfilter.d.ts.map +1 -0
- package/models/components/categoriesfilter.js +82 -0
- package/models/components/categoriesfilter.js.map +1 -0
- package/models/components/category.d.ts +39 -0
- package/models/components/category.d.ts.map +1 -1
- package/models/components/category.js +26 -1
- package/models/components/category.js.map +1 -1
- package/models/components/{company.d.ts → company1.d.ts} +32 -32
- package/models/components/company1.d.ts.map +1 -0
- package/models/components/{company.js → company1.js} +37 -37
- package/models/components/company1.js.map +1 -0
- package/models/components/companyinfo.d.ts +5 -0
- package/models/components/companyinfo.d.ts.map +1 -1
- package/models/components/companyinfo.js +4 -0
- package/models/components/companyinfo.js.map +1 -1
- package/models/components/connection.d.ts +13 -13
- package/models/components/connection.d.ts.map +1 -1
- package/models/components/connection.js +16 -17
- package/models/components/connection.js.map +1 -1
- package/models/components/customfield.d.ts +37 -38
- package/models/components/customfield.d.ts.map +1 -1
- package/models/components/customfield.js +25 -54
- package/models/components/customfield.js.map +1 -1
- package/models/components/getcompaniesresponse.d.ts +3 -3
- package/models/components/getcompaniesresponse.d.ts.map +1 -1
- package/models/components/getcompaniesresponse.js +3 -3
- package/models/components/getcompaniesresponse.js.map +1 -1
- package/models/components/getcompanyresponse.d.ts +3 -3
- package/models/components/getcompanyresponse.d.ts.map +1 -1
- package/models/components/getcompanyresponse.js +3 -3
- package/models/components/getcompanyresponse.js.map +1 -1
- package/models/components/index.d.ts +3 -1
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +3 -1
- package/models/components/index.js.map +1 -1
- package/models/components/invoicelineitem.d.ts +10 -0
- package/models/components/invoicelineitem.d.ts.map +1 -1
- package/models/components/invoicelineitem.js +8 -0
- package/models/components/invoicelineitem.js.map +1 -1
- package/models/components/profitandlossfilter.d.ts +5 -0
- package/models/components/profitandlossfilter.d.ts.map +1 -1
- package/models/components/profitandlossfilter.js +4 -0
- package/models/components/profitandlossfilter.js.map +1 -1
- package/models/components/simpleformfieldoption.d.ts +13 -13
- package/models/components/simpleformfieldoption.d.ts.map +1 -1
- package/models/components/simpleformfieldoption.js +16 -16
- package/models/components/simpleformfieldoption.js.map +1 -1
- package/models/components/supplier.d.ts +10 -0
- package/models/components/supplier.d.ts.map +1 -1
- package/models/components/supplier.js +4 -0
- package/models/components/supplier.js.map +1 -1
- package/models/errors/apierror.d.ts.map +1 -1
- package/models/errors/apierror.js +8 -2
- package/models/errors/apierror.js.map +1 -1
- package/models/errors/badrequestresponse.js +1 -1
- package/models/errors/badrequestresponse.js.map +1 -1
- package/models/errors/notfoundresponse.js +1 -1
- package/models/errors/notfoundresponse.js.map +1 -1
- package/models/errors/paymentrequiredresponse.js +1 -1
- package/models/errors/paymentrequiredresponse.js.map +1 -1
- package/models/errors/unauthorizedresponse.js +1 -1
- package/models/errors/unauthorizedresponse.js.map +1 -1
- package/models/errors/unprocessableresponse.js +1 -1
- package/models/errors/unprocessableresponse.js.map +1 -1
- package/models/operations/accountingcategoriesall.d.ts +5 -0
- package/models/operations/accountingcategoriesall.d.ts.map +1 -1
- package/models/operations/accountingcategoriesall.js +2 -0
- package/models/operations/accountingcategoriesall.js.map +1 -1
- package/models/operations/accountingcategoriesone.d.ts +5 -0
- package/models/operations/accountingcategoriesone.d.ts.map +1 -1
- package/models/operations/accountingcategoriesone.js +2 -0
- package/models/operations/accountingcategoriesone.js.map +1 -1
- package/models/operations/crmcompaniesadd.d.ts +2 -2
- package/models/operations/crmcompaniesadd.d.ts.map +1 -1
- package/models/operations/crmcompaniesadd.js +4 -4
- package/models/operations/crmcompaniesadd.js.map +1 -1
- package/models/operations/crmcompaniesupdate.d.ts +2 -2
- package/models/operations/crmcompaniesupdate.d.ts.map +1 -1
- package/models/operations/crmcompaniesupdate.js +4 -4
- package/models/operations/crmcompaniesupdate.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/activities.test.ts +364 -13
- package/src/__tests__/apideckcompanies.test.ts +373 -9
- package/src/__tests__/apideckdepartments.test.ts +181 -9
- package/src/__tests__/applicants.test.ts +473 -9
- package/src/__tests__/applications.test.ts +189 -9
- package/src/__tests__/bankfeedaccounts.test.ts +4 -4
- package/src/__tests__/billpayments.test.ts +378 -20
- package/src/__tests__/bills.test.ts +500 -9
- package/src/__tests__/collectionticketcomments.test.ts +183 -7
- package/src/__tests__/collectiontickets.test.ts +191 -7
- package/src/__tests__/companies.test.ts +607 -78
- package/src/__tests__/connections.test.ts +409 -5
- package/src/__tests__/connectionsettings.test.ts +410 -5
- package/src/__tests__/contacts.test.ts +470 -13
- package/src/__tests__/creditnotes.test.ts +819 -148
- package/src/__tests__/customers.test.ts +517 -13
- package/src/__tests__/customobjects.test.ts +150 -9
- package/src/__tests__/customobjectschemas.test.ts +321 -9
- package/src/__tests__/departments.test.ts +173 -9
- package/src/__tests__/drivegroups.test.ts +181 -9
- package/src/__tests__/drives.test.ts +179 -9
- package/src/__tests__/employees.test.ts +829 -94
- package/src/__tests__/expenses.test.ts +338 -15
- package/src/__tests__/files.test.ts +106 -5
- package/src/__tests__/folders.test.ts +296 -13
- package/src/__tests__/invoiceitems.test.ts +272 -9
- package/src/__tests__/invoices.test.ts +695 -89
- package/src/__tests__/journalentries.test.ts +490 -8
- package/src/__tests__/leads.test.ts +450 -13
- package/src/__tests__/ledgeraccounts.test.ts +248 -19
- package/src/__tests__/locations.test.ts +298 -9
- package/src/__tests__/messages.test.ts +195 -9
- package/src/__tests__/notes.test.ts +191 -9
- package/src/__tests__/opportunities.test.ts +218 -9
- package/src/__tests__/payments.test.ts +323 -20
- package/src/__tests__/pipelines.test.ts +194 -9
- package/src/__tests__/purchaseorders.test.ts +847 -178
- package/src/__tests__/sharedlinks.test.ts +183 -9
- package/src/__tests__/subsidiaries.test.ts +183 -9
- package/src/__tests__/suppliers.test.ts +509 -13
- package/src/__tests__/taxrates.test.ts +235 -12
- package/src/__tests__/timeoffrequests.test.ts +210 -9
- package/src/__tests__/trackingcategories.test.ts +187 -7
- package/src/__tests__/uploadsessions.test.ts +78 -5
- package/src/__tests__/users.test.ts +356 -9
- package/src/funcs/accountingCategoriesGet.ts +15 -5
- package/src/funcs/accountingCategoriesList.ts +17 -7
- package/src/funcs/crmCompaniesCreate.ts +1 -1
- package/src/funcs/crmCompaniesUpdate.ts +1 -1
- package/src/lib/config.ts +4 -4
- package/src/models/components/balancesheetfilter.ts +9 -0
- package/src/models/components/bankaccount.ts +7 -0
- package/src/models/components/bankaccount1.ts +207 -0
- package/src/models/components/categoriesfilter.ts +104 -0
- package/src/models/components/category.ts +39 -0
- package/src/models/components/{company.ts → company1.ts} +131 -128
- package/src/models/components/companyinfo.ts +9 -0
- package/src/models/components/connection.ts +27 -20
- package/src/models/components/customfield.ts +51 -83
- package/src/models/components/getcompaniesresponse.ts +9 -9
- package/src/models/components/getcompanyresponse.ts +9 -9
- package/src/models/components/index.ts +3 -1
- package/src/models/components/invoicelineitem.ts +18 -0
- package/src/models/components/profitandlossfilter.ts +9 -0
- package/src/models/components/simpleformfieldoption.ts +21 -18
- package/src/models/components/supplier.ts +14 -0
- package/src/models/errors/apierror.ts +8 -2
- package/src/models/errors/badrequestresponse.ts +1 -1
- package/src/models/errors/notfoundresponse.ts +1 -1
- package/src/models/errors/paymentrequiredresponse.ts +1 -1
- package/src/models/errors/unauthorizedresponse.ts +1 -1
- package/src/models/errors/unprocessableresponse.ts +1 -1
- package/src/models/operations/accountingcategoriesall.ts +7 -0
- package/src/models/operations/accountingcategoriesone.ts +7 -0
- package/src/models/operations/crmcompaniesadd.ts +6 -6
- package/src/models/operations/crmcompaniesupdate.ts +6 -6
- package/models/components/company.d.ts.map +0 -1
- 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 {
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
6
|
import { Apideck } from "../index.js";
|
|
7
7
|
import { createTestHTTPClient } from "./testclient.js";
|
|
8
8
|
|
|
@@ -280,10 +280,10 @@ test("Creditnotes Accounting Credit Notes All", async () => {
|
|
|
280
280
|
id: "2389328923893298",
|
|
281
281
|
name: "employee_level",
|
|
282
282
|
description: "Employee Level",
|
|
283
|
-
value:
|
|
284
|
-
"<value>",
|
|
285
|
-
"<value>",
|
|
286
|
-
|
|
283
|
+
value: {
|
|
284
|
+
"0": "<value>",
|
|
285
|
+
"1": "<value>",
|
|
286
|
+
},
|
|
287
287
|
},
|
|
288
288
|
],
|
|
289
289
|
rowVersion: "1-12345",
|
|
@@ -401,10 +401,10 @@ test("Creditnotes Accounting Credit Notes All", async () => {
|
|
|
401
401
|
id: "2389328923893298",
|
|
402
402
|
name: "employee_level",
|
|
403
403
|
description: "Employee Level",
|
|
404
|
-
value:
|
|
405
|
-
{},
|
|
406
|
-
{},
|
|
407
|
-
|
|
404
|
+
value: {
|
|
405
|
+
"0": {},
|
|
406
|
+
"1": {},
|
|
407
|
+
},
|
|
408
408
|
},
|
|
409
409
|
],
|
|
410
410
|
rowVersion: "1-12345",
|
|
@@ -788,9 +788,9 @@ test("Creditnotes Accounting Credit Notes All", async () => {
|
|
|
788
788
|
id: "2389328923893298",
|
|
789
789
|
name: "employee_level",
|
|
790
790
|
description: "Employee Level",
|
|
791
|
-
value:
|
|
792
|
-
{},
|
|
793
|
-
|
|
791
|
+
value: {
|
|
792
|
+
"0": {},
|
|
793
|
+
},
|
|
794
794
|
},
|
|
795
795
|
{
|
|
796
796
|
id: "2389328923893298",
|
|
@@ -891,11 +891,11 @@ test("Creditnotes Accounting Credit Notes All", async () => {
|
|
|
891
891
|
id: "2389328923893298",
|
|
892
892
|
name: "employee_level",
|
|
893
893
|
description: "Employee Level",
|
|
894
|
-
value:
|
|
895
|
-
{},
|
|
896
|
-
{},
|
|
897
|
-
{},
|
|
898
|
-
|
|
894
|
+
value: {
|
|
895
|
+
"0": {},
|
|
896
|
+
"1": {},
|
|
897
|
+
"2": {},
|
|
898
|
+
},
|
|
899
899
|
},
|
|
900
900
|
],
|
|
901
901
|
rowVersion: "1-12345",
|
|
@@ -954,14 +954,8 @@ test("Creditnotes Accounting Credit Notes All", async () => {
|
|
|
954
954
|
});
|
|
955
955
|
});
|
|
956
956
|
|
|
957
|
-
|
|
958
|
-
|
|
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
|
-
);
|
|
961
|
-
});
|
|
962
|
-
|
|
963
|
-
test("Creditnotes Accounting Credit Notes One", async () => {
|
|
964
|
-
const testHttpClient = createTestHTTPClient("accounting.creditNotesOne");
|
|
957
|
+
test("Creditnotes Accounting Credit Notes Add", async () => {
|
|
958
|
+
const testHttpClient = createTestHTTPClient("accounting.creditNotesAdd");
|
|
965
959
|
|
|
966
960
|
const apideck = new Apideck({
|
|
967
961
|
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
@@ -969,29 +963,15 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
969
963
|
apiKey: process.env["APIDECK_API_KEY"] ?? "value",
|
|
970
964
|
});
|
|
971
965
|
|
|
972
|
-
const result = await apideck.accounting.creditNotes.
|
|
973
|
-
id: "<id>",
|
|
966
|
+
const result = await apideck.accounting.creditNotes.create({
|
|
974
967
|
consumerId: "test-consumer",
|
|
975
968
|
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
|
|
976
969
|
serviceId: "salesforce",
|
|
977
|
-
|
|
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",
|
|
970
|
+
creditNote: {
|
|
989
971
|
number: "OIT00546",
|
|
990
972
|
customer: {
|
|
991
973
|
id: "12345",
|
|
992
|
-
displayId: "CUST00101",
|
|
993
974
|
displayName: "Windsurf Shop",
|
|
994
|
-
companyName: "The boring company",
|
|
995
975
|
email: "boring@boring.com",
|
|
996
976
|
},
|
|
997
977
|
companyId: "12345",
|
|
@@ -1011,7 +991,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1011
991
|
type: "accounts_receivable_credit",
|
|
1012
992
|
account: {
|
|
1013
993
|
id: "123456",
|
|
1014
|
-
name: "Bank account",
|
|
1015
994
|
nominalCode: "N091",
|
|
1016
995
|
code: "453",
|
|
1017
996
|
},
|
|
@@ -1040,8 +1019,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1040
1019
|
},
|
|
1041
1020
|
taxRate: {
|
|
1042
1021
|
id: "123456",
|
|
1043
|
-
code: "N-T",
|
|
1044
|
-
name: "GST on Purchases",
|
|
1045
1022
|
rate: 10,
|
|
1046
1023
|
},
|
|
1047
1024
|
trackingCategories: [
|
|
@@ -1056,7 +1033,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1056
1033
|
],
|
|
1057
1034
|
ledgerAccount: {
|
|
1058
1035
|
id: "123456",
|
|
1059
|
-
name: "Bank account",
|
|
1060
1036
|
nominalCode: "N091",
|
|
1061
1037
|
code: "453",
|
|
1062
1038
|
},
|
|
@@ -1065,80 +1041,16 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1065
1041
|
id: "2389328923893298",
|
|
1066
1042
|
name: "employee_level",
|
|
1067
1043
|
description: "Employee Level",
|
|
1068
|
-
value:
|
|
1069
|
-
},
|
|
1070
|
-
{
|
|
1071
|
-
id: "2389328923893298",
|
|
1072
|
-
name: "employee_level",
|
|
1073
|
-
description: "Employee Level",
|
|
1074
|
-
value: [
|
|
1075
|
-
{},
|
|
1076
|
-
],
|
|
1077
|
-
},
|
|
1078
|
-
],
|
|
1079
|
-
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
|
-
},
|
|
1085
|
-
{
|
|
1086
|
-
id: "12345",
|
|
1087
|
-
rowId: "12345",
|
|
1088
|
-
code: "120-C",
|
|
1089
|
-
lineNumber: 1,
|
|
1090
|
-
description:
|
|
1091
|
-
"Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
|
|
1092
|
-
type: "sales_item",
|
|
1093
|
-
taxAmount: 27500,
|
|
1094
|
-
totalAmount: 27500,
|
|
1095
|
-
quantity: 1,
|
|
1096
|
-
unitPrice: 27500.5,
|
|
1097
|
-
unitOfMeasure: "pc.",
|
|
1098
|
-
discountPercentage: 0.01,
|
|
1099
|
-
discountAmount: 19.99,
|
|
1100
|
-
locationId: "12345",
|
|
1101
|
-
departmentId: "12345",
|
|
1102
|
-
item: {
|
|
1103
|
-
id: "12344",
|
|
1104
|
-
code: "120-C",
|
|
1105
|
-
name: "Model Y",
|
|
1106
|
-
},
|
|
1107
|
-
taxRate: {
|
|
1108
|
-
id: "123456",
|
|
1109
|
-
code: "N-T",
|
|
1110
|
-
name: "GST on Purchases",
|
|
1111
|
-
rate: 10,
|
|
1112
|
-
},
|
|
1113
|
-
trackingCategories: [
|
|
1114
|
-
{
|
|
1115
|
-
id: "123456",
|
|
1116
|
-
name: "New York",
|
|
1117
|
-
},
|
|
1118
|
-
{
|
|
1119
|
-
id: "123456",
|
|
1120
|
-
name: "New York",
|
|
1044
|
+
value: "Uses Salesforce and Marketo",
|
|
1121
1045
|
},
|
|
1122
|
-
],
|
|
1123
|
-
ledgerAccount: {
|
|
1124
|
-
id: "123456",
|
|
1125
|
-
name: "Bank account",
|
|
1126
|
-
nominalCode: "N091",
|
|
1127
|
-
code: "453",
|
|
1128
|
-
},
|
|
1129
|
-
customFields: [
|
|
1130
1046
|
{
|
|
1131
1047
|
id: "2389328923893298",
|
|
1132
1048
|
name: "employee_level",
|
|
1133
1049
|
description: "Employee Level",
|
|
1134
|
-
value:
|
|
1050
|
+
value: "Uses Salesforce and Marketo",
|
|
1135
1051
|
},
|
|
1136
1052
|
],
|
|
1137
1053
|
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
1054
|
},
|
|
1143
1055
|
{
|
|
1144
1056
|
id: "12345",
|
|
@@ -1164,8 +1076,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1164
1076
|
},
|
|
1165
1077
|
taxRate: {
|
|
1166
1078
|
id: "123456",
|
|
1167
|
-
code: "N-T",
|
|
1168
|
-
name: "GST on Purchases",
|
|
1169
1079
|
rate: 10,
|
|
1170
1080
|
},
|
|
1171
1081
|
trackingCategories: [
|
|
@@ -1184,7 +1094,6 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1184
1094
|
],
|
|
1185
1095
|
ledgerAccount: {
|
|
1186
1096
|
id: "123456",
|
|
1187
|
-
name: "Bank account",
|
|
1188
1097
|
nominalCode: "N091",
|
|
1189
1098
|
code: "453",
|
|
1190
1099
|
},
|
|
@@ -1193,7 +1102,7 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1193
1102
|
id: "2389328923893298",
|
|
1194
1103
|
name: "employee_level",
|
|
1195
1104
|
description: "Employee Level",
|
|
1196
|
-
value:
|
|
1105
|
+
value: "Uses Salesforce and Marketo",
|
|
1197
1106
|
},
|
|
1198
1107
|
{
|
|
1199
1108
|
id: "2389328923893298",
|
|
@@ -1201,18 +1110,29 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1201
1110
|
description: "Employee Level",
|
|
1202
1111
|
value: 10,
|
|
1203
1112
|
},
|
|
1113
|
+
{
|
|
1114
|
+
id: "2389328923893298",
|
|
1115
|
+
name: "employee_level",
|
|
1116
|
+
description: "Employee Level",
|
|
1117
|
+
value: "Uses Salesforce and Marketo",
|
|
1118
|
+
},
|
|
1204
1119
|
],
|
|
1205
1120
|
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
1121
|
},
|
|
1211
1122
|
],
|
|
1212
1123
|
allocations: [
|
|
1213
1124
|
{
|
|
1214
1125
|
id: "123456",
|
|
1215
|
-
|
|
1126
|
+
amount: 49.99,
|
|
1127
|
+
allocationId: "123456",
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
id: "123456",
|
|
1131
|
+
amount: 49.99,
|
|
1132
|
+
allocationId: "123456",
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
id: "123456",
|
|
1216
1136
|
amount: 49.99,
|
|
1217
1137
|
allocationId: "123456",
|
|
1218
1138
|
},
|
|
@@ -1276,31 +1196,34 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1276
1196
|
id: "123456",
|
|
1277
1197
|
name: "New York",
|
|
1278
1198
|
},
|
|
1199
|
+
{
|
|
1200
|
+
id: "123456",
|
|
1201
|
+
name: "New York",
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
id: "123456",
|
|
1205
|
+
name: "New York",
|
|
1206
|
+
},
|
|
1279
1207
|
],
|
|
1280
1208
|
customFields: [
|
|
1281
1209
|
{
|
|
1282
1210
|
id: "2389328923893298",
|
|
1283
1211
|
name: "employee_level",
|
|
1284
1212
|
description: "Employee Level",
|
|
1285
|
-
value:
|
|
1286
|
-
"<value>",
|
|
1287
|
-
|
|
1213
|
+
value: {
|
|
1214
|
+
"0": "<value>",
|
|
1215
|
+
"1": "<value>",
|
|
1216
|
+
"2": "<value>",
|
|
1217
|
+
},
|
|
1288
1218
|
},
|
|
1289
1219
|
{
|
|
1290
1220
|
id: "2389328923893298",
|
|
1291
1221
|
name: "employee_level",
|
|
1292
1222
|
description: "Employee Level",
|
|
1293
|
-
value:
|
|
1294
|
-
"<value>",
|
|
1295
|
-
"<value>",
|
|
1296
|
-
],
|
|
1223
|
+
value: true,
|
|
1297
1224
|
},
|
|
1298
1225
|
],
|
|
1299
1226
|
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
1227
|
passThrough: [
|
|
1305
1228
|
{
|
|
1306
1229
|
serviceId: "<id>",
|
|
@@ -1315,28 +1238,776 @@ test("Creditnotes Accounting Credit Notes One", async () => {
|
|
|
1315
1238
|
},
|
|
1316
1239
|
],
|
|
1317
1240
|
},
|
|
1318
|
-
{
|
|
1319
|
-
serviceId: "<id>",
|
|
1320
|
-
extendPaths: [
|
|
1321
|
-
{
|
|
1322
|
-
path: "$.nested.property",
|
|
1323
|
-
value: {
|
|
1324
|
-
"TaxClassificationRef": {
|
|
1325
|
-
"value": "EUC-99990201-V1-00020000",
|
|
1326
|
-
},
|
|
1327
|
-
},
|
|
1328
|
-
},
|
|
1329
|
-
],
|
|
1330
|
-
},
|
|
1331
1241
|
],
|
|
1332
1242
|
},
|
|
1333
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
|
+
});
|
|
1334
1256
|
});
|
|
1335
1257
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
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
|
+
"0": {},
|
|
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
|
+
"0": "<value>",
|
|
1582
|
+
},
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
id: "2389328923893298",
|
|
1586
|
+
name: "employee_level",
|
|
1587
|
+
description: "Employee Level",
|
|
1588
|
+
value: {
|
|
1589
|
+
"0": "<value>",
|
|
1590
|
+
"1": "<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
|
+
});
|
|
1629
|
+
});
|
|
1630
|
+
|
|
1631
|
+
test("Creditnotes Accounting Credit Notes Update", async () => {
|
|
1632
|
+
const testHttpClient = createTestHTTPClient("accounting.creditNotesUpdate");
|
|
1633
|
+
|
|
1634
|
+
const apideck = new Apideck({
|
|
1635
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
|
|
1636
|
+
httpClient: testHttpClient,
|
|
1637
|
+
apiKey: process.env["APIDECK_API_KEY"] ?? "value",
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
const result = await apideck.accounting.creditNotes.update({
|
|
1641
|
+
id: "<id>",
|
|
1642
|
+
consumerId: "test-consumer",
|
|
1643
|
+
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
|
|
1644
|
+
serviceId: "salesforce",
|
|
1645
|
+
creditNote: {
|
|
1646
|
+
number: "OIT00546",
|
|
1647
|
+
customer: {
|
|
1648
|
+
id: "12345",
|
|
1649
|
+
displayName: "Windsurf Shop",
|
|
1650
|
+
email: "boring@boring.com",
|
|
1651
|
+
},
|
|
1652
|
+
companyId: "12345",
|
|
1653
|
+
currency: "USD",
|
|
1654
|
+
currencyRate: 0.69,
|
|
1655
|
+
taxInclusive: true,
|
|
1656
|
+
subTotal: 27500,
|
|
1657
|
+
totalAmount: 49.99,
|
|
1658
|
+
totalTax: 2500,
|
|
1659
|
+
taxCode: "1234",
|
|
1660
|
+
balance: 27500,
|
|
1661
|
+
remainingCredit: 27500,
|
|
1662
|
+
status: "authorised",
|
|
1663
|
+
reference: "123456",
|
|
1664
|
+
dateIssued: new Date("2021-05-01T12:00:00.000Z"),
|
|
1665
|
+
datePaid: new Date("2021-05-01T12:00:00.000Z"),
|
|
1666
|
+
type: "accounts_receivable_credit",
|
|
1667
|
+
account: {
|
|
1668
|
+
id: "123456",
|
|
1669
|
+
nominalCode: "N091",
|
|
1670
|
+
code: "453",
|
|
1671
|
+
},
|
|
1672
|
+
lineItems: [
|
|
1673
|
+
{
|
|
1674
|
+
id: "12345",
|
|
1675
|
+
rowId: "12345",
|
|
1676
|
+
code: "120-C",
|
|
1677
|
+
lineNumber: 1,
|
|
1678
|
+
description:
|
|
1679
|
+
"Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
|
|
1680
|
+
type: "sales_item",
|
|
1681
|
+
taxAmount: 27500,
|
|
1682
|
+
totalAmount: 27500,
|
|
1683
|
+
quantity: 1,
|
|
1684
|
+
unitPrice: 27500.5,
|
|
1685
|
+
unitOfMeasure: "pc.",
|
|
1686
|
+
discountPercentage: 0.01,
|
|
1687
|
+
discountAmount: 19.99,
|
|
1688
|
+
locationId: "12345",
|
|
1689
|
+
departmentId: "12345",
|
|
1690
|
+
item: {
|
|
1691
|
+
id: "12344",
|
|
1692
|
+
code: "120-C",
|
|
1693
|
+
name: "Model Y",
|
|
1694
|
+
},
|
|
1695
|
+
taxRate: {
|
|
1696
|
+
id: "123456",
|
|
1697
|
+
rate: 10,
|
|
1698
|
+
},
|
|
1699
|
+
trackingCategories: [
|
|
1700
|
+
{
|
|
1701
|
+
id: "123456",
|
|
1702
|
+
name: "New York",
|
|
1703
|
+
},
|
|
1704
|
+
{
|
|
1705
|
+
id: "123456",
|
|
1706
|
+
name: "New York",
|
|
1707
|
+
},
|
|
1708
|
+
],
|
|
1709
|
+
ledgerAccount: {
|
|
1710
|
+
id: "123456",
|
|
1711
|
+
nominalCode: "N091",
|
|
1712
|
+
code: "453",
|
|
1713
|
+
},
|
|
1714
|
+
customFields: [
|
|
1715
|
+
{
|
|
1716
|
+
id: "2389328923893298",
|
|
1717
|
+
name: "employee_level",
|
|
1718
|
+
description: "Employee Level",
|
|
1719
|
+
value: {
|
|
1720
|
+
"0": {},
|
|
1721
|
+
"1": {},
|
|
1722
|
+
},
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
id: "2389328923893298",
|
|
1726
|
+
name: "employee_level",
|
|
1727
|
+
description: "Employee Level",
|
|
1728
|
+
value: true,
|
|
1729
|
+
},
|
|
1730
|
+
],
|
|
1731
|
+
rowVersion: "1-12345",
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
id: "12345",
|
|
1735
|
+
rowId: "12345",
|
|
1736
|
+
code: "120-C",
|
|
1737
|
+
lineNumber: 1,
|
|
1738
|
+
description:
|
|
1739
|
+
"Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
|
|
1740
|
+
type: "sales_item",
|
|
1741
|
+
taxAmount: 27500,
|
|
1742
|
+
totalAmount: 27500,
|
|
1743
|
+
quantity: 1,
|
|
1744
|
+
unitPrice: 27500.5,
|
|
1745
|
+
unitOfMeasure: "pc.",
|
|
1746
|
+
discountPercentage: 0.01,
|
|
1747
|
+
discountAmount: 19.99,
|
|
1748
|
+
locationId: "12345",
|
|
1749
|
+
departmentId: "12345",
|
|
1750
|
+
item: {
|
|
1751
|
+
id: "12344",
|
|
1752
|
+
code: "120-C",
|
|
1753
|
+
name: "Model Y",
|
|
1754
|
+
},
|
|
1755
|
+
taxRate: {
|
|
1756
|
+
id: "123456",
|
|
1757
|
+
rate: 10,
|
|
1758
|
+
},
|
|
1759
|
+
trackingCategories: [
|
|
1760
|
+
{
|
|
1761
|
+
id: "123456",
|
|
1762
|
+
name: "New York",
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
id: "123456",
|
|
1766
|
+
name: "New York",
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
id: "123456",
|
|
1770
|
+
name: "New York",
|
|
1771
|
+
},
|
|
1772
|
+
],
|
|
1773
|
+
ledgerAccount: {
|
|
1774
|
+
id: "123456",
|
|
1775
|
+
nominalCode: "N091",
|
|
1776
|
+
code: "453",
|
|
1777
|
+
},
|
|
1778
|
+
customFields: [
|
|
1779
|
+
{
|
|
1780
|
+
id: "2389328923893298",
|
|
1781
|
+
name: "employee_level",
|
|
1782
|
+
description: "Employee Level",
|
|
1783
|
+
value: {
|
|
1784
|
+
"0": {},
|
|
1785
|
+
},
|
|
1786
|
+
},
|
|
1787
|
+
],
|
|
1788
|
+
rowVersion: "1-12345",
|
|
1789
|
+
},
|
|
1790
|
+
{
|
|
1791
|
+
id: "12345",
|
|
1792
|
+
rowId: "12345",
|
|
1793
|
+
code: "120-C",
|
|
1794
|
+
lineNumber: 1,
|
|
1795
|
+
description:
|
|
1796
|
+
"Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
|
|
1797
|
+
type: "sales_item",
|
|
1798
|
+
taxAmount: 27500,
|
|
1799
|
+
totalAmount: 27500,
|
|
1800
|
+
quantity: 1,
|
|
1801
|
+
unitPrice: 27500.5,
|
|
1802
|
+
unitOfMeasure: "pc.",
|
|
1803
|
+
discountPercentage: 0.01,
|
|
1804
|
+
discountAmount: 19.99,
|
|
1805
|
+
locationId: "12345",
|
|
1806
|
+
departmentId: "12345",
|
|
1807
|
+
item: {
|
|
1808
|
+
id: "12344",
|
|
1809
|
+
code: "120-C",
|
|
1810
|
+
name: "Model Y",
|
|
1811
|
+
},
|
|
1812
|
+
taxRate: {
|
|
1813
|
+
id: "123456",
|
|
1814
|
+
rate: 10,
|
|
1815
|
+
},
|
|
1816
|
+
trackingCategories: [
|
|
1817
|
+
{
|
|
1818
|
+
id: "123456",
|
|
1819
|
+
name: "New York",
|
|
1820
|
+
},
|
|
1821
|
+
],
|
|
1822
|
+
ledgerAccount: {
|
|
1823
|
+
id: "123456",
|
|
1824
|
+
nominalCode: "N091",
|
|
1825
|
+
code: "453",
|
|
1826
|
+
},
|
|
1827
|
+
customFields: [
|
|
1828
|
+
{
|
|
1829
|
+
id: "2389328923893298",
|
|
1830
|
+
name: "employee_level",
|
|
1831
|
+
description: "Employee Level",
|
|
1832
|
+
value: "Uses Salesforce and Marketo",
|
|
1833
|
+
},
|
|
1834
|
+
],
|
|
1835
|
+
rowVersion: "1-12345",
|
|
1836
|
+
},
|
|
1837
|
+
],
|
|
1838
|
+
allocations: [
|
|
1839
|
+
{
|
|
1840
|
+
id: "123456",
|
|
1841
|
+
amount: 49.99,
|
|
1842
|
+
allocationId: "123456",
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
id: "123456",
|
|
1846
|
+
amount: 49.99,
|
|
1847
|
+
allocationId: "123456",
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
id: "123456",
|
|
1851
|
+
amount: 49.99,
|
|
1852
|
+
allocationId: "123456",
|
|
1853
|
+
},
|
|
1854
|
+
],
|
|
1855
|
+
note: "Some notes about this credit note",
|
|
1856
|
+
terms: "Some terms about this credit note",
|
|
1857
|
+
billingAddress: {
|
|
1858
|
+
id: "123",
|
|
1859
|
+
type: "primary",
|
|
1860
|
+
string: "25 Spring Street, Blackburn, VIC 3130",
|
|
1861
|
+
name: "HQ US",
|
|
1862
|
+
line1: "Main street",
|
|
1863
|
+
line2: "apt #",
|
|
1864
|
+
line3: "Suite #",
|
|
1865
|
+
line4: "delivery instructions",
|
|
1866
|
+
streetNumber: "25",
|
|
1867
|
+
city: "San Francisco",
|
|
1868
|
+
state: "CA",
|
|
1869
|
+
postalCode: "94104",
|
|
1870
|
+
country: "US",
|
|
1871
|
+
latitude: "40.759211",
|
|
1872
|
+
longitude: "-73.984638",
|
|
1873
|
+
county: "Santa Clara",
|
|
1874
|
+
contactName: "Elon Musk",
|
|
1875
|
+
salutation: "Mr",
|
|
1876
|
+
phoneNumber: "111-111-1111",
|
|
1877
|
+
fax: "122-111-1111",
|
|
1878
|
+
email: "elon@musk.com",
|
|
1879
|
+
website: "https://elonmusk.com",
|
|
1880
|
+
notes: "Address notes or delivery instructions.",
|
|
1881
|
+
rowVersion: "1-12345",
|
|
1882
|
+
},
|
|
1883
|
+
shippingAddress: {
|
|
1884
|
+
id: "123",
|
|
1885
|
+
type: "primary",
|
|
1886
|
+
string: "25 Spring Street, Blackburn, VIC 3130",
|
|
1887
|
+
name: "HQ US",
|
|
1888
|
+
line1: "Main street",
|
|
1889
|
+
line2: "apt #",
|
|
1890
|
+
line3: "Suite #",
|
|
1891
|
+
line4: "delivery instructions",
|
|
1892
|
+
streetNumber: "25",
|
|
1893
|
+
city: "San Francisco",
|
|
1894
|
+
state: "CA",
|
|
1895
|
+
postalCode: "94104",
|
|
1896
|
+
country: "US",
|
|
1897
|
+
latitude: "40.759211",
|
|
1898
|
+
longitude: "-73.984638",
|
|
1899
|
+
county: "Santa Clara",
|
|
1900
|
+
contactName: "Elon Musk",
|
|
1901
|
+
salutation: "Mr",
|
|
1902
|
+
phoneNumber: "111-111-1111",
|
|
1903
|
+
fax: "122-111-1111",
|
|
1904
|
+
email: "elon@musk.com",
|
|
1905
|
+
website: "https://elonmusk.com",
|
|
1906
|
+
notes: "Address notes or delivery instructions.",
|
|
1907
|
+
rowVersion: "1-12345",
|
|
1908
|
+
},
|
|
1909
|
+
trackingCategories: [
|
|
1910
|
+
{
|
|
1911
|
+
id: "123456",
|
|
1912
|
+
name: "New York",
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
id: "123456",
|
|
1916
|
+
name: "New York",
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
id: "123456",
|
|
1920
|
+
name: "New York",
|
|
1921
|
+
},
|
|
1922
|
+
],
|
|
1923
|
+
customFields: [
|
|
1924
|
+
{
|
|
1925
|
+
id: "2389328923893298",
|
|
1926
|
+
name: "employee_level",
|
|
1927
|
+
description: "Employee Level",
|
|
1928
|
+
value: true,
|
|
1929
|
+
},
|
|
1930
|
+
],
|
|
1931
|
+
rowVersion: "1-12345",
|
|
1932
|
+
passThrough: [
|
|
1933
|
+
{
|
|
1934
|
+
serviceId: "<id>",
|
|
1935
|
+
extendPaths: [
|
|
1936
|
+
{
|
|
1937
|
+
path: "$.nested.property",
|
|
1938
|
+
value: {
|
|
1939
|
+
"TaxClassificationRef": {
|
|
1940
|
+
"value": "EUC-99990201-V1-00020000",
|
|
1941
|
+
},
|
|
1942
|
+
},
|
|
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
|
+
},
|
|
1981
|
+
],
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
serviceId: "<id>",
|
|
1985
|
+
extendPaths: [
|
|
1986
|
+
{
|
|
1987
|
+
path: "$.nested.property",
|
|
1988
|
+
value: {
|
|
1989
|
+
"TaxClassificationRef": {
|
|
1990
|
+
"value": "EUC-99990201-V1-00020000",
|
|
1991
|
+
},
|
|
1992
|
+
},
|
|
1993
|
+
},
|
|
1994
|
+
],
|
|
1995
|
+
},
|
|
1996
|
+
],
|
|
1997
|
+
},
|
|
1998
|
+
});
|
|
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 () => {
|