zudello-integration-sdk 1.0.68 → 1.0.70
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/package.json +1 -1
- package/src/sdk/Zudello.js +4 -0
- package/src/sdk/ZudelloStore.js +33 -21
package/package.json
CHANGED
package/src/sdk/Zudello.js
CHANGED
|
@@ -29,12 +29,14 @@ const ItemCategoryModule = require("./submodules/zudello/ItemCategory");
|
|
|
29
29
|
const ItemGroupModule = require("./submodules/zudello/ItemGroup");
|
|
30
30
|
const JournalModule = require("./submodules/zudello/Journal");
|
|
31
31
|
const PurchaseOrderModule = require("./submodules/zudello/PurchaseOrder");
|
|
32
|
+
const Payment = require("./submodules/zudello/Payment");
|
|
32
33
|
const PaymentTermModule = require("./submodules/zudello/PaymentTerm");
|
|
33
34
|
const PaymentMethodModule = require("./submodules/zudello/PaymentMethod");
|
|
34
35
|
const ProjectModule = require("./submodules/zudello/Project");
|
|
35
36
|
const ProjectGroupModule = require("./submodules/zudello/ProjectGroup");
|
|
36
37
|
const ProjectTaskModule = require("./submodules/zudello/ProjectTask");
|
|
37
38
|
const ProjectTypeModule = require("./submodules/zudello/ProjectType");
|
|
39
|
+
const RefundModule = require("./submodules/zudello/Refund");
|
|
38
40
|
const SupplierCategoryModule = require("./submodules/zudello/SupplierCategory");
|
|
39
41
|
const SupplierGroupModule = require("./submodules/zudello/SupplierGroup");
|
|
40
42
|
const TeamAddressModule = require("./submodules/zudello/TeamAddress");
|
|
@@ -96,12 +98,14 @@ class ZudelloSDK extends BaseSDK {
|
|
|
96
98
|
this.itemGroup = new ItemGroupModule(this);
|
|
97
99
|
this.journal = new JournalModule(this);
|
|
98
100
|
this.purchaseOrder = new PurchaseOrderModule(this);
|
|
101
|
+
this.payment = new Payment(this);
|
|
99
102
|
this.paymentTerm = new PaymentTermModule(this);
|
|
100
103
|
this.paymentMethod = new PaymentMethodModule(this);
|
|
101
104
|
this.project = new ProjectModule(this);
|
|
102
105
|
this.projectGroup = new ProjectGroupModule(this);
|
|
103
106
|
this.projectTask = new ProjectTaskModule(this);
|
|
104
107
|
this.projectType = new ProjectTypeModule(this);
|
|
108
|
+
this.refund = new RefundModule(this);
|
|
105
109
|
this.supplierCategory = new SupplierCategoryModule(this);
|
|
106
110
|
this.supplierGroup = new SupplierGroupModule(this);
|
|
107
111
|
this.teamAddress = new TeamAddressModule(this);
|
package/src/sdk/ZudelloStore.js
CHANGED
|
@@ -23,37 +23,49 @@ class ZudelloStoreSDK extends BaseSDK {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async fetch({ uuid, resource_type = null }) {
|
|
26
|
-
const validateIsEmpty = this.validator.isEmpty({ uuid })
|
|
26
|
+
const validateIsEmpty = this.validator.isEmpty({ uuid })
|
|
27
27
|
|
|
28
28
|
if (!validateIsEmpty.valid) {
|
|
29
|
-
return this.responseHandler.error(validateIsEmpty.errors)
|
|
29
|
+
return this.responseHandler.error(validateIsEmpty.errors)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return await this.makeRequest(
|
|
33
33
|
"GET",
|
|
34
34
|
`${this.apiURL}/general-store/api/${this.apiVersion}/resources/${uuid}${resource_type ? `?resource_type=${resource_type}` : ""}`,
|
|
35
35
|
{}
|
|
36
|
-
)
|
|
36
|
+
)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
39
|
+
async fetchFields({ documentType }) {
|
|
40
|
+
const validateIsEmpty = this.validator.isEmpty({ documentType })
|
|
41
|
+
|
|
42
|
+
if (!validateIsEmpty.valid) {
|
|
43
|
+
return this.responseHandler.error(validateIsEmpty.errors)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const resource = await this.makeRequest(
|
|
47
|
+
"GET",
|
|
48
|
+
`${this.apiURL}/general-store/api/${this.apiVersion}/resources/?resource_type=document_type&document_type=${documentType}`,
|
|
49
|
+
{}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return _.map(_.get(resource, "data[0].payload.settings.fields", []), "path");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async fetchMetadata({ model }) {
|
|
56
|
+
const validateIsEmpty = this.validator.isEmpty({ model })
|
|
57
|
+
|
|
58
|
+
if (!validateIsEmpty.valid) {
|
|
59
|
+
return this.responseHandler.error(validateIsEmpty.errors)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const fieldMetadata = await this.makeRequest(
|
|
63
|
+
"GET",
|
|
64
|
+
`${this.apiURL}/general-store/api/${this.apiVersion}/metadata/field-metadata?section=forms&model_name=${model}`,
|
|
65
|
+
{}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
return _.map(fieldMetadata.fields, 'path')
|
|
57
69
|
}
|
|
58
70
|
}
|
|
59
71
|
|