zudello-integration-sdk 1.0.95 → 1.0.96
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,16 +1,16 @@
|
|
|
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(
|
|
12
|
-
const AttachmentModule = require(
|
|
13
|
-
const JournalEntryModule = 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");
|
|
13
|
+
const JournalEntryModule = require("./submodules/netsuite-soap/JournalEntry");
|
|
14
14
|
|
|
15
15
|
class NetsuiteSoapSDK extends BaseSDK {
|
|
16
16
|
/**
|
|
@@ -20,23 +20,23 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
20
20
|
constructor(connectionUUID = null) {
|
|
21
21
|
super({
|
|
22
22
|
connectionUUID,
|
|
23
|
-
appUUIDKey:
|
|
24
|
-
integrationName:
|
|
25
|
-
})
|
|
23
|
+
appUUIDKey: "netsuite",
|
|
24
|
+
integrationName: "NetsuiteSOAP",
|
|
25
|
+
});
|
|
26
26
|
|
|
27
|
-
this.transformToTypes = [
|
|
27
|
+
this.transformToTypes = ["vendorBill", "itemReceipt"];
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Create submodule instances.
|
|
31
31
|
*/
|
|
32
|
-
this.vendorBill = new VendorBillModule(this)
|
|
33
|
-
this.vendorCredit = new VendorCreditModule(this)
|
|
34
|
-
this.universal = new UniversalModule(this)
|
|
35
|
-
this.universalTransaction = new UniversalTransactionModule(this)
|
|
36
|
-
this.purchaseOrder = new PurchaseOrderModule(this)
|
|
37
|
-
this.receipt = new ReceiptModule(this)
|
|
38
|
-
this.attach = new AttachmentModule(this)
|
|
39
|
-
this.journalEntry = new JournalEntryModule(this)
|
|
32
|
+
this.vendorBill = new VendorBillModule(this);
|
|
33
|
+
this.vendorCredit = new VendorCreditModule(this);
|
|
34
|
+
this.universal = new UniversalModule(this);
|
|
35
|
+
this.universalTransaction = new UniversalTransactionModule(this);
|
|
36
|
+
this.purchaseOrder = new PurchaseOrderModule(this);
|
|
37
|
+
this.receipt = new ReceiptModule(this);
|
|
38
|
+
this.attach = new AttachmentModule(this);
|
|
39
|
+
this.journalEntry = new JournalEntryModule(this);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -46,20 +46,23 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
46
46
|
* @returns {object} Transformed Response.
|
|
47
47
|
*/
|
|
48
48
|
async transform({ transformFrom, transformTo }) {
|
|
49
|
-
const validateIncludes = this.validator.includes(
|
|
49
|
+
const validateIncludes = this.validator.includes(
|
|
50
|
+
this.transformToTypes,
|
|
51
|
+
transformTo,
|
|
52
|
+
);
|
|
50
53
|
|
|
51
54
|
if (!validateIncludes.valid) {
|
|
52
|
-
return this.responseHandler.error(validateIncludes.errors)
|
|
55
|
+
return this.responseHandler.error(validateIncludes.errors);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
const validateIsEmpty = this.validator.isEmpty({ transformFrom })
|
|
58
|
+
const validateIsEmpty = this.validator.isEmpty({ transformFrom });
|
|
56
59
|
|
|
57
60
|
if (!validateIsEmpty.valid) {
|
|
58
|
-
return this.responseHandler.error(validateIsEmpty.errors)
|
|
61
|
+
return this.responseHandler.error(validateIsEmpty.errors);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
return await this.makeRequest(
|
|
62
|
-
|
|
65
|
+
"POST",
|
|
63
66
|
`${this.apiURL}/zintegrations/action/d751e693-6bbb-4c93-aff4-6561bba29f03`,
|
|
64
67
|
{
|
|
65
68
|
mappable_parameters: {
|
|
@@ -70,9 +73,11 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
70
73
|
value: transformTo,
|
|
71
74
|
},
|
|
72
75
|
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
73
78
|
_debug: true,
|
|
74
|
-
}
|
|
75
|
-
)
|
|
79
|
+
},
|
|
80
|
+
);
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
parseFilters(entries) {
|
|
@@ -87,9 +92,9 @@ class NetsuiteSoapSDK extends BaseSDK {
|
|
|
87
92
|
value: {
|
|
88
93
|
value: entry.value,
|
|
89
94
|
},
|
|
90
|
-
}
|
|
91
|
-
})
|
|
95
|
+
};
|
|
96
|
+
});
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
module.exports = NetsuiteSoapSDK
|
|
100
|
+
module.exports = NetsuiteSoapSDK;
|
|
@@ -9,6 +9,28 @@ class TaskModule {
|
|
|
9
9
|
this.module = parentModule
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Creates Tasks.
|
|
14
|
+
* @returns {object} Create Task Response.
|
|
15
|
+
*/
|
|
16
|
+
async create({ ...fields }) {
|
|
17
|
+
return await this.module.makeRequest(
|
|
18
|
+
"POST",
|
|
19
|
+
`${this.module.apiURL}/zintegrations/action/c71ef5b8-c3a9-49e0-b282-fe575effa18b`,
|
|
20
|
+
{
|
|
21
|
+
mappable_parameters: {
|
|
22
|
+
debug: {
|
|
23
|
+
value: false,
|
|
24
|
+
},
|
|
25
|
+
...fields,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
_debug: true,
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
12
34
|
/**
|
|
13
35
|
* Reuse Universal Listing with type TASK.
|
|
14
36
|
* @returns {object} List Response.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
class VendorCreditModule {
|
|
4
4
|
/**
|
|
5
5
|
* Constructor.
|
|
6
6
|
* @param {class} parentModule Object of Netsuite class.
|
|
7
7
|
*/
|
|
8
|
-
constructor
|
|
9
|
-
this.module = parentModule
|
|
8
|
+
constructor(parentModule) {
|
|
9
|
+
this.module = parentModule;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -16,24 +16,31 @@ class VendorCreditModule {
|
|
|
16
16
|
* @param {string} customForm Custom credit form.
|
|
17
17
|
* @returns {object} Response.
|
|
18
18
|
*/
|
|
19
|
-
async create
|
|
20
|
-
return await this.module.makeRequest(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
async create({ body, memo, customForm }) {
|
|
20
|
+
return await this.module.makeRequest(
|
|
21
|
+
"POST",
|
|
22
|
+
`${this.module.apiURL}/zintegrations/action/cdb6be5c-1137-425e-a162-76cfdbc8e65b`,
|
|
23
|
+
{
|
|
24
|
+
mappable_parameters: {
|
|
25
|
+
debug: {
|
|
26
|
+
value: false,
|
|
27
|
+
},
|
|
28
|
+
body: {
|
|
29
|
+
value: body,
|
|
30
|
+
},
|
|
31
|
+
memo: {
|
|
32
|
+
value: memo,
|
|
33
|
+
},
|
|
34
|
+
customForm: {
|
|
35
|
+
value: customForm,
|
|
36
|
+
},
|
|
24
37
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
memo: {
|
|
29
|
-
value: memo
|
|
30
|
-
},
|
|
31
|
-
customForm: {
|
|
32
|
-
value: customForm
|
|
33
|
-
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
_debug: true,
|
|
34
41
|
}
|
|
35
|
-
|
|
42
|
+
);
|
|
36
43
|
}
|
|
37
44
|
}
|
|
38
45
|
|
|
39
|
-
module.exports = VendorCreditModule
|
|
46
|
+
module.exports = VendorCreditModule;
|
|
@@ -32,7 +32,10 @@ class UniversalModule {
|
|
|
32
32
|
mappable_parameters: {
|
|
33
33
|
url: `${url}?`,
|
|
34
34
|
method,
|
|
35
|
-
qs
|
|
35
|
+
qs: {
|
|
36
|
+
isMap: true,
|
|
37
|
+
value: JSON.stringify(qs),
|
|
38
|
+
},
|
|
36
39
|
body: {
|
|
37
40
|
isMap: true,
|
|
38
41
|
value: JSON.stringify(body),
|
|
@@ -45,7 +48,7 @@ class UniversalModule {
|
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
validNumbers(number) {
|
|
51
|
+
validNumbers(number) {
|
|
49
52
|
if (!_.isInteger(number) || number < 1) {
|
|
50
53
|
throw new Error(
|
|
51
54
|
"Page number and page size must be positive numbers greater than zero."
|
|
@@ -60,10 +63,10 @@ class UniversalModule {
|
|
|
60
63
|
* @param {number} pageNumber Page number of listed data.
|
|
61
64
|
* @param {number} pageSize Page size of listed data.
|
|
62
65
|
* @param {object} qs Some available filters for listed data.
|
|
63
|
-
* @param {
|
|
66
|
+
* @param {object} body Some available data inside.
|
|
64
67
|
* @returns {object} Universal List Response.
|
|
65
68
|
*/
|
|
66
|
-
async list({ url, pageNumber = 1, pageSize = 100, qs = "", body =
|
|
69
|
+
async list({ url, pageNumber = 1, pageSize = 100, qs = "", body = "" }) {
|
|
67
70
|
if (!this.validNumbers(pageSize) && !this.validNumbers(pageNumber)) {
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
@@ -71,11 +74,8 @@ class UniversalModule {
|
|
|
71
74
|
return await this.request({
|
|
72
75
|
url: `${url}/${pageNumber}`,
|
|
73
76
|
method: "GET",
|
|
74
|
-
qs: qs ? `${qs}&PageSize=${pageSize}` :
|
|
75
|
-
body:
|
|
76
|
-
isMap: true,
|
|
77
|
-
value: JSON.stringify(body),
|
|
78
|
-
},
|
|
77
|
+
qs: qs ? `${qs}&PageSize=${pageSize}` : `PageSize=${pageSize}`,
|
|
78
|
+
body: body,
|
|
79
79
|
appendLimit: true,
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -86,7 +86,7 @@ class UniversalModule {
|
|
|
86
86
|
* @param {number} pageNumber Page number of listed data.
|
|
87
87
|
* @param {number} pageSize Page size of listed data.
|
|
88
88
|
* @param {object} qs Some available filters for listed data.
|
|
89
|
-
* @param {
|
|
89
|
+
* @param {object} body Some available data inside.
|
|
90
90
|
* @returns {object} Auto Pagination responses.
|
|
91
91
|
*/
|
|
92
92
|
async *autoPaginationList({
|
|
@@ -94,7 +94,7 @@ class UniversalModule {
|
|
|
94
94
|
pageNumber = 1,
|
|
95
95
|
pageSize = 100,
|
|
96
96
|
qs = "",
|
|
97
|
-
body =
|
|
97
|
+
body = "",
|
|
98
98
|
}) {
|
|
99
99
|
if (!this.validNumbers(pageSize) || !this.validNumbers(pageNumber)) {
|
|
100
100
|
return;
|
|
@@ -114,7 +114,7 @@ class UniversalModule {
|
|
|
114
114
|
pageNumber: currentPageNumber,
|
|
115
115
|
pageSize,
|
|
116
116
|
qs,
|
|
117
|
-
|
|
117
|
+
body,
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
yield response;
|