@dotdev/harmony-sdk 1.23.0 → 1.24.0
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 +2 -1
- package/dist/modules/stock-level-lookup/mappings/stock-level-lookup.mapper.js +2 -1
- package/dist/modules/stock-level-lookup/stock-level-lookup.module.spec.js +5 -2
- package/dist/modules/stock-level-lookup/types/stock-level-lookup.interface.d.ts +6 -0
- package/dist/modules/stock-level-lookup/types/stock-level-lookup.interface.js +6 -0
- package/package.json +1 -1
package/dist/helpers/index.js
CHANGED
|
@@ -115,7 +115,8 @@ export class ApiHelper {
|
|
|
115
115
|
return new RequestError(`API request failed with status ${error.response.status}: {code: ${parsedError?.code}, name: ${parsedError?.name}, message: ${parsedError?.message}}`);
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
|
-
logger.error(`API request error
|
|
118
|
+
logger.error(`API request error`);
|
|
119
|
+
logger.child({ error: error });
|
|
119
120
|
return new RequestError(`API request failed but error response is not in Harmony XML format. Please check the logs for more details.`);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Utils } from "../../../helpers";
|
|
2
2
|
import { mapOptionalStockQueryParams } from "../../../helpers/mapper";
|
|
3
|
-
import { OnlyNonZero, QtyType, StockLevelLookupRequestBody, } from "../types";
|
|
3
|
+
import { IgnoreSizePacks, OnlyNonZero, QtyType, StockLevelLookupRequestBody, } from "../types";
|
|
4
4
|
export function mapWarehouse(src) {
|
|
5
5
|
return {
|
|
6
6
|
namekey: (src?.namekey ?? [])[0],
|
|
@@ -73,6 +73,7 @@ export function mapStockLevelLookupQueryParams(src) {
|
|
|
73
73
|
WarehouseClassFr4: src?.warehouseClassFr4 ?? "",
|
|
74
74
|
WarehouseClassTo4: src?.warehouseClassTo4 ?? "",
|
|
75
75
|
WarehouseClassFr5: src?.warehouseClassFr5 ?? "",
|
|
76
|
+
IgnoreSizePacks: src?.ignoreSizePacks ?? IgnoreSizePacks.YES,
|
|
76
77
|
...optional,
|
|
77
78
|
});
|
|
78
79
|
}
|
|
@@ -3,7 +3,7 @@ import { ApiHelper, TEST_HEADERS, Utils } from "../../helpers";
|
|
|
3
3
|
import { ServiceAlias } from "../shared";
|
|
4
4
|
import { StockSearchType } from "../stock-lookup";
|
|
5
5
|
import { StockLevelLookupModule } from "./stock-level-lookup.module";
|
|
6
|
-
import { OnlyNonZero, QtyType, Summarised, } from "./types";
|
|
6
|
+
import { IgnoreSizePacks, OnlyNonZero, QtyType, Summarised, } from "./types";
|
|
7
7
|
jest.mock("axios");
|
|
8
8
|
const mAxios = axios;
|
|
9
9
|
describe("StockLevelLookupModule.warehouseLookup()", () => {
|
|
@@ -88,6 +88,7 @@ describe("StockLevelLookupModule.stockLevelLookup()", () => {
|
|
|
88
88
|
summarised: Summarised.EXPANDED,
|
|
89
89
|
onlyNonZero: OnlyNonZero.NO,
|
|
90
90
|
warehouse1: "123",
|
|
91
|
+
ignoreSizePacks: IgnoreSizePacks.NO,
|
|
91
92
|
};
|
|
92
93
|
const ns = "S";
|
|
93
94
|
const expectedPayload = `
|
|
@@ -107,6 +108,7 @@ describe("StockLevelLookupModule.stockLevelLookup()", () => {
|
|
|
107
108
|
<Summarised>${params.summarised}</Summarised>
|
|
108
109
|
<OnlyNonZero>${params.onlyNonZero}</OnlyNonZero>
|
|
109
110
|
<Warehouse1>${params.warehouse1}</Warehouse1>
|
|
111
|
+
<IgnoreSizePacks>${params.ignoreSizePacks}</IgnoreSizePacks>
|
|
110
112
|
</${ServiceAlias.STOCK_LEVEL_LOOKUP}:StockLevelLookupRequest>
|
|
111
113
|
</${ns}:Body>
|
|
112
114
|
</${ns}:Envelope>
|
|
@@ -228,10 +230,11 @@ describe("StockLevelLookupModule.stockLevelLookup()", () => {
|
|
|
228
230
|
</QtyType>
|
|
229
231
|
<OnlyNonZero>${params.onlyNonZero}</OnlyNonZero>
|
|
230
232
|
<Warehouse>${params.warehouse}</Warehouse>
|
|
233
|
+
<IgnoreSizePacks>Y</IgnoreSizePacks>
|
|
231
234
|
</${ServiceAlias.STOCK_LEVEL_LOOKUP}:StockLevelLookupByWarehouseQuickViewRequest>
|
|
232
235
|
</${ns}:Body>
|
|
233
236
|
</${ns}:Envelope>
|
|
234
|
-
`;
|
|
237
|
+
`; // ignore size pack set to Y by default
|
|
235
238
|
const mockedResp = {
|
|
236
239
|
data: `
|
|
237
240
|
<?xml version='1.0' encoding='UTF-8'?>
|
|
@@ -113,6 +113,7 @@ export declare class StockLevelLookupRequestBody extends OptionalStockRequestBod
|
|
|
113
113
|
WarehouseClassTo4?: string;
|
|
114
114
|
WarehouseClassFr5?: string;
|
|
115
115
|
WarehouseClassTo5?: string;
|
|
116
|
+
IgnoreSizePacks?: IgnoreSizePacks;
|
|
116
117
|
constructor(obj: Partial<StockLevelLookupRequestBody>);
|
|
117
118
|
toString(): string;
|
|
118
119
|
}
|
|
@@ -142,6 +143,7 @@ export interface StockLevelLookupQueryParams extends OptionalStockQueryParams {
|
|
|
142
143
|
warehouseClassTo4?: string;
|
|
143
144
|
warehouseClassFr5?: string;
|
|
144
145
|
warehouseClassTo5?: string;
|
|
146
|
+
ignoreSizePacks?: IgnoreSizePacks;
|
|
145
147
|
}
|
|
146
148
|
export declare enum QtyType {
|
|
147
149
|
STK = "STK",
|
|
@@ -149,6 +151,10 @@ export declare enum QtyType {
|
|
|
149
151
|
FUT = "FUT",
|
|
150
152
|
AVL = "AVL"
|
|
151
153
|
}
|
|
154
|
+
export declare enum IgnoreSizePacks {
|
|
155
|
+
YES = "Y",
|
|
156
|
+
NO = "N"
|
|
157
|
+
}
|
|
152
158
|
export declare enum Summarised {
|
|
153
159
|
EXPANDED = "E",
|
|
154
160
|
SUMMARISED = "S"
|
|
@@ -25,6 +25,7 @@ export class StockLevelLookupRequestBody extends OptionalStockRequestBody {
|
|
|
25
25
|
WarehouseClassTo4;
|
|
26
26
|
WarehouseClassFr5;
|
|
27
27
|
WarehouseClassTo5;
|
|
28
|
+
IgnoreSizePacks;
|
|
28
29
|
constructor(obj) {
|
|
29
30
|
if (!obj?.SearchType) {
|
|
30
31
|
throw new Error("SearchType is required when constructing StockLookup request body");
|
|
@@ -49,6 +50,11 @@ export var QtyType;
|
|
|
49
50
|
QtyType["FUT"] = "FUT";
|
|
50
51
|
QtyType["AVL"] = "AVL";
|
|
51
52
|
})(QtyType || (QtyType = {}));
|
|
53
|
+
export var IgnoreSizePacks;
|
|
54
|
+
(function (IgnoreSizePacks) {
|
|
55
|
+
IgnoreSizePacks["YES"] = "Y";
|
|
56
|
+
IgnoreSizePacks["NO"] = "N";
|
|
57
|
+
})(IgnoreSizePacks || (IgnoreSizePacks = {}));
|
|
52
58
|
export var Summarised;
|
|
53
59
|
(function (Summarised) {
|
|
54
60
|
Summarised["EXPANDED"] = "E";
|