@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.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -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 CartValidator = require("./CartApplicationValidator");
|
|
6
|
+
const CartModel = require("./CartApplicationModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
6
8
|
|
|
7
9
|
class Cart {
|
|
8
10
|
constructor(_conf) {
|
|
@@ -65,7 +67,7 @@ class Cart {
|
|
|
65
67
|
* @summary: Fetch all items added to the cart
|
|
66
68
|
* @description: Use this API to get details of all the items added to a cart.
|
|
67
69
|
*/
|
|
68
|
-
getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
|
|
70
|
+
async getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
|
|
69
71
|
const { error } = CartValidator.getCart().validate(
|
|
70
72
|
{ id, i, b, assignCardId, areaCode, buyNow },
|
|
71
73
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -80,8 +82,11 @@ class Cart {
|
|
|
80
82
|
{ abortEarly: false, allowUnknown: false }
|
|
81
83
|
);
|
|
82
84
|
if (warrning) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
Logger({
|
|
86
|
+
level: "WARN",
|
|
87
|
+
message: "Parameter Validation warrnings for getCart",
|
|
88
|
+
});
|
|
89
|
+
Logger({ level: "WARN", message: warrning });
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
const query_params = {};
|
|
@@ -94,7 +99,7 @@ class Cart {
|
|
|
94
99
|
|
|
95
100
|
const xHeaders = {};
|
|
96
101
|
|
|
97
|
-
|
|
102
|
+
const response = await APIClient.execute(
|
|
98
103
|
this._conf,
|
|
99
104
|
"get",
|
|
100
105
|
constructUrl({
|
|
@@ -105,6 +110,23 @@ class Cart {
|
|
|
105
110
|
undefined,
|
|
106
111
|
xHeaders
|
|
107
112
|
);
|
|
113
|
+
|
|
114
|
+
const {
|
|
115
|
+
error: res_error,
|
|
116
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
117
|
+
abortEarly: false,
|
|
118
|
+
allowUnknown: false,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (res_error) {
|
|
122
|
+
Logger({
|
|
123
|
+
level: "WARN",
|
|
124
|
+
message: "Response Validation Warnnings for getCart",
|
|
125
|
+
});
|
|
126
|
+
Logger({ level: "WARN", message: res_error });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return response;
|
|
108
130
|
}
|
|
109
131
|
|
|
110
132
|
/**
|
|
@@ -114,7 +136,7 @@ class Cart {
|
|
|
114
136
|
* @summary: Fetch last-modified timestamp
|
|
115
137
|
* @description: Use this API to fetch Last-Modified timestamp in header metadata.
|
|
116
138
|
*/
|
|
117
|
-
getCartLastModified({ id } = {}) {
|
|
139
|
+
async getCartLastModified({ id } = {}) {
|
|
118
140
|
const { error } = CartValidator.getCartLastModified().validate(
|
|
119
141
|
{ id },
|
|
120
142
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -129,8 +151,11 @@ class Cart {
|
|
|
129
151
|
{ abortEarly: false, allowUnknown: false }
|
|
130
152
|
);
|
|
131
153
|
if (warrning) {
|
|
132
|
-
|
|
133
|
-
|
|
154
|
+
Logger({
|
|
155
|
+
level: "WARN",
|
|
156
|
+
message: "Parameter Validation warrnings for getCartLastModified",
|
|
157
|
+
});
|
|
158
|
+
Logger({ level: "WARN", message: warrning });
|
|
134
159
|
}
|
|
135
160
|
|
|
136
161
|
const query_params = {};
|
|
@@ -138,7 +163,7 @@ class Cart {
|
|
|
138
163
|
|
|
139
164
|
const xHeaders = {};
|
|
140
165
|
|
|
141
|
-
|
|
166
|
+
const response = await APIClient.execute(
|
|
142
167
|
this._conf,
|
|
143
168
|
"head",
|
|
144
169
|
constructUrl({
|
|
@@ -149,6 +174,20 @@ class Cart {
|
|
|
149
174
|
undefined,
|
|
150
175
|
xHeaders
|
|
151
176
|
);
|
|
177
|
+
|
|
178
|
+
const { error: res_error } = Joi.string()
|
|
179
|
+
.allow("")
|
|
180
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
181
|
+
|
|
182
|
+
if (res_error) {
|
|
183
|
+
Logger({
|
|
184
|
+
level: "WARN",
|
|
185
|
+
message: "Response Validation Warnnings for getCartLastModified",
|
|
186
|
+
});
|
|
187
|
+
Logger({ level: "WARN", message: res_error });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return response;
|
|
152
191
|
}
|
|
153
192
|
|
|
154
193
|
/**
|
|
@@ -162,7 +201,7 @@ class Cart {
|
|
|
162
201
|
* @summary: Add items to cart
|
|
163
202
|
* @description: Use this API to add items to the cart.
|
|
164
203
|
*/
|
|
165
|
-
addItems({ body, i, b, areaCode, buyNow } = {}) {
|
|
204
|
+
async addItems({ body, i, b, areaCode, buyNow } = {}) {
|
|
166
205
|
const { error } = CartValidator.addItems().validate(
|
|
167
206
|
{ body, i, b, areaCode, buyNow },
|
|
168
207
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -177,8 +216,11 @@ class Cart {
|
|
|
177
216
|
{ abortEarly: false, allowUnknown: false }
|
|
178
217
|
);
|
|
179
218
|
if (warrning) {
|
|
180
|
-
|
|
181
|
-
|
|
219
|
+
Logger({
|
|
220
|
+
level: "WARN",
|
|
221
|
+
message: "Parameter Validation warrnings for addItems",
|
|
222
|
+
});
|
|
223
|
+
Logger({ level: "WARN", message: warrning });
|
|
182
224
|
}
|
|
183
225
|
|
|
184
226
|
const query_params = {};
|
|
@@ -189,7 +231,7 @@ class Cart {
|
|
|
189
231
|
|
|
190
232
|
const xHeaders = {};
|
|
191
233
|
|
|
192
|
-
|
|
234
|
+
const response = await APIClient.execute(
|
|
193
235
|
this._conf,
|
|
194
236
|
"post",
|
|
195
237
|
constructUrl({
|
|
@@ -200,6 +242,23 @@ class Cart {
|
|
|
200
242
|
body,
|
|
201
243
|
xHeaders
|
|
202
244
|
);
|
|
245
|
+
|
|
246
|
+
const {
|
|
247
|
+
error: res_error,
|
|
248
|
+
} = CartModel.AddCartDetailResponse().validate(response, {
|
|
249
|
+
abortEarly: false,
|
|
250
|
+
allowUnknown: false,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
if (res_error) {
|
|
254
|
+
Logger({
|
|
255
|
+
level: "WARN",
|
|
256
|
+
message: "Response Validation Warnnings for addItems",
|
|
257
|
+
});
|
|
258
|
+
Logger({ level: "WARN", message: res_error });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return response;
|
|
203
262
|
}
|
|
204
263
|
|
|
205
264
|
/**
|
|
@@ -214,7 +273,7 @@ class Cart {
|
|
|
214
273
|
* @summary: Update items in the cart
|
|
215
274
|
* @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>
|
|
216
275
|
*/
|
|
217
|
-
updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
|
|
276
|
+
async updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
|
|
218
277
|
const { error } = CartValidator.updateCart().validate(
|
|
219
278
|
{ body, id, i, b, areaCode, buyNow },
|
|
220
279
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -229,8 +288,11 @@ class Cart {
|
|
|
229
288
|
{ abortEarly: false, allowUnknown: false }
|
|
230
289
|
);
|
|
231
290
|
if (warrning) {
|
|
232
|
-
|
|
233
|
-
|
|
291
|
+
Logger({
|
|
292
|
+
level: "WARN",
|
|
293
|
+
message: "Parameter Validation warrnings for updateCart",
|
|
294
|
+
});
|
|
295
|
+
Logger({ level: "WARN", message: warrning });
|
|
234
296
|
}
|
|
235
297
|
|
|
236
298
|
const query_params = {};
|
|
@@ -242,7 +304,7 @@ class Cart {
|
|
|
242
304
|
|
|
243
305
|
const xHeaders = {};
|
|
244
306
|
|
|
245
|
-
|
|
307
|
+
const response = await APIClient.execute(
|
|
246
308
|
this._conf,
|
|
247
309
|
"put",
|
|
248
310
|
constructUrl({
|
|
@@ -253,6 +315,23 @@ class Cart {
|
|
|
253
315
|
body,
|
|
254
316
|
xHeaders
|
|
255
317
|
);
|
|
318
|
+
|
|
319
|
+
const {
|
|
320
|
+
error: res_error,
|
|
321
|
+
} = CartModel.UpdateCartDetailResponse().validate(response, {
|
|
322
|
+
abortEarly: false,
|
|
323
|
+
allowUnknown: false,
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
if (res_error) {
|
|
327
|
+
Logger({
|
|
328
|
+
level: "WARN",
|
|
329
|
+
message: "Response Validation Warnnings for updateCart",
|
|
330
|
+
});
|
|
331
|
+
Logger({ level: "WARN", message: res_error });
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return response;
|
|
256
335
|
}
|
|
257
336
|
|
|
258
337
|
/**
|
|
@@ -263,7 +342,7 @@ class Cart {
|
|
|
263
342
|
* @summary: Count items in the cart
|
|
264
343
|
* @description: Use this API to get the total number of items present in cart.
|
|
265
344
|
*/
|
|
266
|
-
getItemCount({ id, buyNow } = {}) {
|
|
345
|
+
async getItemCount({ id, buyNow } = {}) {
|
|
267
346
|
const { error } = CartValidator.getItemCount().validate(
|
|
268
347
|
{ id, buyNow },
|
|
269
348
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -278,8 +357,11 @@ class Cart {
|
|
|
278
357
|
{ abortEarly: false, allowUnknown: false }
|
|
279
358
|
);
|
|
280
359
|
if (warrning) {
|
|
281
|
-
|
|
282
|
-
|
|
360
|
+
Logger({
|
|
361
|
+
level: "WARN",
|
|
362
|
+
message: "Parameter Validation warrnings for getItemCount",
|
|
363
|
+
});
|
|
364
|
+
Logger({ level: "WARN", message: warrning });
|
|
283
365
|
}
|
|
284
366
|
|
|
285
367
|
const query_params = {};
|
|
@@ -288,7 +370,7 @@ class Cart {
|
|
|
288
370
|
|
|
289
371
|
const xHeaders = {};
|
|
290
372
|
|
|
291
|
-
|
|
373
|
+
const response = await APIClient.execute(
|
|
292
374
|
this._conf,
|
|
293
375
|
"get",
|
|
294
376
|
constructUrl({
|
|
@@ -299,6 +381,23 @@ class Cart {
|
|
|
299
381
|
undefined,
|
|
300
382
|
xHeaders
|
|
301
383
|
);
|
|
384
|
+
|
|
385
|
+
const {
|
|
386
|
+
error: res_error,
|
|
387
|
+
} = CartModel.CartItemCountResponse().validate(response, {
|
|
388
|
+
abortEarly: false,
|
|
389
|
+
allowUnknown: false,
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
if (res_error) {
|
|
393
|
+
Logger({
|
|
394
|
+
level: "WARN",
|
|
395
|
+
message: "Response Validation Warnnings for getItemCount",
|
|
396
|
+
});
|
|
397
|
+
Logger({ level: "WARN", message: res_error });
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return response;
|
|
302
401
|
}
|
|
303
402
|
|
|
304
403
|
/**
|
|
@@ -309,7 +408,7 @@ class Cart {
|
|
|
309
408
|
* @summary: Fetch Coupon
|
|
310
409
|
* @description: Use this API to get a list of available coupons along with their details.
|
|
311
410
|
*/
|
|
312
|
-
getCoupons({ id, buyNow } = {}) {
|
|
411
|
+
async getCoupons({ id, buyNow } = {}) {
|
|
313
412
|
const { error } = CartValidator.getCoupons().validate(
|
|
314
413
|
{ id, buyNow },
|
|
315
414
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -324,8 +423,11 @@ class Cart {
|
|
|
324
423
|
{ abortEarly: false, allowUnknown: false }
|
|
325
424
|
);
|
|
326
425
|
if (warrning) {
|
|
327
|
-
|
|
328
|
-
|
|
426
|
+
Logger({
|
|
427
|
+
level: "WARN",
|
|
428
|
+
message: "Parameter Validation warrnings for getCoupons",
|
|
429
|
+
});
|
|
430
|
+
Logger({ level: "WARN", message: warrning });
|
|
329
431
|
}
|
|
330
432
|
|
|
331
433
|
const query_params = {};
|
|
@@ -334,7 +436,7 @@ class Cart {
|
|
|
334
436
|
|
|
335
437
|
const xHeaders = {};
|
|
336
438
|
|
|
337
|
-
|
|
439
|
+
const response = await APIClient.execute(
|
|
338
440
|
this._conf,
|
|
339
441
|
"get",
|
|
340
442
|
constructUrl({
|
|
@@ -345,6 +447,23 @@ class Cart {
|
|
|
345
447
|
undefined,
|
|
346
448
|
xHeaders
|
|
347
449
|
);
|
|
450
|
+
|
|
451
|
+
const {
|
|
452
|
+
error: res_error,
|
|
453
|
+
} = CartModel.GetCouponResponse().validate(response, {
|
|
454
|
+
abortEarly: false,
|
|
455
|
+
allowUnknown: false,
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
if (res_error) {
|
|
459
|
+
Logger({
|
|
460
|
+
level: "WARN",
|
|
461
|
+
message: "Response Validation Warnnings for getCoupons",
|
|
462
|
+
});
|
|
463
|
+
Logger({ level: "WARN", message: res_error });
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return response;
|
|
348
467
|
}
|
|
349
468
|
|
|
350
469
|
/**
|
|
@@ -359,7 +478,7 @@ class Cart {
|
|
|
359
478
|
* @summary: Apply Coupon
|
|
360
479
|
* @description: Use this API to apply coupons on items in the cart.
|
|
361
480
|
*/
|
|
362
|
-
applyCoupon({ body, i, b, p, id, buyNow } = {}) {
|
|
481
|
+
async applyCoupon({ body, i, b, p, id, buyNow } = {}) {
|
|
363
482
|
const { error } = CartValidator.applyCoupon().validate(
|
|
364
483
|
{ body, i, b, p, id, buyNow },
|
|
365
484
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -374,8 +493,11 @@ class Cart {
|
|
|
374
493
|
{ abortEarly: false, allowUnknown: false }
|
|
375
494
|
);
|
|
376
495
|
if (warrning) {
|
|
377
|
-
|
|
378
|
-
|
|
496
|
+
Logger({
|
|
497
|
+
level: "WARN",
|
|
498
|
+
message: "Parameter Validation warrnings for applyCoupon",
|
|
499
|
+
});
|
|
500
|
+
Logger({ level: "WARN", message: warrning });
|
|
379
501
|
}
|
|
380
502
|
|
|
381
503
|
const query_params = {};
|
|
@@ -387,7 +509,7 @@ class Cart {
|
|
|
387
509
|
|
|
388
510
|
const xHeaders = {};
|
|
389
511
|
|
|
390
|
-
|
|
512
|
+
const response = await APIClient.execute(
|
|
391
513
|
this._conf,
|
|
392
514
|
"post",
|
|
393
515
|
constructUrl({
|
|
@@ -398,6 +520,23 @@ class Cart {
|
|
|
398
520
|
body,
|
|
399
521
|
xHeaders
|
|
400
522
|
);
|
|
523
|
+
|
|
524
|
+
const {
|
|
525
|
+
error: res_error,
|
|
526
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
527
|
+
abortEarly: false,
|
|
528
|
+
allowUnknown: false,
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
if (res_error) {
|
|
532
|
+
Logger({
|
|
533
|
+
level: "WARN",
|
|
534
|
+
message: "Response Validation Warnnings for applyCoupon",
|
|
535
|
+
});
|
|
536
|
+
Logger({ level: "WARN", message: res_error });
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return response;
|
|
401
540
|
}
|
|
402
541
|
|
|
403
542
|
/**
|
|
@@ -408,7 +547,7 @@ class Cart {
|
|
|
408
547
|
* @summary: Remove Coupon Applied
|
|
409
548
|
* @description: Remove Coupon applied on the cart by passing uid in request body.
|
|
410
549
|
*/
|
|
411
|
-
removeCoupon({ id, buyNow } = {}) {
|
|
550
|
+
async removeCoupon({ id, buyNow } = {}) {
|
|
412
551
|
const { error } = CartValidator.removeCoupon().validate(
|
|
413
552
|
{ id, buyNow },
|
|
414
553
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -423,8 +562,11 @@ class Cart {
|
|
|
423
562
|
{ abortEarly: false, allowUnknown: false }
|
|
424
563
|
);
|
|
425
564
|
if (warrning) {
|
|
426
|
-
|
|
427
|
-
|
|
565
|
+
Logger({
|
|
566
|
+
level: "WARN",
|
|
567
|
+
message: "Parameter Validation warrnings for removeCoupon",
|
|
568
|
+
});
|
|
569
|
+
Logger({ level: "WARN", message: warrning });
|
|
428
570
|
}
|
|
429
571
|
|
|
430
572
|
const query_params = {};
|
|
@@ -433,7 +575,7 @@ class Cart {
|
|
|
433
575
|
|
|
434
576
|
const xHeaders = {};
|
|
435
577
|
|
|
436
|
-
|
|
578
|
+
const response = await APIClient.execute(
|
|
437
579
|
this._conf,
|
|
438
580
|
"delete",
|
|
439
581
|
constructUrl({
|
|
@@ -444,6 +586,23 @@ class Cart {
|
|
|
444
586
|
undefined,
|
|
445
587
|
xHeaders
|
|
446
588
|
);
|
|
589
|
+
|
|
590
|
+
const {
|
|
591
|
+
error: res_error,
|
|
592
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
593
|
+
abortEarly: false,
|
|
594
|
+
allowUnknown: false,
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
if (res_error) {
|
|
598
|
+
Logger({
|
|
599
|
+
level: "WARN",
|
|
600
|
+
message: "Response Validation Warnnings for removeCoupon",
|
|
601
|
+
});
|
|
602
|
+
Logger({ level: "WARN", message: res_error });
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
return response;
|
|
447
606
|
}
|
|
448
607
|
|
|
449
608
|
/**
|
|
@@ -458,7 +617,7 @@ class Cart {
|
|
|
458
617
|
* @summary: Get discount offers based on quantity
|
|
459
618
|
* @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.
|
|
460
619
|
*/
|
|
461
|
-
getBulkDiscountOffers({ itemId, articleId, uid, slug } = {}) {
|
|
620
|
+
async getBulkDiscountOffers({ itemId, articleId, uid, slug } = {}) {
|
|
462
621
|
const { error } = CartValidator.getBulkDiscountOffers().validate(
|
|
463
622
|
{ itemId, articleId, uid, slug },
|
|
464
623
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -473,8 +632,11 @@ class Cart {
|
|
|
473
632
|
{ abortEarly: false, allowUnknown: false }
|
|
474
633
|
);
|
|
475
634
|
if (warrning) {
|
|
476
|
-
|
|
477
|
-
|
|
635
|
+
Logger({
|
|
636
|
+
level: "WARN",
|
|
637
|
+
message: "Parameter Validation warrnings for getBulkDiscountOffers",
|
|
638
|
+
});
|
|
639
|
+
Logger({ level: "WARN", message: warrning });
|
|
478
640
|
}
|
|
479
641
|
|
|
480
642
|
const query_params = {};
|
|
@@ -485,7 +647,7 @@ class Cart {
|
|
|
485
647
|
|
|
486
648
|
const xHeaders = {};
|
|
487
649
|
|
|
488
|
-
|
|
650
|
+
const response = await APIClient.execute(
|
|
489
651
|
this._conf,
|
|
490
652
|
"get",
|
|
491
653
|
constructUrl({
|
|
@@ -496,6 +658,23 @@ class Cart {
|
|
|
496
658
|
undefined,
|
|
497
659
|
xHeaders
|
|
498
660
|
);
|
|
661
|
+
|
|
662
|
+
const {
|
|
663
|
+
error: res_error,
|
|
664
|
+
} = CartModel.BulkPriceResponse().validate(response, {
|
|
665
|
+
abortEarly: false,
|
|
666
|
+
allowUnknown: false,
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
if (res_error) {
|
|
670
|
+
Logger({
|
|
671
|
+
level: "WARN",
|
|
672
|
+
message: "Response Validation Warnnings for getBulkDiscountOffers",
|
|
673
|
+
});
|
|
674
|
+
Logger({ level: "WARN", message: res_error });
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return response;
|
|
499
678
|
}
|
|
500
679
|
|
|
501
680
|
/**
|
|
@@ -509,7 +688,7 @@ class Cart {
|
|
|
509
688
|
* @summary: Apply reward points at cart
|
|
510
689
|
* @description: Use this API to redeem a fixed no. of reward points by applying it to the cart.
|
|
511
690
|
*/
|
|
512
|
-
applyRewardPoints({ body, id, i, b, buyNow } = {}) {
|
|
691
|
+
async applyRewardPoints({ body, id, i, b, buyNow } = {}) {
|
|
513
692
|
const { error } = CartValidator.applyRewardPoints().validate(
|
|
514
693
|
{ body, id, i, b, buyNow },
|
|
515
694
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -524,8 +703,11 @@ class Cart {
|
|
|
524
703
|
{ abortEarly: false, allowUnknown: false }
|
|
525
704
|
);
|
|
526
705
|
if (warrning) {
|
|
527
|
-
|
|
528
|
-
|
|
706
|
+
Logger({
|
|
707
|
+
level: "WARN",
|
|
708
|
+
message: "Parameter Validation warrnings for applyRewardPoints",
|
|
709
|
+
});
|
|
710
|
+
Logger({ level: "WARN", message: warrning });
|
|
529
711
|
}
|
|
530
712
|
|
|
531
713
|
const query_params = {};
|
|
@@ -536,7 +718,7 @@ class Cart {
|
|
|
536
718
|
|
|
537
719
|
const xHeaders = {};
|
|
538
720
|
|
|
539
|
-
|
|
721
|
+
const response = await APIClient.execute(
|
|
540
722
|
this._conf,
|
|
541
723
|
"post",
|
|
542
724
|
constructUrl({
|
|
@@ -547,6 +729,23 @@ class Cart {
|
|
|
547
729
|
body,
|
|
548
730
|
xHeaders
|
|
549
731
|
);
|
|
732
|
+
|
|
733
|
+
const {
|
|
734
|
+
error: res_error,
|
|
735
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
736
|
+
abortEarly: false,
|
|
737
|
+
allowUnknown: false,
|
|
738
|
+
});
|
|
739
|
+
|
|
740
|
+
if (res_error) {
|
|
741
|
+
Logger({
|
|
742
|
+
level: "WARN",
|
|
743
|
+
message: "Response Validation Warnnings for applyRewardPoints",
|
|
744
|
+
});
|
|
745
|
+
Logger({ level: "WARN", message: res_error });
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return response;
|
|
550
749
|
}
|
|
551
750
|
|
|
552
751
|
/**
|
|
@@ -561,7 +760,7 @@ class Cart {
|
|
|
561
760
|
* @summary: Fetch address
|
|
562
761
|
* @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>
|
|
563
762
|
*/
|
|
564
|
-
getAddresses({
|
|
763
|
+
async getAddresses({
|
|
565
764
|
cartId,
|
|
566
765
|
buyNow,
|
|
567
766
|
mobileNo,
|
|
@@ -583,8 +782,11 @@ class Cart {
|
|
|
583
782
|
{ abortEarly: false, allowUnknown: false }
|
|
584
783
|
);
|
|
585
784
|
if (warrning) {
|
|
586
|
-
|
|
587
|
-
|
|
785
|
+
Logger({
|
|
786
|
+
level: "WARN",
|
|
787
|
+
message: "Parameter Validation warrnings for getAddresses",
|
|
788
|
+
});
|
|
789
|
+
Logger({ level: "WARN", message: warrning });
|
|
588
790
|
}
|
|
589
791
|
|
|
590
792
|
const query_params = {};
|
|
@@ -597,7 +799,7 @@ class Cart {
|
|
|
597
799
|
|
|
598
800
|
const xHeaders = {};
|
|
599
801
|
|
|
600
|
-
|
|
802
|
+
const response = await APIClient.execute(
|
|
601
803
|
this._conf,
|
|
602
804
|
"get",
|
|
603
805
|
constructUrl({
|
|
@@ -608,6 +810,23 @@ class Cart {
|
|
|
608
810
|
undefined,
|
|
609
811
|
xHeaders
|
|
610
812
|
);
|
|
813
|
+
|
|
814
|
+
const {
|
|
815
|
+
error: res_error,
|
|
816
|
+
} = CartModel.GetAddressesResponse().validate(response, {
|
|
817
|
+
abortEarly: false,
|
|
818
|
+
allowUnknown: false,
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
if (res_error) {
|
|
822
|
+
Logger({
|
|
823
|
+
level: "WARN",
|
|
824
|
+
message: "Response Validation Warnnings for getAddresses",
|
|
825
|
+
});
|
|
826
|
+
Logger({ level: "WARN", message: res_error });
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
return response;
|
|
611
830
|
}
|
|
612
831
|
|
|
613
832
|
/**
|
|
@@ -617,7 +836,7 @@ class Cart {
|
|
|
617
836
|
* @summary: Add address to an account
|
|
618
837
|
* @description: Use this API to add an address to an account.
|
|
619
838
|
*/
|
|
620
|
-
addAddress({ body } = {}) {
|
|
839
|
+
async addAddress({ body } = {}) {
|
|
621
840
|
const { error } = CartValidator.addAddress().validate(
|
|
622
841
|
{ body },
|
|
623
842
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -632,15 +851,18 @@ class Cart {
|
|
|
632
851
|
{ abortEarly: false, allowUnknown: false }
|
|
633
852
|
);
|
|
634
853
|
if (warrning) {
|
|
635
|
-
|
|
636
|
-
|
|
854
|
+
Logger({
|
|
855
|
+
level: "WARN",
|
|
856
|
+
message: "Parameter Validation warrnings for addAddress",
|
|
857
|
+
});
|
|
858
|
+
Logger({ level: "WARN", message: warrning });
|
|
637
859
|
}
|
|
638
860
|
|
|
639
861
|
const query_params = {};
|
|
640
862
|
|
|
641
863
|
const xHeaders = {};
|
|
642
864
|
|
|
643
|
-
|
|
865
|
+
const response = await APIClient.execute(
|
|
644
866
|
this._conf,
|
|
645
867
|
"post",
|
|
646
868
|
constructUrl({
|
|
@@ -651,6 +873,23 @@ class Cart {
|
|
|
651
873
|
body,
|
|
652
874
|
xHeaders
|
|
653
875
|
);
|
|
876
|
+
|
|
877
|
+
const {
|
|
878
|
+
error: res_error,
|
|
879
|
+
} = CartModel.SaveAddressResponse().validate(response, {
|
|
880
|
+
abortEarly: false,
|
|
881
|
+
allowUnknown: false,
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
if (res_error) {
|
|
885
|
+
Logger({
|
|
886
|
+
level: "WARN",
|
|
887
|
+
message: "Response Validation Warnnings for addAddress",
|
|
888
|
+
});
|
|
889
|
+
Logger({ level: "WARN", message: res_error });
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
return response;
|
|
654
893
|
}
|
|
655
894
|
|
|
656
895
|
/**
|
|
@@ -666,7 +905,7 @@ class Cart {
|
|
|
666
905
|
* @summary: Fetch a single address by its ID
|
|
667
906
|
* @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>
|
|
668
907
|
*/
|
|
669
|
-
getAddressById({
|
|
908
|
+
async getAddressById({
|
|
670
909
|
id,
|
|
671
910
|
cartId,
|
|
672
911
|
buyNow,
|
|
@@ -689,8 +928,11 @@ class Cart {
|
|
|
689
928
|
{ abortEarly: false, allowUnknown: false }
|
|
690
929
|
);
|
|
691
930
|
if (warrning) {
|
|
692
|
-
|
|
693
|
-
|
|
931
|
+
Logger({
|
|
932
|
+
level: "WARN",
|
|
933
|
+
message: "Parameter Validation warrnings for getAddressById",
|
|
934
|
+
});
|
|
935
|
+
Logger({ level: "WARN", message: warrning });
|
|
694
936
|
}
|
|
695
937
|
|
|
696
938
|
const query_params = {};
|
|
@@ -703,7 +945,7 @@ class Cart {
|
|
|
703
945
|
|
|
704
946
|
const xHeaders = {};
|
|
705
947
|
|
|
706
|
-
|
|
948
|
+
const response = await APIClient.execute(
|
|
707
949
|
this._conf,
|
|
708
950
|
"get",
|
|
709
951
|
constructUrl({
|
|
@@ -714,6 +956,21 @@ class Cart {
|
|
|
714
956
|
undefined,
|
|
715
957
|
xHeaders
|
|
716
958
|
);
|
|
959
|
+
|
|
960
|
+
const { error: res_error } = CartModel.Address().validate(response, {
|
|
961
|
+
abortEarly: false,
|
|
962
|
+
allowUnknown: false,
|
|
963
|
+
});
|
|
964
|
+
|
|
965
|
+
if (res_error) {
|
|
966
|
+
Logger({
|
|
967
|
+
level: "WARN",
|
|
968
|
+
message: "Response Validation Warnnings for getAddressById",
|
|
969
|
+
});
|
|
970
|
+
Logger({ level: "WARN", message: res_error });
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
return response;
|
|
717
974
|
}
|
|
718
975
|
|
|
719
976
|
/**
|
|
@@ -724,7 +981,7 @@ class Cart {
|
|
|
724
981
|
* @summary: Update address added to an account
|
|
725
982
|
* @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>
|
|
726
983
|
*/
|
|
727
|
-
updateAddress({ id, body } = {}) {
|
|
984
|
+
async updateAddress({ id, body } = {}) {
|
|
728
985
|
const { error } = CartValidator.updateAddress().validate(
|
|
729
986
|
{ id, body },
|
|
730
987
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -739,15 +996,18 @@ class Cart {
|
|
|
739
996
|
{ abortEarly: false, allowUnknown: false }
|
|
740
997
|
);
|
|
741
998
|
if (warrning) {
|
|
742
|
-
|
|
743
|
-
|
|
999
|
+
Logger({
|
|
1000
|
+
level: "WARN",
|
|
1001
|
+
message: "Parameter Validation warrnings for updateAddress",
|
|
1002
|
+
});
|
|
1003
|
+
Logger({ level: "WARN", message: warrning });
|
|
744
1004
|
}
|
|
745
1005
|
|
|
746
1006
|
const query_params = {};
|
|
747
1007
|
|
|
748
1008
|
const xHeaders = {};
|
|
749
1009
|
|
|
750
|
-
|
|
1010
|
+
const response = await APIClient.execute(
|
|
751
1011
|
this._conf,
|
|
752
1012
|
"put",
|
|
753
1013
|
constructUrl({
|
|
@@ -758,6 +1018,23 @@ class Cart {
|
|
|
758
1018
|
body,
|
|
759
1019
|
xHeaders
|
|
760
1020
|
);
|
|
1021
|
+
|
|
1022
|
+
const {
|
|
1023
|
+
error: res_error,
|
|
1024
|
+
} = CartModel.UpdateAddressResponse().validate(response, {
|
|
1025
|
+
abortEarly: false,
|
|
1026
|
+
allowUnknown: false,
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
if (res_error) {
|
|
1030
|
+
Logger({
|
|
1031
|
+
level: "WARN",
|
|
1032
|
+
message: "Response Validation Warnnings for updateAddress",
|
|
1033
|
+
});
|
|
1034
|
+
Logger({ level: "WARN", message: res_error });
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
return response;
|
|
761
1038
|
}
|
|
762
1039
|
|
|
763
1040
|
/**
|
|
@@ -767,7 +1044,7 @@ class Cart {
|
|
|
767
1044
|
* @summary: Remove address associated with an account
|
|
768
1045
|
* @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.
|
|
769
1046
|
*/
|
|
770
|
-
removeAddress({ id } = {}) {
|
|
1047
|
+
async removeAddress({ id } = {}) {
|
|
771
1048
|
const { error } = CartValidator.removeAddress().validate(
|
|
772
1049
|
{ id },
|
|
773
1050
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -782,15 +1059,18 @@ class Cart {
|
|
|
782
1059
|
{ abortEarly: false, allowUnknown: false }
|
|
783
1060
|
);
|
|
784
1061
|
if (warrning) {
|
|
785
|
-
|
|
786
|
-
|
|
1062
|
+
Logger({
|
|
1063
|
+
level: "WARN",
|
|
1064
|
+
message: "Parameter Validation warrnings for removeAddress",
|
|
1065
|
+
});
|
|
1066
|
+
Logger({ level: "WARN", message: warrning });
|
|
787
1067
|
}
|
|
788
1068
|
|
|
789
1069
|
const query_params = {};
|
|
790
1070
|
|
|
791
1071
|
const xHeaders = {};
|
|
792
1072
|
|
|
793
|
-
|
|
1073
|
+
const response = await APIClient.execute(
|
|
794
1074
|
this._conf,
|
|
795
1075
|
"delete",
|
|
796
1076
|
constructUrl({
|
|
@@ -801,6 +1081,23 @@ class Cart {
|
|
|
801
1081
|
undefined,
|
|
802
1082
|
xHeaders
|
|
803
1083
|
);
|
|
1084
|
+
|
|
1085
|
+
const {
|
|
1086
|
+
error: res_error,
|
|
1087
|
+
} = CartModel.DeleteAddressResponse().validate(response, {
|
|
1088
|
+
abortEarly: false,
|
|
1089
|
+
allowUnknown: false,
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
if (res_error) {
|
|
1093
|
+
Logger({
|
|
1094
|
+
level: "WARN",
|
|
1095
|
+
message: "Response Validation Warnnings for removeAddress",
|
|
1096
|
+
});
|
|
1097
|
+
Logger({ level: "WARN", message: res_error });
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
return response;
|
|
804
1101
|
}
|
|
805
1102
|
|
|
806
1103
|
/**
|
|
@@ -814,7 +1111,7 @@ class Cart {
|
|
|
814
1111
|
* @summary: Select an address from available addresses
|
|
815
1112
|
* @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>
|
|
816
1113
|
*/
|
|
817
|
-
selectAddress({ body, cartId, buyNow, i, b } = {}) {
|
|
1114
|
+
async selectAddress({ body, cartId, buyNow, i, b } = {}) {
|
|
818
1115
|
const { error } = CartValidator.selectAddress().validate(
|
|
819
1116
|
{ body, cartId, buyNow, i, b },
|
|
820
1117
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -829,8 +1126,11 @@ class Cart {
|
|
|
829
1126
|
{ abortEarly: false, allowUnknown: false }
|
|
830
1127
|
);
|
|
831
1128
|
if (warrning) {
|
|
832
|
-
|
|
833
|
-
|
|
1129
|
+
Logger({
|
|
1130
|
+
level: "WARN",
|
|
1131
|
+
message: "Parameter Validation warrnings for selectAddress",
|
|
1132
|
+
});
|
|
1133
|
+
Logger({ level: "WARN", message: warrning });
|
|
834
1134
|
}
|
|
835
1135
|
|
|
836
1136
|
const query_params = {};
|
|
@@ -841,7 +1141,7 @@ class Cart {
|
|
|
841
1141
|
|
|
842
1142
|
const xHeaders = {};
|
|
843
1143
|
|
|
844
|
-
|
|
1144
|
+
const response = await APIClient.execute(
|
|
845
1145
|
this._conf,
|
|
846
1146
|
"post",
|
|
847
1147
|
constructUrl({
|
|
@@ -852,6 +1152,23 @@ class Cart {
|
|
|
852
1152
|
body,
|
|
853
1153
|
xHeaders
|
|
854
1154
|
);
|
|
1155
|
+
|
|
1156
|
+
const {
|
|
1157
|
+
error: res_error,
|
|
1158
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
1159
|
+
abortEarly: false,
|
|
1160
|
+
allowUnknown: false,
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
if (res_error) {
|
|
1164
|
+
Logger({
|
|
1165
|
+
level: "WARN",
|
|
1166
|
+
message: "Response Validation Warnnings for selectAddress",
|
|
1167
|
+
});
|
|
1168
|
+
Logger({ level: "WARN", message: res_error });
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
return response;
|
|
855
1172
|
}
|
|
856
1173
|
|
|
857
1174
|
/**
|
|
@@ -863,7 +1180,7 @@ class Cart {
|
|
|
863
1180
|
* @summary: Update cart payment
|
|
864
1181
|
* @description: Use this API to update cart payment.
|
|
865
1182
|
*/
|
|
866
|
-
selectPaymentMode({ body, id, buyNow } = {}) {
|
|
1183
|
+
async selectPaymentMode({ body, id, buyNow } = {}) {
|
|
867
1184
|
const { error } = CartValidator.selectPaymentMode().validate(
|
|
868
1185
|
{ body, id, buyNow },
|
|
869
1186
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -878,8 +1195,11 @@ class Cart {
|
|
|
878
1195
|
{ abortEarly: false, allowUnknown: false }
|
|
879
1196
|
);
|
|
880
1197
|
if (warrning) {
|
|
881
|
-
|
|
882
|
-
|
|
1198
|
+
Logger({
|
|
1199
|
+
level: "WARN",
|
|
1200
|
+
message: "Parameter Validation warrnings for selectPaymentMode",
|
|
1201
|
+
});
|
|
1202
|
+
Logger({ level: "WARN", message: warrning });
|
|
883
1203
|
}
|
|
884
1204
|
|
|
885
1205
|
const query_params = {};
|
|
@@ -888,7 +1208,7 @@ class Cart {
|
|
|
888
1208
|
|
|
889
1209
|
const xHeaders = {};
|
|
890
1210
|
|
|
891
|
-
|
|
1211
|
+
const response = await APIClient.execute(
|
|
892
1212
|
this._conf,
|
|
893
1213
|
"put",
|
|
894
1214
|
constructUrl({
|
|
@@ -899,6 +1219,23 @@ class Cart {
|
|
|
899
1219
|
body,
|
|
900
1220
|
xHeaders
|
|
901
1221
|
);
|
|
1222
|
+
|
|
1223
|
+
const {
|
|
1224
|
+
error: res_error,
|
|
1225
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
1226
|
+
abortEarly: false,
|
|
1227
|
+
allowUnknown: false,
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1230
|
+
if (res_error) {
|
|
1231
|
+
Logger({
|
|
1232
|
+
level: "WARN",
|
|
1233
|
+
message: "Response Validation Warnnings for selectPaymentMode",
|
|
1234
|
+
});
|
|
1235
|
+
Logger({ level: "WARN", message: res_error });
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
return response;
|
|
902
1239
|
}
|
|
903
1240
|
|
|
904
1241
|
/**
|
|
@@ -914,7 +1251,7 @@ class Cart {
|
|
|
914
1251
|
* @summary: Verify the coupon eligibility against the payment mode
|
|
915
1252
|
* @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
|
|
916
1253
|
*/
|
|
917
|
-
validateCouponForPayment({
|
|
1254
|
+
async validateCouponForPayment({
|
|
918
1255
|
id,
|
|
919
1256
|
buyNow,
|
|
920
1257
|
addressId,
|
|
@@ -955,10 +1292,11 @@ class Cart {
|
|
|
955
1292
|
{ abortEarly: false, allowUnknown: false }
|
|
956
1293
|
);
|
|
957
1294
|
if (warrning) {
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1295
|
+
Logger({
|
|
1296
|
+
level: "WARN",
|
|
1297
|
+
message: "Parameter Validation warrnings for validateCouponForPayment",
|
|
1298
|
+
});
|
|
1299
|
+
Logger({ level: "WARN", message: warrning });
|
|
962
1300
|
}
|
|
963
1301
|
|
|
964
1302
|
const query_params = {};
|
|
@@ -972,7 +1310,7 @@ class Cart {
|
|
|
972
1310
|
|
|
973
1311
|
const xHeaders = {};
|
|
974
1312
|
|
|
975
|
-
|
|
1313
|
+
const response = await APIClient.execute(
|
|
976
1314
|
this._conf,
|
|
977
1315
|
"get",
|
|
978
1316
|
constructUrl({
|
|
@@ -983,6 +1321,23 @@ class Cart {
|
|
|
983
1321
|
undefined,
|
|
984
1322
|
xHeaders
|
|
985
1323
|
);
|
|
1324
|
+
|
|
1325
|
+
const {
|
|
1326
|
+
error: res_error,
|
|
1327
|
+
} = CartModel.PaymentCouponValidate().validate(response, {
|
|
1328
|
+
abortEarly: false,
|
|
1329
|
+
allowUnknown: false,
|
|
1330
|
+
});
|
|
1331
|
+
|
|
1332
|
+
if (res_error) {
|
|
1333
|
+
Logger({
|
|
1334
|
+
level: "WARN",
|
|
1335
|
+
message: "Response Validation Warnnings for validateCouponForPayment",
|
|
1336
|
+
});
|
|
1337
|
+
Logger({ level: "WARN", message: res_error });
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
return response;
|
|
986
1341
|
}
|
|
987
1342
|
|
|
988
1343
|
/**
|
|
@@ -998,7 +1353,7 @@ class Cart {
|
|
|
998
1353
|
* @summary: Get delivery date and options before checkout
|
|
999
1354
|
* @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
|
|
1000
1355
|
*/
|
|
1001
|
-
getShipments({ p, id, buyNow, addressId, areaCode } = {}) {
|
|
1356
|
+
async getShipments({ p, id, buyNow, addressId, areaCode } = {}) {
|
|
1002
1357
|
const { error } = CartValidator.getShipments().validate(
|
|
1003
1358
|
{ p, id, buyNow, addressId, areaCode },
|
|
1004
1359
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1013,8 +1368,11 @@ class Cart {
|
|
|
1013
1368
|
{ abortEarly: false, allowUnknown: false }
|
|
1014
1369
|
);
|
|
1015
1370
|
if (warrning) {
|
|
1016
|
-
|
|
1017
|
-
|
|
1371
|
+
Logger({
|
|
1372
|
+
level: "WARN",
|
|
1373
|
+
message: "Parameter Validation warrnings for getShipments",
|
|
1374
|
+
});
|
|
1375
|
+
Logger({ level: "WARN", message: warrning });
|
|
1018
1376
|
}
|
|
1019
1377
|
|
|
1020
1378
|
const query_params = {};
|
|
@@ -1026,7 +1384,7 @@ class Cart {
|
|
|
1026
1384
|
|
|
1027
1385
|
const xHeaders = {};
|
|
1028
1386
|
|
|
1029
|
-
|
|
1387
|
+
const response = await APIClient.execute(
|
|
1030
1388
|
this._conf,
|
|
1031
1389
|
"get",
|
|
1032
1390
|
constructUrl({
|
|
@@ -1037,6 +1395,23 @@ class Cart {
|
|
|
1037
1395
|
undefined,
|
|
1038
1396
|
xHeaders
|
|
1039
1397
|
);
|
|
1398
|
+
|
|
1399
|
+
const {
|
|
1400
|
+
error: res_error,
|
|
1401
|
+
} = CartModel.CartShipmentsResponse().validate(response, {
|
|
1402
|
+
abortEarly: false,
|
|
1403
|
+
allowUnknown: false,
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
if (res_error) {
|
|
1407
|
+
Logger({
|
|
1408
|
+
level: "WARN",
|
|
1409
|
+
message: "Response Validation Warnnings for getShipments",
|
|
1410
|
+
});
|
|
1411
|
+
Logger({ level: "WARN", message: res_error });
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
return response;
|
|
1040
1415
|
}
|
|
1041
1416
|
|
|
1042
1417
|
/**
|
|
@@ -1047,7 +1422,7 @@ class Cart {
|
|
|
1047
1422
|
* @summary: Checkout all items in the cart
|
|
1048
1423
|
* @description: Use this API to checkout all items in the cart for payment and order generation. For COD, order will be directly generated, whereas for other checkout modes, user will be redirected to a payment gateway.
|
|
1049
1424
|
*/
|
|
1050
|
-
checkoutCart({ body, buyNow } = {}) {
|
|
1425
|
+
async checkoutCart({ body, buyNow } = {}) {
|
|
1051
1426
|
const { error } = CartValidator.checkoutCart().validate(
|
|
1052
1427
|
{ body, buyNow },
|
|
1053
1428
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1062,8 +1437,11 @@ class Cart {
|
|
|
1062
1437
|
{ abortEarly: false, allowUnknown: false }
|
|
1063
1438
|
);
|
|
1064
1439
|
if (warrning) {
|
|
1065
|
-
|
|
1066
|
-
|
|
1440
|
+
Logger({
|
|
1441
|
+
level: "WARN",
|
|
1442
|
+
message: "Parameter Validation warrnings for checkoutCart",
|
|
1443
|
+
});
|
|
1444
|
+
Logger({ level: "WARN", message: warrning });
|
|
1067
1445
|
}
|
|
1068
1446
|
|
|
1069
1447
|
const query_params = {};
|
|
@@ -1071,7 +1449,7 @@ class Cart {
|
|
|
1071
1449
|
|
|
1072
1450
|
const xHeaders = {};
|
|
1073
1451
|
|
|
1074
|
-
|
|
1452
|
+
const response = await APIClient.execute(
|
|
1075
1453
|
this._conf,
|
|
1076
1454
|
"post",
|
|
1077
1455
|
constructUrl({
|
|
@@ -1082,6 +1460,23 @@ class Cart {
|
|
|
1082
1460
|
body,
|
|
1083
1461
|
xHeaders
|
|
1084
1462
|
);
|
|
1463
|
+
|
|
1464
|
+
const {
|
|
1465
|
+
error: res_error,
|
|
1466
|
+
} = CartModel.CartCheckoutResponse().validate(response, {
|
|
1467
|
+
abortEarly: false,
|
|
1468
|
+
allowUnknown: false,
|
|
1469
|
+
});
|
|
1470
|
+
|
|
1471
|
+
if (res_error) {
|
|
1472
|
+
Logger({
|
|
1473
|
+
level: "WARN",
|
|
1474
|
+
message: "Response Validation Warnnings for checkoutCart",
|
|
1475
|
+
});
|
|
1476
|
+
Logger({ level: "WARN", message: res_error });
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
return response;
|
|
1085
1480
|
}
|
|
1086
1481
|
|
|
1087
1482
|
/**
|
|
@@ -1093,7 +1488,7 @@ class Cart {
|
|
|
1093
1488
|
* @summary: Update the cart meta
|
|
1094
1489
|
* @description: Use this API to update cart meta like checkout_mode and gstin.
|
|
1095
1490
|
*/
|
|
1096
|
-
updateCartMeta({ body, id, buyNow } = {}) {
|
|
1491
|
+
async updateCartMeta({ body, id, buyNow } = {}) {
|
|
1097
1492
|
const { error } = CartValidator.updateCartMeta().validate(
|
|
1098
1493
|
{ body, id, buyNow },
|
|
1099
1494
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1108,8 +1503,11 @@ class Cart {
|
|
|
1108
1503
|
{ abortEarly: false, allowUnknown: false }
|
|
1109
1504
|
);
|
|
1110
1505
|
if (warrning) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1506
|
+
Logger({
|
|
1507
|
+
level: "WARN",
|
|
1508
|
+
message: "Parameter Validation warrnings for updateCartMeta",
|
|
1509
|
+
});
|
|
1510
|
+
Logger({ level: "WARN", message: warrning });
|
|
1113
1511
|
}
|
|
1114
1512
|
|
|
1115
1513
|
const query_params = {};
|
|
@@ -1118,7 +1516,7 @@ class Cart {
|
|
|
1118
1516
|
|
|
1119
1517
|
const xHeaders = {};
|
|
1120
1518
|
|
|
1121
|
-
|
|
1519
|
+
const response = await APIClient.execute(
|
|
1122
1520
|
this._conf,
|
|
1123
1521
|
"put",
|
|
1124
1522
|
constructUrl({
|
|
@@ -1129,6 +1527,21 @@ class Cart {
|
|
|
1129
1527
|
body,
|
|
1130
1528
|
xHeaders
|
|
1131
1529
|
);
|
|
1530
|
+
|
|
1531
|
+
const { error: res_error } = CartModel.CartMetaResponse().validate(
|
|
1532
|
+
response,
|
|
1533
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1534
|
+
);
|
|
1535
|
+
|
|
1536
|
+
if (res_error) {
|
|
1537
|
+
Logger({
|
|
1538
|
+
level: "WARN",
|
|
1539
|
+
message: "Response Validation Warnnings for updateCartMeta",
|
|
1540
|
+
});
|
|
1541
|
+
Logger({ level: "WARN", message: res_error });
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
return response;
|
|
1132
1545
|
}
|
|
1133
1546
|
|
|
1134
1547
|
/**
|
|
@@ -1138,7 +1551,7 @@ class Cart {
|
|
|
1138
1551
|
* @summary: Generate token for sharing the cart
|
|
1139
1552
|
* @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.
|
|
1140
1553
|
*/
|
|
1141
|
-
getCartShareLink({ body } = {}) {
|
|
1554
|
+
async getCartShareLink({ body } = {}) {
|
|
1142
1555
|
const { error } = CartValidator.getCartShareLink().validate(
|
|
1143
1556
|
{ body },
|
|
1144
1557
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1153,15 +1566,18 @@ class Cart {
|
|
|
1153
1566
|
{ abortEarly: false, allowUnknown: false }
|
|
1154
1567
|
);
|
|
1155
1568
|
if (warrning) {
|
|
1156
|
-
|
|
1157
|
-
|
|
1569
|
+
Logger({
|
|
1570
|
+
level: "WARN",
|
|
1571
|
+
message: "Parameter Validation warrnings for getCartShareLink",
|
|
1572
|
+
});
|
|
1573
|
+
Logger({ level: "WARN", message: warrning });
|
|
1158
1574
|
}
|
|
1159
1575
|
|
|
1160
1576
|
const query_params = {};
|
|
1161
1577
|
|
|
1162
1578
|
const xHeaders = {};
|
|
1163
1579
|
|
|
1164
|
-
|
|
1580
|
+
const response = await APIClient.execute(
|
|
1165
1581
|
this._conf,
|
|
1166
1582
|
"post",
|
|
1167
1583
|
constructUrl({
|
|
@@ -1172,6 +1588,23 @@ class Cart {
|
|
|
1172
1588
|
body,
|
|
1173
1589
|
xHeaders
|
|
1174
1590
|
);
|
|
1591
|
+
|
|
1592
|
+
const {
|
|
1593
|
+
error: res_error,
|
|
1594
|
+
} = CartModel.GetShareCartLinkResponse().validate(response, {
|
|
1595
|
+
abortEarly: false,
|
|
1596
|
+
allowUnknown: false,
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
if (res_error) {
|
|
1600
|
+
Logger({
|
|
1601
|
+
level: "WARN",
|
|
1602
|
+
message: "Response Validation Warnnings for getCartShareLink",
|
|
1603
|
+
});
|
|
1604
|
+
Logger({ level: "WARN", message: res_error });
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
return response;
|
|
1175
1608
|
}
|
|
1176
1609
|
|
|
1177
1610
|
/**
|
|
@@ -1181,7 +1614,7 @@ class Cart {
|
|
|
1181
1614
|
* @summary: Get details of a shared cart
|
|
1182
1615
|
* @description: Use this API to get the shared cart details as per the token generated using the share-cart API.
|
|
1183
1616
|
*/
|
|
1184
|
-
getCartSharedItems({ token } = {}) {
|
|
1617
|
+
async getCartSharedItems({ token } = {}) {
|
|
1185
1618
|
const { error } = CartValidator.getCartSharedItems().validate(
|
|
1186
1619
|
{ token },
|
|
1187
1620
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1196,15 +1629,18 @@ class Cart {
|
|
|
1196
1629
|
{ abortEarly: false, allowUnknown: false }
|
|
1197
1630
|
);
|
|
1198
1631
|
if (warrning) {
|
|
1199
|
-
|
|
1200
|
-
|
|
1632
|
+
Logger({
|
|
1633
|
+
level: "WARN",
|
|
1634
|
+
message: "Parameter Validation warrnings for getCartSharedItems",
|
|
1635
|
+
});
|
|
1636
|
+
Logger({ level: "WARN", message: warrning });
|
|
1201
1637
|
}
|
|
1202
1638
|
|
|
1203
1639
|
const query_params = {};
|
|
1204
1640
|
|
|
1205
1641
|
const xHeaders = {};
|
|
1206
1642
|
|
|
1207
|
-
|
|
1643
|
+
const response = await APIClient.execute(
|
|
1208
1644
|
this._conf,
|
|
1209
1645
|
"get",
|
|
1210
1646
|
constructUrl({
|
|
@@ -1215,6 +1651,23 @@ class Cart {
|
|
|
1215
1651
|
undefined,
|
|
1216
1652
|
xHeaders
|
|
1217
1653
|
);
|
|
1654
|
+
|
|
1655
|
+
const {
|
|
1656
|
+
error: res_error,
|
|
1657
|
+
} = CartModel.SharedCartResponse().validate(response, {
|
|
1658
|
+
abortEarly: false,
|
|
1659
|
+
allowUnknown: false,
|
|
1660
|
+
});
|
|
1661
|
+
|
|
1662
|
+
if (res_error) {
|
|
1663
|
+
Logger({
|
|
1664
|
+
level: "WARN",
|
|
1665
|
+
message: "Response Validation Warnnings for getCartSharedItems",
|
|
1666
|
+
});
|
|
1667
|
+
Logger({ level: "WARN", message: res_error });
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
return response;
|
|
1218
1671
|
}
|
|
1219
1672
|
|
|
1220
1673
|
/**
|
|
@@ -1226,7 +1679,7 @@ class Cart {
|
|
|
1226
1679
|
* @summary: Merge or replace existing cart
|
|
1227
1680
|
* @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.
|
|
1228
1681
|
*/
|
|
1229
|
-
updateCartWithSharedItems({ token, action } = {}) {
|
|
1682
|
+
async updateCartWithSharedItems({ token, action } = {}) {
|
|
1230
1683
|
const { error } = CartValidator.updateCartWithSharedItems().validate(
|
|
1231
1684
|
{ token, action },
|
|
1232
1685
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1243,17 +1696,18 @@ class Cart {
|
|
|
1243
1696
|
{ abortEarly: false, allowUnknown: false }
|
|
1244
1697
|
);
|
|
1245
1698
|
if (warrning) {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1699
|
+
Logger({
|
|
1700
|
+
level: "WARN",
|
|
1701
|
+
message: "Parameter Validation warrnings for updateCartWithSharedItems",
|
|
1702
|
+
});
|
|
1703
|
+
Logger({ level: "WARN", message: warrning });
|
|
1250
1704
|
}
|
|
1251
1705
|
|
|
1252
1706
|
const query_params = {};
|
|
1253
1707
|
|
|
1254
1708
|
const xHeaders = {};
|
|
1255
1709
|
|
|
1256
|
-
|
|
1710
|
+
const response = await APIClient.execute(
|
|
1257
1711
|
this._conf,
|
|
1258
1712
|
"post",
|
|
1259
1713
|
constructUrl({
|
|
@@ -1264,6 +1718,23 @@ class Cart {
|
|
|
1264
1718
|
undefined,
|
|
1265
1719
|
xHeaders
|
|
1266
1720
|
);
|
|
1721
|
+
|
|
1722
|
+
const {
|
|
1723
|
+
error: res_error,
|
|
1724
|
+
} = CartModel.SharedCartResponse().validate(response, {
|
|
1725
|
+
abortEarly: false,
|
|
1726
|
+
allowUnknown: false,
|
|
1727
|
+
});
|
|
1728
|
+
|
|
1729
|
+
if (res_error) {
|
|
1730
|
+
Logger({
|
|
1731
|
+
level: "WARN",
|
|
1732
|
+
message: "Response Validation Warnnings for updateCartWithSharedItems",
|
|
1733
|
+
});
|
|
1734
|
+
Logger({ level: "WARN", message: res_error });
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
return response;
|
|
1267
1738
|
}
|
|
1268
1739
|
|
|
1269
1740
|
/**
|
|
@@ -1277,7 +1748,7 @@ class Cart {
|
|
|
1277
1748
|
* @summary: Fetch available promotions
|
|
1278
1749
|
* @description: Use this API to get top 5 offers available for current product
|
|
1279
1750
|
*/
|
|
1280
|
-
getPromotionOffers({ slug, pageSize, promotionGroup } = {}) {
|
|
1751
|
+
async getPromotionOffers({ slug, pageSize, promotionGroup } = {}) {
|
|
1281
1752
|
const { error } = CartValidator.getPromotionOffers().validate(
|
|
1282
1753
|
{ slug, pageSize, promotionGroup },
|
|
1283
1754
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1292,8 +1763,11 @@ class Cart {
|
|
|
1292
1763
|
{ abortEarly: false, allowUnknown: false }
|
|
1293
1764
|
);
|
|
1294
1765
|
if (warrning) {
|
|
1295
|
-
|
|
1296
|
-
|
|
1766
|
+
Logger({
|
|
1767
|
+
level: "WARN",
|
|
1768
|
+
message: "Parameter Validation warrnings for getPromotionOffers",
|
|
1769
|
+
});
|
|
1770
|
+
Logger({ level: "WARN", message: warrning });
|
|
1297
1771
|
}
|
|
1298
1772
|
|
|
1299
1773
|
const query_params = {};
|
|
@@ -1303,7 +1777,7 @@ class Cart {
|
|
|
1303
1777
|
|
|
1304
1778
|
const xHeaders = {};
|
|
1305
1779
|
|
|
1306
|
-
|
|
1780
|
+
const response = await APIClient.execute(
|
|
1307
1781
|
this._conf,
|
|
1308
1782
|
"get",
|
|
1309
1783
|
constructUrl({
|
|
@@ -1314,6 +1788,23 @@ class Cart {
|
|
|
1314
1788
|
undefined,
|
|
1315
1789
|
xHeaders
|
|
1316
1790
|
);
|
|
1791
|
+
|
|
1792
|
+
const {
|
|
1793
|
+
error: res_error,
|
|
1794
|
+
} = CartModel.PromotionOffersResponse().validate(response, {
|
|
1795
|
+
abortEarly: false,
|
|
1796
|
+
allowUnknown: false,
|
|
1797
|
+
});
|
|
1798
|
+
|
|
1799
|
+
if (res_error) {
|
|
1800
|
+
Logger({
|
|
1801
|
+
level: "WARN",
|
|
1802
|
+
message: "Response Validation Warnnings for getPromotionOffers",
|
|
1803
|
+
});
|
|
1804
|
+
Logger({ level: "WARN", message: res_error });
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
return response;
|
|
1317
1808
|
}
|
|
1318
1809
|
|
|
1319
1810
|
/**
|
|
@@ -1330,7 +1821,7 @@ class Cart {
|
|
|
1330
1821
|
* @summary: Fetch ladder price promotion
|
|
1331
1822
|
* @description: Use this API to get applicable ladder price promotion for current product
|
|
1332
1823
|
*/
|
|
1333
|
-
getLadderOffers({ slug, storeId, promotionId, pageSize } = {}) {
|
|
1824
|
+
async getLadderOffers({ slug, storeId, promotionId, pageSize } = {}) {
|
|
1334
1825
|
const { error } = CartValidator.getLadderOffers().validate(
|
|
1335
1826
|
{ slug, storeId, promotionId, pageSize },
|
|
1336
1827
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1345,8 +1836,11 @@ class Cart {
|
|
|
1345
1836
|
{ abortEarly: false, allowUnknown: false }
|
|
1346
1837
|
);
|
|
1347
1838
|
if (warrning) {
|
|
1348
|
-
|
|
1349
|
-
|
|
1839
|
+
Logger({
|
|
1840
|
+
level: "WARN",
|
|
1841
|
+
message: "Parameter Validation warrnings for getLadderOffers",
|
|
1842
|
+
});
|
|
1843
|
+
Logger({ level: "WARN", message: warrning });
|
|
1350
1844
|
}
|
|
1351
1845
|
|
|
1352
1846
|
const query_params = {};
|
|
@@ -1357,7 +1851,7 @@ class Cart {
|
|
|
1357
1851
|
|
|
1358
1852
|
const xHeaders = {};
|
|
1359
1853
|
|
|
1360
|
-
|
|
1854
|
+
const response = await APIClient.execute(
|
|
1361
1855
|
this._conf,
|
|
1362
1856
|
"get",
|
|
1363
1857
|
constructUrl({
|
|
@@ -1368,6 +1862,23 @@ class Cart {
|
|
|
1368
1862
|
undefined,
|
|
1369
1863
|
xHeaders
|
|
1370
1864
|
);
|
|
1865
|
+
|
|
1866
|
+
const {
|
|
1867
|
+
error: res_error,
|
|
1868
|
+
} = CartModel.LadderPriceOffers().validate(response, {
|
|
1869
|
+
abortEarly: false,
|
|
1870
|
+
allowUnknown: false,
|
|
1871
|
+
});
|
|
1872
|
+
|
|
1873
|
+
if (res_error) {
|
|
1874
|
+
Logger({
|
|
1875
|
+
level: "WARN",
|
|
1876
|
+
message: "Response Validation Warnnings for getLadderOffers",
|
|
1877
|
+
});
|
|
1878
|
+
Logger({ level: "WARN", message: res_error });
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
return response;
|
|
1371
1882
|
}
|
|
1372
1883
|
}
|
|
1373
1884
|
|