@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 PosCartValidator = require("./PosCartApplicationValidator");
6
+ const PosCartModel = require("./PosCartApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class PosCart {
8
10
  constructor(_conf) {
@@ -68,7 +70,7 @@ class PosCart {
68
70
  * @summary: Fetch all items added to the cart
69
71
  * @description: Use this API to get details of all the items added to a cart.
70
72
  */
71
- getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
73
+ async getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
72
74
  const { error } = PosCartValidator.getCart().validate(
73
75
  { id, i, b, assignCardId, areaCode, buyNow },
74
76
  { abortEarly: false, allowUnknown: true }
@@ -76,6 +78,20 @@ class PosCart {
76
78
  if (error) {
77
79
  return Promise.reject(new FDKClientValidationError(error));
78
80
  }
81
+
82
+ // Showing warrnings if extra unknown parameters are found
83
+ const { error: warrning } = PosCartValidator.getCart().validate(
84
+ { id, i, b, assignCardId, areaCode, buyNow },
85
+ { abortEarly: false, allowUnknown: false }
86
+ );
87
+ if (warrning) {
88
+ Logger({
89
+ level: "WARN",
90
+ message: "Parameter Validation warrnings for getCart",
91
+ });
92
+ Logger({ level: "WARN", message: warrning });
93
+ }
94
+
79
95
  const query_params = {};
80
96
  query_params["id"] = id;
81
97
  query_params["i"] = i;
@@ -86,7 +102,7 @@ class PosCart {
86
102
 
87
103
  const xHeaders = {};
88
104
 
89
- return APIClient.execute(
105
+ const response = await APIClient.execute(
90
106
  this._conf,
91
107
  "get",
92
108
  constructUrl({
@@ -97,6 +113,23 @@ class PosCart {
97
113
  undefined,
98
114
  xHeaders
99
115
  );
116
+
117
+ const {
118
+ error: res_error,
119
+ } = PosCartModel.CartDetailResponse().validate(response, {
120
+ abortEarly: false,
121
+ allowUnknown: false,
122
+ });
123
+
124
+ if (res_error) {
125
+ Logger({
126
+ level: "WARN",
127
+ message: "Response Validation Warnnings for getCart",
128
+ });
129
+ Logger({ level: "WARN", message: res_error });
130
+ }
131
+
132
+ return response;
100
133
  }
101
134
 
102
135
  /**
@@ -106,7 +139,7 @@ class PosCart {
106
139
  * @summary: Fetch last-modified timestamp
107
140
  * @description: Use this API to fetch Last-Modified timestamp in header metadata.
108
141
  */
109
- getCartLastModified({ id } = {}) {
142
+ async getCartLastModified({ id } = {}) {
110
143
  const { error } = PosCartValidator.getCartLastModified().validate(
111
144
  { id },
112
145
  { abortEarly: false, allowUnknown: true }
@@ -114,12 +147,26 @@ class PosCart {
114
147
  if (error) {
115
148
  return Promise.reject(new FDKClientValidationError(error));
116
149
  }
150
+
151
+ // Showing warrnings if extra unknown parameters are found
152
+ const { error: warrning } = PosCartValidator.getCartLastModified().validate(
153
+ { id },
154
+ { abortEarly: false, allowUnknown: false }
155
+ );
156
+ if (warrning) {
157
+ Logger({
158
+ level: "WARN",
159
+ message: "Parameter Validation warrnings for getCartLastModified",
160
+ });
161
+ Logger({ level: "WARN", message: warrning });
162
+ }
163
+
117
164
  const query_params = {};
118
165
  query_params["id"] = id;
119
166
 
120
167
  const xHeaders = {};
121
168
 
122
- return APIClient.execute(
169
+ const response = await APIClient.execute(
123
170
  this._conf,
124
171
  "head",
125
172
  constructUrl({
@@ -130,6 +177,20 @@ class PosCart {
130
177
  undefined,
131
178
  xHeaders
132
179
  );
180
+
181
+ const { error: res_error } = Joi.string()
182
+ .allow("")
183
+ .validate(response, { abortEarly: false, allowUnknown: false });
184
+
185
+ if (res_error) {
186
+ Logger({
187
+ level: "WARN",
188
+ message: "Response Validation Warnnings for getCartLastModified",
189
+ });
190
+ Logger({ level: "WARN", message: res_error });
191
+ }
192
+
193
+ return response;
133
194
  }
134
195
 
135
196
  /**
@@ -143,7 +204,7 @@ class PosCart {
143
204
  * @summary: Add items to cart
144
205
  * @description: Use this API to add items to the cart.
145
206
  */
146
- addItems({ body, i, b, areaCode, buyNow } = {}) {
207
+ async addItems({ body, i, b, areaCode, buyNow } = {}) {
147
208
  const { error } = PosCartValidator.addItems().validate(
148
209
  { body, i, b, areaCode, buyNow },
149
210
  { abortEarly: false, allowUnknown: true }
@@ -151,6 +212,20 @@ class PosCart {
151
212
  if (error) {
152
213
  return Promise.reject(new FDKClientValidationError(error));
153
214
  }
215
+
216
+ // Showing warrnings if extra unknown parameters are found
217
+ const { error: warrning } = PosCartValidator.addItems().validate(
218
+ { body, i, b, areaCode, buyNow },
219
+ { abortEarly: false, allowUnknown: false }
220
+ );
221
+ if (warrning) {
222
+ Logger({
223
+ level: "WARN",
224
+ message: "Parameter Validation warrnings for addItems",
225
+ });
226
+ Logger({ level: "WARN", message: warrning });
227
+ }
228
+
154
229
  const query_params = {};
155
230
  query_params["i"] = i;
156
231
  query_params["b"] = b;
@@ -159,7 +234,7 @@ class PosCart {
159
234
 
160
235
  const xHeaders = {};
161
236
 
162
- return APIClient.execute(
237
+ const response = await APIClient.execute(
163
238
  this._conf,
164
239
  "post",
165
240
  constructUrl({
@@ -170,6 +245,23 @@ class PosCart {
170
245
  body,
171
246
  xHeaders
172
247
  );
248
+
249
+ const {
250
+ error: res_error,
251
+ } = PosCartModel.AddCartDetailResponse().validate(response, {
252
+ abortEarly: false,
253
+ allowUnknown: false,
254
+ });
255
+
256
+ if (res_error) {
257
+ Logger({
258
+ level: "WARN",
259
+ message: "Response Validation Warnnings for addItems",
260
+ });
261
+ Logger({ level: "WARN", message: res_error });
262
+ }
263
+
264
+ return response;
173
265
  }
174
266
 
175
267
  /**
@@ -184,7 +276,7 @@ class PosCart {
184
276
  * @summary: Update items in the cart
185
277
  * @description: <p>Use this API to update items added to the cart with the help of a request object containing attributes like item_quantity and item_size. These attributes will be fetched from the following APIs</p> <ul> <li><font color="monochrome">operation</font> Operation for current api call. <b>update_item</b> for update items. <b>remove_item</b> for removing items.</li> <li> <font color="monochrome">item_id</font> "/platform/content/v1/products/"</li> <li> <font color="monochrome">item_size</font> "/platform/content/v1/products/:slug/sizes/"</li> <li> <font color="monochrome">quantity</font> item quantity (must be greater than or equal to 1)</li> <li> <font color="monochrome">article_id</font> "/content​/v1​/products​/:identifier​/sizes​/price​/"</li> <li> <font color="monochrome">item_index</font> item position in the cart (must be greater than or equal to 0)</li> </ul>
186
278
  */
187
- updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
279
+ async updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
188
280
  const { error } = PosCartValidator.updateCart().validate(
189
281
  { body, id, i, b, areaCode, buyNow },
190
282
  { abortEarly: false, allowUnknown: true }
@@ -192,6 +284,20 @@ class PosCart {
192
284
  if (error) {
193
285
  return Promise.reject(new FDKClientValidationError(error));
194
286
  }
287
+
288
+ // Showing warrnings if extra unknown parameters are found
289
+ const { error: warrning } = PosCartValidator.updateCart().validate(
290
+ { body, id, i, b, areaCode, buyNow },
291
+ { abortEarly: false, allowUnknown: false }
292
+ );
293
+ if (warrning) {
294
+ Logger({
295
+ level: "WARN",
296
+ message: "Parameter Validation warrnings for updateCart",
297
+ });
298
+ Logger({ level: "WARN", message: warrning });
299
+ }
300
+
195
301
  const query_params = {};
196
302
  query_params["id"] = id;
197
303
  query_params["i"] = i;
@@ -201,7 +307,7 @@ class PosCart {
201
307
 
202
308
  const xHeaders = {};
203
309
 
204
- return APIClient.execute(
310
+ const response = await APIClient.execute(
205
311
  this._conf,
206
312
  "put",
207
313
  constructUrl({
@@ -212,6 +318,23 @@ class PosCart {
212
318
  body,
213
319
  xHeaders
214
320
  );
321
+
322
+ const {
323
+ error: res_error,
324
+ } = PosCartModel.UpdateCartDetailResponse().validate(response, {
325
+ abortEarly: false,
326
+ allowUnknown: false,
327
+ });
328
+
329
+ if (res_error) {
330
+ Logger({
331
+ level: "WARN",
332
+ message: "Response Validation Warnnings for updateCart",
333
+ });
334
+ Logger({ level: "WARN", message: res_error });
335
+ }
336
+
337
+ return response;
215
338
  }
216
339
 
217
340
  /**
@@ -222,7 +345,7 @@ class PosCart {
222
345
  * @summary: Count items in the cart
223
346
  * @description: Use this API to get the total number of items present in cart.
224
347
  */
225
- getItemCount({ id, buyNow } = {}) {
348
+ async getItemCount({ id, buyNow } = {}) {
226
349
  const { error } = PosCartValidator.getItemCount().validate(
227
350
  { id, buyNow },
228
351
  { abortEarly: false, allowUnknown: true }
@@ -230,13 +353,27 @@ class PosCart {
230
353
  if (error) {
231
354
  return Promise.reject(new FDKClientValidationError(error));
232
355
  }
356
+
357
+ // Showing warrnings if extra unknown parameters are found
358
+ const { error: warrning } = PosCartValidator.getItemCount().validate(
359
+ { id, buyNow },
360
+ { abortEarly: false, allowUnknown: false }
361
+ );
362
+ if (warrning) {
363
+ Logger({
364
+ level: "WARN",
365
+ message: "Parameter Validation warrnings for getItemCount",
366
+ });
367
+ Logger({ level: "WARN", message: warrning });
368
+ }
369
+
233
370
  const query_params = {};
234
371
  query_params["id"] = id;
235
372
  query_params["buy_now"] = buyNow;
236
373
 
237
374
  const xHeaders = {};
238
375
 
239
- return APIClient.execute(
376
+ const response = await APIClient.execute(
240
377
  this._conf,
241
378
  "get",
242
379
  constructUrl({
@@ -247,6 +384,23 @@ class PosCart {
247
384
  undefined,
248
385
  xHeaders
249
386
  );
387
+
388
+ const {
389
+ error: res_error,
390
+ } = PosCartModel.CartItemCountResponse().validate(response, {
391
+ abortEarly: false,
392
+ allowUnknown: false,
393
+ });
394
+
395
+ if (res_error) {
396
+ Logger({
397
+ level: "WARN",
398
+ message: "Response Validation Warnnings for getItemCount",
399
+ });
400
+ Logger({ level: "WARN", message: res_error });
401
+ }
402
+
403
+ return response;
250
404
  }
251
405
 
252
406
  /**
@@ -257,7 +411,7 @@ class PosCart {
257
411
  * @summary: Fetch Coupon
258
412
  * @description: Use this API to get a list of available coupons along with their details.
259
413
  */
260
- getCoupons({ id, buyNow } = {}) {
414
+ async getCoupons({ id, buyNow } = {}) {
261
415
  const { error } = PosCartValidator.getCoupons().validate(
262
416
  { id, buyNow },
263
417
  { abortEarly: false, allowUnknown: true }
@@ -265,13 +419,27 @@ class PosCart {
265
419
  if (error) {
266
420
  return Promise.reject(new FDKClientValidationError(error));
267
421
  }
422
+
423
+ // Showing warrnings if extra unknown parameters are found
424
+ const { error: warrning } = PosCartValidator.getCoupons().validate(
425
+ { id, buyNow },
426
+ { abortEarly: false, allowUnknown: false }
427
+ );
428
+ if (warrning) {
429
+ Logger({
430
+ level: "WARN",
431
+ message: "Parameter Validation warrnings for getCoupons",
432
+ });
433
+ Logger({ level: "WARN", message: warrning });
434
+ }
435
+
268
436
  const query_params = {};
269
437
  query_params["id"] = id;
270
438
  query_params["buy_now"] = buyNow;
271
439
 
272
440
  const xHeaders = {};
273
441
 
274
- return APIClient.execute(
442
+ const response = await APIClient.execute(
275
443
  this._conf,
276
444
  "get",
277
445
  constructUrl({
@@ -282,6 +450,23 @@ class PosCart {
282
450
  undefined,
283
451
  xHeaders
284
452
  );
453
+
454
+ const {
455
+ error: res_error,
456
+ } = PosCartModel.GetCouponResponse().validate(response, {
457
+ abortEarly: false,
458
+ allowUnknown: false,
459
+ });
460
+
461
+ if (res_error) {
462
+ Logger({
463
+ level: "WARN",
464
+ message: "Response Validation Warnnings for getCoupons",
465
+ });
466
+ Logger({ level: "WARN", message: res_error });
467
+ }
468
+
469
+ return response;
285
470
  }
286
471
 
287
472
  /**
@@ -296,7 +481,7 @@ class PosCart {
296
481
  * @summary: Apply Coupon
297
482
  * @description: Use this API to apply coupons on items in the cart.
298
483
  */
299
- applyCoupon({ body, i, b, p, id, buyNow } = {}) {
484
+ async applyCoupon({ body, i, b, p, id, buyNow } = {}) {
300
485
  const { error } = PosCartValidator.applyCoupon().validate(
301
486
  { body, i, b, p, id, buyNow },
302
487
  { abortEarly: false, allowUnknown: true }
@@ -304,6 +489,20 @@ class PosCart {
304
489
  if (error) {
305
490
  return Promise.reject(new FDKClientValidationError(error));
306
491
  }
492
+
493
+ // Showing warrnings if extra unknown parameters are found
494
+ const { error: warrning } = PosCartValidator.applyCoupon().validate(
495
+ { body, i, b, p, id, buyNow },
496
+ { abortEarly: false, allowUnknown: false }
497
+ );
498
+ if (warrning) {
499
+ Logger({
500
+ level: "WARN",
501
+ message: "Parameter Validation warrnings for applyCoupon",
502
+ });
503
+ Logger({ level: "WARN", message: warrning });
504
+ }
505
+
307
506
  const query_params = {};
308
507
  query_params["i"] = i;
309
508
  query_params["b"] = b;
@@ -313,7 +512,7 @@ class PosCart {
313
512
 
314
513
  const xHeaders = {};
315
514
 
316
- return APIClient.execute(
515
+ const response = await APIClient.execute(
317
516
  this._conf,
318
517
  "post",
319
518
  constructUrl({
@@ -324,6 +523,23 @@ class PosCart {
324
523
  body,
325
524
  xHeaders
326
525
  );
526
+
527
+ const {
528
+ error: res_error,
529
+ } = PosCartModel.CartDetailResponse().validate(response, {
530
+ abortEarly: false,
531
+ allowUnknown: false,
532
+ });
533
+
534
+ if (res_error) {
535
+ Logger({
536
+ level: "WARN",
537
+ message: "Response Validation Warnnings for applyCoupon",
538
+ });
539
+ Logger({ level: "WARN", message: res_error });
540
+ }
541
+
542
+ return response;
327
543
  }
328
544
 
329
545
  /**
@@ -334,7 +550,7 @@ class PosCart {
334
550
  * @summary: Remove Coupon Applied
335
551
  * @description: Remove Coupon applied on the cart by passing uid in request body.
336
552
  */
337
- removeCoupon({ id, buyNow } = {}) {
553
+ async removeCoupon({ id, buyNow } = {}) {
338
554
  const { error } = PosCartValidator.removeCoupon().validate(
339
555
  { id, buyNow },
340
556
  { abortEarly: false, allowUnknown: true }
@@ -342,13 +558,27 @@ class PosCart {
342
558
  if (error) {
343
559
  return Promise.reject(new FDKClientValidationError(error));
344
560
  }
561
+
562
+ // Showing warrnings if extra unknown parameters are found
563
+ const { error: warrning } = PosCartValidator.removeCoupon().validate(
564
+ { id, buyNow },
565
+ { abortEarly: false, allowUnknown: false }
566
+ );
567
+ if (warrning) {
568
+ Logger({
569
+ level: "WARN",
570
+ message: "Parameter Validation warrnings for removeCoupon",
571
+ });
572
+ Logger({ level: "WARN", message: warrning });
573
+ }
574
+
345
575
  const query_params = {};
346
576
  query_params["id"] = id;
347
577
  query_params["buy_now"] = buyNow;
348
578
 
349
579
  const xHeaders = {};
350
580
 
351
- return APIClient.execute(
581
+ const response = await APIClient.execute(
352
582
  this._conf,
353
583
  "delete",
354
584
  constructUrl({
@@ -359,6 +589,23 @@ class PosCart {
359
589
  undefined,
360
590
  xHeaders
361
591
  );
592
+
593
+ const {
594
+ error: res_error,
595
+ } = PosCartModel.CartDetailResponse().validate(response, {
596
+ abortEarly: false,
597
+ allowUnknown: false,
598
+ });
599
+
600
+ if (res_error) {
601
+ Logger({
602
+ level: "WARN",
603
+ message: "Response Validation Warnnings for removeCoupon",
604
+ });
605
+ Logger({ level: "WARN", message: res_error });
606
+ }
607
+
608
+ return response;
362
609
  }
363
610
 
364
611
  /**
@@ -373,7 +620,7 @@ class PosCart {
373
620
  * @summary: Get discount offers based on quantity
374
621
  * @description: Use this API to get a list of applicable offers along with current, next and best offer for given product. Either one of uid, item_id, slug should be present.
375
622
  */
376
- getBulkDiscountOffers({ itemId, articleId, uid, slug } = {}) {
623
+ async getBulkDiscountOffers({ itemId, articleId, uid, slug } = {}) {
377
624
  const { error } = PosCartValidator.getBulkDiscountOffers().validate(
378
625
  { itemId, articleId, uid, slug },
379
626
  { abortEarly: false, allowUnknown: true }
@@ -381,6 +628,22 @@ class PosCart {
381
628
  if (error) {
382
629
  return Promise.reject(new FDKClientValidationError(error));
383
630
  }
631
+
632
+ // Showing warrnings if extra unknown parameters are found
633
+ const {
634
+ error: warrning,
635
+ } = PosCartValidator.getBulkDiscountOffers().validate(
636
+ { itemId, articleId, uid, slug },
637
+ { abortEarly: false, allowUnknown: false }
638
+ );
639
+ if (warrning) {
640
+ Logger({
641
+ level: "WARN",
642
+ message: "Parameter Validation warrnings for getBulkDiscountOffers",
643
+ });
644
+ Logger({ level: "WARN", message: warrning });
645
+ }
646
+
384
647
  const query_params = {};
385
648
  query_params["item_id"] = itemId;
386
649
  query_params["article_id"] = articleId;
@@ -389,7 +652,7 @@ class PosCart {
389
652
 
390
653
  const xHeaders = {};
391
654
 
392
- return APIClient.execute(
655
+ const response = await APIClient.execute(
393
656
  this._conf,
394
657
  "get",
395
658
  constructUrl({
@@ -400,6 +663,23 @@ class PosCart {
400
663
  undefined,
401
664
  xHeaders
402
665
  );
666
+
667
+ const {
668
+ error: res_error,
669
+ } = PosCartModel.BulkPriceResponse().validate(response, {
670
+ abortEarly: false,
671
+ allowUnknown: false,
672
+ });
673
+
674
+ if (res_error) {
675
+ Logger({
676
+ level: "WARN",
677
+ message: "Response Validation Warnnings for getBulkDiscountOffers",
678
+ });
679
+ Logger({ level: "WARN", message: res_error });
680
+ }
681
+
682
+ return response;
403
683
  }
404
684
 
405
685
  /**
@@ -413,7 +693,7 @@ class PosCart {
413
693
  * @summary: Apply reward points at cart
414
694
  * @description: Use this API to redeem a fixed no. of reward points by applying it to the cart.
415
695
  */
416
- applyRewardPoints({ body, id, i, b, buyNow } = {}) {
696
+ async applyRewardPoints({ body, id, i, b, buyNow } = {}) {
417
697
  const { error } = PosCartValidator.applyRewardPoints().validate(
418
698
  { body, id, i, b, buyNow },
419
699
  { abortEarly: false, allowUnknown: true }
@@ -421,6 +701,20 @@ class PosCart {
421
701
  if (error) {
422
702
  return Promise.reject(new FDKClientValidationError(error));
423
703
  }
704
+
705
+ // Showing warrnings if extra unknown parameters are found
706
+ const { error: warrning } = PosCartValidator.applyRewardPoints().validate(
707
+ { body, id, i, b, buyNow },
708
+ { abortEarly: false, allowUnknown: false }
709
+ );
710
+ if (warrning) {
711
+ Logger({
712
+ level: "WARN",
713
+ message: "Parameter Validation warrnings for applyRewardPoints",
714
+ });
715
+ Logger({ level: "WARN", message: warrning });
716
+ }
717
+
424
718
  const query_params = {};
425
719
  query_params["id"] = id;
426
720
  query_params["i"] = i;
@@ -429,7 +723,7 @@ class PosCart {
429
723
 
430
724
  const xHeaders = {};
431
725
 
432
- return APIClient.execute(
726
+ const response = await APIClient.execute(
433
727
  this._conf,
434
728
  "post",
435
729
  constructUrl({
@@ -440,6 +734,23 @@ class PosCart {
440
734
  body,
441
735
  xHeaders
442
736
  );
737
+
738
+ const {
739
+ error: res_error,
740
+ } = PosCartModel.CartDetailResponse().validate(response, {
741
+ abortEarly: false,
742
+ allowUnknown: false,
743
+ });
744
+
745
+ if (res_error) {
746
+ Logger({
747
+ level: "WARN",
748
+ message: "Response Validation Warnnings for applyRewardPoints",
749
+ });
750
+ Logger({ level: "WARN", message: res_error });
751
+ }
752
+
753
+ return response;
443
754
  }
444
755
 
445
756
  /**
@@ -454,7 +765,7 @@ class PosCart {
454
765
  * @summary: Fetch address
455
766
  * @description: Use this API to get all the addresses associated with an account. If successful, returns a Address resource in the response body specified in GetAddressesResponse.attibutes listed below are optional <ul> <li> <font color="monochrome">uid</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
456
767
  */
457
- getAddresses({
768
+ async getAddresses({
458
769
  cartId,
459
770
  buyNow,
460
771
  mobileNo,
@@ -469,6 +780,20 @@ class PosCart {
469
780
  if (error) {
470
781
  return Promise.reject(new FDKClientValidationError(error));
471
782
  }
783
+
784
+ // Showing warrnings if extra unknown parameters are found
785
+ const { error: warrning } = PosCartValidator.getAddresses().validate(
786
+ { cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
787
+ { abortEarly: false, allowUnknown: false }
788
+ );
789
+ if (warrning) {
790
+ Logger({
791
+ level: "WARN",
792
+ message: "Parameter Validation warrnings for getAddresses",
793
+ });
794
+ Logger({ level: "WARN", message: warrning });
795
+ }
796
+
472
797
  const query_params = {};
473
798
  query_params["cart_id"] = cartId;
474
799
  query_params["buy_now"] = buyNow;
@@ -479,7 +804,7 @@ class PosCart {
479
804
 
480
805
  const xHeaders = {};
481
806
 
482
- return APIClient.execute(
807
+ const response = await APIClient.execute(
483
808
  this._conf,
484
809
  "get",
485
810
  constructUrl({
@@ -490,6 +815,23 @@ class PosCart {
490
815
  undefined,
491
816
  xHeaders
492
817
  );
818
+
819
+ const {
820
+ error: res_error,
821
+ } = PosCartModel.GetAddressesResponse().validate(response, {
822
+ abortEarly: false,
823
+ allowUnknown: false,
824
+ });
825
+
826
+ if (res_error) {
827
+ Logger({
828
+ level: "WARN",
829
+ message: "Response Validation Warnnings for getAddresses",
830
+ });
831
+ Logger({ level: "WARN", message: res_error });
832
+ }
833
+
834
+ return response;
493
835
  }
494
836
 
495
837
  /**
@@ -499,7 +841,7 @@ class PosCart {
499
841
  * @summary: Add address to an account
500
842
  * @description: Use this API to add an address to an account.
501
843
  */
502
- addAddress({ body } = {}) {
844
+ async addAddress({ body } = {}) {
503
845
  const { error } = PosCartValidator.addAddress().validate(
504
846
  { body },
505
847
  { abortEarly: false, allowUnknown: true }
@@ -507,11 +849,25 @@ class PosCart {
507
849
  if (error) {
508
850
  return Promise.reject(new FDKClientValidationError(error));
509
851
  }
852
+
853
+ // Showing warrnings if extra unknown parameters are found
854
+ const { error: warrning } = PosCartValidator.addAddress().validate(
855
+ { body },
856
+ { abortEarly: false, allowUnknown: false }
857
+ );
858
+ if (warrning) {
859
+ Logger({
860
+ level: "WARN",
861
+ message: "Parameter Validation warrnings for addAddress",
862
+ });
863
+ Logger({ level: "WARN", message: warrning });
864
+ }
865
+
510
866
  const query_params = {};
511
867
 
512
868
  const xHeaders = {};
513
869
 
514
- return APIClient.execute(
870
+ const response = await APIClient.execute(
515
871
  this._conf,
516
872
  "post",
517
873
  constructUrl({
@@ -522,6 +878,23 @@ class PosCart {
522
878
  body,
523
879
  xHeaders
524
880
  );
881
+
882
+ const {
883
+ error: res_error,
884
+ } = PosCartModel.SaveAddressResponse().validate(response, {
885
+ abortEarly: false,
886
+ allowUnknown: false,
887
+ });
888
+
889
+ if (res_error) {
890
+ Logger({
891
+ level: "WARN",
892
+ message: "Response Validation Warnnings for addAddress",
893
+ });
894
+ Logger({ level: "WARN", message: res_error });
895
+ }
896
+
897
+ return response;
525
898
  }
526
899
 
527
900
  /**
@@ -537,7 +910,7 @@ class PosCart {
537
910
  * @summary: Fetch a single address by its ID
538
911
  * @description: Use this API to get an addresses using its ID. If successful, returns a Address resource in the response body specified in `Address`. Attibutes listed below are optional <ul> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
539
912
  */
540
- getAddressById({
913
+ async getAddressById({
541
914
  id,
542
915
  cartId,
543
916
  buyNow,
@@ -553,6 +926,20 @@ class PosCart {
553
926
  if (error) {
554
927
  return Promise.reject(new FDKClientValidationError(error));
555
928
  }
929
+
930
+ // Showing warrnings if extra unknown parameters are found
931
+ const { error: warrning } = PosCartValidator.getAddressById().validate(
932
+ { id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
933
+ { abortEarly: false, allowUnknown: false }
934
+ );
935
+ if (warrning) {
936
+ Logger({
937
+ level: "WARN",
938
+ message: "Parameter Validation warrnings for getAddressById",
939
+ });
940
+ Logger({ level: "WARN", message: warrning });
941
+ }
942
+
556
943
  const query_params = {};
557
944
  query_params["cart_id"] = cartId;
558
945
  query_params["buy_now"] = buyNow;
@@ -563,7 +950,7 @@ class PosCart {
563
950
 
564
951
  const xHeaders = {};
565
952
 
566
- return APIClient.execute(
953
+ const response = await APIClient.execute(
567
954
  this._conf,
568
955
  "get",
569
956
  constructUrl({
@@ -574,6 +961,21 @@ class PosCart {
574
961
  undefined,
575
962
  xHeaders
576
963
  );
964
+
965
+ const { error: res_error } = PosCartModel.Address().validate(response, {
966
+ abortEarly: false,
967
+ allowUnknown: false,
968
+ });
969
+
970
+ if (res_error) {
971
+ Logger({
972
+ level: "WARN",
973
+ message: "Response Validation Warnnings for getAddressById",
974
+ });
975
+ Logger({ level: "WARN", message: res_error });
976
+ }
977
+
978
+ return response;
577
979
  }
578
980
 
579
981
  /**
@@ -584,7 +986,7 @@ class PosCart {
584
986
  * @summary: Update address added to an account
585
987
  * @description: <p>Use this API to update an existing address in the account. Request object should contain attributes mentioned in <font color="blue">Address </font> can be updated. These attributes are:</p> <ul> <li> <font color="monochrome">is_default_address</font></li> <li> <font color="monochrome">landmark</font></li> <li> <font color="monochrome">area</font></li> <li> <font color="monochrome">pincode</font></li> <li> <font color="monochrome">email</font></li> <li> <font color="monochrome">address_type</font></li> <li> <font color="monochrome">name</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">address</font></li> </ul>
586
988
  */
587
- updateAddress({ id, body } = {}) {
989
+ async updateAddress({ id, body } = {}) {
588
990
  const { error } = PosCartValidator.updateAddress().validate(
589
991
  { id, body },
590
992
  { abortEarly: false, allowUnknown: true }
@@ -592,11 +994,25 @@ class PosCart {
592
994
  if (error) {
593
995
  return Promise.reject(new FDKClientValidationError(error));
594
996
  }
997
+
998
+ // Showing warrnings if extra unknown parameters are found
999
+ const { error: warrning } = PosCartValidator.updateAddress().validate(
1000
+ { id, body },
1001
+ { abortEarly: false, allowUnknown: false }
1002
+ );
1003
+ if (warrning) {
1004
+ Logger({
1005
+ level: "WARN",
1006
+ message: "Parameter Validation warrnings for updateAddress",
1007
+ });
1008
+ Logger({ level: "WARN", message: warrning });
1009
+ }
1010
+
595
1011
  const query_params = {};
596
1012
 
597
1013
  const xHeaders = {};
598
1014
 
599
- return APIClient.execute(
1015
+ const response = await APIClient.execute(
600
1016
  this._conf,
601
1017
  "put",
602
1018
  constructUrl({
@@ -607,6 +1023,23 @@ class PosCart {
607
1023
  body,
608
1024
  xHeaders
609
1025
  );
1026
+
1027
+ const {
1028
+ error: res_error,
1029
+ } = PosCartModel.UpdateAddressResponse().validate(response, {
1030
+ abortEarly: false,
1031
+ allowUnknown: false,
1032
+ });
1033
+
1034
+ if (res_error) {
1035
+ Logger({
1036
+ level: "WARN",
1037
+ message: "Response Validation Warnnings for updateAddress",
1038
+ });
1039
+ Logger({ level: "WARN", message: res_error });
1040
+ }
1041
+
1042
+ return response;
610
1043
  }
611
1044
 
612
1045
  /**
@@ -616,7 +1049,7 @@ class PosCart {
616
1049
  * @summary: Remove address associated with an account
617
1050
  * @description: Use this API to delete an address by its ID. This will returns an object that will indicate whether the address was deleted successfully or not.
618
1051
  */
619
- removeAddress({ id } = {}) {
1052
+ async removeAddress({ id } = {}) {
620
1053
  const { error } = PosCartValidator.removeAddress().validate(
621
1054
  { id },
622
1055
  { abortEarly: false, allowUnknown: true }
@@ -624,11 +1057,25 @@ class PosCart {
624
1057
  if (error) {
625
1058
  return Promise.reject(new FDKClientValidationError(error));
626
1059
  }
1060
+
1061
+ // Showing warrnings if extra unknown parameters are found
1062
+ const { error: warrning } = PosCartValidator.removeAddress().validate(
1063
+ { id },
1064
+ { abortEarly: false, allowUnknown: false }
1065
+ );
1066
+ if (warrning) {
1067
+ Logger({
1068
+ level: "WARN",
1069
+ message: "Parameter Validation warrnings for removeAddress",
1070
+ });
1071
+ Logger({ level: "WARN", message: warrning });
1072
+ }
1073
+
627
1074
  const query_params = {};
628
1075
 
629
1076
  const xHeaders = {};
630
1077
 
631
- return APIClient.execute(
1078
+ const response = await APIClient.execute(
632
1079
  this._conf,
633
1080
  "delete",
634
1081
  constructUrl({
@@ -639,6 +1086,23 @@ class PosCart {
639
1086
  undefined,
640
1087
  xHeaders
641
1088
  );
1089
+
1090
+ const {
1091
+ error: res_error,
1092
+ } = PosCartModel.DeleteAddressResponse().validate(response, {
1093
+ abortEarly: false,
1094
+ allowUnknown: false,
1095
+ });
1096
+
1097
+ if (res_error) {
1098
+ Logger({
1099
+ level: "WARN",
1100
+ message: "Response Validation Warnnings for removeAddress",
1101
+ });
1102
+ Logger({ level: "WARN", message: res_error });
1103
+ }
1104
+
1105
+ return response;
642
1106
  }
643
1107
 
644
1108
  /**
@@ -652,7 +1116,7 @@ class PosCart {
652
1116
  * @summary: Select an address from available addresses
653
1117
  * @description: <p>Select Address from all addresses associated with the account in order to ship the cart items to that address, otherwise default address will be selected implicitly. See `SelectCartAddressRequest` in schema of request body for the list of attributes needed to select Address from account. On successful request, this API returns a Cart object. Below address attributes are required. <ul> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">billing_address_id</font></li> <li> <font color="monochrome">uid</font></li> </ul></p>
654
1118
  */
655
- selectAddress({ body, cartId, buyNow, i, b } = {}) {
1119
+ async selectAddress({ body, cartId, buyNow, i, b } = {}) {
656
1120
  const { error } = PosCartValidator.selectAddress().validate(
657
1121
  { body, cartId, buyNow, i, b },
658
1122
  { abortEarly: false, allowUnknown: true }
@@ -660,6 +1124,20 @@ class PosCart {
660
1124
  if (error) {
661
1125
  return Promise.reject(new FDKClientValidationError(error));
662
1126
  }
1127
+
1128
+ // Showing warrnings if extra unknown parameters are found
1129
+ const { error: warrning } = PosCartValidator.selectAddress().validate(
1130
+ { body, cartId, buyNow, i, b },
1131
+ { abortEarly: false, allowUnknown: false }
1132
+ );
1133
+ if (warrning) {
1134
+ Logger({
1135
+ level: "WARN",
1136
+ message: "Parameter Validation warrnings for selectAddress",
1137
+ });
1138
+ Logger({ level: "WARN", message: warrning });
1139
+ }
1140
+
663
1141
  const query_params = {};
664
1142
  query_params["cart_id"] = cartId;
665
1143
  query_params["buy_now"] = buyNow;
@@ -668,7 +1146,7 @@ class PosCart {
668
1146
 
669
1147
  const xHeaders = {};
670
1148
 
671
- return APIClient.execute(
1149
+ const response = await APIClient.execute(
672
1150
  this._conf,
673
1151
  "post",
674
1152
  constructUrl({
@@ -679,6 +1157,23 @@ class PosCart {
679
1157
  body,
680
1158
  xHeaders
681
1159
  );
1160
+
1161
+ const {
1162
+ error: res_error,
1163
+ } = PosCartModel.CartDetailResponse().validate(response, {
1164
+ abortEarly: false,
1165
+ allowUnknown: false,
1166
+ });
1167
+
1168
+ if (res_error) {
1169
+ Logger({
1170
+ level: "WARN",
1171
+ message: "Response Validation Warnnings for selectAddress",
1172
+ });
1173
+ Logger({ level: "WARN", message: res_error });
1174
+ }
1175
+
1176
+ return response;
682
1177
  }
683
1178
 
684
1179
  /**
@@ -690,7 +1185,7 @@ class PosCart {
690
1185
  * @summary: Update cart payment
691
1186
  * @description: Use this API to update cart payment.
692
1187
  */
693
- selectPaymentMode({ body, id, buyNow } = {}) {
1188
+ async selectPaymentMode({ body, id, buyNow } = {}) {
694
1189
  const { error } = PosCartValidator.selectPaymentMode().validate(
695
1190
  { body, id, buyNow },
696
1191
  { abortEarly: false, allowUnknown: true }
@@ -698,13 +1193,27 @@ class PosCart {
698
1193
  if (error) {
699
1194
  return Promise.reject(new FDKClientValidationError(error));
700
1195
  }
1196
+
1197
+ // Showing warrnings if extra unknown parameters are found
1198
+ const { error: warrning } = PosCartValidator.selectPaymentMode().validate(
1199
+ { body, id, buyNow },
1200
+ { abortEarly: false, allowUnknown: false }
1201
+ );
1202
+ if (warrning) {
1203
+ Logger({
1204
+ level: "WARN",
1205
+ message: "Parameter Validation warrnings for selectPaymentMode",
1206
+ });
1207
+ Logger({ level: "WARN", message: warrning });
1208
+ }
1209
+
701
1210
  const query_params = {};
702
1211
  query_params["id"] = id;
703
1212
  query_params["buy_now"] = buyNow;
704
1213
 
705
1214
  const xHeaders = {};
706
1215
 
707
- return APIClient.execute(
1216
+ const response = await APIClient.execute(
708
1217
  this._conf,
709
1218
  "put",
710
1219
  constructUrl({
@@ -715,6 +1224,23 @@ class PosCart {
715
1224
  body,
716
1225
  xHeaders
717
1226
  );
1227
+
1228
+ const {
1229
+ error: res_error,
1230
+ } = PosCartModel.CartDetailResponse().validate(response, {
1231
+ abortEarly: false,
1232
+ allowUnknown: false,
1233
+ });
1234
+
1235
+ if (res_error) {
1236
+ Logger({
1237
+ level: "WARN",
1238
+ message: "Response Validation Warnnings for selectPaymentMode",
1239
+ });
1240
+ Logger({ level: "WARN", message: res_error });
1241
+ }
1242
+
1243
+ return response;
718
1244
  }
719
1245
 
720
1246
  /**
@@ -730,7 +1256,7 @@ class PosCart {
730
1256
  * @summary: Verify the coupon eligibility against the payment mode
731
1257
  * @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
732
1258
  */
733
- validateCouponForPayment({
1259
+ async validateCouponForPayment({
734
1260
  id,
735
1261
  buyNow,
736
1262
  addressId,
@@ -754,6 +1280,30 @@ class PosCart {
754
1280
  if (error) {
755
1281
  return Promise.reject(new FDKClientValidationError(error));
756
1282
  }
1283
+
1284
+ // Showing warrnings if extra unknown parameters are found
1285
+ const {
1286
+ error: warrning,
1287
+ } = PosCartValidator.validateCouponForPayment().validate(
1288
+ {
1289
+ id,
1290
+ buyNow,
1291
+ addressId,
1292
+ paymentMode,
1293
+ paymentIdentifier,
1294
+ aggregatorName,
1295
+ merchantCode,
1296
+ },
1297
+ { abortEarly: false, allowUnknown: false }
1298
+ );
1299
+ if (warrning) {
1300
+ Logger({
1301
+ level: "WARN",
1302
+ message: "Parameter Validation warrnings for validateCouponForPayment",
1303
+ });
1304
+ Logger({ level: "WARN", message: warrning });
1305
+ }
1306
+
757
1307
  const query_params = {};
758
1308
  query_params["id"] = id;
759
1309
  query_params["buy_now"] = buyNow;
@@ -765,7 +1315,7 @@ class PosCart {
765
1315
 
766
1316
  const xHeaders = {};
767
1317
 
768
- return APIClient.execute(
1318
+ const response = await APIClient.execute(
769
1319
  this._conf,
770
1320
  "get",
771
1321
  constructUrl({
@@ -776,6 +1326,23 @@ class PosCart {
776
1326
  undefined,
777
1327
  xHeaders
778
1328
  );
1329
+
1330
+ const {
1331
+ error: res_error,
1332
+ } = PosCartModel.PaymentCouponValidate().validate(response, {
1333
+ abortEarly: false,
1334
+ allowUnknown: false,
1335
+ });
1336
+
1337
+ if (res_error) {
1338
+ Logger({
1339
+ level: "WARN",
1340
+ message: "Response Validation Warnnings for validateCouponForPayment",
1341
+ });
1342
+ Logger({ level: "WARN", message: res_error });
1343
+ }
1344
+
1345
+ return response;
779
1346
  }
780
1347
 
781
1348
  /**
@@ -795,7 +1362,7 @@ class PosCart {
795
1362
  * @summary: Get delivery date and options before checkout
796
1363
  * @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
797
1364
  */
798
- getShipments({
1365
+ async getShipments({
799
1366
  pickAtStoreUid,
800
1367
  orderingStoreId,
801
1368
  p,
@@ -819,6 +1386,28 @@ class PosCart {
819
1386
  if (error) {
820
1387
  return Promise.reject(new FDKClientValidationError(error));
821
1388
  }
1389
+
1390
+ // Showing warrnings if extra unknown parameters are found
1391
+ const { error: warrning } = PosCartValidator.getShipments().validate(
1392
+ {
1393
+ pickAtStoreUid,
1394
+ orderingStoreId,
1395
+ p,
1396
+ id,
1397
+ addressId,
1398
+ areaCode,
1399
+ orderType,
1400
+ },
1401
+ { abortEarly: false, allowUnknown: false }
1402
+ );
1403
+ if (warrning) {
1404
+ Logger({
1405
+ level: "WARN",
1406
+ message: "Parameter Validation warrnings for getShipments",
1407
+ });
1408
+ Logger({ level: "WARN", message: warrning });
1409
+ }
1410
+
822
1411
  const query_params = {};
823
1412
  query_params["pick_at_store_uid"] = pickAtStoreUid;
824
1413
  query_params["ordering_store_id"] = orderingStoreId;
@@ -830,7 +1419,7 @@ class PosCart {
830
1419
 
831
1420
  const xHeaders = {};
832
1421
 
833
- return APIClient.execute(
1422
+ const response = await APIClient.execute(
834
1423
  this._conf,
835
1424
  "get",
836
1425
  constructUrl({
@@ -841,6 +1430,23 @@ class PosCart {
841
1430
  undefined,
842
1431
  xHeaders
843
1432
  );
1433
+
1434
+ const {
1435
+ error: res_error,
1436
+ } = PosCartModel.CartShipmentsResponse().validate(response, {
1437
+ abortEarly: false,
1438
+ allowUnknown: false,
1439
+ });
1440
+
1441
+ if (res_error) {
1442
+ Logger({
1443
+ level: "WARN",
1444
+ message: "Response Validation Warnnings for getShipments",
1445
+ });
1446
+ Logger({ level: "WARN", message: res_error });
1447
+ }
1448
+
1449
+ return response;
844
1450
  }
845
1451
 
846
1452
  /**
@@ -859,7 +1465,7 @@ class PosCart {
859
1465
  * @summary: Update shipment delivery type and quantity before checkout
860
1466
  * @description: Use this API to update the delivery type and quantity as per customer's preference for either store pick-up or home-delivery.
861
1467
  */
862
- updateShipments({ body, i, p, id, addressId, orderType } = {}) {
1468
+ async updateShipments({ body, i, p, id, addressId, orderType } = {}) {
863
1469
  const { error } = PosCartValidator.updateShipments().validate(
864
1470
  { body, i, p, id, addressId, orderType },
865
1471
  { abortEarly: false, allowUnknown: true }
@@ -867,6 +1473,20 @@ class PosCart {
867
1473
  if (error) {
868
1474
  return Promise.reject(new FDKClientValidationError(error));
869
1475
  }
1476
+
1477
+ // Showing warrnings if extra unknown parameters are found
1478
+ const { error: warrning } = PosCartValidator.updateShipments().validate(
1479
+ { body, i, p, id, addressId, orderType },
1480
+ { abortEarly: false, allowUnknown: false }
1481
+ );
1482
+ if (warrning) {
1483
+ Logger({
1484
+ level: "WARN",
1485
+ message: "Parameter Validation warrnings for updateShipments",
1486
+ });
1487
+ Logger({ level: "WARN", message: warrning });
1488
+ }
1489
+
870
1490
  const query_params = {};
871
1491
  query_params["i"] = i;
872
1492
  query_params["p"] = p;
@@ -876,7 +1496,7 @@ class PosCart {
876
1496
 
877
1497
  const xHeaders = {};
878
1498
 
879
- return APIClient.execute(
1499
+ const response = await APIClient.execute(
880
1500
  this._conf,
881
1501
  "put",
882
1502
  constructUrl({
@@ -887,6 +1507,23 @@ class PosCart {
887
1507
  body,
888
1508
  xHeaders
889
1509
  );
1510
+
1511
+ const {
1512
+ error: res_error,
1513
+ } = PosCartModel.CartShipmentsResponse().validate(response, {
1514
+ abortEarly: false,
1515
+ allowUnknown: false,
1516
+ });
1517
+
1518
+ if (res_error) {
1519
+ Logger({
1520
+ level: "WARN",
1521
+ message: "Response Validation Warnnings for updateShipments",
1522
+ });
1523
+ Logger({ level: "WARN", message: res_error });
1524
+ }
1525
+
1526
+ return response;
890
1527
  }
891
1528
 
892
1529
  /**
@@ -897,7 +1534,7 @@ class PosCart {
897
1534
  * @summary: Checkout all items in the cart
898
1535
  * @description: Use this API to checkout all items in the cart for payment and order generation. For COD, order will be generated directly, whereas for other checkout modes, user will be redirected to a payment gateway.
899
1536
  */
900
- checkoutCart({ body, id } = {}) {
1537
+ async checkoutCart({ body, id } = {}) {
901
1538
  const { error } = PosCartValidator.checkoutCart().validate(
902
1539
  { body, id },
903
1540
  { abortEarly: false, allowUnknown: true }
@@ -905,12 +1542,26 @@ class PosCart {
905
1542
  if (error) {
906
1543
  return Promise.reject(new FDKClientValidationError(error));
907
1544
  }
1545
+
1546
+ // Showing warrnings if extra unknown parameters are found
1547
+ const { error: warrning } = PosCartValidator.checkoutCart().validate(
1548
+ { body, id },
1549
+ { abortEarly: false, allowUnknown: false }
1550
+ );
1551
+ if (warrning) {
1552
+ Logger({
1553
+ level: "WARN",
1554
+ message: "Parameter Validation warrnings for checkoutCart",
1555
+ });
1556
+ Logger({ level: "WARN", message: warrning });
1557
+ }
1558
+
908
1559
  const query_params = {};
909
1560
  query_params["id"] = id;
910
1561
 
911
1562
  const xHeaders = {};
912
1563
 
913
- return APIClient.execute(
1564
+ const response = await APIClient.execute(
914
1565
  this._conf,
915
1566
  "post",
916
1567
  constructUrl({
@@ -921,6 +1572,23 @@ class PosCart {
921
1572
  body,
922
1573
  xHeaders
923
1574
  );
1575
+
1576
+ const {
1577
+ error: res_error,
1578
+ } = PosCartModel.CartCheckoutResponse().validate(response, {
1579
+ abortEarly: false,
1580
+ allowUnknown: false,
1581
+ });
1582
+
1583
+ if (res_error) {
1584
+ Logger({
1585
+ level: "WARN",
1586
+ message: "Response Validation Warnnings for checkoutCart",
1587
+ });
1588
+ Logger({ level: "WARN", message: res_error });
1589
+ }
1590
+
1591
+ return response;
924
1592
  }
925
1593
 
926
1594
  /**
@@ -932,7 +1600,7 @@ class PosCart {
932
1600
  * @summary: Update the cart meta
933
1601
  * @description: Use this API to update cart meta like checkout_mode and gstin.
934
1602
  */
935
- updateCartMeta({ body, id, buyNow } = {}) {
1603
+ async updateCartMeta({ body, id, buyNow } = {}) {
936
1604
  const { error } = PosCartValidator.updateCartMeta().validate(
937
1605
  { body, id, buyNow },
938
1606
  { abortEarly: false, allowUnknown: true }
@@ -940,13 +1608,27 @@ class PosCart {
940
1608
  if (error) {
941
1609
  return Promise.reject(new FDKClientValidationError(error));
942
1610
  }
1611
+
1612
+ // Showing warrnings if extra unknown parameters are found
1613
+ const { error: warrning } = PosCartValidator.updateCartMeta().validate(
1614
+ { body, id, buyNow },
1615
+ { abortEarly: false, allowUnknown: false }
1616
+ );
1617
+ if (warrning) {
1618
+ Logger({
1619
+ level: "WARN",
1620
+ message: "Parameter Validation warrnings for updateCartMeta",
1621
+ });
1622
+ Logger({ level: "WARN", message: warrning });
1623
+ }
1624
+
943
1625
  const query_params = {};
944
1626
  query_params["id"] = id;
945
1627
  query_params["buy_now"] = buyNow;
946
1628
 
947
1629
  const xHeaders = {};
948
1630
 
949
- return APIClient.execute(
1631
+ const response = await APIClient.execute(
950
1632
  this._conf,
951
1633
  "put",
952
1634
  constructUrl({
@@ -957,6 +1639,23 @@ class PosCart {
957
1639
  body,
958
1640
  xHeaders
959
1641
  );
1642
+
1643
+ const {
1644
+ error: res_error,
1645
+ } = PosCartModel.CartMetaResponse().validate(response, {
1646
+ abortEarly: false,
1647
+ allowUnknown: false,
1648
+ });
1649
+
1650
+ if (res_error) {
1651
+ Logger({
1652
+ level: "WARN",
1653
+ message: "Response Validation Warnnings for updateCartMeta",
1654
+ });
1655
+ Logger({ level: "WARN", message: res_error });
1656
+ }
1657
+
1658
+ return response;
960
1659
  }
961
1660
 
962
1661
  /**
@@ -967,7 +1666,7 @@ class PosCart {
967
1666
  * @summary: Get available delivery modes for cart
968
1667
  * @description: Use this API to get the delivery modes (home-delivery/store-pickup) along with a list of pickup stores available for a given cart at a given PIN Code. User can then view the address of a pickup store with the help of store-address API.
969
1668
  */
970
- getAvailableDeliveryModes({ areaCode, id } = {}) {
1669
+ async getAvailableDeliveryModes({ areaCode, id } = {}) {
971
1670
  const { error } = PosCartValidator.getAvailableDeliveryModes().validate(
972
1671
  { areaCode, id },
973
1672
  { abortEarly: false, allowUnknown: true }
@@ -975,13 +1674,29 @@ class PosCart {
975
1674
  if (error) {
976
1675
  return Promise.reject(new FDKClientValidationError(error));
977
1676
  }
1677
+
1678
+ // Showing warrnings if extra unknown parameters are found
1679
+ const {
1680
+ error: warrning,
1681
+ } = PosCartValidator.getAvailableDeliveryModes().validate(
1682
+ { areaCode, id },
1683
+ { abortEarly: false, allowUnknown: false }
1684
+ );
1685
+ if (warrning) {
1686
+ Logger({
1687
+ level: "WARN",
1688
+ message: "Parameter Validation warrnings for getAvailableDeliveryModes",
1689
+ });
1690
+ Logger({ level: "WARN", message: warrning });
1691
+ }
1692
+
978
1693
  const query_params = {};
979
1694
  query_params["area_code"] = areaCode;
980
1695
  query_params["id"] = id;
981
1696
 
982
1697
  const xHeaders = {};
983
1698
 
984
- return APIClient.execute(
1699
+ const response = await APIClient.execute(
985
1700
  this._conf,
986
1701
  "get",
987
1702
  constructUrl({
@@ -992,6 +1707,23 @@ class PosCart {
992
1707
  undefined,
993
1708
  xHeaders
994
1709
  );
1710
+
1711
+ const {
1712
+ error: res_error,
1713
+ } = PosCartModel.CartDeliveryModesResponse().validate(response, {
1714
+ abortEarly: false,
1715
+ allowUnknown: false,
1716
+ });
1717
+
1718
+ if (res_error) {
1719
+ Logger({
1720
+ level: "WARN",
1721
+ message: "Response Validation Warnnings for getAvailableDeliveryModes",
1722
+ });
1723
+ Logger({ level: "WARN", message: res_error });
1724
+ }
1725
+
1726
+ return response;
995
1727
  }
996
1728
 
997
1729
  /**
@@ -1001,7 +1733,7 @@ class PosCart {
1001
1733
  * @summary: Get list of stores for give uids
1002
1734
  * @description: Use this API to get the store details by entering the unique identifier of the pickup stores shown in the response of available-delivery-mode API.
1003
1735
  */
1004
- getStoreAddressByUid({ storeUid } = {}) {
1736
+ async getStoreAddressByUid({ storeUid } = {}) {
1005
1737
  const { error } = PosCartValidator.getStoreAddressByUid().validate(
1006
1738
  { storeUid },
1007
1739
  { abortEarly: false, allowUnknown: true }
@@ -1009,12 +1741,28 @@ class PosCart {
1009
1741
  if (error) {
1010
1742
  return Promise.reject(new FDKClientValidationError(error));
1011
1743
  }
1744
+
1745
+ // Showing warrnings if extra unknown parameters are found
1746
+ const {
1747
+ error: warrning,
1748
+ } = PosCartValidator.getStoreAddressByUid().validate(
1749
+ { storeUid },
1750
+ { abortEarly: false, allowUnknown: false }
1751
+ );
1752
+ if (warrning) {
1753
+ Logger({
1754
+ level: "WARN",
1755
+ message: "Parameter Validation warrnings for getStoreAddressByUid",
1756
+ });
1757
+ Logger({ level: "WARN", message: warrning });
1758
+ }
1759
+
1012
1760
  const query_params = {};
1013
1761
  query_params["store_uid"] = storeUid;
1014
1762
 
1015
1763
  const xHeaders = {};
1016
1764
 
1017
- return APIClient.execute(
1765
+ const response = await APIClient.execute(
1018
1766
  this._conf,
1019
1767
  "get",
1020
1768
  constructUrl({
@@ -1025,6 +1773,23 @@ class PosCart {
1025
1773
  undefined,
1026
1774
  xHeaders
1027
1775
  );
1776
+
1777
+ const {
1778
+ error: res_error,
1779
+ } = PosCartModel.StoreDetailsResponse().validate(response, {
1780
+ abortEarly: false,
1781
+ allowUnknown: false,
1782
+ });
1783
+
1784
+ if (res_error) {
1785
+ Logger({
1786
+ level: "WARN",
1787
+ message: "Response Validation Warnnings for getStoreAddressByUid",
1788
+ });
1789
+ Logger({ level: "WARN", message: res_error });
1790
+ }
1791
+
1792
+ return response;
1028
1793
  }
1029
1794
 
1030
1795
  /**
@@ -1034,7 +1799,7 @@ class PosCart {
1034
1799
  * @summary: Generate token for sharing the cart
1035
1800
  * @description: Use this API to generate a shared cart snapshot and return a shortlink token. The link can be shared with other users for getting the same items in their cart.
1036
1801
  */
1037
- getCartShareLink({ body } = {}) {
1802
+ async getCartShareLink({ body } = {}) {
1038
1803
  const { error } = PosCartValidator.getCartShareLink().validate(
1039
1804
  { body },
1040
1805
  { abortEarly: false, allowUnknown: true }
@@ -1042,11 +1807,25 @@ class PosCart {
1042
1807
  if (error) {
1043
1808
  return Promise.reject(new FDKClientValidationError(error));
1044
1809
  }
1810
+
1811
+ // Showing warrnings if extra unknown parameters are found
1812
+ const { error: warrning } = PosCartValidator.getCartShareLink().validate(
1813
+ { body },
1814
+ { abortEarly: false, allowUnknown: false }
1815
+ );
1816
+ if (warrning) {
1817
+ Logger({
1818
+ level: "WARN",
1819
+ message: "Parameter Validation warrnings for getCartShareLink",
1820
+ });
1821
+ Logger({ level: "WARN", message: warrning });
1822
+ }
1823
+
1045
1824
  const query_params = {};
1046
1825
 
1047
1826
  const xHeaders = {};
1048
1827
 
1049
- return APIClient.execute(
1828
+ const response = await APIClient.execute(
1050
1829
  this._conf,
1051
1830
  "post",
1052
1831
  constructUrl({
@@ -1057,6 +1836,23 @@ class PosCart {
1057
1836
  body,
1058
1837
  xHeaders
1059
1838
  );
1839
+
1840
+ const {
1841
+ error: res_error,
1842
+ } = PosCartModel.GetShareCartLinkResponse().validate(response, {
1843
+ abortEarly: false,
1844
+ allowUnknown: false,
1845
+ });
1846
+
1847
+ if (res_error) {
1848
+ Logger({
1849
+ level: "WARN",
1850
+ message: "Response Validation Warnnings for getCartShareLink",
1851
+ });
1852
+ Logger({ level: "WARN", message: res_error });
1853
+ }
1854
+
1855
+ return response;
1060
1856
  }
1061
1857
 
1062
1858
  /**
@@ -1066,7 +1862,7 @@ class PosCart {
1066
1862
  * @summary: Get details of a shared cart
1067
1863
  * @description: Use this API to get the shared cart details as per the token generated using the share-cart API.
1068
1864
  */
1069
- getCartSharedItems({ token } = {}) {
1865
+ async getCartSharedItems({ token } = {}) {
1070
1866
  const { error } = PosCartValidator.getCartSharedItems().validate(
1071
1867
  { token },
1072
1868
  { abortEarly: false, allowUnknown: true }
@@ -1074,11 +1870,25 @@ class PosCart {
1074
1870
  if (error) {
1075
1871
  return Promise.reject(new FDKClientValidationError(error));
1076
1872
  }
1873
+
1874
+ // Showing warrnings if extra unknown parameters are found
1875
+ const { error: warrning } = PosCartValidator.getCartSharedItems().validate(
1876
+ { token },
1877
+ { abortEarly: false, allowUnknown: false }
1878
+ );
1879
+ if (warrning) {
1880
+ Logger({
1881
+ level: "WARN",
1882
+ message: "Parameter Validation warrnings for getCartSharedItems",
1883
+ });
1884
+ Logger({ level: "WARN", message: warrning });
1885
+ }
1886
+
1077
1887
  const query_params = {};
1078
1888
 
1079
1889
  const xHeaders = {};
1080
1890
 
1081
- return APIClient.execute(
1891
+ const response = await APIClient.execute(
1082
1892
  this._conf,
1083
1893
  "get",
1084
1894
  constructUrl({
@@ -1089,6 +1899,23 @@ class PosCart {
1089
1899
  undefined,
1090
1900
  xHeaders
1091
1901
  );
1902
+
1903
+ const {
1904
+ error: res_error,
1905
+ } = PosCartModel.SharedCartResponse().validate(response, {
1906
+ abortEarly: false,
1907
+ allowUnknown: false,
1908
+ });
1909
+
1910
+ if (res_error) {
1911
+ Logger({
1912
+ level: "WARN",
1913
+ message: "Response Validation Warnnings for getCartSharedItems",
1914
+ });
1915
+ Logger({ level: "WARN", message: res_error });
1916
+ }
1917
+
1918
+ return response;
1092
1919
  }
1093
1920
 
1094
1921
  /**
@@ -1100,7 +1927,7 @@ class PosCart {
1100
1927
  * @summary: Merge or replace existing cart
1101
1928
  * @description: Use this API to merge the shared cart with existing cart, or replace the existing cart with the shared cart. The `action` parameter is used to indicate the operation Merge or Replace.
1102
1929
  */
1103
- updateCartWithSharedItems({ token, action } = {}) {
1930
+ async updateCartWithSharedItems({ token, action } = {}) {
1104
1931
  const { error } = PosCartValidator.updateCartWithSharedItems().validate(
1105
1932
  { token, action },
1106
1933
  { abortEarly: false, allowUnknown: true }
@@ -1108,11 +1935,27 @@ class PosCart {
1108
1935
  if (error) {
1109
1936
  return Promise.reject(new FDKClientValidationError(error));
1110
1937
  }
1938
+
1939
+ // Showing warrnings if extra unknown parameters are found
1940
+ const {
1941
+ error: warrning,
1942
+ } = PosCartValidator.updateCartWithSharedItems().validate(
1943
+ { token, action },
1944
+ { abortEarly: false, allowUnknown: false }
1945
+ );
1946
+ if (warrning) {
1947
+ Logger({
1948
+ level: "WARN",
1949
+ message: "Parameter Validation warrnings for updateCartWithSharedItems",
1950
+ });
1951
+ Logger({ level: "WARN", message: warrning });
1952
+ }
1953
+
1111
1954
  const query_params = {};
1112
1955
 
1113
1956
  const xHeaders = {};
1114
1957
 
1115
- return APIClient.execute(
1958
+ const response = await APIClient.execute(
1116
1959
  this._conf,
1117
1960
  "post",
1118
1961
  constructUrl({
@@ -1123,6 +1966,23 @@ class PosCart {
1123
1966
  undefined,
1124
1967
  xHeaders
1125
1968
  );
1969
+
1970
+ const {
1971
+ error: res_error,
1972
+ } = PosCartModel.SharedCartResponse().validate(response, {
1973
+ abortEarly: false,
1974
+ allowUnknown: false,
1975
+ });
1976
+
1977
+ if (res_error) {
1978
+ Logger({
1979
+ level: "WARN",
1980
+ message: "Response Validation Warnnings for updateCartWithSharedItems",
1981
+ });
1982
+ Logger({ level: "WARN", message: res_error });
1983
+ }
1984
+
1985
+ return response;
1126
1986
  }
1127
1987
  }
1128
1988