@gofynd/fdk-client-javascript 1.0.0 → 1.0.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.
Files changed (156) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +393 -393
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +268 -268
  5. package/documentation/application/PAYMENT.md +249 -249
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3497 -3097
  9. package/documentation/platform/COMPANYPROFILE.md +207 -207
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1518 -1324
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +96 -96
  14. package/index.js +7 -1
  15. package/package.json +1 -1
  16. package/sdk/application/ApplicationConfig.js +1 -1
  17. package/sdk/application/Cart/CartApplicationClient.js +865 -52
  18. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  19. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  20. package/sdk/application/Cart/CartApplicationValidator.js +1 -0
  21. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  22. package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
  23. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
  24. package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
  25. package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
  26. package/sdk/application/Common/CommonApplicationClient.js +66 -4
  27. package/sdk/application/Common/CommonApplicationValidator.js +1 -0
  28. package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
  29. package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
  30. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  31. package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
  32. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  33. package/sdk/application/Content/ContentApplicationClient.js +621 -38
  34. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  35. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  36. package/sdk/application/Content/ContentApplicationValidator.js +1 -0
  37. package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
  38. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
  39. package/sdk/application/Lead/LeadApplicationClient.js +229 -14
  40. package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
  41. package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
  42. package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
  43. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  44. package/sdk/application/Order/OrderApplicationClient.js +403 -24
  45. package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
  46. package/sdk/application/Order/OrderApplicationModel.js +334 -334
  47. package/sdk/application/Order/OrderApplicationValidator.js +1 -0
  48. package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
  49. package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
  50. package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
  51. package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
  52. package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
  53. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  54. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  55. package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
  56. package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
  57. package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
  58. package/sdk/application/Share/ShareApplicationClient.js +226 -14
  59. package/sdk/application/Share/ShareApplicationValidator.js +1 -0
  60. package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
  61. package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
  62. package/sdk/application/User/UserApplicationClient.js +1133 -70
  63. package/sdk/application/User/UserApplicationValidator.js +1 -0
  64. package/sdk/common/AxiosHelper.js +1 -1
  65. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  66. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
  67. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  68. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
  69. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  70. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
  71. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  72. package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
  73. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  74. package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
  75. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  76. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  77. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
  78. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
  79. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
  80. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
  81. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
  82. package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
  83. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
  84. package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
  85. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
  86. package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
  87. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  88. package/sdk/platform/Common/CommonPlatformClient.js +73 -4
  89. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  90. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
  91. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  92. package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
  93. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  94. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
  95. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
  96. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
  97. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  98. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
  99. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  100. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
  101. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  102. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
  103. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  104. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  105. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  106. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  107. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  108. package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
  109. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  110. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
  111. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  112. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
  113. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  114. package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
  115. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  116. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
  117. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  118. package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
  119. package/sdk/platform/OAuthClient.js +8 -8
  120. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  121. package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
  122. package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
  123. package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
  124. package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
  125. package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
  126. package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
  127. package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
  128. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  129. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
  130. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  131. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  132. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  133. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
  134. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  135. package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
  136. package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
  137. package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
  138. package/sdk/platform/PlatformApplicationClient.js +3461 -3263
  139. package/sdk/platform/PlatformClient.d.ts +2973 -2827
  140. package/sdk/platform/PlatformClient.js +3461 -3263
  141. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  142. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
  143. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  144. package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
  145. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  146. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
  147. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  148. package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
  149. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  150. package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
  151. package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
  152. package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
  153. package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
  154. package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
  155. package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
  156. package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const OrderValidator = require("./OrderApplicationValidator");
