@dotdev/harmony-sdk 1.10.0 → 1.10.2
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/dist/helpers/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const parseXml = promisify(parseString);
|
|
|
8
8
|
export class ApiHelper {
|
|
9
9
|
static async sendSoapRequest(endpoint, axiosInstance, requestBody, type = "POST") {
|
|
10
10
|
const url = `${endpoint}?wsdl`;
|
|
11
|
+
let response;
|
|
11
12
|
try {
|
|
12
13
|
let response;
|
|
13
14
|
switch (type) {
|
|
@@ -25,10 +26,12 @@ export class ApiHelper {
|
|
|
25
26
|
});
|
|
26
27
|
break;
|
|
27
28
|
}
|
|
29
|
+
console.log(`Response from Harmony: `, { response });
|
|
28
30
|
const result = (await parseXml(response?.data)); // fix type
|
|
29
31
|
return result["S:Envelope"]["S:Body"][0];
|
|
30
32
|
}
|
|
31
33
|
catch (error) {
|
|
34
|
+
console.error(`Response from Harmony: `, { response });
|
|
32
35
|
throw await ApiHelper.parseError(error);
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -79,6 +82,8 @@ export class ApiHelper {
|
|
|
79
82
|
? `ns2:${methodName[0]}Response`
|
|
80
83
|
: `ns2:${methodName}Response`;
|
|
81
84
|
const requestBody = ApiHelper.createServiceRequestBody(methodName, sessionId, serviceAlias, body);
|
|
85
|
+
console.debug(`request body`);
|
|
86
|
+
console.debug(requestBody);
|
|
82
87
|
const response = await ApiHelper.sendSoapRequest(serviceName, axios, requestBody);
|
|
83
88
|
return response[responseMethodName][0];
|
|
84
89
|
}
|
|
@@ -129,6 +129,8 @@ export class StockLookupModule {
|
|
|
129
129
|
* @returns {Promise<Stock[]>} Array of stock response objects which correspond to Harmony API response
|
|
130
130
|
*/
|
|
131
131
|
async stockLookup(params, sessionId) {
|
|
132
|
+
console.debug(`stockLookup params`);
|
|
133
|
+
console.debug(params);
|
|
132
134
|
const body = mapStockLookupRequestParams(params);
|
|
133
135
|
try {
|
|
134
136
|
const response = await ApiHelper.sendServiceRequest(this.SERVICE_URL, [`StockLookup`, `Request`], sessionId, ServiceAlias.STOCK_LOOKUP, this.axiosInstance, body.toString());
|