@gofynd/fdk-client-javascript 1.0.1 → 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 (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
2
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
3
  const PlatformAPIClient = require("../PlatformAPIClient");
4
4
  const OrderValidator = require("./OrderPlatformValidator");
5
+ const OrderModel = require("./OrderPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+
5
8
  class Order {
6
9
  constructor(config) {
7
10
  this.config = config;
@@ -10,6 +13,8 @@ class Order {
10
13
  /**
11
14
  * @param {Object} arg - Arg object.
12
15
  * @param {string} [arg.lane] -
16
+ * @param {string} [arg.bagStatus] -
17
+ * @param {boolean} [arg.statusOverrideLane] -
13
18
  * @param {string} [arg.searchType] -
14
19
  * @param {string} [arg.searchValue] -
15
20
  * @param {string} [arg.searchId] -
@@ -23,16 +28,22 @@ class Order {
23
28
  * @param {number} [arg.pageNo] -
24
29
  * @param {number} [arg.pageSize] -
25
30
  * @param {boolean} [arg.isPrioritySort] -
31
+ * @param {boolean} [arg.fetchActiveShipment] -
26
32
  * @param {boolean} [arg.excludeLockedShipments] -
27
33
  * @param {string} [arg.paymentMethods] -
28
34
  * @param {string} [arg.channelShipmentId] -
29
35
  * @param {string} [arg.channelOrderId] -
30
36
  * @param {string} [arg.customMeta] -
37
+ * @param {string} [arg.orderingChannel] -
38
+ * @param {string} [arg.companyAffiliateTag] -
39
+ * @returns {Promise<ShipmentInternalPlatformViewResponse>} - Success response
31
40
  * @summary:
32
41
  * @description:
33
42
  */
34
- getShipments({
43
+ async getShipments({
35
44
  lane,
45
+ bagStatus,
46
+ statusOverrideLane,
36
47
  searchType,
37
48
  searchValue,
38
49
  searchId,
@@ -46,15 +57,20 @@ class Order {
46
57
  pageNo,
47
58
  pageSize,
48
59
  isPrioritySort,
60
+ fetchActiveShipment,
49
61
  excludeLockedShipments,
50
62
  paymentMethods,
51
63
  channelShipmentId,
52
64
  channelOrderId,
53
65
  customMeta,
66
+ orderingChannel,
67
+ companyAffiliateTag,
54
68
  } = {}) {
55
69
  const { error } = OrderValidator.getShipments().validate(
56
70
  {
57
71
  lane,
72
+ bagStatus,
73
+ statusOverrideLane,
58
74
  searchType,
59
75
  searchValue,
60
76
  searchId,
@@ -68,11 +84,14 @@ class Order {
68
84
  pageNo,
69
85
  pageSize,
70
86
  isPrioritySort,
87
+ fetchActiveShipment,
71
88
  excludeLockedShipments,
72
89
  paymentMethods,
73
90
  channelShipmentId,
74
91
  channelOrderId,
75
92
  customMeta,
93
+ orderingChannel,
94
+ companyAffiliateTag,
76
95
  },
77
96
  { abortEarly: false, allowUnknown: true }
78
97
  );
@@ -84,6 +103,8 @@ class Order {
84
103
  const { error: warrning } = OrderValidator.getShipments().validate(
85
104
  {
86
105
  lane,
106
+ bagStatus,
107
+ statusOverrideLane,
87
108
  searchType,
88
109
  searchValue,
89
110
  searchId,
@@ -97,21 +118,29 @@ class Order {
97
118
  pageNo,
98
119
  pageSize,
99
120
  isPrioritySort,
121
+ fetchActiveShipment,
100
122
  excludeLockedShipments,
101
123
  paymentMethods,
102
124
  channelShipmentId,
103
125
  channelOrderId,
104
126
  customMeta,
127
+ orderingChannel,
128
+ companyAffiliateTag,
105
129
  },
106
130
  { abortEarly: false, allowUnknown: false }
107
131
  );
108
132
  if (warrning) {
109
- console.log("Parameter Validation warrnings for getShipments");
110
- console.log(warrning);
133
+ Logger({
134
+ level: "WARN",
135
+ message: "Parameter Validation warrnings for getShipments",
136
+ });
137
+ Logger({ level: "WARN", message: warrning });
111
138
  }
112
139
 
113
140
  const query_params = {};
114
141
  query_params["lane"] = lane;
142
+ query_params["bag_status"] = bagStatus;
143
+ query_params["status_override_lane"] = statusOverrideLane;
115
144
  query_params["search_type"] = searchType;
116
145
  query_params["search_value"] = searchValue;
117
146
  query_params["search_id"] = searchId;
@@ -125,15 +154,18 @@ class Order {
125
154
  query_params["page_no"] = pageNo;
126
155
  query_params["page_size"] = pageSize;
127
156
  query_params["is_priority_sort"] = isPrioritySort;
157
+ query_params["fetch_active_shipment"] = fetchActiveShipment;
128
158
  query_params["exclude_locked_shipments"] = excludeLockedShipments;
129
159
  query_params["payment_methods"] = paymentMethods;
130
160
  query_params["channel_shipment_id"] = channelShipmentId;
131
161
  query_params["channel_order_id"] = channelOrderId;
132
162
  query_params["custom_meta"] = customMeta;
163
+ query_params["ordering_channel"] = orderingChannel;
164
+ query_params["company_affiliate_tag"] = companyAffiliateTag;
133
165
 
134
166
  const xHeaders = {};
135
167
 
136
- return PlatformAPIClient.execute(
168
+ const response = await PlatformAPIClient.execute(
137
169
  this.config,
138
170
  "get",
139
171
  `/service/platform/orders/v1.0/company/${this.config.companyId}/shipments-listing`,
@@ -141,6 +173,23 @@ class Order {
141
173
  undefined,
142
174
  xHeaders
143
175
  );
176
+
177
+ const {
178
+ error: res_error,
179
+ } = OrderModel.ShipmentInternalPlatformViewResponse().validate(response, {
180
+ abortEarly: false,
181
+ allowUnknown: false,
182
+ });
183
+
184
+ if (res_error) {
185
+ Logger({
186
+ level: "WARN",
187
+ message: "Response Validation Warnnings for getShipments",
188
+ });
189
+ Logger({ level: "WARN", message: res_error });
190
+ }
191
+
192
+ return response;
144
193
  }
145
194
 
146
195
  /**
@@ -149,10 +198,11 @@ class Order {
149
198
  * @param {string} [arg.shipmentId] -
150
199
  * @param {string} [arg.orderingCompanyId] -
151
200
  * @param {string} [arg.requestByExt] -
201
+ * @returns {Promise<ShipmentInfoResponse>} - Success response
152
202
  * @summary:
153
203
  * @description:
154
204
  */
155
- getShipmentById({
205
+ async getShipmentById({
156
206
  channelShipmentId,
157
207
  shipmentId,
158
208
  orderingCompanyId,
@@ -182,8 +232,11 @@ class Order {
182
232
  { abortEarly: false, allowUnknown: false }
183
233
  );
184
234
  if (warrning) {
185
- console.log("Parameter Validation warrnings for getShipmentById");
186
- console.log(warrning);
235
+ Logger({
236
+ level: "WARN",
237
+ message: "Parameter Validation warrnings for getShipmentById",
238
+ });
239
+ Logger({ level: "WARN", message: warrning });
187
240
  }
188
241
 
189
242
  const query_params = {};
@@ -194,7 +247,7 @@ class Order {
194
247
 
195
248
  const xHeaders = {};
196
249
 
197
- return PlatformAPIClient.execute(
250
+ const response = await PlatformAPIClient.execute(
198
251
  this.config,
199
252
  "get",
200
253
  `/service/platform/orders/v1.0/company/${this.config.companyId}/shipment-details`,
@@ -202,15 +255,33 @@ class Order {
202
255
  undefined,
203
256
  xHeaders
204
257
  );
258
+
259
+ const {
260
+ error: res_error,
261
+ } = OrderModel.ShipmentInfoResponse().validate(response, {
262
+ abortEarly: false,
263
+ allowUnknown: false,
264
+ });
265
+
266
+ if (res_error) {
267
+ Logger({
268
+ level: "WARN",
269
+ message: "Response Validation Warnnings for getShipmentById",
270
+ });
271
+ Logger({ level: "WARN", message: res_error });
272
+ }
273
+
274
+ return response;
205
275
  }
206
276
 
207
277
  /**
208
278
  * @param {Object} arg - Arg object.
209
279
  * @param {string} arg.orderId -
280
+ * @returns {Promise<ShipmentDetailsResponse>} - Success response
210
281
  * @summary:
211
282
  * @description:
212
283
  */
213
- getOrderById({ orderId } = {}) {
284
+ async getOrderById({ orderId } = {}) {
214
285
  const { error } = OrderValidator.getOrderById().validate(
215
286
  {
216
287
  orderId,
@@ -229,8 +300,11 @@ class Order {
229
300
  { abortEarly: false, allowUnknown: false }
230
301
  );
231
302
  if (warrning) {
232
- console.log("Parameter Validation warrnings for getOrderById");
233
- console.log(warrning);
303
+ Logger({
304
+ level: "WARN",
305
+ message: "Parameter Validation warrnings for getOrderById",
306
+ });
307
+ Logger({ level: "WARN", message: warrning });
234
308
  }
235
309
 
236
310
  const query_params = {};
@@ -238,7 +312,7 @@ class Order {
238
312
 
239
313
  const xHeaders = {};
240
314
 
241
- return PlatformAPIClient.execute(
315
+ const response = await PlatformAPIClient.execute(
242
316
  this.config,
243
317
  "get",
244
318
  `/service/platform/orders/v1.0/company/${this.config.companyId}/order-details`,
@@ -246,6 +320,23 @@ class Order {
246
320
  undefined,
247
321
  xHeaders
248
322
  );
323
+
324
+ const {
325
+ error: res_error,
326
+ } = OrderModel.ShipmentDetailsResponse().validate(response, {
327
+ abortEarly: false,
328
+ allowUnknown: false,
329
+ });
330
+
331
+ if (res_error) {
332
+ Logger({
333
+ level: "WARN",
334
+ message: "Response Validation Warnnings for getOrderById",
335
+ });
336
+ Logger({ level: "WARN", message: res_error });
337
+ }
338
+
339
+ return response;
249
340
  }
250
341
 
251
342
  /**
@@ -259,10 +350,11 @@ class Order {
259
350
  * @param {string} [arg.salesChannel] -
260
351
  * @param {string} [arg.paymentMode] -
261
352
  * @param {string} [arg.bagStatus] -
353
+ * @returns {Promise<LaneConfigResponse>} - Success response
262
354
  * @summary:
263
355
  * @description:
264
356
  */
265
- getLaneConfig({
357
+ async getLaneConfig({
266
358
  superLane,
267
359
  groupEntity,
268
360
  fromDate,
@@ -307,8 +399,11 @@ class Order {
307
399
  { abortEarly: false, allowUnknown: false }
308
400
  );
309
401
  if (warrning) {
310
- console.log("Parameter Validation warrnings for getLaneConfig");
311
- console.log(warrning);
402
+ Logger({
403
+ level: "WARN",
404
+ message: "Parameter Validation warrnings for getLaneConfig",
405
+ });
406
+ Logger({ level: "WARN", message: warrning });
312
407
  }
313
408
 
314
409
  const query_params = {};
@@ -324,7 +419,7 @@ class Order {
324
419
 
325
420
  const xHeaders = {};
326
421
 
327
- return PlatformAPIClient.execute(
422
+ const response = await PlatformAPIClient.execute(
328
423
  this.config,
329
424
  "get",
330
425
  `/service/platform/orders/v1.0/company/${this.config.companyId}/lane-config/`,
@@ -332,6 +427,23 @@ class Order {
332
427
  undefined,
333
428
  xHeaders
334
429
  );
430
+
431
+ const {
432
+ error: res_error,
433
+ } = OrderModel.LaneConfigResponse().validate(response, {
434
+ abortEarly: false,
435
+ allowUnknown: false,
436
+ });
437
+
438
+ if (res_error) {
439
+ Logger({
440
+ level: "WARN",
441
+ message: "Response Validation Warnnings for getLaneConfig",
442
+ });
443
+ Logger({ level: "WARN", message: res_error });
444
+ }
445
+
446
+ return response;
335
447
  }
336
448
 
337
449
  /**
@@ -352,10 +464,11 @@ class Order {
352
464
  * @param {number} [arg.pageSize] -
353
465
  * @param {boolean} [arg.isPrioritySort] -
354
466
  * @param {string} [arg.customMeta] -
467
+ * @returns {Promise<OrderListingResponse>} - Success response
355
468
  * @summary:
356
469
  * @description:
357
470
  */
358
- getOrders({
471
+ async getOrders({
359
472
  lane,
360
473
  searchType,
361
474
  bagStatus,
@@ -421,8 +534,11 @@ class Order {
421
534
  { abortEarly: false, allowUnknown: false }
422
535
  );
423
536
  if (warrning) {
424
- console.log("Parameter Validation warrnings for getOrders");
425
- console.log(warrning);
537
+ Logger({
538
+ level: "WARN",
539
+ message: "Parameter Validation warrnings for getOrders",
540
+ });
541
+ Logger({ level: "WARN", message: warrning });
426
542
  }
427
543
 
428
544
  const query_params = {};
@@ -445,7 +561,7 @@ class Order {
445
561
 
446
562
  const xHeaders = {};
447
563
 
448
- return PlatformAPIClient.execute(
564
+ const response = await PlatformAPIClient.execute(
449
565
  this.config,
450
566
  "get",
451
567
  `/service/platform/orders/v1.0/company/${this.config.companyId}/orders-listing`,
@@ -453,16 +569,34 @@ class Order {
453
569
  undefined,
454
570
  xHeaders
455
571
  );
572
+
573
+ const {
574
+ error: res_error,
575
+ } = OrderModel.OrderListingResponse().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 getOrders",
584
+ });
585
+ Logger({ level: "WARN", message: res_error });
586
+ }
587
+
588
+ return response;
456
589
  }
457
590
 
458
591
  /**
459
592
  * @param {Object} arg - Arg object.
460
593
  * @param {string} [arg.fromDate] -
461
594
  * @param {string} [arg.toDate] -
595
+ * @returns {Promise<MetricCountResponse>} - Success response
462
596
  * @summary:
463
597
  * @description:
464
598
  */
465
- getMetricCount({ fromDate, toDate } = {}) {
599
+ async getMetricCount({ fromDate, toDate } = {}) {
466
600
  const { error } = OrderValidator.getMetricCount().validate(
467
601
  {
468
602
  fromDate,
@@ -483,8 +617,11 @@ class Order {
483
617
  { abortEarly: false, allowUnknown: false }
484
618
  );
485
619
  if (warrning) {
486
- console.log("Parameter Validation warrnings for getMetricCount");
487
- console.log(warrning);
620
+ Logger({
621
+ level: "WARN",
622
+ message: "Parameter Validation warrnings for getMetricCount",
623
+ });
624
+ Logger({ level: "WARN", message: warrning });
488
625
  }
489
626
 
490
627
  const query_params = {};
@@ -493,7 +630,7 @@ class Order {
493
630
 
494
631
  const xHeaders = {};
495
632
 
496
- return PlatformAPIClient.execute(
633
+ const response = await PlatformAPIClient.execute(
497
634
  this.config,
498
635
  "get",
499
636
  `/service/platform/orders/v1.0/company/${this.config.companyId}/shipment/metrics-count/`,
@@ -501,16 +638,34 @@ class Order {
501
638
  undefined,
502
639
  xHeaders
503
640
  );
641
+
642
+ const {
643
+ error: res_error,
644
+ } = OrderModel.MetricCountResponse().validate(response, {
645
+ abortEarly: false,
646
+ allowUnknown: false,
647
+ });
648
+
649
+ if (res_error) {
650
+ Logger({
651
+ level: "WARN",
652
+ message: "Response Validation Warnnings for getMetricCount",
653
+ });
654
+ Logger({ level: "WARN", message: res_error });
655
+ }
656
+
657
+ return response;
504
658
  }
505
659
 
506
660
  /**
507
661
  * @param {Object} arg - Arg object.
508
662
  * @param {string} arg.view -
509
663
  * @param {string} [arg.groupEntity] -
664
+ * @returns {Promise<FiltersResponse>} - Success response
510
665
  * @summary:
511
666
  * @description:
512
667
  */
513
- getfilters({ view, groupEntity } = {}) {
668
+ async getfilters({ view, groupEntity } = {}) {
514
669
  const { error } = OrderValidator.getfilters().validate(
515
670
  {
516
671
  view,
@@ -531,8 +686,11 @@ class Order {
531
686
  { abortEarly: false, allowUnknown: false }
532
687
  );
533
688
  if (warrning) {
534
- console.log("Parameter Validation warrnings for getfilters");
535
- console.log(warrning);
689
+ Logger({
690
+ level: "WARN",
691
+ message: "Parameter Validation warrnings for getfilters",
692
+ });
693
+ Logger({ level: "WARN", message: warrning });
536
694
  }
537
695
 
538
696
  const query_params = {};
@@ -541,7 +699,7 @@ class Order {
541
699
 
542
700
  const xHeaders = {};
543
701
 
544
- return PlatformAPIClient.execute(
702
+ const response = await PlatformAPIClient.execute(
545
703
  this.config,
546
704
  "get",
547
705
  `/service/platform/orders/v1.0/company/${this.config.companyId}/filter-listing`,
@@ -549,16 +707,32 @@ class Order {
549
707
  undefined,
550
708
  xHeaders
551
709
  );
710
+
711
+ const { error: res_error } = OrderModel.FiltersResponse().validate(
712
+ response,
713
+ { abortEarly: false, allowUnknown: false }
714
+ );
715
+
716
+ if (res_error) {
717
+ Logger({
718
+ level: "WARN",
719
+ message: "Response Validation Warnnings for getfilters",
720
+ });
721
+ Logger({ level: "WARN", message: res_error });
722
+ }
723
+
724
+ return response;
552
725
  }
553
726
 
554
727
  /**
555
728
  * @param {Object} arg - Arg object.
556
729
  * @param {string} [arg.fromDate] -
557
730
  * @param {string} [arg.toDate] -
731
+ * @returns {Promise<Success>} - Success response
558
732
  * @summary:
559
733
  * @description:
560
734
  */
561
- createShipmentReport({ fromDate, toDate } = {}) {
735
+ async createShipmentReport({ fromDate, toDate } = {}) {
562
736
  const { error } = OrderValidator.createShipmentReport().validate(
563
737
  {
564
738
  fromDate,
@@ -579,8 +753,11 @@ class Order {
579
753
  { abortEarly: false, allowUnknown: false }
580
754
  );
581
755
  if (warrning) {
582
- console.log("Parameter Validation warrnings for createShipmentReport");
583
- console.log(warrning);
756
+ Logger({
757
+ level: "WARN",
758
+ message: "Parameter Validation warrnings for createShipmentReport",
759
+ });
760
+ Logger({ level: "WARN", message: warrning });
584
761
  }
585
762
 
586
763
  const query_params = {};
@@ -589,7 +766,7 @@ class Order {
589
766
 
590
767
  const xHeaders = {};
591
768
 
592
- return PlatformAPIClient.execute(
769
+ const response = await PlatformAPIClient.execute(
593
770
  this.config,
594
771
  "post",
595
772
  `/service/platform/orders/v1.0/company/${this.config.companyId}/reports/shipment`,
@@ -597,16 +774,32 @@ class Order {
597
774
  undefined,
598
775
  xHeaders
599
776
  );
777
+
778
+ const { error: res_error } = OrderModel.Success().validate(response, {
779
+ abortEarly: false,
780
+ allowUnknown: false,
781
+ });
782
+
783
+ if (res_error) {
784
+ Logger({
785
+ level: "WARN",
786
+ message: "Response Validation Warnnings for createShipmentReport",
787
+ });
788
+ Logger({ level: "WARN", message: res_error });
789
+ }
790
+
791
+ return response;
600
792
  }
601
793
 
602
794
  /**
603
795
  * @param {Object} arg - Arg object.
604
796
  * @param {number} [arg.pageNo] -
605
797
  * @param {number} [arg.pageSize] -
798
+ * @returns {Promise<OmsReports>} - Success response
606
799
  * @summary:
607
800
  * @description:
608
801
  */
609
- getReportsShipmentListing({ pageNo, pageSize } = {}) {
802
+ async getReportsShipmentListing({ pageNo, pageSize } = {}) {
610
803
  const { error } = OrderValidator.getReportsShipmentListing().validate(
611
804
  {
612
805
  pageNo,
@@ -629,10 +822,11 @@ class Order {
629
822
  { abortEarly: false, allowUnknown: false }
630
823
  );
631
824
  if (warrning) {
632
- console.log(
633
- "Parameter Validation warrnings for getReportsShipmentListing"
634
- );
635
- console.log(warrning);
825
+ Logger({
826
+ level: "WARN",
827
+ message: "Parameter Validation warrnings for getReportsShipmentListing",
828
+ });
829
+ Logger({ level: "WARN", message: warrning });
636
830
  }
637
831
 
638
832
  const query_params = {};
@@ -641,7 +835,7 @@ class Order {
641
835
 
642
836
  const xHeaders = {};
643
837
 
644
- return PlatformAPIClient.execute(
838
+ const response = await PlatformAPIClient.execute(
645
839
  this.config,
646
840
  "get",
647
841
  `/service/platform/orders/v1.0/company/${this.config.companyId}/reports/shipment-listing`,
@@ -649,15 +843,31 @@ class Order {
649
843
  undefined,
650
844
  xHeaders
651
845
  );
846
+
847
+ const { error: res_error } = OrderModel.OmsReports().validate(response, {
848
+ abortEarly: false,
849
+ allowUnknown: false,
850
+ });
851
+
852
+ if (res_error) {
853
+ Logger({
854
+ level: "WARN",
855
+ message: "Response Validation Warnnings for getReportsShipmentListing",
856
+ });
857
+ Logger({ level: "WARN", message: res_error });
858
+ }
859
+
860
+ return response;
652
861
  }
653
862
 
654
863
  /**
655
864
  * @param {Object} arg - Arg object.
656
865
  * @param {JioCodeUpsertPayload} arg.body
866
+ * @returns {Promise<JioCodeUpsertResponse>} - Success response
657
867
  * @summary:
658
868
  * @description:
659
869
  */
660
- upsertJioCode({ body } = {}) {
870
+ async upsertJioCode({ body } = {}) {
661
871
  const { error } = OrderValidator.upsertJioCode().validate(
662
872
  {
663
873
  body,
@@ -676,15 +886,18 @@ class Order {
676
886
  { abortEarly: false, allowUnknown: false }
677
887
  );
678
888
  if (warrning) {
679
- console.log("Parameter Validation warrnings for upsertJioCode");
680
- console.log(warrning);
889
+ Logger({
890
+ level: "WARN",
891
+ message: "Parameter Validation warrnings for upsertJioCode",
892
+ });
893
+ Logger({ level: "WARN", message: warrning });
681
894
  }
682
895
 
683
896
  const query_params = {};
684
897
 
685
898
  const xHeaders = {};
686
899
 
687
- return PlatformAPIClient.execute(
900
+ const response = await PlatformAPIClient.execute(
688
901
  this.config,
689
902
  "post",
690
903
  `/service/platform/orders/v1.0/company/${this.config.companyId}/upsert/jiocode/article`,
@@ -692,16 +905,34 @@ class Order {
692
905
  body,
693
906
  xHeaders
694
907
  );
908
+
909
+ const {
910
+ error: res_error,
911
+ } = OrderModel.JioCodeUpsertResponse().validate(response, {
912
+ abortEarly: false,
913
+ allowUnknown: false,
914
+ });
915
+
916
+ if (res_error) {
917
+ Logger({
918
+ level: "WARN",
919
+ message: "Response Validation Warnnings for upsertJioCode",
920
+ });
921
+ Logger({ level: "WARN", message: res_error });
922
+ }
923
+
924
+ return response;
695
925
  }
696
926
 
697
927
  /**
698
928
  * @param {Object} arg - Arg object.
699
929
  * @param {string} arg.batchId -
700
930
  * @param {string} arg.docType -
931
+ * @returns {Promise<BulkInvoicingResponse>} - Success response
701
932
  * @summary:
702
933
  * @description:
703
934
  */
704
- getBulkInvoice({ batchId, docType } = {}) {
935
+ async getBulkInvoice({ batchId, docType } = {}) {
705
936
  const { error } = OrderValidator.getBulkInvoice().validate(
706
937
  {
707
938
  batchId,
@@ -722,8 +953,11 @@ class Order {
722
953
  { abortEarly: false, allowUnknown: false }
723
954
  );
724
955
  if (warrning) {
725
- console.log("Parameter Validation warrnings for getBulkInvoice");
726
- console.log(warrning);
956
+ Logger({
957
+ level: "WARN",
958
+ message: "Parameter Validation warrnings for getBulkInvoice",
959
+ });
960
+ Logger({ level: "WARN", message: warrning });
727
961
  }
728
962
 
729
963
  const query_params = {};
@@ -732,7 +966,7 @@ class Order {
732
966
 
733
967
  const xHeaders = {};
734
968
 
735
- return PlatformAPIClient.execute(
969
+ const response = await PlatformAPIClient.execute(
736
970
  this.config,
737
971
  "get",
738
972
  `/service/platform/orders/v1.0/company/${this.config.companyId}/bulk-action/invoice`,
@@ -740,15 +974,33 @@ class Order {
740
974
  undefined,
741
975
  xHeaders
742
976
  );
977
+
978
+ const {
979
+ error: res_error,
980
+ } = OrderModel.BulkInvoicingResponse().validate(response, {
981
+ abortEarly: false,
982
+ allowUnknown: false,
983
+ });
984
+
985
+ if (res_error) {
986
+ Logger({
987
+ level: "WARN",
988
+ message: "Response Validation Warnnings for getBulkInvoice",
989
+ });
990
+ Logger({ level: "WARN", message: res_error });
991
+ }
992
+
993
+ return response;
743
994
  }
744
995
 
745
996
  /**
746
997
  * @param {Object} arg - Arg object.
747
998
  * @param {string} arg.batchId -
999
+ * @returns {Promise<BulkInvoiceLabelResponse>} - Success response
748
1000
  * @summary:
749
1001
  * @description:
750
1002
  */
751
- getBulkInvoiceLabel({ batchId } = {}) {
1003
+ async getBulkInvoiceLabel({ batchId } = {}) {
752
1004
  const { error } = OrderValidator.getBulkInvoiceLabel().validate(
753
1005
  {
754
1006
  batchId,
@@ -767,8 +1019,11 @@ class Order {
767
1019
  { abortEarly: false, allowUnknown: false }
768
1020
  );
769
1021
  if (warrning) {
770
- console.log("Parameter Validation warrnings for getBulkInvoiceLabel");
771
- console.log(warrning);
1022
+ Logger({
1023
+ level: "WARN",
1024
+ message: "Parameter Validation warrnings for getBulkInvoiceLabel",
1025
+ });
1026
+ Logger({ level: "WARN", message: warrning });
772
1027
  }
773
1028
 
774
1029
  const query_params = {};
@@ -776,7 +1031,7 @@ class Order {
776
1031
 
777
1032
  const xHeaders = {};
778
1033
 
779
- return PlatformAPIClient.execute(
1034
+ const response = await PlatformAPIClient.execute(
780
1035
  this.config,
781
1036
  "get",
782
1037
  `/service/platform/orders/v1.0/company/${this.config.companyId}/invoice-label-external`,
@@ -784,6 +1039,23 @@ class Order {
784
1039
  undefined,
785
1040
  xHeaders
786
1041
  );
1042
+
1043
+ const {
1044
+ error: res_error,
1045
+ } = OrderModel.BulkInvoiceLabelResponse().validate(response, {
1046
+ abortEarly: false,
1047
+ allowUnknown: false,
1048
+ });
1049
+
1050
+ if (res_error) {
1051
+ Logger({
1052
+ level: "WARN",
1053
+ message: "Response Validation Warnnings for getBulkInvoiceLabel",
1054
+ });
1055
+ Logger({ level: "WARN", message: res_error });
1056
+ }
1057
+
1058
+ return response;
787
1059
  }
788
1060
 
789
1061
  /**
@@ -802,10 +1074,11 @@ class Order {
802
1074
  * @param {number} [arg.pageSize] -
803
1075
  * @param {string} [arg.customerId] -
804
1076
  * @param {boolean} [arg.isPrioritySort] -
1077
+ * @returns {Promise<FileResponse>} - Success response
805
1078
  * @summary:
806
1079
  * @description:
807
1080
  */
808
- getBulkShipmentExcelFile({
1081
+ async getBulkShipmentExcelFile({
809
1082
  lane,
810
1083
  searchType,
811
1084
  searchId,
@@ -867,10 +1140,11 @@ class Order {
867
1140
  { abortEarly: false, allowUnknown: false }
868
1141
  );
869
1142
  if (warrning) {
870
- console.log(
871
- "Parameter Validation warrnings for getBulkShipmentExcelFile"
872
- );
873
- console.log(warrning);
1143
+ Logger({
1144
+ level: "WARN",
1145
+ message: "Parameter Validation warrnings for getBulkShipmentExcelFile",
1146
+ });
1147
+ Logger({ level: "WARN", message: warrning });
874
1148
  }
875
1149
 
876
1150
  const query_params = {};
@@ -891,7 +1165,7 @@ class Order {
891
1165
 
892
1166
  const xHeaders = {};
893
1167
 
894
- return PlatformAPIClient.execute(
1168
+ const response = await PlatformAPIClient.execute(
895
1169
  this.config,
896
1170
  "get",
897
1171
  `/service/platform/orders/v1.0/company/${this.config.companyId}/generate/file`,
@@ -899,6 +1173,21 @@ class Order {
899
1173
  undefined,
900
1174
  xHeaders
901
1175
  );
1176
+
1177
+ const { error: res_error } = OrderModel.FileResponse().validate(response, {
1178
+ abortEarly: false,
1179
+ allowUnknown: false,
1180
+ });
1181
+
1182
+ if (res_error) {
1183
+ Logger({
1184
+ level: "WARN",
1185
+ message: "Response Validation Warnnings for getBulkShipmentExcelFile",
1186
+ });
1187
+ Logger({ level: "WARN", message: res_error });
1188
+ }
1189
+
1190
+ return response;
902
1191
  }
903
1192
 
904
1193
  /**
@@ -917,10 +1206,11 @@ class Order {
917
1206
  * @param {number} [arg.pageSize] -
918
1207
  * @param {string} [arg.customerId] -
919
1208
  * @param {boolean} [arg.isPrioritySort] -
1209
+ * @returns {Promise<BulkListingResponse>} - Success response
920
1210
  * @summary:
921
1211
  * @description:
922
1212
  */
923
- getBulkList({
1213
+ async getBulkList({
924
1214
  lane,
925
1215
  searchType,
926
1216
  searchId,
@@ -980,8 +1270,11 @@ class Order {
980
1270
  { abortEarly: false, allowUnknown: false }
981
1271
  );
982
1272
  if (warrning) {
983
- console.log("Parameter Validation warrnings for getBulkList");
984
- console.log(warrning);
1273
+ Logger({
1274
+ level: "WARN",
1275
+ message: "Parameter Validation warrnings for getBulkList",
1276
+ });
1277
+ Logger({ level: "WARN", message: warrning });
985
1278
  }
986
1279
 
987
1280
  const query_params = {};
@@ -1002,7 +1295,7 @@ class Order {
1002
1295
 
1003
1296
  const xHeaders = {};
1004
1297
 
1005
- return PlatformAPIClient.execute(
1298
+ const response = await PlatformAPIClient.execute(
1006
1299
  this.config,
1007
1300
  "get",
1008
1301
  `/service/platform/orders/v1.0/company/${this.config.companyId}/bulk-action/listing`,
@@ -1010,16 +1303,34 @@ class Order {
1010
1303
  undefined,
1011
1304
  xHeaders
1012
1305
  );
1306
+
1307
+ const {
1308
+ error: res_error,
1309
+ } = OrderModel.BulkListingResponse().validate(response, {
1310
+ abortEarly: false,
1311
+ allowUnknown: false,
1312
+ });
1313
+
1314
+ if (res_error) {
1315
+ Logger({
1316
+ level: "WARN",
1317
+ message: "Response Validation Warnnings for getBulkList",
1318
+ });
1319
+ Logger({ level: "WARN", message: res_error });
1320
+ }
1321
+
1322
+ return response;
1013
1323
  }
1014
1324
 
1015
1325
  /**
1016
1326
  * @param {Object} arg - Arg object.
1017
1327
  * @param {string} arg.batchId -
1018
1328
  * @param {string} [arg.reportType] -
1329
+ * @returns {Promise<FileResponse>} - Success response
1019
1330
  * @summary:
1020
1331
  * @description:
1021
1332
  */
1022
- getBulkActionFailedReport({ batchId, reportType } = {}) {
1333
+ async getBulkActionFailedReport({ batchId, reportType } = {}) {
1023
1334
  const { error } = OrderValidator.getBulkActionFailedReport().validate(
1024
1335
  {
1025
1336
  batchId,
@@ -1042,10 +1353,11 @@ class Order {
1042
1353
  { abortEarly: false, allowUnknown: false }
1043
1354
  );
1044
1355
  if (warrning) {
1045
- console.log(
1046
- "Parameter Validation warrnings for getBulkActionFailedReport"
1047
- );
1048
- console.log(warrning);
1356
+ Logger({
1357
+ level: "WARN",
1358
+ message: "Parameter Validation warrnings for getBulkActionFailedReport",
1359
+ });
1360
+ Logger({ level: "WARN", message: warrning });
1049
1361
  }
1050
1362
 
1051
1363
  const query_params = {};
@@ -1054,7 +1366,7 @@ class Order {
1054
1366
 
1055
1367
  const xHeaders = {};
1056
1368
 
1057
- return PlatformAPIClient.execute(
1369
+ const response = await PlatformAPIClient.execute(
1058
1370
  this.config,
1059
1371
  "get",
1060
1372
  `/service/platform/orders/v1.0/company/${this.config.companyId}/bulk-action-failed-report/`,
@@ -1062,6 +1374,21 @@ class Order {
1062
1374
  undefined,
1063
1375
  xHeaders
1064
1376
  );
1377
+
1378
+ const { error: res_error } = OrderModel.FileResponse().validate(response, {
1379
+ abortEarly: false,
1380
+ allowUnknown: false,
1381
+ });
1382
+
1383
+ if (res_error) {
1384
+ Logger({
1385
+ level: "WARN",
1386
+ message: "Response Validation Warnnings for getBulkActionFailedReport",
1387
+ });
1388
+ Logger({ level: "WARN", message: res_error });
1389
+ }
1390
+
1391
+ return response;
1065
1392
  }
1066
1393
 
1067
1394
  /**
@@ -1072,10 +1399,11 @@ class Order {
1072
1399
  * @param {string} arg.bagId - ID of the bag. An order may contain multiple
1073
1400
  * items and may get divided into one or more shipment, each having its own ID.
1074
1401
  * @param {string} arg.state - State for which reasons are required.
1402
+ * @returns {Promise<PlatformShipmentReasonsResponse>} - Success response
1075
1403
  * @summary: Get reasons behind full or partial cancellation of a shipment
1076
1404
  * @description: Use this API to retrieve the issues that led to the cancellation of bags within a shipment.
1077
1405
  */
1078
- getShipmentReasons({ shipmentId, bagId, state } = {}) {
1406
+ async getShipmentReasons({ shipmentId, bagId, state } = {}) {
1079
1407
  const { error } = OrderValidator.getShipmentReasons().validate(
1080
1408
  {
1081
1409
  shipmentId,
@@ -1098,15 +1426,18 @@ class Order {
1098
1426
  { abortEarly: false, allowUnknown: false }
1099
1427
  );
1100
1428
  if (warrning) {
1101
- console.log("Parameter Validation warrnings for getShipmentReasons");
1102
- console.log(warrning);
1429
+ Logger({
1430
+ level: "WARN",
1431
+ message: "Parameter Validation warrnings for getShipmentReasons",
1432
+ });
1433
+ Logger({ level: "WARN", message: warrning });
1103
1434
  }
1104
1435
 
1105
1436
  const query_params = {};
1106
1437
 
1107
1438
  const xHeaders = {};
1108
1439
 
1109
- return PlatformAPIClient.execute(
1440
+ const response = await PlatformAPIClient.execute(
1110
1441
  this.config,
1111
1442
  "get",
1112
1443
  `/service/platform/orders/v1.0/company/${this.config.companyId}/shipments/${shipmentId}/bags/${bagId}/state/${state}/reasons`,
@@ -1114,15 +1445,33 @@ class Order {
1114
1445
  undefined,
1115
1446
  xHeaders
1116
1447
  );
1448
+
1449
+ const {
1450
+ error: res_error,
1451
+ } = OrderModel.PlatformShipmentReasonsResponse().validate(response, {
1452
+ abortEarly: false,
1453
+ allowUnknown: false,
1454
+ });
1455
+
1456
+ if (res_error) {
1457
+ Logger({
1458
+ level: "WARN",
1459
+ message: "Response Validation Warnnings for getShipmentReasons",
1460
+ });
1461
+ Logger({ level: "WARN", message: res_error });
1462
+ }
1463
+
1464
+ return response;
1117
1465
  }
1118
1466
 
1119
1467
  /**
1120
1468
  * @param {Object} arg - Arg object.
1121
1469
  * @param {BulkActionPayload} arg.body
1470
+ * @returns {Promise<BulkActionResponse>} - Success response
1122
1471
  * @summary: emits uuid to kafka topic.
1123
1472
  * @description: Use this API to start processing Xlsx file.
1124
1473
  */
1125
- bulkActionProcessXlsxFile({ body } = {}) {
1474
+ async bulkActionProcessXlsxFile({ body } = {}) {
1126
1475
  const { error } = OrderValidator.bulkActionProcessXlsxFile().validate(
1127
1476
  {
1128
1477
  body,
@@ -1143,17 +1492,18 @@ class Order {
1143
1492
  { abortEarly: false, allowUnknown: false }
1144
1493
  );
1145
1494
  if (warrning) {
1146
- console.log(
1147
- "Parameter Validation warrnings for bulkActionProcessXlsxFile"
1148
- );
1149
- console.log(warrning);
1495
+ Logger({
1496
+ level: "WARN",
1497
+ message: "Parameter Validation warrnings for bulkActionProcessXlsxFile",
1498
+ });
1499
+ Logger({ level: "WARN", message: warrning });
1150
1500
  }
1151
1501
 
1152
1502
  const query_params = {};
1153
1503
 
1154
1504
  const xHeaders = {};
1155
1505
 
1156
- return PlatformAPIClient.execute(
1506
+ const response = await PlatformAPIClient.execute(
1157
1507
  this.config,
1158
1508
  "post",
1159
1509
  `/service/platform/orders/v2.0/company/${this.config.companyId}/bulk-action/`,
@@ -1161,15 +1511,33 @@ class Order {
1161
1511
  body,
1162
1512
  xHeaders
1163
1513
  );
1514
+
1515
+ const {
1516
+ error: res_error,
1517
+ } = OrderModel.BulkActionResponse().validate(response, {
1518
+ abortEarly: false,
1519
+ allowUnknown: false,
1520
+ });
1521
+
1522
+ if (res_error) {
1523
+ Logger({
1524
+ level: "WARN",
1525
+ message: "Response Validation Warnnings for bulkActionProcessXlsxFile",
1526
+ });
1527
+ Logger({ level: "WARN", message: res_error });
1528
+ }
1529
+
1530
+ return response;
1164
1531
  }
1165
1532
 
1166
1533
  /**
1167
1534
  * @param {Object} arg - Arg object.
1168
1535
  * @param {string} arg.batchId -
1536
+ * @returns {Promise<BulkActionDetailsResponse>} - Success response
1169
1537
  * @summary: Returns failed, processing and successfully processed shipments.
1170
1538
  * @description: Returns failed, processing and successfully processed shipments along with their counts and failed reasons.
1171
1539
  */
1172
- bulkActionDetails({ batchId } = {}) {
1540
+ async bulkActionDetails({ batchId } = {}) {
1173
1541
  const { error } = OrderValidator.bulkActionDetails().validate(
1174
1542
  {
1175
1543
  batchId,
@@ -1188,15 +1556,18 @@ class Order {
1188
1556
  { abortEarly: false, allowUnknown: false }
1189
1557
  );
1190
1558
  if (warrning) {
1191
- console.log("Parameter Validation warrnings for bulkActionDetails");
1192
- console.log(warrning);
1559
+ Logger({
1560
+ level: "WARN",
1561
+ message: "Parameter Validation warrnings for bulkActionDetails",
1562
+ });
1563
+ Logger({ level: "WARN", message: warrning });
1193
1564
  }
1194
1565
 
1195
1566
  const query_params = {};
1196
1567
 
1197
1568
  const xHeaders = {};
1198
1569
 
1199
- return PlatformAPIClient.execute(
1570
+ const response = await PlatformAPIClient.execute(
1200
1571
  this.config,
1201
1572
  "get",
1202
1573
  `/service/platform/orders/v2.0/company/${this.config.companyId}/bulk-action/${batchId}`,
@@ -1204,6 +1575,23 @@ class Order {
1204
1575
  undefined,
1205
1576
  xHeaders
1206
1577
  );
1578
+
1579
+ const {
1580
+ error: res_error,
1581
+ } = OrderModel.BulkActionDetailsResponse().validate(response, {
1582
+ abortEarly: false,
1583
+ allowUnknown: false,
1584
+ });
1585
+
1586
+ if (res_error) {
1587
+ Logger({
1588
+ level: "WARN",
1589
+ message: "Response Validation Warnnings for bulkActionDetails",
1590
+ });
1591
+ Logger({ level: "WARN", message: res_error });
1592
+ }
1593
+
1594
+ return response;
1207
1595
  }
1208
1596
 
1209
1597
  /**
@@ -1211,10 +1599,11 @@ class Order {
1211
1599
  * @param {string} [arg.bagId] -
1212
1600
  * @param {string} [arg.channelBagId] -
1213
1601
  * @param {string} [arg.channelId] -
1602
+ * @returns {Promise<BagDetailsPlatformResponse>} - Success response
1214
1603
  * @summary:
1215
1604
  * @description:
1216
1605
  */
1217
- getBagById({ bagId, channelBagId, channelId } = {}) {
1606
+ async getBagById({ bagId, channelBagId, channelId } = {}) {
1218
1607
  const { error } = OrderValidator.getBagById().validate(
1219
1608
  {
1220
1609
  bagId,
@@ -1237,8 +1626,11 @@ class Order {
1237
1626
  { abortEarly: false, allowUnknown: false }
1238
1627
  );
1239
1628
  if (warrning) {
1240
- console.log("Parameter Validation warrnings for getBagById");
1241
- console.log(warrning);
1629
+ Logger({
1630
+ level: "WARN",
1631
+ message: "Parameter Validation warrnings for getBagById",
1632
+ });
1633
+ Logger({ level: "WARN", message: warrning });
1242
1634
  }
1243
1635
 
1244
1636
  const query_params = {};
@@ -1248,7 +1640,7 @@ class Order {
1248
1640
 
1249
1641
  const xHeaders = {};
1250
1642
 
1251
- return PlatformAPIClient.execute(
1643
+ const response = await PlatformAPIClient.execute(
1252
1644
  this.config,
1253
1645
  "get",
1254
1646
  `/service/platform/orders/v1.0/company/${this.config.companyId}/bag-details/`,
@@ -1256,6 +1648,23 @@ class Order {
1256
1648
  undefined,
1257
1649
  xHeaders
1258
1650
  );
1651
+
1652
+ const {
1653
+ error: res_error,
1654
+ } = OrderModel.BagDetailsPlatformResponse().validate(response, {
1655
+ abortEarly: false,
1656
+ allowUnknown: false,
1657
+ });
1658
+
1659
+ if (res_error) {
1660
+ Logger({
1661
+ level: "WARN",
1662
+ message: "Response Validation Warnnings for getBagById",
1663
+ });
1664
+ Logger({ level: "WARN", message: res_error });
1665
+ }
1666
+
1667
+ return response;
1259
1668
  }
1260
1669
 
1261
1670
  /**
@@ -1269,10 +1678,11 @@ class Order {
1269
1678
  * @param {string} [arg.channelId] -
1270
1679
  * @param {number} [arg.pageNo] -
1271
1680
  * @param {number} [arg.pageSize] -
1681
+ * @returns {Promise<GetBagsPlatformResponse>} - Success response
1272
1682
  * @summary:
1273
1683
  * @description:
1274
1684
  */
1275
- getBags({
1685
+ async getBags({
1276
1686
  bagIds,
1277
1687
  shipmentIds,
1278
1688
  orderIds,
@@ -1317,8 +1727,11 @@ class Order {
1317
1727
  { abortEarly: false, allowUnknown: false }
1318
1728
  );
1319
1729
  if (warrning) {
1320
- console.log("Parameter Validation warrnings for getBags");
1321
- console.log(warrning);
1730
+ Logger({
1731
+ level: "WARN",
1732
+ message: "Parameter Validation warrnings for getBags",
1733
+ });
1734
+ Logger({ level: "WARN", message: warrning });
1322
1735
  }
1323
1736
 
1324
1737
  const query_params = {};
@@ -1334,7 +1747,7 @@ class Order {
1334
1747
 
1335
1748
  const xHeaders = {};
1336
1749
 
1337
- return PlatformAPIClient.execute(
1750
+ const response = await PlatformAPIClient.execute(
1338
1751
  this.config,
1339
1752
  "get",
1340
1753
  `/service/platform/orders/v1.0/company/${this.config.companyId}/bags`,
@@ -1342,15 +1755,33 @@ class Order {
1342
1755
  undefined,
1343
1756
  xHeaders
1344
1757
  );
1758
+
1759
+ const {
1760
+ error: res_error,
1761
+ } = OrderModel.GetBagsPlatformResponse().validate(response, {
1762
+ abortEarly: false,
1763
+ allowUnknown: false,
1764
+ });
1765
+
1766
+ if (res_error) {
1767
+ Logger({
1768
+ level: "WARN",
1769
+ message: "Response Validation Warnnings for getBags",
1770
+ });
1771
+ Logger({ level: "WARN", message: res_error });
1772
+ }
1773
+
1774
+ return response;
1345
1775
  }
1346
1776
 
1347
1777
  /**
1348
1778
  * @param {Object} arg - Arg object.
1349
1779
  * @param {InvalidateShipmentCachePayload} arg.body
1780
+ * @returns {Promise<InvalidateShipmentCacheResponse>} - Success response
1350
1781
  * @summary:
1351
1782
  * @description: Invalidate shipment Cache
1352
1783
  */
1353
- invalidateShipmentCache({ body } = {}) {
1784
+ async invalidateShipmentCache({ body } = {}) {
1354
1785
  const { error } = OrderValidator.invalidateShipmentCache().validate(
1355
1786
  {
1356
1787
  body,
@@ -1371,15 +1802,18 @@ class Order {
1371
1802
  { abortEarly: false, allowUnknown: false }
1372
1803
  );
1373
1804
  if (warrning) {
1374
- console.log("Parameter Validation warrnings for invalidateShipmentCache");
1375
- console.log(warrning);
1805
+ Logger({
1806
+ level: "WARN",
1807
+ message: "Parameter Validation warrnings for invalidateShipmentCache",
1808
+ });
1809
+ Logger({ level: "WARN", message: warrning });
1376
1810
  }
1377
1811
 
1378
1812
  const query_params = {};
1379
1813
 
1380
1814
  const xHeaders = {};
1381
1815
 
1382
- return PlatformAPIClient.execute(
1816
+ const response = await PlatformAPIClient.execute(
1383
1817
  this.config,
1384
1818
  "put",
1385
1819
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/update-cache`,
@@ -1387,15 +1821,33 @@ class Order {
1387
1821
  body,
1388
1822
  xHeaders
1389
1823
  );
1824
+
1825
+ const {
1826
+ error: res_error,
1827
+ } = OrderModel.InvalidateShipmentCacheResponse().validate(response, {
1828
+ abortEarly: false,
1829
+ allowUnknown: false,
1830
+ });
1831
+
1832
+ if (res_error) {
1833
+ Logger({
1834
+ level: "WARN",
1835
+ message: "Response Validation Warnnings for invalidateShipmentCache",
1836
+ });
1837
+ Logger({ level: "WARN", message: res_error });
1838
+ }
1839
+
1840
+ return response;
1390
1841
  }
1391
1842
 
1392
1843
  /**
1393
1844
  * @param {Object} arg - Arg object.
1394
1845
  * @param {StoreReassign} arg.body
1846
+ * @returns {Promise<StoreReassignResponse>} - Success response
1395
1847
  * @summary:
1396
1848
  * @description: Reassign Location
1397
1849
  */
1398
- reassignLocation({ body } = {}) {
1850
+ async reassignLocation({ body } = {}) {
1399
1851
  const { error } = OrderValidator.reassignLocation().validate(
1400
1852
  {
1401
1853
  body,
@@ -1414,15 +1866,18 @@ class Order {
1414
1866
  { abortEarly: false, allowUnknown: false }
1415
1867
  );
1416
1868
  if (warrning) {
1417
- console.log("Parameter Validation warrnings for reassignLocation");
1418
- console.log(warrning);
1869
+ Logger({
1870
+ level: "WARN",
1871
+ message: "Parameter Validation warrnings for reassignLocation",
1872
+ });
1873
+ Logger({ level: "WARN", message: warrning });
1419
1874
  }
1420
1875
 
1421
1876
  const query_params = {};
1422
1877
 
1423
1878
  const xHeaders = {};
1424
1879
 
1425
- return PlatformAPIClient.execute(
1880
+ const response = await PlatformAPIClient.execute(
1426
1881
  this.config,
1427
1882
  "post",
1428
1883
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/store/reassign-internal`,
@@ -1430,15 +1885,33 @@ class Order {
1430
1885
  body,
1431
1886
  xHeaders
1432
1887
  );
1888
+
1889
+ const {
1890
+ error: res_error,
1891
+ } = OrderModel.StoreReassignResponse().validate(response, {
1892
+ abortEarly: false,
1893
+ allowUnknown: false,
1894
+ });
1895
+
1896
+ if (res_error) {
1897
+ Logger({
1898
+ level: "WARN",
1899
+ message: "Response Validation Warnnings for reassignLocation",
1900
+ });
1901
+ Logger({ level: "WARN", message: res_error });
1902
+ }
1903
+
1904
+ return response;
1433
1905
  }
1434
1906
 
1435
1907
  /**
1436
1908
  * @param {Object} arg - Arg object.
1437
1909
  * @param {UpdateShipmentLockPayload} arg.body
1910
+ * @returns {Promise<UpdateShipmentLockResponse>} - Success response
1438
1911
  * @summary:
1439
1912
  * @description: update shipment lock
1440
1913
  */
1441
- updateShipmentLock({ body } = {}) {
1914
+ async updateShipmentLock({ body } = {}) {
1442
1915
  const { error } = OrderValidator.updateShipmentLock().validate(
1443
1916
  {
1444
1917
  body,
@@ -1457,15 +1930,18 @@ class Order {
1457
1930
  { abortEarly: false, allowUnknown: false }
1458
1931
  );
1459
1932
  if (warrning) {
1460
- console.log("Parameter Validation warrnings for updateShipmentLock");
1461
- console.log(warrning);
1933
+ Logger({
1934
+ level: "WARN",
1935
+ message: "Parameter Validation warrnings for updateShipmentLock",
1936
+ });
1937
+ Logger({ level: "WARN", message: warrning });
1462
1938
  }
1463
1939
 
1464
1940
  const query_params = {};
1465
1941
 
1466
1942
  const xHeaders = {};
1467
1943
 
1468
- return PlatformAPIClient.execute(
1944
+ const response = await PlatformAPIClient.execute(
1469
1945
  this.config,
1470
1946
  "post",
1471
1947
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/entity/lock-manager`,
@@ -1473,15 +1949,33 @@ class Order {
1473
1949
  body,
1474
1950
  xHeaders
1475
1951
  );
1952
+
1953
+ const {
1954
+ error: res_error,
1955
+ } = OrderModel.UpdateShipmentLockResponse().validate(response, {
1956
+ abortEarly: false,
1957
+ allowUnknown: false,
1958
+ });
1959
+
1960
+ if (res_error) {
1961
+ Logger({
1962
+ level: "WARN",
1963
+ message: "Response Validation Warnnings for updateShipmentLock",
1964
+ });
1965
+ Logger({ level: "WARN", message: res_error });
1966
+ }
1967
+
1968
+ return response;
1476
1969
  }
1477
1970
 
1478
1971
  /**
1479
1972
  * @param {Object} arg - Arg object.
1480
1973
  * @param {string} [arg.date] -
1974
+ * @returns {Promise<AnnouncementsResponse>} - Success response
1481
1975
  * @summary:
1482
1976
  * @description:
1483
1977
  */
1484
- getAnnouncements({ date } = {}) {
1978
+ async getAnnouncements({ date } = {}) {
1485
1979
  const { error } = OrderValidator.getAnnouncements().validate(
1486
1980
  {
1487
1981
  date,
@@ -1500,8 +1994,11 @@ class Order {
1500
1994
  { abortEarly: false, allowUnknown: false }
1501
1995
  );
1502
1996
  if (warrning) {
1503
- console.log("Parameter Validation warrnings for getAnnouncements");
1504
- console.log(warrning);
1997
+ Logger({
1998
+ level: "WARN",
1999
+ message: "Parameter Validation warrnings for getAnnouncements",
2000
+ });
2001
+ Logger({ level: "WARN", message: warrning });
1505
2002
  }
1506
2003
 
1507
2004
  const query_params = {};
@@ -1509,7 +2006,7 @@ class Order {
1509
2006
 
1510
2007
  const xHeaders = {};
1511
2008
 
1512
- return PlatformAPIClient.execute(
2009
+ const response = await PlatformAPIClient.execute(
1513
2010
  this.config,
1514
2011
  "get",
1515
2012
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/announcements`,
@@ -1517,6 +2014,23 @@ class Order {
1517
2014
  undefined,
1518
2015
  xHeaders
1519
2016
  );
2017
+
2018
+ const {
2019
+ error: res_error,
2020
+ } = OrderModel.AnnouncementsResponse().validate(response, {
2021
+ abortEarly: false,
2022
+ allowUnknown: false,
2023
+ });
2024
+
2025
+ if (res_error) {
2026
+ Logger({
2027
+ level: "WARN",
2028
+ message: "Response Validation Warnnings for getAnnouncements",
2029
+ });
2030
+ Logger({ level: "WARN", message: res_error });
2031
+ }
2032
+
2033
+ return response;
1520
2034
  }
1521
2035
 
1522
2036
  /**
@@ -1533,10 +2047,11 @@ class Order {
1533
2047
  * @param {string} [arg.city] -
1534
2048
  * @param {string} [arg.state] -
1535
2049
  * @param {string} [arg.country] -
2050
+ * @returns {Promise<BaseResponse>} - Success response
1536
2051
  * @summary:
1537
2052
  * @description:
1538
2053
  */
1539
- updateAddress({
2054
+ async updateAddress({
1540
2055
  shipmentId,
1541
2056
  addressCategory,
1542
2057
  name,
@@ -1590,8 +2105,11 @@ class Order {
1590
2105
  { abortEarly: false, allowUnknown: false }
1591
2106
  );
1592
2107
  if (warrning) {
1593
- console.log("Parameter Validation warrnings for updateAddress");
1594
- console.log(warrning);
2108
+ Logger({
2109
+ level: "WARN",
2110
+ message: "Parameter Validation warrnings for updateAddress",
2111
+ });
2112
+ Logger({ level: "WARN", message: warrning });
1595
2113
  }
1596
2114
 
1597
2115
  const query_params = {};
@@ -1610,7 +2128,7 @@ class Order {
1610
2128
 
1611
2129
  const xHeaders = {};
1612
2130
 
1613
- return PlatformAPIClient.execute(
2131
+ const response = await PlatformAPIClient.execute(
1614
2132
  this.config,
1615
2133
  "post",
1616
2134
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/delight/update-address`,
@@ -1618,6 +2136,21 @@ class Order {
1618
2136
  undefined,
1619
2137
  xHeaders
1620
2138
  );
2139
+
2140
+ const { error: res_error } = OrderModel.BaseResponse().validate(response, {
2141
+ abortEarly: false,
2142
+ allowUnknown: false,
2143
+ });
2144
+
2145
+ if (res_error) {
2146
+ Logger({
2147
+ level: "WARN",
2148
+ message: "Response Validation Warnnings for updateAddress",
2149
+ });
2150
+ Logger({ level: "WARN", message: res_error });
2151
+ }
2152
+
2153
+ return response;
1621
2154
  }
1622
2155
 
1623
2156
  /**
@@ -1627,10 +2160,11 @@ class Order {
1627
2160
  * @param {string} arg.bagId -
1628
2161
  * @param {string} [arg.callingTo] -
1629
2162
  * @param {string} [arg.callerId] -
2163
+ * @returns {Promise<Click2CallResponse>} - Success response
1630
2164
  * @summary:
1631
2165
  * @description:
1632
2166
  */
1633
- click2Call({ caller, receiver, bagId, callingTo, callerId } = {}) {
2167
+ async click2Call({ caller, receiver, bagId, callingTo, callerId } = {}) {
1634
2168
  const { error } = OrderValidator.click2Call().validate(
1635
2169
  {
1636
2170
  caller,
@@ -1657,8 +2191,11 @@ class Order {
1657
2191
  { abortEarly: false, allowUnknown: false }
1658
2192
  );
1659
2193
  if (warrning) {
1660
- console.log("Parameter Validation warrnings for click2Call");
1661
- console.log(warrning);
2194
+ Logger({
2195
+ level: "WARN",
2196
+ message: "Parameter Validation warrnings for click2Call",
2197
+ });
2198
+ Logger({ level: "WARN", message: warrning });
1662
2199
  }
1663
2200
 
1664
2201
  const query_params = {};
@@ -1670,7 +2207,7 @@ class Order {
1670
2207
 
1671
2208
  const xHeaders = {};
1672
2209
 
1673
- return PlatformAPIClient.execute(
2210
+ const response = await PlatformAPIClient.execute(
1674
2211
  this.config,
1675
2212
  "get",
1676
2213
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/ninja/click2call`,
@@ -1678,15 +2215,33 @@ class Order {
1678
2215
  undefined,
1679
2216
  xHeaders
1680
2217
  );
2218
+
2219
+ const {
2220
+ error: res_error,
2221
+ } = OrderModel.Click2CallResponse().validate(response, {
2222
+ abortEarly: false,
2223
+ allowUnknown: false,
2224
+ });
2225
+
2226
+ if (res_error) {
2227
+ Logger({
2228
+ level: "WARN",
2229
+ message: "Response Validation Warnnings for click2Call",
2230
+ });
2231
+ Logger({ level: "WARN", message: res_error });
2232
+ }
2233
+
2234
+ return response;
1681
2235
  }
1682
2236
 
1683
2237
  /**
1684
2238
  * @param {Object} arg - Arg object.
1685
2239
  * @param {UpdateShipmentStatusRequest} arg.body
2240
+ * @returns {Promise<UpdateShipmentStatusResponseBody>} - Success response
1686
2241
  * @summary:
1687
2242
  * @description: Update shipment status
1688
2243
  */
1689
- updateShipmentStatus({ body } = {}) {
2244
+ async updateShipmentStatus({ body } = {}) {
1690
2245
  const { error } = OrderValidator.updateShipmentStatus().validate(
1691
2246
  {
1692
2247
  body,
@@ -1705,15 +2260,18 @@ class Order {
1705
2260
  { abortEarly: false, allowUnknown: false }
1706
2261
  );
1707
2262
  if (warrning) {
1708
- console.log("Parameter Validation warrnings for updateShipmentStatus");
1709
- console.log(warrning);
2263
+ Logger({
2264
+ level: "WARN",
2265
+ message: "Parameter Validation warrnings for updateShipmentStatus",
2266
+ });
2267
+ Logger({ level: "WARN", message: warrning });
1710
2268
  }
1711
2269
 
1712
2270
  const query_params = {};
1713
2271
 
1714
2272
  const xHeaders = {};
1715
2273
 
1716
- return PlatformAPIClient.execute(
2274
+ const response = await PlatformAPIClient.execute(
1717
2275
  this.config,
1718
2276
  "put",
1719
2277
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/shipment/status-internal`,
@@ -1721,15 +2279,33 @@ class Order {
1721
2279
  body,
1722
2280
  xHeaders
1723
2281
  );
2282
+
2283
+ const {
2284
+ error: res_error,
2285
+ } = OrderModel.UpdateShipmentStatusResponseBody().validate(response, {
2286
+ abortEarly: false,
2287
+ allowUnknown: false,
2288
+ });
2289
+
2290
+ if (res_error) {
2291
+ Logger({
2292
+ level: "WARN",
2293
+ message: "Response Validation Warnnings for updateShipmentStatus",
2294
+ });
2295
+ Logger({ level: "WARN", message: res_error });
2296
+ }
2297
+
2298
+ return response;
1724
2299
  }
1725
2300
 
1726
2301
  /**
1727
2302
  * @param {Object} arg - Arg object.
1728
2303
  * @param {CreateOrderPayload} arg.body
2304
+ * @returns {Promise<CreateOrderResponse>} - Success response
1729
2305
  * @summary:
1730
2306
  * @description:
1731
2307
  */
1732
- processManifest({ body } = {}) {
2308
+ async processManifest({ body } = {}) {
1733
2309
  const { error } = OrderValidator.processManifest().validate(
1734
2310
  {
1735
2311
  body,
@@ -1748,15 +2324,18 @@ class Order {
1748
2324
  { abortEarly: false, allowUnknown: false }
1749
2325
  );
1750
2326
  if (warrning) {
1751
- console.log("Parameter Validation warrnings for processManifest");
1752
- console.log(warrning);
2327
+ Logger({
2328
+ level: "WARN",
2329
+ message: "Parameter Validation warrnings for processManifest",
2330
+ });
2331
+ Logger({ level: "WARN", message: warrning });
1753
2332
  }
1754
2333
 
1755
2334
  const query_params = {};
1756
2335
 
1757
2336
  const xHeaders = {};
1758
2337
 
1759
- return PlatformAPIClient.execute(
2338
+ const response = await PlatformAPIClient.execute(
1760
2339
  this.config,
1761
2340
  "post",
1762
2341
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/process-manifest`,
@@ -1764,15 +2343,33 @@ class Order {
1764
2343
  body,
1765
2344
  xHeaders
1766
2345
  );
2346
+
2347
+ const {
2348
+ error: res_error,
2349
+ } = OrderModel.CreateOrderResponse().validate(response, {
2350
+ abortEarly: false,
2351
+ allowUnknown: false,
2352
+ });
2353
+
2354
+ if (res_error) {
2355
+ Logger({
2356
+ level: "WARN",
2357
+ message: "Response Validation Warnnings for processManifest",
2358
+ });
2359
+ Logger({ level: "WARN", message: res_error });
2360
+ }
2361
+
2362
+ return response;
1767
2363
  }
1768
2364
 
1769
2365
  /**
1770
2366
  * @param {Object} arg - Arg object.
1771
2367
  * @param {DispatchManifest} arg.body
2368
+ * @returns {Promise<SuccessResponse>} - Success response
1772
2369
  * @summary:
1773
2370
  * @description:
1774
2371
  */
1775
- dispatchManifest({ body } = {}) {
2372
+ async dispatchManifest({ body } = {}) {
1776
2373
  const { error } = OrderValidator.dispatchManifest().validate(
1777
2374
  {
1778
2375
  body,
@@ -1791,15 +2388,18 @@ class Order {
1791
2388
  { abortEarly: false, allowUnknown: false }
1792
2389
  );
1793
2390
  if (warrning) {
1794
- console.log("Parameter Validation warrnings for dispatchManifest");
1795
- console.log(warrning);
2391
+ Logger({
2392
+ level: "WARN",
2393
+ message: "Parameter Validation warrnings for dispatchManifest",
2394
+ });
2395
+ Logger({ level: "WARN", message: warrning });
1796
2396
  }
1797
2397
 
1798
2398
  const query_params = {};
1799
2399
 
1800
2400
  const xHeaders = {};
1801
2401
 
1802
- return PlatformAPIClient.execute(
2402
+ const response = await PlatformAPIClient.execute(
1803
2403
  this.config,
1804
2404
  "post",
1805
2405
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/manifest/dispatch`,
@@ -1807,14 +2407,30 @@ class Order {
1807
2407
  body,
1808
2408
  xHeaders
1809
2409
  );
2410
+
2411
+ const { error: res_error } = OrderModel.SuccessResponse().validate(
2412
+ response,
2413
+ { abortEarly: false, allowUnknown: false }
2414
+ );
2415
+
2416
+ if (res_error) {
2417
+ Logger({
2418
+ level: "WARN",
2419
+ message: "Response Validation Warnnings for dispatchManifest",
2420
+ });
2421
+ Logger({ level: "WARN", message: res_error });
2422
+ }
2423
+
2424
+ return response;
1810
2425
  }
1811
2426
 
1812
2427
  /**
1813
2428
  * @param {Object} arg - Arg object.
2429
+ * @returns {Promise<GetActionsResponse>} - Success response
1814
2430
  * @summary:
1815
2431
  * @description:
1816
2432
  */
1817
- getRoleBasedActions({} = {}) {
2433
+ async getRoleBasedActions({} = {}) {
1818
2434
  const { error } = OrderValidator.getRoleBasedActions().validate(
1819
2435
  {},
1820
2436
  { abortEarly: false, allowUnknown: true }
@@ -1829,15 +2445,18 @@ class Order {
1829
2445
  { abortEarly: false, allowUnknown: false }
1830
2446
  );
1831
2447
  if (warrning) {
1832
- console.log("Parameter Validation warrnings for getRoleBasedActions");
1833
- console.log(warrning);
2448
+ Logger({
2449
+ level: "WARN",
2450
+ message: "Parameter Validation warrnings for getRoleBasedActions",
2451
+ });
2452
+ Logger({ level: "WARN", message: warrning });
1834
2453
  }
1835
2454
 
1836
2455
  const query_params = {};
1837
2456
 
1838
2457
  const xHeaders = {};
1839
2458
 
1840
- return PlatformAPIClient.execute(
2459
+ const response = await PlatformAPIClient.execute(
1841
2460
  this.config,
1842
2461
  "get",
1843
2462
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/roles`,
@@ -1845,16 +2464,34 @@ class Order {
1845
2464
  undefined,
1846
2465
  xHeaders
1847
2466
  );
2467
+
2468
+ const {
2469
+ error: res_error,
2470
+ } = OrderModel.GetActionsResponse().validate(response, {
2471
+ abortEarly: false,
2472
+ allowUnknown: false,
2473
+ });
2474
+
2475
+ if (res_error) {
2476
+ Logger({
2477
+ level: "WARN",
2478
+ message: "Response Validation Warnnings for getRoleBasedActions",
2479
+ });
2480
+ Logger({ level: "WARN", message: res_error });
2481
+ }
2482
+
2483
+ return response;
1848
2484
  }
1849
2485
 
1850
2486
  /**
1851
2487
  * @param {Object} arg - Arg object.
1852
2488
  * @param {number} [arg.shipmentId] -
1853
2489
  * @param {number} [arg.bagId] -
2490
+ * @returns {Promise<ShipmentHistoryResponse>} - Success response
1854
2491
  * @summary:
1855
2492
  * @description:
1856
2493
  */
1857
- getShipmentHistory({ shipmentId, bagId } = {}) {
2494
+ async getShipmentHistory({ shipmentId, bagId } = {}) {
1858
2495
  const { error } = OrderValidator.getShipmentHistory().validate(
1859
2496
  {
1860
2497
  shipmentId,
@@ -1875,8 +2512,11 @@ class Order {
1875
2512
  { abortEarly: false, allowUnknown: false }
1876
2513
  );
1877
2514
  if (warrning) {
1878
- console.log("Parameter Validation warrnings for getShipmentHistory");
1879
- console.log(warrning);
2515
+ Logger({
2516
+ level: "WARN",
2517
+ message: "Parameter Validation warrnings for getShipmentHistory",
2518
+ });
2519
+ Logger({ level: "WARN", message: warrning });
1880
2520
  }
1881
2521
 
1882
2522
  const query_params = {};
@@ -1885,7 +2525,7 @@ class Order {
1885
2525
 
1886
2526
  const xHeaders = {};
1887
2527
 
1888
- return PlatformAPIClient.execute(
2528
+ const response = await PlatformAPIClient.execute(
1889
2529
  this.config,
1890
2530
  "get",
1891
2531
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/shipment/history`,
@@ -1893,15 +2533,33 @@ class Order {
1893
2533
  undefined,
1894
2534
  xHeaders
1895
2535
  );
2536
+
2537
+ const {
2538
+ error: res_error,
2539
+ } = OrderModel.ShipmentHistoryResponse().validate(response, {
2540
+ abortEarly: false,
2541
+ allowUnknown: false,
2542
+ });
2543
+
2544
+ if (res_error) {
2545
+ Logger({
2546
+ level: "WARN",
2547
+ message: "Response Validation Warnnings for getShipmentHistory",
2548
+ });
2549
+ Logger({ level: "WARN", message: res_error });
2550
+ }
2551
+
2552
+ return response;
1896
2553
  }
1897
2554
 
1898
2555
  /**
1899
2556
  * @param {Object} arg - Arg object.
1900
2557
  * @param {PostShipmentHistory} arg.body
2558
+ * @returns {Promise<ShipmentHistoryResponse>} - Success response
1901
2559
  * @summary:
1902
2560
  * @description:
1903
2561
  */
1904
- postShipmentHistory({ body } = {}) {
2562
+ async postShipmentHistory({ body } = {}) {
1905
2563
  const { error } = OrderValidator.postShipmentHistory().validate(
1906
2564
  {
1907
2565
  body,
@@ -1920,15 +2578,18 @@ class Order {
1920
2578
  { abortEarly: false, allowUnknown: false }
1921
2579
  );
1922
2580
  if (warrning) {
1923
- console.log("Parameter Validation warrnings for postShipmentHistory");
1924
- console.log(warrning);
2581
+ Logger({
2582
+ level: "WARN",
2583
+ message: "Parameter Validation warrnings for postShipmentHistory",
2584
+ });
2585
+ Logger({ level: "WARN", message: warrning });
1925
2586
  }
1926
2587
 
1927
2588
  const query_params = {};
1928
2589
 
1929
2590
  const xHeaders = {};
1930
2591
 
1931
- return PlatformAPIClient.execute(
2592
+ const response = await PlatformAPIClient.execute(
1932
2593
  this.config,
1933
2594
  "post",
1934
2595
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/shipment/history`,
@@ -1936,15 +2597,33 @@ class Order {
1936
2597
  body,
1937
2598
  xHeaders
1938
2599
  );
2600
+
2601
+ const {
2602
+ error: res_error,
2603
+ } = OrderModel.ShipmentHistoryResponse().validate(response, {
2604
+ abortEarly: false,
2605
+ allowUnknown: false,
2606
+ });
2607
+
2608
+ if (res_error) {
2609
+ Logger({
2610
+ level: "WARN",
2611
+ message: "Response Validation Warnnings for postShipmentHistory",
2612
+ });
2613
+ Logger({ level: "WARN", message: res_error });
2614
+ }
2615
+
2616
+ return response;
1939
2617
  }
1940
2618
 
1941
2619
  /**
1942
2620
  * @param {Object} arg - Arg object.
1943
2621
  * @param {SendSmsPayload} arg.body
2622
+ * @returns {Promise<OrderStatusResult>} - Success response
1944
2623
  * @summary:
1945
2624
  * @description:
1946
2625
  */
1947
- sendSmsNinja({ body } = {}) {
2626
+ async sendSmsNinja({ body } = {}) {
1948
2627
  const { error } = OrderValidator.sendSmsNinja().validate(
1949
2628
  {
1950
2629
  body,
@@ -1963,15 +2642,18 @@ class Order {
1963
2642
  { abortEarly: false, allowUnknown: false }
1964
2643
  );
1965
2644
  if (warrning) {
1966
- console.log("Parameter Validation warrnings for sendSmsNinja");
1967
- console.log(warrning);
2645
+ Logger({
2646
+ level: "WARN",
2647
+ message: "Parameter Validation warrnings for sendSmsNinja",
2648
+ });
2649
+ Logger({ level: "WARN", message: warrning });
1968
2650
  }
1969
2651
 
1970
2652
  const query_params = {};
1971
2653
 
1972
2654
  const xHeaders = {};
1973
2655
 
1974
- return PlatformAPIClient.execute(
2656
+ const response = await PlatformAPIClient.execute(
1975
2657
  this.config,
1976
2658
  "post",
1977
2659
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/ninja/send-sms`,
@@ -1979,15 +2661,33 @@ class Order {
1979
2661
  body,
1980
2662
  xHeaders
1981
2663
  );
2664
+
2665
+ const {
2666
+ error: res_error,
2667
+ } = OrderModel.OrderStatusResult().validate(response, {
2668
+ abortEarly: false,
2669
+ allowUnknown: false,
2670
+ });
2671
+
2672
+ if (res_error) {
2673
+ Logger({
2674
+ level: "WARN",
2675
+ message: "Response Validation Warnnings for sendSmsNinja",
2676
+ });
2677
+ Logger({ level: "WARN", message: res_error });
2678
+ }
2679
+
2680
+ return response;
1982
2681
  }
1983
2682
 
1984
2683
  /**
1985
2684
  * @param {Object} arg - Arg object.
1986
2685
  * @param {ManualAssignDPToShipment} arg.body
2686
+ * @returns {Promise<ManualAssignDPToShipmentResponse>} - Success response
1987
2687
  * @summary:
1988
2688
  * @description:
1989
2689
  */
1990
- platformManualAssignDPToShipment({ body } = {}) {
2690
+ async platformManualAssignDPToShipment({ body } = {}) {
1991
2691
  const {
1992
2692
  error,
1993
2693
  } = OrderValidator.platformManualAssignDPToShipment().validate(
@@ -2010,17 +2710,19 @@ class Order {
2010
2710
  { abortEarly: false, allowUnknown: false }
2011
2711
  );
2012
2712
  if (warrning) {
2013
- console.log(
2014
- "Parameter Validation warrnings for platformManualAssignDPToShipment"
2015
- );
2016
- console.log(warrning);
2713
+ Logger({
2714
+ level: "WARN",
2715
+ message:
2716
+ "Parameter Validation warrnings for platformManualAssignDPToShipment",
2717
+ });
2718
+ Logger({ level: "WARN", message: warrning });
2017
2719
  }
2018
2720
 
2019
2721
  const query_params = {};
2020
2722
 
2021
2723
  const xHeaders = {};
2022
2724
 
2023
- return PlatformAPIClient.execute(
2725
+ const response = await PlatformAPIClient.execute(
2024
2726
  this.config,
2025
2727
  "post",
2026
2728
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/oms/manual-place-shipment`,
@@ -2028,15 +2730,34 @@ class Order {
2028
2730
  body,
2029
2731
  xHeaders
2030
2732
  );
2733
+
2734
+ const {
2735
+ error: res_error,
2736
+ } = OrderModel.ManualAssignDPToShipmentResponse().validate(response, {
2737
+ abortEarly: false,
2738
+ allowUnknown: false,
2739
+ });
2740
+
2741
+ if (res_error) {
2742
+ Logger({
2743
+ level: "WARN",
2744
+ message:
2745
+ "Response Validation Warnnings for platformManualAssignDPToShipment",
2746
+ });
2747
+ Logger({ level: "WARN", message: res_error });
2748
+ }
2749
+
2750
+ return response;
2031
2751
  }
2032
2752
 
2033
2753
  /**
2034
2754
  * @param {Object} arg - Arg object.
2035
2755
  * @param {CreateOrderPayload} arg.body
2756
+ * @returns {Promise<CreateOrderResponse>} - Success response
2036
2757
  * @summary:
2037
2758
  * @description:
2038
2759
  */
2039
- updatePackagingDimensions({ body } = {}) {
2760
+ async updatePackagingDimensions({ body } = {}) {
2040
2761
  const { error } = OrderValidator.updatePackagingDimensions().validate(
2041
2762
  {
2042
2763
  body,
@@ -2057,17 +2778,18 @@ class Order {
2057
2778
  { abortEarly: false, allowUnknown: false }
2058
2779
  );
2059
2780
  if (warrning) {
2060
- console.log(
2061
- "Parameter Validation warrnings for updatePackagingDimensions"
2062
- );
2063
- console.log(warrning);
2781
+ Logger({
2782
+ level: "WARN",
2783
+ message: "Parameter Validation warrnings for updatePackagingDimensions",
2784
+ });
2785
+ Logger({ level: "WARN", message: warrning });
2064
2786
  }
2065
2787
 
2066
2788
  const query_params = {};
2067
2789
 
2068
2790
  const xHeaders = {};
2069
2791
 
2070
- return PlatformAPIClient.execute(
2792
+ const response = await PlatformAPIClient.execute(
2071
2793
  this.config,
2072
2794
  "post",
2073
2795
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/update-packaging-dimension`,
@@ -2075,15 +2797,33 @@ class Order {
2075
2797
  body,
2076
2798
  xHeaders
2077
2799
  );
2800
+
2801
+ const {
2802
+ error: res_error,
2803
+ } = OrderModel.CreateOrderResponse().validate(response, {
2804
+ abortEarly: false,
2805
+ allowUnknown: false,
2806
+ });
2807
+
2808
+ if (res_error) {
2809
+ Logger({
2810
+ level: "WARN",
2811
+ message: "Response Validation Warnnings for updatePackagingDimensions",
2812
+ });
2813
+ Logger({ level: "WARN", message: res_error });
2814
+ }
2815
+
2816
+ return response;
2078
2817
  }
2079
2818
 
2080
2819
  /**
2081
2820
  * @param {Object} arg - Arg object.
2082
2821
  * @param {CreateOrderAPI} arg.body
2822
+ * @returns {Promise<CreateOrderResponse>} - Success response
2083
2823
  * @summary:
2084
2824
  * @description:
2085
2825
  */
2086
- createOrder({ body } = {}) {
2826
+ async createOrder({ body } = {}) {
2087
2827
  const { error } = OrderValidator.createOrder().validate(
2088
2828
  {
2089
2829
  body,
@@ -2102,15 +2842,18 @@ class Order {
2102
2842
  { abortEarly: false, allowUnknown: false }
2103
2843
  );
2104
2844
  if (warrning) {
2105
- console.log("Parameter Validation warrnings for createOrder");
2106
- console.log(warrning);
2845
+ Logger({
2846
+ level: "WARN",
2847
+ message: "Parameter Validation warrnings for createOrder",
2848
+ });
2849
+ Logger({ level: "WARN", message: warrning });
2107
2850
  }
2108
2851
 
2109
2852
  const query_params = {};
2110
2853
 
2111
2854
  const xHeaders = {};
2112
2855
 
2113
- return PlatformAPIClient.execute(
2856
+ const response = await PlatformAPIClient.execute(
2114
2857
  this.config,
2115
2858
  "post",
2116
2859
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/create-order`,
@@ -2118,14 +2861,32 @@ class Order {
2118
2861
  body,
2119
2862
  xHeaders
2120
2863
  );
2864
+
2865
+ const {
2866
+ error: res_error,
2867
+ } = OrderModel.CreateOrderResponse().validate(response, {
2868
+ abortEarly: false,
2869
+ allowUnknown: false,
2870
+ });
2871
+
2872
+ if (res_error) {
2873
+ Logger({
2874
+ level: "WARN",
2875
+ message: "Response Validation Warnnings for createOrder",
2876
+ });
2877
+ Logger({ level: "WARN", message: res_error });
2878
+ }
2879
+
2880
+ return response;
2121
2881
  }
2122
2882
 
2123
2883
  /**
2124
2884
  * @param {Object} arg - Arg object.
2885
+ * @returns {Promise<CreateChannelConfigData>} - Success response
2125
2886
  * @summary:
2126
2887
  * @description: getChannelConfig
2127
2888
  */
2128
- getChannelConfig({} = {}) {
2889
+ async getChannelConfig({} = {}) {
2129
2890
  const { error } = OrderValidator.getChannelConfig().validate(
2130
2891
  {},
2131
2892
  { abortEarly: false, allowUnknown: true }
@@ -2140,15 +2901,18 @@ class Order {
2140
2901
  { abortEarly: false, allowUnknown: false }
2141
2902
  );
2142
2903
  if (warrning) {
2143
- console.log("Parameter Validation warrnings for getChannelConfig");
2144
- console.log(warrning);
2904
+ Logger({
2905
+ level: "WARN",
2906
+ message: "Parameter Validation warrnings for getChannelConfig",
2907
+ });
2908
+ Logger({ level: "WARN", message: warrning });
2145
2909
  }
2146
2910
 
2147
2911
  const query_params = {};
2148
2912
 
2149
2913
  const xHeaders = {};
2150
2914
 
2151
- return PlatformAPIClient.execute(
2915
+ const response = await PlatformAPIClient.execute(
2152
2916
  this.config,
2153
2917
  "get",
2154
2918
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/order-config`,
@@ -2156,15 +2920,33 @@ class Order {
2156
2920
  undefined,
2157
2921
  xHeaders
2158
2922
  );
2923
+
2924
+ const {
2925
+ error: res_error,
2926
+ } = OrderModel.CreateChannelConfigData().validate(response, {
2927
+ abortEarly: false,
2928
+ allowUnknown: false,
2929
+ });
2930
+
2931
+ if (res_error) {
2932
+ Logger({
2933
+ level: "WARN",
2934
+ message: "Response Validation Warnnings for getChannelConfig",
2935
+ });
2936
+ Logger({ level: "WARN", message: res_error });
2937
+ }
2938
+
2939
+ return response;
2159
2940
  }
2160
2941
 
2161
2942
  /**
2162
2943
  * @param {Object} arg - Arg object.
2163
2944
  * @param {CreateChannelConfigData} arg.body
2945
+ * @returns {Promise<CreateChannelConfigResponse>} - Success response
2164
2946
  * @summary:
2165
2947
  * @description: createChannelConfig
2166
2948
  */
2167
- createChannelConfig({ body } = {}) {
2949
+ async createChannelConfig({ body } = {}) {
2168
2950
  const { error } = OrderValidator.createChannelConfig().validate(
2169
2951
  {
2170
2952
  body,
@@ -2183,15 +2965,18 @@ class Order {
2183
2965
  { abortEarly: false, allowUnknown: false }
2184
2966
  );
2185
2967
  if (warrning) {
2186
- console.log("Parameter Validation warrnings for createChannelConfig");
2187
- console.log(warrning);
2968
+ Logger({
2969
+ level: "WARN",
2970
+ message: "Parameter Validation warrnings for createChannelConfig",
2971
+ });
2972
+ Logger({ level: "WARN", message: warrning });
2188
2973
  }
2189
2974
 
2190
2975
  const query_params = {};
2191
2976
 
2192
2977
  const xHeaders = {};
2193
2978
 
2194
- return PlatformAPIClient.execute(
2979
+ const response = await PlatformAPIClient.execute(
2195
2980
  this.config,
2196
2981
  "post",
2197
2982
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/order-config`,
@@ -2199,15 +2984,33 @@ class Order {
2199
2984
  body,
2200
2985
  xHeaders
2201
2986
  );
2987
+
2988
+ const {
2989
+ error: res_error,
2990
+ } = OrderModel.CreateChannelConfigResponse().validate(response, {
2991
+ abortEarly: false,
2992
+ allowUnknown: false,
2993
+ });
2994
+
2995
+ if (res_error) {
2996
+ Logger({
2997
+ level: "WARN",
2998
+ message: "Response Validation Warnnings for createChannelConfig",
2999
+ });
3000
+ Logger({ level: "WARN", message: res_error });
3001
+ }
3002
+
3003
+ return response;
2202
3004
  }
2203
3005
 
2204
3006
  /**
2205
3007
  * @param {Object} arg - Arg object.
2206
3008
  * @param {UploadConsent} arg.body
3009
+ * @returns {Promise<SuccessResponse>} - Success response
2207
3010
  * @summary:
2208
3011
  * @description:
2209
3012
  */
2210
- uploadConsent({ body } = {}) {
3013
+ async uploadConsent({ body } = {}) {
2211
3014
  const { error } = OrderValidator.uploadConsent().validate(
2212
3015
  {
2213
3016
  body,
@@ -2226,15 +3029,18 @@ class Order {
2226
3029
  { abortEarly: false, allowUnknown: false }
2227
3030
  );
2228
3031
  if (warrning) {
2229
- console.log("Parameter Validation warrnings for uploadConsent");
2230
- console.log(warrning);
3032
+ Logger({
3033
+ level: "WARN",
3034
+ message: "Parameter Validation warrnings for uploadConsent",
3035
+ });
3036
+ Logger({ level: "WARN", message: warrning });
2231
3037
  }
2232
3038
 
2233
3039
  const query_params = {};
2234
3040
 
2235
3041
  const xHeaders = {};
2236
3042
 
2237
- return PlatformAPIClient.execute(
3043
+ const response = await PlatformAPIClient.execute(
2238
3044
  this.config,
2239
3045
  "post",
2240
3046
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/manifest/uploadConsent`,
@@ -2242,15 +3048,31 @@ class Order {
2242
3048
  body,
2243
3049
  xHeaders
2244
3050
  );
3051
+
3052
+ const { error: res_error } = OrderModel.SuccessResponse().validate(
3053
+ response,
3054
+ { abortEarly: false, allowUnknown: false }
3055
+ );
3056
+
3057
+ if (res_error) {
3058
+ Logger({
3059
+ level: "WARN",
3060
+ message: "Response Validation Warnnings for uploadConsent",
3061
+ });
3062
+ Logger({ level: "WARN", message: res_error });
3063
+ }
3064
+
3065
+ return response;
2245
3066
  }
2246
3067
 
2247
3068
  /**
2248
3069
  * @param {Object} arg - Arg object.
2249
3070
  * @param {PlatformOrderUpdate} arg.body
3071
+ * @returns {Promise<ResponseDetail>} - Success response
2250
3072
  * @summary:
2251
3073
  * @description:
2252
3074
  */
2253
- orderUpdate({ body } = {}) {
3075
+ async orderUpdate({ body } = {}) {
2254
3076
  const { error } = OrderValidator.orderUpdate().validate(
2255
3077
  {
2256
3078
  body,
@@ -2269,15 +3091,18 @@ class Order {
2269
3091
  { abortEarly: false, allowUnknown: false }
2270
3092
  );
2271
3093
  if (warrning) {
2272
- console.log("Parameter Validation warrnings for orderUpdate");
2273
- console.log(warrning);
3094
+ Logger({
3095
+ level: "WARN",
3096
+ message: "Parameter Validation warrnings for orderUpdate",
3097
+ });
3098
+ Logger({ level: "WARN", message: warrning });
2274
3099
  }
2275
3100
 
2276
3101
  const query_params = {};
2277
3102
 
2278
3103
  const xHeaders = {};
2279
3104
 
2280
- return PlatformAPIClient.execute(
3105
+ const response = await PlatformAPIClient.execute(
2281
3106
  this.config,
2282
3107
  "put",
2283
3108
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/order/validation`,
@@ -2285,15 +3110,31 @@ class Order {
2285
3110
  body,
2286
3111
  xHeaders
2287
3112
  );
3113
+
3114
+ const { error: res_error } = OrderModel.ResponseDetail().validate(
3115
+ response,
3116
+ { abortEarly: false, allowUnknown: false }
3117
+ );
3118
+
3119
+ if (res_error) {
3120
+ Logger({
3121
+ level: "WARN",
3122
+ message: "Response Validation Warnnings for orderUpdate",
3123
+ });
3124
+ Logger({ level: "WARN", message: res_error });
3125
+ }
3126
+
3127
+ return response;
2288
3128
  }
2289
3129
 
2290
3130
  /**
2291
3131
  * @param {Object} arg - Arg object.
2292
3132
  * @param {OrderStatus} arg.body
3133
+ * @returns {Promise<OrderStatusResult>} - Success response
2293
3134
  * @summary:
2294
3135
  * @description:
2295
3136
  */
2296
- checkOrderStatus({ body } = {}) {
3137
+ async checkOrderStatus({ body } = {}) {
2297
3138
  const { error } = OrderValidator.checkOrderStatus().validate(
2298
3139
  {
2299
3140
  body,
@@ -2312,15 +3153,18 @@ class Order {
2312
3153
  { abortEarly: false, allowUnknown: false }
2313
3154
  );
2314
3155
  if (warrning) {
2315
- console.log("Parameter Validation warrnings for checkOrderStatus");
2316
- console.log(warrning);
3156
+ Logger({
3157
+ level: "WARN",
3158
+ message: "Parameter Validation warrnings for checkOrderStatus",
3159
+ });
3160
+ Logger({ level: "WARN", message: warrning });
2317
3161
  }
2318
3162
 
2319
3163
  const query_params = {};
2320
3164
 
2321
3165
  const xHeaders = {};
2322
3166
 
2323
- return PlatformAPIClient.execute(
3167
+ const response = await PlatformAPIClient.execute(
2324
3168
  this.config,
2325
3169
  "post",
2326
3170
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/debug/order_status`,
@@ -2328,14 +3172,32 @@ class Order {
2328
3172
  body,
2329
3173
  xHeaders
2330
3174
  );
3175
+
3176
+ const {
3177
+ error: res_error,
3178
+ } = OrderModel.OrderStatusResult().validate(response, {
3179
+ abortEarly: false,
3180
+ allowUnknown: false,
3181
+ });
3182
+
3183
+ if (res_error) {
3184
+ Logger({
3185
+ level: "WARN",
3186
+ message: "Response Validation Warnnings for checkOrderStatus",
3187
+ });
3188
+ Logger({ level: "WARN", message: res_error });
3189
+ }
3190
+
3191
+ return response;
2331
3192
  }
2332
3193
 
2333
3194
  /**
2334
3195
  * @param {Object} arg - Arg object.
3196
+ * @returns {Promise<OrderStatusResult>} - Success response
2335
3197
  * @summary:
2336
3198
  * @description:
2337
3199
  */
2338
- sendSmsNinjaPlatform({} = {}) {
3200
+ async sendSmsNinjaPlatform({} = {}) {
2339
3201
  const { error } = OrderValidator.sendSmsNinjaPlatform().validate(
2340
3202
  {},
2341
3203
  { abortEarly: false, allowUnknown: true }
@@ -2350,15 +3212,18 @@ class Order {
2350
3212
  { abortEarly: false, allowUnknown: false }
2351
3213
  );
2352
3214
  if (warrning) {
2353
- console.log("Parameter Validation warrnings for sendSmsNinjaPlatform");
2354
- console.log(warrning);
3215
+ Logger({
3216
+ level: "WARN",
3217
+ message: "Parameter Validation warrnings for sendSmsNinjaPlatform",
3218
+ });
3219
+ Logger({ level: "WARN", message: warrning });
2355
3220
  }
2356
3221
 
2357
3222
  const query_params = {};
2358
3223
 
2359
3224
  const xHeaders = {};
2360
3225
 
2361
- return PlatformAPIClient.execute(
3226
+ const response = await PlatformAPIClient.execute(
2362
3227
  this.config,
2363
3228
  "get",
2364
3229
  `/service/platform/order-manage/v1.0/company/${this.config.companyId}/bag/state/transition`,
@@ -2366,6 +3231,23 @@ class Order {
2366
3231
  undefined,
2367
3232
  xHeaders
2368
3233
  );
3234
+
3235
+ const {
3236
+ error: res_error,
3237
+ } = OrderModel.OrderStatusResult().validate(response, {
3238
+ abortEarly: false,
3239
+ allowUnknown: false,
3240
+ });
3241
+
3242
+ if (res_error) {
3243
+ Logger({
3244
+ level: "WARN",
3245
+ message: "Response Validation Warnnings for sendSmsNinjaPlatform",
3246
+ });
3247
+ Logger({ level: "WARN", message: res_error });
3248
+ }
3249
+
3250
+ return response;
2369
3251
  }
2370
3252
  }
2371
3253