@dotdev/harmony-sdk 1.0.6

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 +88 -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,419 @@
1
+ import axios from "axios";
2
+ import { ApiHelper } from "../../helpers";
3
+ import { StockLookupModule } from "./stock-lookup.module";
4
+ import { StockSearchType, } from "./types/stock-lookup.interface";
5
+ jest.mock("axios");
6
+ const mAxios = axios;
7
+ const sessionId = ""; // process.env.SESSION_ID as string;
8
+ const stockLookupModule = new StockLookupModule(mAxios);
9
+ describe("SizeGridLookup", () => {
10
+ test("sizeGridLookup", async () => {
11
+ const mockedResponse = {
12
+ data: `
13
+ <?xml version='1.0' encoding='UTF-8'?>
14
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
15
+ <S:Body>
16
+ <ns2:SizeGridLookupResponse xmlns:ns2="http://stk.ws.fbsaust.com.au">
17
+ <SizeGrid>
18
+ <namekey>01</namekey>
19
+ <description_1>XS-S to 4XL</description_1>
20
+ <description_2></description_2>
21
+ <size_1>XS-S</size_1>
22
+ <size_2>S-M</size_2>
23
+ <size_3>M-L</size_3>
24
+ <size_4>LX-L</size_4>
25
+ <size_5>XXS</size_5>
26
+ <size_6>XS</size_6>
27
+ <size_7>S</size_7>
28
+ <size_8>M</size_8>
29
+ <size_9>L</size_9>
30
+ <size_10>XL</size_10>
31
+ <size_11>XXL</size_11>
32
+ <size_12>XXXL</size_12>
33
+ <size_13>4XL</size_13>
34
+ <size_14></size_14>
35
+ <size_15></size_15>
36
+ <size_16></size_16>
37
+ <size_17></size_17>
38
+ <size_18></size_18>
39
+ <size_19></size_19>
40
+ <size_20></size_20>
41
+ </SizeGrid>
42
+ </ns2:SizeGridLookupResponse>
43
+ </S:Body>
44
+ </S:Envelope>
45
+ `,
46
+ };
47
+ const expected = {
48
+ namekey: "01",
49
+ description1: "XS-S to 4XL",
50
+ description2: "",
51
+ size1: "XS-S",
52
+ size2: "S-M",
53
+ size3: "M-L",
54
+ size4: "LX-L",
55
+ size5: "XXS",
56
+ size6: "XS",
57
+ size7: "S",
58
+ size8: "M",
59
+ size9: "L",
60
+ size10: "XL",
61
+ size11: "XXL",
62
+ size12: "XXXL",
63
+ size13: "4XL",
64
+ size14: "",
65
+ size15: "",
66
+ size16: "",
67
+ size17: "",
68
+ size18: "",
69
+ size19: "",
70
+ size20: "",
71
+ };
72
+ mAxios.post.mockResolvedValueOnce(mockedResponse);
73
+ const response = await stockLookupModule.sizeGridLookup(sessionId);
74
+ expect(Array.isArray(response)).toBe(true);
75
+ expect(response.length).toEqual(1);
76
+ expect(response[0]).toEqual(expected);
77
+ });
78
+ });
79
+ describe("StockClassificationLookup", () => {
80
+ test("stockClassificationLookup", async () => {
81
+ const mockedResponse = {
82
+ data: `
83
+ <?xml version='1.0' encoding='UTF-8'?>
84
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
85
+ <S:Body>
86
+ <ns2:StockClassificationLookupResponse xmlns:ns2="http://stk.ws.fbsaust.com.au">
87
+ <StockClassification>
88
+ <code>BACK</code>
89
+ <description>BACK PACK</description>
90
+ </StockClassification>
91
+ <StockClassification>
92
+ <code>BASHO</code>
93
+ <description>BASIC HOODY</description>
94
+ </StockClassification>
95
+ </ns2:StockClassificationLookupResponse>
96
+ </S:Body>
97
+ </S:Envelope>
98
+ `,
99
+ };
100
+ const mockedOutput = [
101
+ { code: "BACK", description: "BACK PACK" },
102
+ { code: "BASHO", description: "BASIC HOODY" },
103
+ ];
104
+ mAxios.post.mockResolvedValueOnce(mockedResponse);
105
+ const response = await stockLookupModule.stockClassificationLookup(`"${sessionId}"`);
106
+ expect(Array.isArray(response)).toEqual(true);
107
+ expect(response.length).toEqual(2);
108
+ expect(response[0]).toHaveProperty("code");
109
+ expect(response[0]).toHaveProperty("description");
110
+ expect(response).toEqual(mockedOutput);
111
+ });
112
+ });
113
+ describe("StockBarcodeLookup", () => {
114
+ test("stockBarcodeLookup", async () => {
115
+ const resp = {
116
+ data: `<?xml version='1.0' encoding='UTF-8'?>
117
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
118
+ <S:Body>
119
+ <ns2:StockBarcodeLookupResponse xmlns:ns2="http://">
120
+ <SystemTime>29-07-2024 10:51:27</SystemTime>
121
+ <StockBarcode>
122
+ <stock>9999999.TEST</stock>
123
+ <barcode>1234567891234</barcode>
124
+ <size>10</size>
125
+ <pack></pack>
126
+ </StockBarcode>
127
+ </ns2:StockBarcodeLookupResponse>
128
+ </S:Body>
129
+ </S:Envelope>`,
130
+ };
131
+ const mockedOutput = [
132
+ {
133
+ stock: "9999999.TEST",
134
+ barcode: "1234567891234",
135
+ size: "10",
136
+ pack: "",
137
+ },
138
+ ];
139
+ const params = {
140
+ searchType: StockSearchType.BARCODE,
141
+ searchValue: "1234567891234",
142
+ };
143
+ mAxios.post.mockResolvedValueOnce(resp);
144
+ const response = await stockLookupModule.stockBarcodeLookup(params, `"${sessionId}"`);
145
+ expect(Array.isArray(response)).toEqual(true);
146
+ expect(response.length).toEqual(1);
147
+ expect(response[0]).toHaveProperty("stock");
148
+ expect(response[0]).toHaveProperty("barcode");
149
+ expect(response[0]).toHaveProperty("size");
150
+ expect(response[0]).toHaveProperty("pack");
151
+ expect(response).toEqual(mockedOutput);
152
+ });
153
+ test("stockBarcodeLookup check correct method name being sent", async () => {
154
+ const mockedSendApiRequest = jest.spyOn(ApiHelper, "sendSoapRequest");
155
+ const resp = {
156
+ data: `<?xml version='1.0' encoding='UTF-8'?>
157
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
158
+ <S:Body>
159
+ <ns2:StockBarcodeLookupResponse xmlns:ns2="http://">
160
+ <SystemTime>29-07-2024 10:51:27</SystemTime>
161
+ <StockBarcode>
162
+ <stock>9999999.TEST</stock>
163
+ <barcode>1234567891234</barcode>
164
+ <size>10</size>
165
+ <pack></pack>
166
+ </StockBarcode>
167
+ </ns2:StockBarcodeLookupResponse>
168
+ </S:Body>
169
+ </S:Envelope>`,
170
+ };
171
+ mAxios.post.mockResolvedValueOnce(resp);
172
+ const response = await stockLookupModule.stockBarcodeLookup({
173
+ searchType: StockSearchType.BARCODE,
174
+ }, "");
175
+ const apiBody = mockedSendApiRequest.mock.calls[0][2];
176
+ expect(apiBody?.includes(`<stk:StockBarcodeLookupRequest>`) &&
177
+ apiBody?.includes(`</stk:StockBarcodeLookupRequest>`)).toBe(true);
178
+ });
179
+ test("stockBarcodeLookup errors", async () => {
180
+ // requires valid barcode
181
+ try {
182
+ const params = {
183
+ searchType: StockSearchType.BARCODE,
184
+ searchValue: "123",
185
+ };
186
+ await stockLookupModule.stockBarcodeLookup(params, `"${sessionId}"`);
187
+ }
188
+ catch (error) {
189
+ expect(error?.message).toEqual("Barcode search requires a barcode value");
190
+ }
191
+ // stock search cannot except only wildcard character
192
+ try {
193
+ const params = {
194
+ searchType: StockSearchType.STOCK,
195
+ searchValue: "*",
196
+ };
197
+ await stockLookupModule.stockBarcodeLookup(params, `"${sessionId}"`);
198
+ }
199
+ catch (error) {
200
+ expect(error?.message).toEqual("Stock search value cannot be '*'");
201
+ }
202
+ // stock keyword search cannot except wildcard
203
+ try {
204
+ const params = {
205
+ searchType: StockSearchType.STOCK_KEYWORD,
206
+ searchValue: "test*",
207
+ };
208
+ await stockLookupModule.stockBarcodeLookup(params, `"${sessionId}"`);
209
+ }
210
+ catch (error) {
211
+ expect(error?.message).toEqual("Stock Keyword search does not allow wildcard character (*)");
212
+ }
213
+ // stock keyword search cannot except blank search value
214
+ try {
215
+ const params = {
216
+ searchType: StockSearchType.STOCK_KEYWORD,
217
+ searchValue: "",
218
+ };
219
+ await stockLookupModule.stockBarcodeLookup(params, `"${sessionId}"`);
220
+ }
221
+ catch (error) {
222
+ expect(error?.message).toEqual("Stock Keyword search value cannot be empty");
223
+ }
224
+ });
225
+ });
226
+ describe("StockColorLookup", () => {
227
+ test("stockColorLookup base", async () => {
228
+ const resp = {
229
+ data: `
230
+ <?xml version='1.0' encoding='UTF-8'?>
231
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
232
+ <S:Body>
233
+ <ns2:StockColorLookupResponse xmlns:ns2="http://stk.ws.fbsaust.com.au">
234
+ <StockColor>
235
+ <code>.TEST</code>
236
+ <description>TEST &amp; THIS</description>
237
+ </StockColor>
238
+ </ns2:StockColorLookupResponse>
239
+ </S:Body>
240
+ </S:Envelope>
241
+ `,
242
+ };
243
+ const mockedOutput = [
244
+ {
245
+ code: ".TEST",
246
+ description: "TEST & THIS",
247
+ },
248
+ ];
249
+ mAxios.post.mockResolvedValueOnce(resp);
250
+ const response = await stockLookupModule.stockColorLookup(`"${sessionId}"`);
251
+ expect(Array.isArray(response)).toEqual(true);
252
+ expect(response.length).toEqual(1);
253
+ expect(response[0]).toHaveProperty("code");
254
+ expect(response[0]).toHaveProperty("description");
255
+ expect(response).toEqual(mockedOutput);
256
+ });
257
+ });
258
+ describe("StockCatergoryLookup", () => {
259
+ test("stockCategoryLookup base", async () => {
260
+ const resp = {
261
+ data: `
262
+ <?xml version='1.0' encoding='UTF-8'?>
263
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
264
+ <S:Body>
265
+ <ns2:StockCategoryLookupResponse xmlns:ns2="http://stk.ws.fbsaust.com.au">
266
+ <StockCategory>
267
+ <code>123</code>
268
+ <description_1>ONE TWO THREE</description_1>
269
+ <description_2>! @ #</description_2>
270
+ </StockCategory>
271
+ </ns2:StockCategoryLookupResponse>
272
+ </S:Body>
273
+ </S:Envelope>
274
+ `,
275
+ };
276
+ const mockedOutput = [
277
+ {
278
+ code: "123",
279
+ description1: "ONE TWO THREE",
280
+ description2: "! @ #",
281
+ },
282
+ ];
283
+ mAxios.post.mockResolvedValueOnce(resp);
284
+ const response = await stockLookupModule.stockCategoryLookup(`"${sessionId}"`);
285
+ expect(Array.isArray(response)).toEqual(true);
286
+ expect(response.length).toEqual(1);
287
+ expect(response[0]).toHaveProperty("code");
288
+ expect(response[0]).toHaveProperty("description1");
289
+ expect(response[0]).toHaveProperty("description2");
290
+ expect(response).toEqual(mockedOutput);
291
+ });
292
+ });
293
+ describe("StockLookup", () => {
294
+ const params = {
295
+ searchType: StockSearchType.STOCK_KEYWORD,
296
+ searchValue: "test*",
297
+ };
298
+ test("stockLookup base test", async () => {
299
+ const resp = {
300
+ data: `
301
+ <?xml version='1.0' encoding='UTF-8'?>
302
+ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
303
+ <S:Body>
304
+ <ns2:StockLookupResponse xmlns:ns2="http://stk.ws.fbsaust.com.au">
305
+ <SystemTime>02-02-2022 09:09:09</SystemTime>
306
+ <Stock>
307
+ <namekey>6008016.KHAK</namekey>
308
+ <description_1>TWISTED TEE DRESS</description_1>
309
+ <description_2></description_2>
310
+ <category>Z-SL</category>
311
+ <class_1>DREKN</class_1>
312
+ <class_2>COREP</class_2>
313
+ <class_3>05DRE</class_3>
314
+ <extra_class_1></extra_class_1>
315
+ <extra_class_2>FEM</extra_class_2>
316
+ <extra_class_3></extra_class_3>
317
+ <extra_class_4>02DRE</extra_class_4>
318
+ <extra_class_5></extra_class_5>
319
+ <sales_code>@LL</sales_code>
320
+ <per></per>
321
+ <color_code>KHAK</color_code>
322
+ <color_description>KHAKI</color_description>
323
+ <supplier>AUWUHMYH</supplier>
324
+ <supplier_reference></supplier_reference>
325
+ <barcode></barcode>
326
+ <weight>0.21000000000000002</weight>
327
+ <volume>0.0</volume>
328
+ <tax_category>1</tax_category>
329
+ <qdp>0</qdp>
330
+ <pdp>2</pdp>
331
+ <packs_per_carton>1</packs_per_carton>
332
+ <singles_per_pack>1</singles_per_pack>
333
+ <carton_per_item>0</carton_per_item>
334
+ <units_per_single>0</units_per_single>
335
+ <units_per_box>0.0</units_per_box>
336
+ <sales_price_1>59.95</sales_price_1>
337
+ <sales_price_2>0.0</sales_price_2>
338
+ <sales_price_3>26.75</sales_price_3>
339
+ <sales_price_4>59.95</sales_price_4>
340
+ <sales_price_5>20.0</sales_price_5>
341
+ <sales_price_6>69.95</sales_price_6>
342
+ <sales_price_7>0.0</sales_price_7>
343
+ <sales_price_8>28.75</sales_price_8>
344
+ <sales_price_9>69.95</sales_price_9>
345
+ <sales_price_10>30.0</sales_price_10>
346
+ <sales_price_11>20.0</sales_price_11>
347
+ <sales_price_12>30.0</sales_price_12>
348
+ <sell_start_date></sell_start_date>
349
+ <sell_end_date></sell_end_date>
350
+ <deliver_from_date></deliver_from_date>
351
+ <iso_country_of_origin></iso_country_of_origin>
352
+ <size>6</size>
353
+ <pack></pack>
354
+ </Stock>
355
+ </ns2:StockLookupResponse>
356
+ </S:Body>
357
+ </S:Envelope>
358
+ `,
359
+ };
360
+ const mockedOutput = [
361
+ {
362
+ namekey: "6008016.KHAK",
363
+ description1: "TWISTED TEE DRESS",
364
+ description2: "",
365
+ category: "Z-SL",
366
+ class1: "DREKN",
367
+ class2: "COREP",
368
+ class3: "05DRE",
369
+ extraClass1: "",
370
+ extraClass2: "FEM",
371
+ extraClass3: "",
372
+ extraClass4: "02DRE",
373
+ extraClass5: "",
374
+ salesCode: "@LL",
375
+ per: "",
376
+ colorCode: "KHAK",
377
+ colorDescription: "KHAKI",
378
+ supplier: "AUWUHMYH",
379
+ supplierReference: "",
380
+ barcode: "",
381
+ weight: 0.21000000000000002,
382
+ volume: 0,
383
+ taxCategory: 1,
384
+ qdp: 0,
385
+ pdp: 2,
386
+ packsPerCarton: 1,
387
+ singlesPerPack: 1,
388
+ cartonPerItem: 0,
389
+ unitsPerSingle: 0,
390
+ unitsPerBox: 0,
391
+ salesPrice1: 59.95,
392
+ salesPrice2: 0,
393
+ salesPrice3: 26.75,
394
+ salesPrice4: 59.95,
395
+ salesPrice5: 20,
396
+ salesPrice6: 69.95,
397
+ salesPrice7: 0,
398
+ salesPrice8: 28.75,
399
+ salesPrice9: 69.95,
400
+ salesPrice10: 30,
401
+ salesPrice11: 20,
402
+ salesPrice12: 30,
403
+ sellStartDate: "",
404
+ sellEndDate: "",
405
+ deliverFromDate: "",
406
+ isoCountryOfOrigin: "",
407
+ size: "6",
408
+ pack: "",
409
+ stockActive: undefined,
410
+ alternateNamekey: undefined,
411
+ },
412
+ ];
413
+ mAxios.post.mockResolvedValueOnce(resp);
414
+ const response = await stockLookupModule.stockLookup(params, `"${sessionId}"`);
415
+ expect(Array.isArray(response)).toEqual(true);
416
+ expect(response.length).toEqual(1);
417
+ expect(response).toEqual(mockedOutput);
418
+ });
419
+ });
@@ -0,0 +1 @@
1
+ export * from "./stock-lookup.interface";
@@ -0,0 +1 @@
1
+ export * from "./stock-lookup.interface";
@@ -0,0 +1,242 @@
1
+ import { OptionalStockQueryParams, OptionalStockRequestBody, ParamLimits } from "../../shared/types";
2
+ export declare class StockLookupRequestBody extends OptionalStockRequestBody {
3
+ SearchType: StockLookupSearchType;
4
+ SearchValue?: string;
5
+ Warehouse?: string;
6
+ Debtor?: string;
7
+ DateTime?: string;
8
+ constructor(obj: Partial<StockLookupRequestBody>);
9
+ toString(): string;
10
+ }
11
+ export type StockLookupSearchType = StockSearchType | StockClassificationType;
12
+ export declare enum StockSearchType {
13
+ BARCODE = "Barcode",
14
+ STOCK = "Stock",
15
+ STOCK_KEYWORD = "StockKeyword"
16
+ }
17
+ export interface StockLookupRequestParams extends OptionalStockQueryParams {
18
+ searchType: StockLookupSearchType;
19
+ searchValue?: string;
20
+ warehouse?: string;
21
+ debtor?: string;
22
+ datetime?: string;
23
+ }
24
+ export declare const STOCK_LOOKUP_REQUEST_PARAMS_LIMIT: ParamLimits<StockLookupRequestParams>;
25
+ export interface StockBaseInterfaceRaw {
26
+ code: string | string[];
27
+ description: string | string[];
28
+ }
29
+ export interface StockBaseInterface {
30
+ code: string;
31
+ description: string;
32
+ }
33
+ export interface SizeGridRaw {
34
+ namekey: string | string[];
35
+ description_1: string | string[];
36
+ description_2: string | string[];
37
+ size_1: string | string[];
38
+ size_2: string | string[];
39
+ size_3: string | string[];
40
+ size_4: string | string[];
41
+ size_5: string | string[];
42
+ size_6: string | string[];
43
+ size_7: string | string[];
44
+ size_8: string | string[];
45
+ size_9: string | string[];
46
+ size_10: string | string[];
47
+ size_11: string | string[];
48
+ size_12: string | string[];
49
+ size_13: string | string[];
50
+ size_14: string | string[];
51
+ size_15: string | string[];
52
+ size_16: string | string[];
53
+ size_17: string | string[];
54
+ size_18: string | string[];
55
+ size_19: string | string[];
56
+ size_20: string | string[];
57
+ }
58
+ export interface SizeGrid {
59
+ namekey: string;
60
+ description1: string;
61
+ description2: string;
62
+ size1: string;
63
+ size2: string;
64
+ size3: string;
65
+ size4: string;
66
+ size5: string;
67
+ size6: string;
68
+ size7: string;
69
+ size8: string;
70
+ size9: string;
71
+ size10: string;
72
+ size11: string;
73
+ size12: string;
74
+ size13: string;
75
+ size14: string;
76
+ size15: string;
77
+ size16: string;
78
+ size17: string;
79
+ size18: string;
80
+ size19: string;
81
+ size20: string;
82
+ }
83
+ export interface SizeGridResponse {
84
+ SizeGrid: SizeGridRaw[];
85
+ }
86
+ export interface StockClassification extends StockBaseInterface {
87
+ }
88
+ export interface StockClassificationRaw extends StockBaseInterfaceRaw {
89
+ }
90
+ export interface StockClassificationResponse {
91
+ StockClassification: StockClassificationRaw[];
92
+ }
93
+ export declare enum StockClassificationType {
94
+ STK1 = "STK1",
95
+ STK2 = "STK2",
96
+ STK3 = "STK3",
97
+ EXT1 = "EXT1",
98
+ EXT2 = "EXT2",
99
+ EXT3 = "EXT3",
100
+ EXT4 = "EXT4",
101
+ EXT5 = "EXT5"
102
+ }
103
+ export interface StockBarcodeRaw {
104
+ stock: string[];
105
+ barcode: string[];
106
+ size: string[];
107
+ pack: string[];
108
+ }
109
+ export interface StockBarcode {
110
+ stock: string;
111
+ barcode: string;
112
+ size: string;
113
+ pack: string;
114
+ }
115
+ export interface StockBarcodeResponse {
116
+ StockBarcode: StockBarcodeRaw[];
117
+ }
118
+ export interface StockColor extends StockBaseInterface {
119
+ }
120
+ export interface StockColorRaw extends StockBaseInterfaceRaw {
121
+ }
122
+ export interface StockColorResponse {
123
+ StockColor: StockColorRaw[];
124
+ }
125
+ export interface StockCategory {
126
+ code: string;
127
+ description1: string;
128
+ description2: string;
129
+ }
130
+ export interface StockCategoryRaw {
131
+ code: string[];
132
+ description_1: string[];
133
+ description_2: string[];
134
+ }
135
+ export interface StockCatergoryResponse {
136
+ StockCategory: StockCategoryRaw[];
137
+ }
138
+ export interface Stock {
139
+ namekey: string;
140
+ description1: string;
141
+ description2: string;
142
+ category: string;
143
+ class1: string;
144
+ class2: string;
145
+ class3: string;
146
+ extraClass1: string;
147
+ extraClass2: string;
148
+ extraClass3: string;
149
+ extraClass4: string;
150
+ extraClass5: string;
151
+ salesCode: string;
152
+ per: string;
153
+ colorCode: string;
154
+ colorDescription: string;
155
+ supplier: string;
156
+ supplierReference: string;
157
+ barcode: string;
158
+ weight: number;
159
+ volume: number;
160
+ taxCategory: number;
161
+ qdp: number;
162
+ pdp: number;
163
+ packsPerCarton: number;
164
+ singlesPerPack: number;
165
+ cartonPerItem: number;
166
+ unitsPerSingle: number;
167
+ unitsPerBox: number;
168
+ salesPrice1: number;
169
+ salesPrice2: number;
170
+ salesPrice3: number;
171
+ salesPrice4: number;
172
+ salesPrice5: number;
173
+ salesPrice6: number;
174
+ salesPrice7: number;
175
+ salesPrice8: number;
176
+ salesPrice9: number;
177
+ salesPrice10: number;
178
+ salesPrice11: number;
179
+ salesPrice12: number;
180
+ sellStartDate: string;
181
+ sellEndDate: string;
182
+ deliverFromDate: string;
183
+ isoCountryOfOrigin: string;
184
+ size?: string;
185
+ pack?: string;
186
+ stockActive?: string;
187
+ alternateNamekey?: string;
188
+ }
189
+ export interface StockRaw {
190
+ namekey: string[];
191
+ description_1: string[];
192
+ description_2: string[];
193
+ category: string[];
194
+ class_1: string[];
195
+ class_2: string[];
196
+ class_3: string[];
197
+ extra_class_1: string[];
198
+ extra_class_2: string[];
199
+ extra_class_3: string[];
200
+ extra_class_4: string[];
201
+ extra_class_5: string[];
202
+ sales_code: string[];
203
+ per: string[];
204
+ color_code: string[];
205
+ color_description: string[];
206
+ supplier: string[];
207
+ supplier_reference: string[];
208
+ barcode: string[];
209
+ weight: string[];
210
+ volume: string[];
211
+ tax_category: string[];
212
+ qdp: string[];
213
+ pdp: string[];
214
+ packs_per_carton: string[];
215
+ singles_per_pack: string[];
216
+ carton_per_item: string[];
217
+ units_per_single: string[];
218
+ units_per_box: string[];
219
+ sales_price_1: string[];
220
+ sales_price_2: string[];
221
+ sales_price_3: string[];
222
+ sales_price_4: string[];
223
+ sales_price_5: string[];
224
+ sales_price_6: string[];
225
+ sales_price_7: string[];
226
+ sales_price_8: string[];
227
+ sales_price_9: string[];
228
+ sales_price_10: string[];
229
+ sales_price_11: string[];
230
+ sales_price_12: string[];
231
+ sell_start_date: string[];
232
+ sell_end_date: string[];
233
+ deliver_from_date: string[];
234
+ iso_country_of_origin: string[];
235
+ size: string[];
236
+ pack: string[];
237
+ stock_active: string[];
238
+ alternate_namekey: string[];
239
+ }
240
+ export interface StockResponse {
241
+ Stock: StockRaw[];
242
+ }