@dotdev/harmony-sdk 1.0.1

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.
Files changed (124) hide show
  1. package/README.md +132 -0
  2. package/dist/HarmonyAPI.d.ts +37 -0
  3. package/dist/HarmonyAPI.js +113 -0
  4. package/dist/errors/index.d.ts +15 -0
  5. package/dist/errors/index.js +18 -0
  6. package/dist/helpers/index.d.ts +50 -0
  7. package/dist/helpers/index.js +167 -0
  8. package/dist/helpers/index.spec.d.ts +1 -0
  9. package/dist/helpers/index.spec.js +147 -0
  10. package/dist/helpers/mapper.d.ts +2 -0
  11. package/dist/helpers/mapper.js +28 -0
  12. package/dist/helpers/utils.d.ts +71 -0
  13. package/dist/helpers/utils.js +133 -0
  14. package/dist/helpers/utils.spec.d.ts +1 -0
  15. package/dist/helpers/utils.spec.js +96 -0
  16. package/dist/index.d.ts +5 -0
  17. package/dist/index.js +5 -0
  18. package/dist/modules/auth/auth.module.d.ts +7 -0
  19. package/dist/modules/auth/auth.module.js +42 -0
  20. package/dist/modules/auth/auth.module.spec.d.ts +1 -0
  21. package/dist/modules/auth/auth.module.spec.js +55 -0
  22. package/dist/modules/auth/index.d.ts +2 -0
  23. package/dist/modules/auth/index.js +2 -0
  24. package/dist/modules/auth/types/index.d.ts +7 -0
  25. package/dist/modules/auth/types/index.js +1 -0
  26. package/dist/modules/carrier/carrier.module.d.ts +10 -0
  27. package/dist/modules/carrier/carrier.module.js +39 -0
  28. package/dist/modules/carrier/carrier.module.spec.d.ts +1 -0
  29. package/dist/modules/carrier/carrier.module.spec.js +187 -0
  30. package/dist/modules/carrier/index.d.ts +3 -0
  31. package/dist/modules/carrier/index.js +3 -0
  32. package/dist/modules/carrier/mappings/index.d.ts +5 -0
  33. package/dist/modules/carrier/mappings/index.js +36 -0
  34. package/dist/modules/carrier/types/index.d.ts +42 -0
  35. package/dist/modules/carrier/types/index.js +2 -0
  36. package/dist/modules/diary/diary.module.d.ts +9 -0
  37. package/dist/modules/diary/diary.module.js +28 -0
  38. package/dist/modules/diary/index.d.ts +3 -0
  39. package/dist/modules/diary/index.js +3 -0
  40. package/dist/modules/diary/mappings/diary.mapper.d.ts +4 -0
  41. package/dist/modules/diary/mappings/diary.mapper.js +101 -0
  42. package/dist/modules/diary/mappings/diary.mapper.spec.d.ts +1 -0
  43. package/dist/modules/diary/mappings/diary.mapper.spec.js +18 -0
  44. package/dist/modules/diary/mappings/index.d.ts +1 -0
  45. package/dist/modules/diary/mappings/index.js +1 -0
  46. package/dist/modules/diary/types/diary.interface.d.ts +138 -0
  47. package/dist/modules/diary/types/diary.interface.js +24 -0
  48. package/dist/modules/diary/types/index.d.ts +1 -0
  49. package/dist/modules/diary/types/index.js +1 -0
  50. package/dist/modules/gift-voucher/gift-voucher.module.d.ts +12 -0
  51. package/dist/modules/gift-voucher/gift-voucher.module.js +55 -0
  52. package/dist/modules/gift-voucher/gift-voucher.module.spec.d.ts +1 -0
  53. package/dist/modules/gift-voucher/gift-voucher.module.spec.js +296 -0
  54. package/dist/modules/gift-voucher/index.d.ts +1 -0
  55. package/dist/modules/gift-voucher/index.js +1 -0
  56. package/dist/modules/gift-voucher/mappings/index.d.ts +6 -0
  57. package/dist/modules/gift-voucher/mappings/index.js +70 -0
  58. package/dist/modules/gift-voucher/mappings/index.spec.d.ts +1 -0
  59. package/dist/modules/gift-voucher/mappings/index.spec.js +21 -0
  60. package/dist/modules/gift-voucher/types/index.d.ts +92 -0
  61. package/dist/modules/gift-voucher/types/index.js +1 -0
  62. package/dist/modules/index.d.ts +8 -0
  63. package/dist/modules/index.js +8 -0
  64. package/dist/modules/point-of-sale/index.d.ts +3 -0
  65. package/dist/modules/point-of-sale/index.js +3 -0
  66. package/dist/modules/point-of-sale/mappings/index.d.ts +1 -0
  67. package/dist/modules/point-of-sale/mappings/index.js +1 -0
  68. package/dist/modules/point-of-sale/mappings/process-sale-order.mapper.d.ts +6 -0
  69. package/dist/modules/point-of-sale/mappings/process-sale-order.mapper.js +142 -0
  70. package/dist/modules/point-of-sale/point-of-sale.module.d.ts +43 -0
  71. package/dist/modules/point-of-sale/point-of-sale.module.js +64 -0
  72. package/dist/modules/point-of-sale/point-of-sale.module.spec.d.ts +1 -0
  73. package/dist/modules/point-of-sale/point-of-sale.module.spec.js +205 -0
  74. package/dist/modules/point-of-sale/types/cancel-existing-sales-order.interface.d.ts +13 -0
  75. package/dist/modules/point-of-sale/types/cancel-existing-sales-order.interface.js +1 -0
  76. package/dist/modules/point-of-sale/types/index.d.ts +124 -0
  77. package/dist/modules/point-of-sale/types/index.js +31 -0
  78. package/dist/modules/point-of-sale/types/modify-existing-sales-order.interface.d.ts +12 -0
  79. package/dist/modules/point-of-sale/types/modify-existing-sales-order.interface.js +1 -0
  80. package/dist/modules/point-of-sale/types/process-returns.interface.d.ts +17 -0
  81. package/dist/modules/point-of-sale/types/process-returns.interface.js +1 -0
  82. package/dist/modules/point-of-sale/types/process-sale-order.interface.d.ts +67 -0
  83. package/dist/modules/point-of-sale/types/process-sale-order.interface.js +1 -0
  84. package/dist/modules/shared/index.d.ts +1 -0
  85. package/dist/modules/shared/index.js +1 -0
  86. package/dist/modules/shared/types/index.d.ts +93 -0
  87. package/dist/modules/shared/types/index.js +53 -0
  88. package/dist/modules/stock-level-lookup/index.d.ts +3 -0
  89. package/dist/modules/stock-level-lookup/index.js +3 -0
  90. package/dist/modules/stock-level-lookup/mappings/index.d.ts +1 -0
  91. package/dist/modules/stock-level-lookup/mappings/index.js +1 -0
  92. package/dist/modules/stock-level-lookup/mappings/stock-level-lookup.mapper.d.ts +4 -0
  93. package/dist/modules/stock-level-lookup/mappings/stock-level-lookup.mapper.js +78 -0
  94. package/dist/modules/stock-level-lookup/mappings/stock-level-lookup.mapper.spec.d.ts +1 -0
  95. package/dist/modules/stock-level-lookup/mappings/stock-level-lookup.mapper.spec.js +57 -0
  96. package/dist/modules/stock-level-lookup/stock-level-lookup.module.d.ts +10 -0
  97. package/dist/modules/stock-level-lookup/stock-level-lookup.module.js +39 -0
  98. package/dist/modules/stock-level-lookup/stock-level-lookup.module.spec.d.ts +1 -0
  99. package/dist/modules/stock-level-lookup/stock-level-lookup.module.spec.js +317 -0
  100. package/dist/modules/stock-level-lookup/types/index.d.ts +1 -0
  101. package/dist/modules/stock-level-lookup/types/index.js +1 -0
  102. package/dist/modules/stock-level-lookup/types/stock-level-lookup.interface.d.ts +162 -0
  103. package/dist/modules/stock-level-lookup/types/stock-level-lookup.interface.js +61 -0
  104. package/dist/modules/stock-lookup/index.d.ts +3 -0
  105. package/dist/modules/stock-lookup/index.js +3 -0
  106. package/dist/modules/stock-lookup/mappings/index.d.ts +1 -0
  107. package/dist/modules/stock-lookup/mappings/index.js +1 -0
  108. package/dist/modules/stock-lookup/mappings/stock-lookup.mapper.d.ts +22 -0
  109. package/dist/modules/stock-lookup/mappings/stock-lookup.mapper.js +156 -0
  110. package/dist/modules/stock-lookup/mappings/stock-lookup.mapper.spec.d.ts +1 -0
  111. package/dist/modules/stock-lookup/mappings/stock-lookup.mapper.spec.js +92 -0
  112. package/dist/modules/stock-lookup/stock-lookup.module.d.ts +65 -0
  113. package/dist/modules/stock-lookup/stock-lookup.module.js +141 -0
  114. package/dist/modules/stock-lookup/stock-lookup.module.spec.d.ts +1 -0
  115. package/dist/modules/stock-lookup/stock-lookup.module.spec.js +419 -0
  116. package/dist/modules/stock-lookup/types/index.d.ts +1 -0
  117. package/dist/modules/stock-lookup/types/index.js +1 -0
  118. package/dist/modules/stock-lookup/types/stock-lookup.interface.d.ts +242 -0
  119. package/dist/modules/stock-lookup/types/stock-lookup.interface.js +82 -0
  120. package/dist/modules/stock-lookup/types/stock-lookup.interface.spec.d.ts +1 -0
  121. package/dist/modules/stock-lookup/types/stock-lookup.interface.spec.js +76 -0
  122. package/dist/types/index.d.ts +5 -0
  123. package/dist/types/index.js +6 -0
  124. package/package.json +39 -0