6
+ const OrderModel = require("./OrderApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Order {
8
10
  constructor(_conf) {
@@ -64,7 +66,14 @@ class Order {
64
66
  * @summary: Get all orders
65
67
  * @description: Use this API to retrieve all the orders.
66
68
  */
67
- getOrders({ status, pageNo, pageSize, fromDate, toDate, customMeta } = {}) {
69
+ async getOrders({
70
+ status,
71
+ pageNo,
72
+ pageSize,
73
+ fromDate,
74
+ toDate,
75
+ customMeta,
76
+ } = {}) {
68
77
  const { error } = OrderValidator.getOrders().validate(
69
78
  { status, pageNo, pageSize, fromDate, toDate, customMeta },
70
79
  { abortEarly: false, allowUnknown: true }
@@ -72,6 +81,20 @@ class Order {
72
81
  if (error) {
73
82
  return Promise.reject(new FDKClientValidationError(error));
74
83
  }
84
+
85
+ // Showing warrnings if extra unknown parameters are found
86
+ const { error: warrning } = OrderValidator.getOrders().validate(
87
+ { status, pageNo, pageSize, fromDate, toDate, customMeta },
88
+ { abortEarly: false, allowUnknown: false }
89
+ );
90
+ if (warrning) {
91
+ Logger({
92
+ level: "WARN",
93
+ message: "Parameter Validation warrnings for getOrders",
94
+ });
95
+ Logger({ level: "WARN", message: warrning });
96
+ }
97
+
75
98
  const query_params = {};
76
99
  query_params["status"] = status;
77
100
  query_params["page_no"] = pageNo;
@@ -82,7 +105,7 @@ class Order {
82
105
 
83
106
  const xHeaders = {};
84
107
 
85
- return APIClient.execute(
108
+ const response = await APIClient.execute(
86
109
  this._conf,
87
110
  "get",
88
111
  constructUrl({
@@ -93,6 +116,21 @@ class Order {
93
116
  undefined,
94
117
  xHeaders
95
118
  );
119
+
120
+ const { error: res_error } = OrderModel.OrderList().validate(response, {
121
+ abortEarly: false,
122
+ allowUnknown: false,
123
+ });
124
+
125
+ if (res_error) {
126
+ Logger({
127
+ level: "WARN",
128
+ message: "Response Validation Warnnings for getOrders",
129
+ });
130
+ Logger({ level: "WARN", message: res_error });
131
+ }
132
+
133
+ return response;
96
134
  }
97
135
 
98
136
  /**
@@ -103,7 +141,7 @@ class Order {
103
141
  * @summary: Get details of an order
104
142
  * @description: Use this API to retrieve order details such as tracking details, shipment, store information using Fynd Order ID.
105
143
  */
106
- getOrderById({ orderId } = {}) {
144
+ async getOrderById({ orderId } = {}) {
107
145
  const { error } = OrderValidator.getOrderById().validate(
108
146
  { orderId },
109
147
  { abortEarly: false, allowUnknown: true }
@@ -111,11 +149,25 @@ class Order {
111
149
  if (error) {
112
150
  return Promise.reject(new FDKClientValidationError(error));
113
151
  }
152
+
153
+ // Showing warrnings if extra unknown parameters are found
154
+ const { error: warrning } = OrderValidator.getOrderById().validate(
155
+ { orderId },
156
+ { abortEarly: false, allowUnknown: false }
157
+ );
158
+ if (warrning) {
159
+ Logger({
160
+ level: "WARN",
161
+ message: "Parameter Validation warrnings for getOrderById",
162
+ });
163
+ Logger({ level: "WARN", message: warrning });
164
+ }
165
+
114
166
  const query_params = {};
115
167
 
116
168
  const xHeaders = {};
117
169
 
118
- return APIClient.execute(
170
+ const response = await APIClient.execute(
119
171
  this._conf,
120
172
  "get",
121
173
  constructUrl({
@@ -126,6 +178,21 @@ class Order {
126
178
  undefined,
127
179
  xHeaders
128
180
  );
181
+
182
+ const { error: res_error } = OrderModel.OrderById().validate(response, {
183
+ abortEarly: false,
184
+ allowUnknown: false,
185
+ });
186
+
187
+ if (res_error) {
188
+ Logger({
189
+ level: "WARN",
190
+ message: "Response Validation Warnnings for getOrderById",
191
+ });
192
+ Logger({ level: "WARN", message: res_error });
193
+ }
194
+
195
+ return response;
129
196
  }
130
197
 
131
198
  /**
@@ -136,7 +203,7 @@ class Order {
136
203
  * @summary: Get POS Order
137
204
  * @description: Use this API to retrieve a POS order and all its details such as tracking details, shipment, store information using Fynd Order ID.
138
205
  */
139
- getPosOrderById({ orderId } = {}) {
206
+ async getPosOrderById({ orderId } = {}) {
140
207
  const { error } = OrderValidator.getPosOrderById().validate(
141
208
  { orderId },
142
209
  { abortEarly: false, allowUnknown: true }
@@ -144,11 +211,25 @@ class Order {
144
211
  if (error) {
145
212
  return Promise.reject(new FDKClientValidationError(error));
146
213
  }
214
+
215
+ // Showing warrnings if extra unknown parameters are found
216
+ const { error: warrning } = OrderValidator.getPosOrderById().validate(
217
+ { orderId },
218
+ { abortEarly: false, allowUnknown: false }
219
+ );
220
+ if (warrning) {
221
+ Logger({
222
+ level: "WARN",
223
+ message: "Parameter Validation warrnings for getPosOrderById",
224
+ });
225
+ Logger({ level: "WARN", message: warrning });
226
+ }
227
+
147
228
  const query_params = {};
148
229
 
149
230
  const xHeaders = {};
150
231
 
151
- return APIClient.execute(
232
+ const response = await APIClient.execute(
152
233
  this._conf,
153
234
  "get",
154
235
  constructUrl({
@@ -159,6 +240,21 @@ class Order {
159
240
  undefined,
160
241
  xHeaders
161
242
  );
243
+
244
+ const { error: res_error } = OrderModel.OrderList().validate(response, {
245
+ abortEarly: false,
246
+ allowUnknown: false,
247
+ });
248
+
249
+ if (res_error) {
250
+ Logger({
251
+ level: "WARN",
252
+ message: "Response Validation Warnnings for getPosOrderById",
253
+ });
254
+ Logger({ level: "WARN", message: res_error });
255
+ }
256
+
257
+ return response;
162
258
  }
163
259
 
164
260
  /**
@@ -170,7 +266,7 @@ class Order {
170
266
  * @summary: Get details of a shipment
171
267
  * @description: Use this API to retrieve shipment details such as price breakup, tracking details, store information, etc. using Shipment ID.
172
268
  */
173
- getShipmentById({ shipmentId } = {}) {
269
+ async getShipmentById({ shipmentId } = {}) {
174
270
  const { error } = OrderValidator.getShipmentById().validate(
175
271
  { shipmentId },
176
272
  { abortEarly: false, allowUnknown: true }
@@ -178,11 +274,25 @@ class Order {
178
274
  if (error) {
179
275
  return Promise.reject(new FDKClientValidationError(error));
180
276
  }
277
+
278
+ // Showing warrnings if extra unknown parameters are found
279
+ const { error: warrning } = OrderValidator.getShipmentById().validate(
280
+ { shipmentId },
281
+ { abortEarly: false, allowUnknown: false }
282
+ );
283
+ if (warrning) {
284
+ Logger({
285
+ level: "WARN",
286
+ message: "Parameter Validation warrnings for getShipmentById",
287
+ });
288
+ Logger({ level: "WARN", message: warrning });
289
+ }
290
+
181
291
  const query_params = {};
182
292
 
183
293
  const xHeaders = {};
184
294
 
185
- return APIClient.execute(
295
+ const response = await APIClient.execute(
186
296
  this._conf,
187
297
  "get",
188
298
  constructUrl({
@@ -193,6 +303,21 @@ class Order {
193
303
  undefined,
194
304
  xHeaders
195
305
  );
306
+
307
+ const { error: res_error } = OrderModel.ShipmentById().validate(response, {
308
+ abortEarly: false,
309
+ allowUnknown: false,
310
+ });
311
+
312
+ if (res_error) {
313
+ Logger({
314
+ level: "WARN",
315
+ message: "Response Validation Warnnings for getShipmentById",
316
+ });
317
+ Logger({ level: "WARN", message: res_error });
318
+ }
319
+
320
+ return response;
196
321
  }
197
322
 
198
323
  /**
@@ -202,7 +327,7 @@ class Order {
202
327
  * @summary: Get Invoice of a shipment
203
328
  * @description: Use this API to retrieve shipment invoice.
204
329
  */
205
- getInvoiceByShipmentId({ shipmentId } = {}) {
330
+ async getInvoiceByShipmentId({ shipmentId } = {}) {
206
331
  const { error } = OrderValidator.getInvoiceByShipmentId().validate(
207
332
  { shipmentId },
208
333
  { abortEarly: false, allowUnknown: true }
@@ -210,11 +335,27 @@ class Order {
210
335
  if (error) {
211
336
  return Promise.reject(new FDKClientValidationError(error));
212
337
  }
338
+
339
+ // Showing warrnings if extra unknown parameters are found
340
+ const {
341
+ error: warrning,
342
+ } = OrderValidator.getInvoiceByShipmentId().validate(
343
+ { shipmentId },
344
+ { abortEarly: false, allowUnknown: false }
345
+ );
346
+ if (warrning) {
347
+ Logger({
348
+ level: "WARN",
349
+ message: "Parameter Validation warrnings for getInvoiceByShipmentId",
350
+ });
351
+ Logger({ level: "WARN", message: warrning });
352
+ }
353
+
213
354
  const query_params = {};
214
355
 
215
356
  const xHeaders = {};
216
357
 
217
- return APIClient.execute(
358
+ const response = await APIClient.execute(
218
359
  this._conf,
219
360
  "get",
220
361
  constructUrl({
@@ -225,6 +366,23 @@ class Order {
225
366
  undefined,
226
367
  xHeaders
227
368
  );
369
+
370
+ const {
371
+ error: res_error,
372
+ } = OrderModel.ResponseGetInvoiceShipment().validate(response, {
373
+ abortEarly: false,
374
+ allowUnknown: false,
375
+ });
376
+
377
+ if (res_error) {
378
+ Logger({
379
+ level: "WARN",
380
+ message: "Response Validation Warnnings for getInvoiceByShipmentId",
381
+ });
382
+ Logger({ level: "WARN", message: res_error });
383
+ }
384
+
385
+ return response;
228
386
  }
229
387
 
230
388
  /**
@@ -236,7 +394,7 @@ class Order {
236
394
  * @summary: Track shipment
237
395
  * @description: Track Shipment by shipment id, for application based on application Id
238
396
  */
239
- trackShipment({ shipmentId } = {}) {
397
+ async trackShipment({ shipmentId } = {}) {
240
398
  const { error } = OrderValidator.trackShipment().validate(
241
399
  { shipmentId },
242
400
  { abortEarly: false, allowUnknown: true }
@@ -244,11 +402,25 @@ class Order {
244
402
  if (error) {
245
403
  return Promise.reject(new FDKClientValidationError(error));
246
404
  }
405
+
406
+ // Showing warrnings if extra unknown parameters are found
407
+ const { error: warrning } = OrderValidator.trackShipment().validate(
408
+ { shipmentId },
409
+ { abortEarly: false, allowUnknown: false }
410
+ );
411
+ if (warrning) {
412
+ Logger({
413
+ level: "WARN",
414
+ message: "Parameter Validation warrnings for trackShipment",
415
+ });
416
+ Logger({ level: "WARN", message: warrning });
417
+ }
418
+
247
419
  const query_params = {};
248
420
 
249
421
  const xHeaders = {};
250
422
 
251
- return APIClient.execute(
423
+ const response = await APIClient.execute(
252
424
  this._conf,
253
425
  "get",
254
426
  constructUrl({
@@ -259,6 +431,21 @@ class Order {
259
431
  undefined,
260
432
  xHeaders
261
433
  );
434
+
435
+ const { error: res_error } = OrderModel.ShipmentTrack().validate(response, {
436
+ abortEarly: false,
437
+ allowUnknown: false,
438
+ });
439
+
440
+ if (res_error) {
441
+ Logger({
442
+ level: "WARN",
443
+ message: "Response Validation Warnnings for trackShipment",
444
+ });
445
+ Logger({ level: "WARN", message: res_error });
446
+ }
447
+
448
+ return response;
262
449
  }
263
450
 
264
451
  /**
@@ -272,7 +459,7 @@ class Order {
272
459
  * @summary: Get Customer Details by Shipment Id
273
460
  * @description: Use this API to retrieve customer details such as mobileno using Shipment ID.
274
461
  */
275
- getCustomerDetailsByShipmentId({ orderId, shipmentId } = {}) {
462
+ async getCustomerDetailsByShipmentId({ orderId, shipmentId } = {}) {
276
463
  const { error } = OrderValidator.getCustomerDetailsByShipmentId().validate(
277
464
  { orderId, shipmentId },
278
465
  { abortEarly: false, allowUnknown: true }
@@ -280,11 +467,28 @@ class Order {
280
467
  if (error) {
281
468
  return Promise.reject(new FDKClientValidationError(error));
282
469
  }
470
+
471
+ // Showing warrnings if extra unknown parameters are found
472
+ const {
473
+ error: warrning,
474
+ } = OrderValidator.getCustomerDetailsByShipmentId().validate(
475
+ { orderId, shipmentId },
476
+ { abortEarly: false, allowUnknown: false }
477
+ );
478
+ if (warrning) {
479
+ Logger({
480
+ level: "WARN",
481
+ message:
482
+ "Parameter Validation warrnings for getCustomerDetailsByShipmentId",
483
+ });
484
+ Logger({ level: "WARN", message: warrning });
485
+ }
486
+
283
487
  const query_params = {};
284
488
 
285
489
  const xHeaders = {};
286
490
 
287
- return APIClient.execute(
491
+ const response = await APIClient.execute(
288
492
  this._conf,
289
493
  "get",
290
494
  constructUrl({
@@ -295,6 +499,24 @@ class Order {
295
499
  undefined,
296
500
  xHeaders
297
501
  );
502
+
503
+ const {
504
+ error: res_error,
505
+ } = OrderModel.CustomerDetailsResponse().validate(response, {
506
+ abortEarly: false,
507
+ allowUnknown: false,
508
+ });
509
+
510
+ if (res_error) {
511
+ Logger({
512
+ level: "WARN",
513
+ message:
514
+ "Response Validation Warnnings for getCustomerDetailsByShipmentId",
515
+ });
516
+ Logger({ level: "WARN", message: res_error });
517
+ }
518
+
519
+ return response;
298
520
  }
299
521
 
300
522
  /**
@@ -308,7 +530,7 @@ class Order {
308
530
  * @summary: Send and Resend Otp code to Order-Shipment customer
309
531
  * @description: Use this API to send OTP to the customer of the mapped Shipment.
310
532
  */
311
- sendOtpToShipmentCustomer({ orderId, shipmentId } = {}) {
533
+ async sendOtpToShipmentCustomer({ orderId, shipmentId } = {}) {
312
534
  const { error } = OrderValidator.sendOtpToShipmentCustomer().validate(
313
535
  { orderId, shipmentId },
314
536
  { abortEarly: false, allowUnknown: true }
@@ -316,11 +538,27 @@ class Order {
316
538
  if (error) {
317
539
  return Promise.reject(new FDKClientValidationError(error));
318
540
  }
541
+
542
+ // Showing warrnings if extra unknown parameters are found
543
+ const {
544
+ error: warrning,
545
+ } = OrderValidator.sendOtpToShipmentCustomer().validate(
546
+ { orderId, shipmentId },
547
+ { abortEarly: false, allowUnknown: false }
548
+ );
549
+ if (warrning) {
550
+ Logger({
551
+ level: "WARN",
552
+ message: "Parameter Validation warrnings for sendOtpToShipmentCustomer",
553
+ });
554
+ Logger({ level: "WARN", message: warrning });
555
+ }
556
+
319
557
  const query_params = {};
320
558
 
321
559
  const xHeaders = {};
322
560
 
323
- return APIClient.execute(
561
+ const response = await APIClient.execute(
324
562
  this._conf,
325
563
  "post",
326
564
  constructUrl({
@@ -331,6 +569,23 @@ class Order {
331
569
  undefined,
332
570
  xHeaders
333
571
  );
572
+
573
+ const {
574
+ error: res_error,
575
+ } = OrderModel.SendOtpToCustomerResponse().validate(response, {
576
+ abortEarly: false,
577
+ allowUnknown: false,
578
+ });
579
+
580
+ if (res_error) {
581
+ Logger({
582
+ level: "WARN",
583
+ message: "Response Validation Warnnings for sendOtpToShipmentCustomer",
584
+ });
585
+ Logger({ level: "WARN", message: res_error });
586
+ }
587
+
588
+ return response;
334
589
  }
335
590
 
336
591
  /**
@@ -345,7 +600,7 @@ class Order {
345
600
  * @summary: Verify Otp code
346
601
  * @description: Use this API to verify OTP and create a session token with custom payload.
347
602
  */
348
- verifyOtpShipmentCustomer({ orderId, shipmentId, body } = {}) {
603
+ async verifyOtpShipmentCustomer({ orderId, shipmentId, body } = {}) {
349
604
  const { error } = OrderValidator.verifyOtpShipmentCustomer().validate(
350
605
  { orderId, shipmentId, body },
351
606
  { abortEarly: false, allowUnknown: true }
@@ -353,11 +608,27 @@ class Order {
353
608
  if (error) {
354
609
  return Promise.reject(new FDKClientValidationError(error));
355
610
  }
611
+
612
+ // Showing warrnings if extra unknown parameters are found
613
+ const {
614
+ error: warrning,
615
+ } = OrderValidator.verifyOtpShipmentCustomer().validate(
616
+ { orderId, shipmentId, body },
617
+ { abortEarly: false, allowUnknown: false }
618
+ );
619
+ if (warrning) {
620
+ Logger({
621
+ level: "WARN",
622
+ message: "Parameter Validation warrnings for verifyOtpShipmentCustomer",
623
+ });
624
+ Logger({ level: "WARN", message: warrning });
625
+ }
626
+
356
627
  const query_params = {};
357
628
 
358
629
  const xHeaders = {};
359
630
 
360
- return APIClient.execute(
631
+ const response = await APIClient.execute(
361
632
  this._conf,
362
633
  "post",
363
634
  constructUrl({
@@ -368,6 +639,23 @@ class Order {
368
639
  body,
369
640
  xHeaders
370
641
  );
642
+
643
+ const {
644
+ error: res_error,
645
+ } = OrderModel.VerifyOtpResponse().validate(response, {
646
+ abortEarly: false,
647
+ allowUnknown: false,
648
+ });
649
+
650
+ if (res_error) {
651
+ Logger({
652
+ level: "WARN",
653
+ message: "Response Validation Warnnings for verifyOtpShipmentCustomer",
654
+ });
655
+ Logger({ level: "WARN", message: res_error });
656
+ }
657
+
658
+ return response;
371
659
  }
372
660
 
373
661
  /**
@@ -381,7 +669,7 @@ class Order {
381
669
  * @summary: Get reasons behind full or partial cancellation of a shipment
382
670
  * @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
383
671
  */
384
- getShipmentBagReasons({ shipmentId, bagId } = {}) {
672
+ async getShipmentBagReasons({ shipmentId, bagId } = {}) {
385
673
  const { error } = OrderValidator.getShipmentBagReasons().validate(
386
674
  { shipmentId, bagId },
387
675
  { abortEarly: false, allowUnknown: true }
@@ -389,11 +677,25 @@ class Order {
389
677
  if (error) {
390
678
  return Promise.reject(new FDKClientValidationError(error));
391
679
  }
680
+
681
+ // Showing warrnings if extra unknown parameters are found
682
+ const { error: warrning } = OrderValidator.getShipmentBagReasons().validate(
683
+ { shipmentId, bagId },
684
+ { abortEarly: false, allowUnknown: false }
685
+ );
686
+ if (warrning) {
687
+ Logger({
688
+ level: "WARN",
689
+ message: "Parameter Validation warrnings for getShipmentBagReasons",
690
+ });
691
+ Logger({ level: "WARN", message: warrning });
692
+ }
693
+
392
694
  const query_params = {};
393
695
 
394
696
  const xHeaders = {};
395
697
 
396
- return APIClient.execute(
698
+ const response = await APIClient.execute(
397
699
  this._conf,
398
700
  "get",
399
701
  constructUrl({
@@ -404,6 +706,23 @@ class Order {
404
706
  undefined,
405
707
  xHeaders
406
708
  );
709
+
710
+ const {
711
+ error: res_error,
712
+ } = OrderModel.ShipmentBagReasons().validate(response, {
713
+ abortEarly: false,
714
+ allowUnknown: false,
715
+ });
716
+
717
+ if (res_error) {
718
+ Logger({
719
+ level: "WARN",
720
+ message: "Response Validation Warnnings for getShipmentBagReasons",
721
+ });
722
+ Logger({ level: "WARN", message: res_error });
723
+ }
724
+
725
+ return response;
407
726
  }
408
727
 
409
728
  /**
@@ -415,7 +734,7 @@ class Order {
415
734
  * @summary: Get reasons behind full or partial cancellation of a shipment
416
735
  * @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
417
736
  */
418
- getShipmentReasons({ shipmentId } = {}) {
737
+ async getShipmentReasons({ shipmentId } = {}) {
419
738
  const { error } = OrderValidator.getShipmentReasons().validate(
420
739
  { shipmentId },
421
740
  { abortEarly: false, allowUnknown: true }
@@ -423,11 +742,25 @@ class Order {
423
742
  if (error) {
424
743
  return Promise.reject(new FDKClientValidationError(error));
425
744
  }
745
+
746
+ // Showing warrnings if extra unknown parameters are found
747
+ const { error: warrning } = OrderValidator.getShipmentReasons().validate(
748
+ { shipmentId },
749
+ { abortEarly: false, allowUnknown: false }
750
+ );
751
+ if (warrning) {
752
+ Logger({
753
+ level: "WARN",
754
+ message: "Parameter Validation warrnings for getShipmentReasons",
755
+ });
756
+ Logger({ level: "WARN", message: warrning });
757
+ }
758
+
426
759
  const query_params = {};
427
760
 
428
761
  const xHeaders = {};
429
762
 
430
- return APIClient.execute(
763
+ const response = await APIClient.execute(
431
764
  this._conf,
432
765
  "get",
433
766
  constructUrl({
@@ -438,6 +771,21 @@ class Order {
438
771
  undefined,
439
772
  xHeaders
440
773
  );
774
+
775
+ const { error: res_error } = OrderModel.ShipmentReasons().validate(
776
+ response,
777
+ { abortEarly: false, allowUnknown: false }
778
+ );
779
+
780
+ if (res_error) {
781
+ Logger({
782
+ level: "WARN",
783
+ message: "Response Validation Warnnings for getShipmentReasons",
784
+ });
785
+ Logger({ level: "WARN", message: res_error });
786
+ }
787
+
788
+ return response;
441
789
  }
442
790
 
443
791
  /**
@@ -450,7 +798,7 @@ class Order {
450
798
  * @summary: Update the shipment status
451
799
  * @description: Use this API to update the status of a shipment using its shipment ID.
452
800
  */
453
- updateShipmentStatus({ shipmentId, body } = {}) {
801
+ async updateShipmentStatus({ shipmentId, body } = {}) {
454
802
  const { error } = OrderValidator.updateShipmentStatus().validate(
455
803
  { shipmentId, body },
456
804
  { abortEarly: false, allowUnknown: true }
@@ -458,11 +806,25 @@ class Order {
458
806
  if (error) {
459
807
  return Promise.reject(new FDKClientValidationError(error));
460
808
  }
809
+
810
+ // Showing warrnings if extra unknown parameters are found
811
+ const { error: warrning } = OrderValidator.updateShipmentStatus().validate(
812
+ { shipmentId, body },
813
+ { abortEarly: false, allowUnknown: false }
814
+ );
815
+ if (warrning) {
816
+ Logger({
817
+ level: "WARN",
818
+ message: "Parameter Validation warrnings for updateShipmentStatus",
819
+ });
820
+ Logger({ level: "WARN", message: warrning });
821
+ }
822
+
461
823
  const query_params = {};
462
824
 
463
825
  const xHeaders = {};
464
826
 
465
- return APIClient.execute(
827
+ const response = await APIClient.execute(
466
828
  this._conf,
467
829
  "put",
468
830
  constructUrl({
@@ -473,6 +835,23 @@ class Order {
473
835
  body,
474
836
  xHeaders
475
837
  );
838
+
839
+ const {
840
+ error: res_error,
841
+ } = OrderModel.ShipmentApplicationStatusResponse().validate(response, {
842
+ abortEarly: false,
843
+ allowUnknown: false,
844
+ });
845
+
846
+ if (res_error) {
847
+ Logger({
848
+ level: "WARN",
849
+ message: "Response Validation Warnnings for updateShipmentStatus",
850
+ });
851
+ Logger({ level: "WARN", message: res_error });
852
+ }
853
+
854
+ return response;
476
855
  }
477
856
  }
478
857