zudello-integration-sdk 1.0.43 → 1.0.44
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
CHANGED
package/src/sdk/NetsuiteSOAP.js
CHANGED
|
@@ -1,93 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
const _ = require(
|
|
3
|
+
const _ = require("lodash");
|
|
4
4
|
|
|
5
|
-
const BaseSDK = require(
|
|
6
|
-
const VendorBillModule = require(
|
|
7
|
-
const VendorCreditModule = require(
|
|
8
|
-
const UniversalModule = require(
|
|
9
|
-
const UniversalTransactionModule = require(
|
|
10
|
-
const PurchaseOrderModule = require(
|
|
11
|
-
const ReceiptModule = require(
|
|
5
|
+
const BaseSDK = require("./Base");
|
|
6
|
+
const VendorBillModule = require("./submodules/netsuite-soap/VendorBill");
|
|
7
|
+
const VendorCreditModule = require("./submodules/netsuite-soap/VendorCredit");
|
|
8
|
+
const UniversalModule = require("./submodules/netsuite-soap/Universal");
|
|
9
|
+
const UniversalTransactionModule = require("./submodules/netsuite-soap/UniversalTransaction");
|
|
10
|
+
const PurchaseOrderModule = require("./submodules/netsuite-soap/PurchaseOrder");
|
|
11
|
+
const ReceiptModule = require("./submodules/netsuite-soap/Receipt");
|
|
12
|
+
const AttachmentModule = require("./submodules/netsuite-soap/Attachment");
|
|
12
13
|
|
|
13
14
|
class NetsuiteSoapSDK extends BaseSDK {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Constructor.
|
|
17
|
+
* @param {class} auth Auth class object with authorized api instance.
|
|
18
|
+
* @param {string} connectionUUID The UUID of the Connection we're working on.
|
|
19
|
+
*/
|
|
20
|
+
constructor(auth, connectionUUID, organizationUUID, apiURL, apiVersion, loggerClass = null) {
|
|
21
|
+
super({
|
|
22
|
+
auth,
|
|
23
|
+
connectionUUID,
|
|
24
|
+
organizationUUID,
|
|
25
|
+
apiURL,
|
|
26
|
+
apiVersion,
|
|
27
|
+
appUUIDKey: "netsuite",
|
|
28
|
+
integrationName: "NetsuiteSOAP",
|
|
29
|
+
loggerClass,
|
|
30
|
+
});
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
this.transformToTypes = ["vendorBill", "itemReceipt"];
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Create submodule instances.
|
|
36
|
+
*/
|
|
37
|
+
this.vendorBill = new VendorBillModule(this);
|
|
38
|
+
this.vendorCredit = new VendorCreditModule(this);
|
|
39
|
+
this.universal = new UniversalModule(this);
|
|
40
|
+
this.universalTransaction = new UniversalTransactionModule(this);
|
|
41
|
+
this.purchaseOrder = new PurchaseOrderModule(this);
|
|
42
|
+
this.receipt = new ReceiptModule(this);
|
|
43
|
+
this.attach = new AttachmentModule(this);
|
|
44
|
+
}
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Transaction transform FROM.
|
|
48
|
+
* @param {array} transformFrom.
|
|
49
|
+
* @param {string} transformTo.
|
|
50
|
+
* @returns {object} Transformed Response.
|
|
51
|
+
*/
|
|
52
|
+
async transform({ transformFrom, transformTo }) {
|
|
53
|
+
const validateIncludes = this.validator.includes(this.transformToTypes, transformTo);
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
if (!validateIncludes.valid) {
|
|
56
|
+
return this.responseHandler.error(validateIncludes.errors);
|
|
57
|
+
}
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
const validateIsEmpty = this.validator.isEmpty({ transformFrom });
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
if (!validateIsEmpty.valid) {
|
|
62
|
+
return this.responseHandler.error(validateIsEmpty.errors);
|
|
63
|
+
}
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
return await this.makeRequest(
|
|
66
|
+
"GET",
|
|
67
|
+
`${this.apiURL}/zintegrations/action/d751e693-6bbb-4c93-aff4-6561bba29f03`,
|
|
68
|
+
{
|
|
69
|
+
mappable_parameters: {
|
|
70
|
+
transformFrom: {
|
|
71
|
+
value: transformFrom,
|
|
72
|
+
},
|
|
73
|
+
transformTo: {
|
|
74
|
+
value: transformTo,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
_debug: true,
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
parseFilters(entries) {
|
|
83
|
+
return _.map(entries, (entry) => {
|
|
84
|
+
return {
|
|
85
|
+
field: {
|
|
86
|
+
value: entry.field,
|
|
87
|
+
},
|
|
88
|
+
operator: {
|
|
89
|
+
value: entry.operator,
|
|
90
|
+
},
|
|
91
|
+
value: {
|
|
92
|
+
value: entry.value,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
module.exports = NetsuiteSoapSDK
|
|
99
|
+
module.exports = NetsuiteSoapSDK;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
class AttachmentModule {
|
|
4
|
+
/**
|
|
5
|
+
* Constructor.
|
|
6
|
+
* @param {class} parentModule Object of Netsuite class.
|
|
7
|
+
*/
|
|
8
|
+
constructor(parentModule) {
|
|
9
|
+
this.module = parentModule;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create attachment.
|
|
14
|
+
* @param {object} body Body of attachment.
|
|
15
|
+
* @returns {object} Response.
|
|
16
|
+
*/
|
|
17
|
+
async create({ body }) {
|
|
18
|
+
return await this.module.makeRequest(
|
|
19
|
+
"POST",
|
|
20
|
+
`${this.module.apiURL}/zintegrations/action/621f658e-96e6-4e5a-b6c3-716cd5bbbcf8`,
|
|
21
|
+
{
|
|
22
|
+
mappable_parameters: {
|
|
23
|
+
debug: {
|
|
24
|
+
value: false,
|
|
25
|
+
},
|
|
26
|
+
body: {
|
|
27
|
+
value: body,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
_debug: true,
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = AttachmentModule;
|