@@ -0,0 +1,317 @@
1
+ import axios from "axios";
2
+ import { ApiHelper, Utils } from "../../helpers";
3
+ import { ServiceAlias } from "../shared";
4
+ import { StockSearchType } from "../stock-lookup";
5
+ import { StockLevelLookupModule } from "./stock-level-lookup.module";
6
+ import { OnlyNonZero, QtyType, Summarised, } from "./types";
7
+ jest.mock("axios");
8
+ const mAxios = axios;
9
+ describe("StockLevelLookupModule.warehouseLookup()", () => {
10
+ const sessionId = "test-sid"; // process.env.SESSION_ID as string;
11
+ let stockLookupLevelModule;
12
+ let mockApiHelperSendRequest;
13
+ beforeAll(() => {
14
+ stockLookupLevelModule = new StockLevelLookupModule(mAxios);
15
+ mockApiHelperSendRequest = jest.spyOn(ApiHelper, "sendSoapRequest");
16
+ });
17
+ it("should return a list of warehouses", async () => {
18
+ const ns = "S";
19
+ const expectedPayload = `
20
+ <${ns}:Envelope xmlns:${ns}="http://schemas.xmlsoap.org/soap/envelope/" xmlns:${ServiceAlias.STOCK_LEVEL_LOOKUP}="http://${ServiceAlias.STOCK_LEVEL_LOOKUP}.ws.fbsaust.com.au">
21
+ <${ns}:Header>
22
+ <${ServiceAlias.STOCK_LEVEL_LOOKUP}:SessionId>${sessionId}</${ServiceAlias.STOCK_LEVEL_LOOKUP}:SessionId>
23
+ </${ns}:Header>
24
+ <${ns}:Body>
25
+ <${ServiceAlias.STOCK_LEVEL_LOOKUP}:WarehouseLookup></${ServiceAlias.STOCK_LEVEL_LOOKUP}:WarehouseLookup>
26
+ </${ns}:Body>
27
+ </${ns}:Envelope>
28
+ `;
29
+ const mockedResp = {
30
+ data: `
31
+ <?xml version='1.0' encoding='UTF-8'?>
32
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
33
+ <S:Body>
34
+ <ns2:WarehouseLookupResponse xmlns:ns2="http://${ServiceAlias.STOCK_LEVEL_LOOKUP}.ws.fbsaust.com.au">
35
+ <Warehouse>
36
+ <namekey>000</namekey>
37
+ <description_1>TEST WAREHOUSE</description_1>
38
+ <description_2>TEST DESCRIPTION</description_2>
39
+ <class_1>a</class_1>
40
+ <class_2>b</class_2>
41
+ <class_3>c</class_3>
42
+ <class_4>d</class_4>
43
+ <class_5>e</class_5>
44
+ </Warehouse>
45
+ </ns2:WarehouseLookupResponse>
46
+ </S:Body>
47
+ </S:Envelope>
48
+ `,
49
+ };
50
+ const expectedResponse = {
51
+ namekey: "000",
52
+ description1: "TEST WAREHOUSE",
53
+ description2: "TEST DESCRIPTION",
54
+ class1: "a",
55
+ class2: "b",
56
+ class3: "c",
57
+ class4: "d",
58
+ class5: "e",
59
+ };
60
+ mAxios.post.mockResolvedValueOnce(mockedResp);
61
+ const response = await stockLookupLevelModule.warehouseLookup(sessionId);
62
+ // Test that expected response is correct
63
+ expect(Array.isArray(response)).toBe(true);
64
+ expect(response.length).toBe(1);
65
+ expect(response[0]).toEqual(expectedResponse);
66
+ const actualPayload = mAxios.post.mock.calls[0][1];
67
+ // Test that actual payload sent in the API matches expected payload
68
+ expect(Utils.removeEmptySpaces(actualPayload)).toEqual(Utils.removeEmptySpaces(expectedPayload));
69
+ mAxios.post.mockClear();
70
+ });
71
+ });
72
+ describe("StockLevelLookupModule.stockLevelLookup()", () => {
73
+ const sessionId = "test-sid"; // process.env.SESSION_ID as string;
74
+ let stockLookupLevelModule;
75
+ let mockApiHelperSendRequest;
76
+ beforeAll(() => {
77
+ stockLookupLevelModule = new StockLevelLookupModule(mAxios);
78
+ mockApiHelperSendRequest = jest.spyOn(ApiHelper, "sendSoapRequest");
79
+ });
80
+ it("should send correct request for stockLevelLookup and return a list of stock level objets", async () => {
81
+ const params = {
82
+ searchType: {
83
+ type: StockSearchType.STOCK_KEYWORD,
84
+ value: "TEST",
85
+ },
86
+ qtyType: QtyType.STK,
87
+ summarised: Summarised.EXPANDED,
88
+ onlyNonZero: OnlyNonZero.NO,
89
+ warehouse1: "123",
90
+ };
91
+ const ns = "S";
92
+ const expectedPayload = `
93
+ <${ns}:Envelope xmlns:${ns}="http://schemas.xmlsoap.org/soap/envelope/" xmlns:${ServiceAlias.STOCK_LEVEL_LOOKUP}="http://${ServiceAlias.STOCK_LEVEL_LOOKUP}.ws.fbsaust.com.au">
94
+ <${ns}:Header>
95
+ <${ServiceAlias.STOCK_LEVEL_LOOKUP}:SessionId>${sessionId}</${ServiceAlias.STOCK_LEVEL_LOOKUP}:SessionId>
96
+ </${ns}:Header>
97
+ <${ns}:Body>
98
+ <${ServiceAlias.STOCK_LEVEL_LOOKUP}:StockLevelLookupRequest>
99
+ <SearchType>
100
+ <Type>${params.searchType.type}</Type>
101
+ <Value>${params.searchType.value}</Value>
102
+ </SearchType>
103
+ <QtyType>
104
+ <Type>${params.qtyType}</Type>
105
+ </QtyType>
106
+ <Summarised>${params.summarised}</Summarised>
107
+ <OnlyNonZero>${params.onlyNonZero}</OnlyNonZero>
108
+ <Warehouse1>${params.warehouse1}</Warehouse1>
109
+ </${ServiceAlias.STOCK_LEVEL_LOOKUP}:StockLevelLookupRequest>
110
+ </${ns}:Body>
111
+ </${ns}:Envelope>
112
+ `;
113
+ const mockedResp = {
114
+ data: `
115
+ <?xml version='1.0' encoding='UTF-8'?>
116
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
117
+ <S:Body>
118
+ <ns2:StockLevelLookupResponse xmlns:ns2="http://${ServiceAlias.STOCK_LEVEL_LOOKUP}.ws.fbsaust.com.au">
119
+ <SystemTime>05-08-2024 11:21:28</SystemTime>
120
+ <StockLevel>
121
+ <stock>4001003.BLK</stock>
122
+ <stock_type>Pack</stock_type>
123
+ <pack>ED7</pack>
124
+ <warehouse>114</warehouse>
125
+ <sales_code>@MA</sales_code>
126
+ <qty_type>FRE</qty_type>
127
+ <qdp>0</qdp>
128
+ <pack_qty>0.0</pack_qty>
129
+ <qty>0.0</qty>
130
+ <sizeQty1>0.0</sizeQty1>
131
+ <sizeQty2>0.0</sizeQty2>
132
+ <sizeQty3>0.0</sizeQty3>
133
+ <sizeQty4>0.0</sizeQty4>
134
+ <sizeQty5>0.0</sizeQty5>
135
+ <sizeQty6>0.0</sizeQty6>
136
+ <sizeQty7>0.0</sizeQty7>
137
+ <sizeQty8>0.0</sizeQty8>
138
+ <sizeQty9>0.0</sizeQty9>
139
+ <sizeQty10>0.0</sizeQty10>
140
+ <sizeQty11>0.0</sizeQty11>
141
+ <sizeQty12>0.0</sizeQty12>
142
+ <sizeQty13>0.0</sizeQty13>
143
+ <sizeQty14>0.0</sizeQty14>
144
+ <sizeQty15>0.0</sizeQty15>
145
+ <sizeQty16>0.0</sizeQty16>
146
+ <sizeQty17>0.0</sizeQty17>
147
+ <sizeQty18>0.0</sizeQty18>
148
+ <sizeQty19>0.0</sizeQty19>
149
+ <sizeQty20>0.0</sizeQty20>
150
+ </StockLevel>
151
+ </ns2:StockLevelLookupResponse>
152
+ </S:Body>
153
+ </S:Envelope>
154
+ `,
155
+ };
156
+ const expectedResult = {
157
+ stock: "4001003.BLK",
158
+ stockType: "Pack",
159
+ pack: "ED7",
160
+ warehouse: "114",
161
+ salesCode: "@MA",
162
+ qtyType: "FRE",
163
+ qdp: 0,
164
+ packQty: 0,
165
+ qty: 0,
166
+ sizeQty1: 0,
167
+ sizeQty2: 0,
168
+ sizeQty3: 0,
169
+ sizeQty4: 0,
170
+ sizeQty5: 0,
171
+ sizeQty6: 0,
172
+ sizeQty7: 0,
173
+ sizeQty8: 0,
174
+ sizeQty9: 0,
175
+ sizeQty10: 0,
176
+ sizeQty11: 0,
177
+ sizeQty12: 0,
178
+ sizeQty13: 0,
179
+ sizeQty14: 0,
180
+ sizeQty15: 0,
181
+ sizeQty16: 0,
182
+ sizeQty17: 0,
183
+ sizeQty18: 0,
184
+ sizeQty19: 0,
185
+ sizeQty20: 0,
186
+ };
187
+ mAxios.post.mockResolvedValueOnce(mockedResp);
188
+ const response = await stockLookupLevelModule.stockLevelLookup(params, sessionId);
189
+ // Test that expected response is correct
190
+ expect(Array.isArray(response)).toBe(true);
191
+ expect(response.length).toBe(1);
192
+ expect(response[0]).toEqual(expectedResult);
193
+ const actualPayload = mAxios.post.mock.calls[0][1];
194
+ // Test that actual payload sent in the API matches expected payload
195
+ expect(Utils.removeEmptySpaces(actualPayload)).toEqual(Utils.removeEmptySpaces(expectedPayload));
196
+ mAxios.post.mockReset();
197
+ });
198
+ it("should send correct request for stockLevelLookupByWarehouseQuickView and return a list of stock level objets", async () => {
199
+ const params = {
200
+ searchType: {
201
+ type: StockSearchType.STOCK_KEYWORD,
202
+ value: "TEST",
203
+ },
204
+ qtyType: QtyType.STK,
205
+ onlyNonZero: OnlyNonZero.NO,
206
+ warehouse: "123",
207
+ sysModTimeFr: "2020-02-02 00:00:00",
208
+ sysModTimeTo: "2020-02-02 01:00:00",
209
+ };
210
+ const ns = "S";
211
+ const expectedPayload = `
212
+ <${ns}:Envelope xmlns:${ns}="http://schemas.xmlsoap.org/soap/envelope/" xmlns:${ServiceAlias.STOCK_LEVEL_LOOKUP}="http://${ServiceAlias.STOCK_LEVEL_LOOKUP}.ws.fbsaust.com.au">
213
+ <${ns}:Header>
214
+ <${ServiceAlias.STOCK_LEVEL_LOOKUP}:SessionId>${sessionId}</${ServiceAlias.STOCK_LEVEL_LOOKUP}:SessionId>
215
+ </${ns}:Header>
216
+ <${ns}:Body>
217
+ <${ServiceAlias.STOCK_LEVEL_LOOKUP}:StockLevelLookupByWarehouseQuickViewRequest>
218
+ <SysModTimeFr>${params.sysModTimeFr}</SysModTimeFr>
219
+ <SysModTimeTo>${params.sysModTimeTo}</SysModTimeTo>
220
+ <SearchType>
221
+ <Type>${params.searchType.type}</Type>
222
+ <Value>${params.searchType.value}</Value>
223
+ </SearchType>
224
+ <QtyType>
225
+ <Type>${params.qtyType}</Type>
226
+ </QtyType>
227
+ <OnlyNonZero>${params.onlyNonZero}</OnlyNonZero>
228
+ <Warehouse>${params.warehouse}</Warehouse>
229
+ </${ServiceAlias.STOCK_LEVEL_LOOKUP}:StockLevelLookupByWarehouseQuickViewRequest>
230
+ </${ns}:Body>
231
+ </${ns}:Envelope>
232
+ `;
233
+ const mockedResp = {
234
+ data: `
235
+ <?xml version='1.0' encoding='UTF-8'?>
236
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
237
+ <S:Body>
238
+ <ns2:StockLevelLookupByWarehouseQuickViewResponse xmlns:ns2="http://${ServiceAlias.STOCK_LEVEL_LOOKUP}.ws.fbsaust.com.au">
239
+ <SystemTime>05-08-2024 11:21:28</SystemTime>
240
+ <StockLevel>
241
+ <stock>4001003.BLK</stock>
242
+ <stock_type>Pack</stock_type>
243
+ <pack>ED7</pack>
244
+ <warehouse>114</warehouse>
245
+ <sales_code>@MA</sales_code>
246
+ <qty_type>FRE</qty_type>
247
+ <qdp>0</qdp>
248
+ <pack_qty>0.0</pack_qty>
249
+ <qty>0.0</qty>
250
+ <sizeQty1>0.0</sizeQty1>
251
+ <sizeQty2>0.0</sizeQty2>
252
+ <sizeQty3>0.0</sizeQty3>
253
+ <sizeQty4>0.0</sizeQty4>
254
+ <sizeQty5>0.0</sizeQty5>
255
+ <sizeQty6>0.0</sizeQty6>
256
+ <sizeQty7>0.0</sizeQty7>
257
+ <sizeQty8>0.0</sizeQty8>
258
+ <sizeQty9>0.0</sizeQty9>
259
+ <sizeQty10>0.0</sizeQty10>
260
+ <sizeQty11>0.0</sizeQty11>
261
+ <sizeQty12>0.0</sizeQty12>
262
+ <sizeQty13>0.0</sizeQty13>
263
+ <sizeQty14>0.0</sizeQty14>
264
+ <sizeQty15>0.0</sizeQty15>
265
+ <sizeQty16>0.0</sizeQty16>
266
+ <sizeQty17>0.0</sizeQty17>
267
+ <sizeQty18>0.0</sizeQty18>
268
+ <sizeQty19>0.0</sizeQty19>
269
+ <sizeQty20>0.0</sizeQty20>
270
+ </StockLevel>
271
+ </ns2:StockLevelLookupByWarehouseQuickViewResponse>
272
+ </S:Body>
273
+ </S:Envelope>
274
+ `,
275
+ };
276
+ const expectedResult = {
277
+ stock: "4001003.BLK",
278
+ stockType: "Pack",
279
+ pack: "ED7",
280
+ warehouse: "114",
281
+ salesCode: "@MA",
282
+ qtyType: "FRE",
283
+ qdp: 0,
284
+ packQty: 0,
285
+ qty: 0,
286
+ sizeQty1: 0,
287
+ sizeQty2: 0,
288
+ sizeQty3: 0,
289
+ sizeQty4: 0,
290
+ sizeQty5: 0,
291
+ sizeQty6: 0,
292
+ sizeQty7: 0,
293
+ sizeQty8: 0,
294
+ sizeQty9: 0,
295
+ sizeQty10: 0,
296
+ sizeQty11: 0,
297
+ sizeQty12: 0,
298
+ sizeQty13: 0,
299
+ sizeQty14: 0,
300
+ sizeQty15: 0,
301
+ sizeQty16: 0,
302
+ sizeQty17: 0,
303
+ sizeQty18: 0,
304
+ sizeQty19: 0,
305
+ sizeQty20: 0,
306
+ };
307
+ mAxios.post.mockResolvedValueOnce(mockedResp);
308
+ const response = await stockLookupLevelModule.stockLevelLookupByWarehouseQuickView(params, sessionId);
309
+ // Test that expected response is correct
310
+ expect(Array.isArray(response)).toBe(true);
311
+ expect(response.length).toBe(1);
312
+ expect(response[0]).toEqual(expectedResult);
313
+ const actualPayload = mAxios.post.mock.calls[0][1];
314
+ // Test that actual payload sent in the API matches expected payload
315
+ expect(Utils.removeEmptySpaces(actualPayload)).toEqual(Utils.removeEmptySpaces(expectedPayload));
316
+ });
317
+ });
@@ -0,0 +1 @@
1
+ export * from "./stock-level-lookup.interface";
@@ -0,0 +1 @@
1
+ export * from "./stock-level-lookup.interface";
@@ -0,0 +1,162 @@
1
+ import { CombinedSearchTypeValue, OptionalStockQueryParams, OptionalStockRequestBody } from "../../shared/types";
2
+ export interface WarehouseRaw {
3
+ namekey: string[];
4
+ description_1?: string[];
5
+ description_2?: string[];
6
+ class_1?: string[];
7
+ class_2?: string[];
8
+ class_3?: string[];
9
+ class_4?: string[];
10
+ class_5?: string[];
11
+ }
12
+ export interface Warehouse {
13
+ namekey: string;
14
+ description1?: string;
15
+ description2?: string;
16
+ class1?: string;
17
+ class2?: string;
18
+ class3?: string;
19
+ class4?: string;
20
+ class5?: string;
21
+ }
22
+ export interface WarehouseResponse {
23
+ Warehouse: WarehouseRaw[];
24
+ }
25
+ export interface StockLevelResponse {
26
+ StockLevel: StockLevelRaw[];
27
+ }
28
+ export interface StockLevel {
29
+ stock: string;
30
+ stockType: string;
31
+ pack: string;
32
+ warehouse: string;
33
+ salesCode: string;
34
+ qtyType: string;
35
+ qdp: number;
36
+ packQty: number;
37
+ qty: number;
38
+ sizeQty1: number;
39
+ sizeQty2: number;
40
+ sizeQty3: number;
41
+ sizeQty4: number;
42
+ sizeQty5: number;
43
+ sizeQty6: number;
44
+ sizeQty7: number;
45
+ sizeQty8: number;
46
+ sizeQty9: number;
47
+ sizeQty10: number;
48
+ sizeQty11: number;
49
+ sizeQty12: number;
50
+ sizeQty13: number;
51
+ sizeQty14: number;
52
+ sizeQty15: number;
53
+ sizeQty16: number;
54
+ sizeQty17: number;
55
+ sizeQty18: number;
56
+ sizeQty19: number;
57
+ sizeQty20: number;
58
+ }
59
+ export interface StockLevelRaw {
60
+ stock: string[];
61
+ stock_type: string[];
62
+ pack: string[];
63
+ warehouse: string[];
64
+ sales_code: string[];
65
+ qty_type: string[];
66
+ qdp: string[];
67
+ pack_qty: string[];
68
+ qty: string[];
69
+ size_qty_01: string[];
70
+ size_qty_02: string[];
71
+ size_qty_03: string[];
72
+ size_qty_04: string[];
73
+ size_qty_05: string[];
74
+ size_qty_06: string[];
75
+ size_qty_07: string[];
76
+ size_qty_08: string[];
77
+ size_qty_09: string[];
78
+ size_qty_10: string[];
79
+ size_qty_11: string[];
80
+ size_qty_12: string[];
81
+ size_qty_13: string[];
82
+ size_qty_14: string[];
83
+ size_qty_15: string[];
84
+ size_qty_16: string[];
85
+ size_qty_17: string[];
86
+ size_qty_18: string[];
87
+ size_qty_19: string[];
88
+ size_qty_20: string[];
89
+ }
90
+ export declare class StockLevelLookupRequestBody extends OptionalStockRequestBody {
91
+ SearchType: string;
92
+ QtyType: string;
93
+ Summarised?: string;
94
+ OnlyNonZero?: string;
95
+ Warehouse?: string;
96
+ Warehouse1?: string;
97
+ Warehouse2?: string;
98
+ Warehouse3?: string;
99
+ Warehouse4?: string;
100
+ Warehouse5?: string;
101
+ Warehouse6?: string;
102
+ Warehouse7?: string;
103
+ Warehouse8?: string;
104
+ Warehouse9?: string;
105
+ Warehouse10?: string;
106
+ WarehouseClassFr1?: string;
107
+ WarehouseClassTo1?: string;
108
+ WarehouseClassFr2?: string;
109
+ WarehouseClassTo2?: string;
110
+ WarehouseClassFr3?: string;
111
+ WarehouseClassTo3?: string;
112
+ WarehouseClassFr4?: string;
113
+ WarehouseClassTo4?: string;
114
+ WarehouseClassFr5?: string;
115
+ WarehouseClassTo5?: string;
116
+ constructor(obj: Partial<StockLevelLookupRequestBody>);
117
+ toString(): string;
118
+ }
119
+ export interface StockLevelLookupQueryParams extends OptionalStockQueryParams {
120
+ searchType: CombinedSearchTypeValue;
121
+ qtyType: QtyType;
122
+ summarised?: Summarised;
123
+ onlyNonZero?: OnlyNonZero;
124
+ warehouse?: string;
125
+ warehouse1?: string;
126
+ warehouse2?: string;
127
+ warehouse3?: string;
128
+ warehouse4?: string;
129
+ warehouse5?: string;
130
+ warehouse6?: string;
131
+ warehouse7?: string;
132
+ warehouse8?: string;
133
+ warehouse9?: string;
134
+ warehouse10?: string;
135
+ warehouseClassFr1?: string;
136
+ warehouseClassTo1?: string;
137
+ warehouseClassFr2?: string;
138
+ warehouseClassTo2?: string;
139
+ warehouseClassFr3?: string;
140
+ warehouseClassTo3?: string;
141
+ warehouseClassFr4?: string;
142
+ warehouseClassTo4?: string;
143
+ warehouseClassFr5?: string;
144
+ warehouseClassTo5?: string;
145
+ }
146
+ export declare enum QtyType {
147
+ STK = "STK",
148
+ FRE = "FRE",
149
+ FUT = "FUT",
150
+ AVL = "AVL"
151
+ }
152
+ export declare enum Summarised {
153
+ EXPANDED = "E",
154
+ SUMMARISED = "S"
155
+ }
156
+ export declare enum OnlyNonZero {
157
+ YES = "Y",
158
+ NO = "N"
159
+ }
160
+ export interface StockLevelByWarehouseQuickViewResponse {
161
+ StockLevel: StockLevelRaw[];
162
+ }
@@ -0,0 +1,61 @@
1
+ import { OptionalStockRequestBody, } from "../../shared/types";
2
+ export class StockLevelLookupRequestBody extends OptionalStockRequestBody {
3
+ SearchType; // XML string with Te.g. <Type>StockKeyword</Type><Value>WEBSIL</Value>
4
+ QtyType;
5
+ Summarised;
6
+ OnlyNonZero;
7
+ Warehouse; // warehouse namekey
8
+ Warehouse1;
9
+ Warehouse2;
10
+ Warehouse3;
11
+ Warehouse4;
12
+ Warehouse5;
13
+ Warehouse6;
14
+ Warehouse7;
15
+ Warehouse8;
16
+ Warehouse9;
17
+ Warehouse10;
18
+ WarehouseClassFr1;
19
+ WarehouseClassTo1;
20
+ WarehouseClassFr2;
21
+ WarehouseClassTo2;
22
+ WarehouseClassFr3;
23
+ WarehouseClassTo3;
24
+ WarehouseClassFr4;
25
+ WarehouseClassTo4;
26
+ WarehouseClassFr5;
27
+ WarehouseClassTo5;
28
+ constructor(obj) {
29
+ if (!obj?.SearchType) {
30
+ throw new Error("SearchType is required when constructing StockLookup request body");
31
+ }
32
+ super(obj);
33
+ Object.assign(this, obj);
34
+ }
35
+ toString() {
36
+ let str = "";
37
+ for (const k in this) {
38
+ if (this[k]) {
39
+ str += `<${k}>${this[k]}</${k}>\n`;
40
+ }
41
+ }
42
+ return str;
43
+ }
44
+ }
45
+ export var QtyType;
46
+ (function (QtyType) {
47
+ QtyType["STK"] = "STK";
48
+ QtyType["FRE"] = "FRE";
49
+ QtyType["FUT"] = "FUT";
50
+ QtyType["AVL"] = "AVL";
51
+ })(QtyType || (QtyType = {}));
52
+ export var Summarised;
53
+ (function (Summarised) {
54
+ Summarised["EXPANDED"] = "E";
55
+ Summarised["SUMMARISED"] = "S";
56
+ })(Summarised || (Summarised = {}));
57
+ export var OnlyNonZero;
58
+ (function (OnlyNonZero) {
59
+ OnlyNonZero["YES"] = "Y";
60
+ OnlyNonZero["NO"] = "N";
61
+ })(OnlyNonZero || (OnlyNonZero = {}));
@@ -0,0 +1,3 @@
1
+ export * from "./mappings";
2
+ export * from "./stock-lookup.module";
3
+ export * from "./types";
@@ -0,0 +1,3 @@
1
+ export * from "./mappings";
2
+ export * from "./stock-lookup.module";
3
+ export * from "./types";
@@ -0,0 +1 @@
1
+ export * from "./stock-lookup.mapper";
@@ -0,0 +1 @@
1
+ export * from "./stock-lookup.mapper";
@@ -0,0 +1,22 @@
1
+ import { SizeGrid, SizeGridRaw, Stock, StockBarcode, StockBarcodeRaw, StockCategory, StockCategoryRaw, StockColor, StockColorRaw, StockLookupRequestBody, StockLookupRequestParams, StockRaw } from "../types/stock-lookup.interface";
2
+ /**
3
+ * Map response of SizeGridLookup API call from Harmony into internal SizeGrid interface
4
+ *
5
+ * @export
6
+ * @param {SizeGridRaw} src response in raw format from Harmony API
7
+ * @returns {SizeGrid} SizeGrid object which follows internal naming conventions
8
+ */
9
+ export declare function mapSizeGrid(src: SizeGridRaw): SizeGrid;
10
+ export declare function mapStockColor(src: StockColorRaw): StockColor;
11
+ export declare function mapStockClassification(src: StockColorRaw): StockColor;
12
+ export declare function mapStockBarcode(src: StockBarcodeRaw): StockBarcode;
13
+ export declare function mapStockCategory(src: StockCategoryRaw): StockCategory;
14
+ export declare function mapStock(src: StockRaw): Stock;
15
+ /**
16
+ * Map request params for stock lookup to SOAP request body
17
+ *
18
+ * @export
19
+ * @param {StockLookupRequestParams} src request parameters from the SDK API
20
+ * @returns {StockLookupRequestBody} SOAP request body object for Harmony SOAP API
21
+ */
22
+ export declare function mapStockLookupRequestParams(src: StockLookupRequestParams): StockLookupRequestBody;