@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 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 }
|
|
@@ -83,8 +85,11 @@ class PosCart {
|
|
|
83
85
|
{ abortEarly: false, allowUnknown: false }
|
|
84
86
|
);
|
|
85
87
|
if (warrning) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
Logger({
|
|
89
|
+
level: "WARN",
|
|
90
|
+
message: "Parameter Validation warrnings for getCart",
|
|
91
|
+
});
|
|
92
|
+
Logger({ level: "WARN", message: warrning });
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
const query_params = {};
|
|
@@ -97,7 +102,7 @@ class PosCart {
|
|
|
97
102
|
|
|
98
103
|
const xHeaders = {};
|
|
99
104
|
|
|
100
|
-
|
|
105
|
+
const response = await APIClient.execute(
|
|
101
106
|
this._conf,
|
|
102
107
|
"get",
|
|
103
108
|
constructUrl({
|
|
@@ -108,6 +113,23 @@ class PosCart {
|
|
|
108
113
|
undefined,
|
|
109
114
|
xHeaders
|
|
110
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;
|
|
111
133
|
}
|
|
112
134
|
|
|
113
135
|
/**
|
|
@@ -117,7 +139,7 @@ class PosCart {
|
|
|
117
139
|
* @summary: Fetch last-modified timestamp
|
|
118
140
|
* @description: Use this API to fetch Last-Modified timestamp in header metadata.
|
|
119
141
|
*/
|
|
120
|
-
getCartLastModified({ id } = {}) {
|
|
142
|
+
async getCartLastModified({ id } = {}) {
|
|
121
143
|
const { error } = PosCartValidator.getCartLastModified().validate(
|
|
122
144
|
{ id },
|
|
123
145
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -132,8 +154,11 @@ class PosCart {
|
|
|
132
154
|
{ abortEarly: false, allowUnknown: false }
|
|
133
155
|
);
|
|
134
156
|
if (warrning) {
|
|
135
|
-
|
|
136
|
-
|
|
157
|
+
Logger({
|
|
158
|
+
level: "WARN",
|
|
159
|
+
message: "Parameter Validation warrnings for getCartLastModified",
|
|
160
|
+
});
|
|
161
|
+
Logger({ level: "WARN", message: warrning });
|
|
137
162
|
}
|
|
138
163
|
|
|
139
164
|
const query_params = {};
|
|
@@ -141,7 +166,7 @@ class PosCart {
|
|
|
141
166
|
|
|
142
167
|
const xHeaders = {};
|
|
143
168
|
|
|
144
|
-
|
|
169
|
+
const response = await APIClient.execute(
|
|
145
170
|
this._conf,
|
|
146
171
|
"head",
|
|
147
172
|
constructUrl({
|
|
@@ -152,6 +177,20 @@ class PosCart {
|
|
|
152
177
|
undefined,
|
|
153
178
|
xHeaders
|
|
154
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;
|
|
155
194
|
}
|
|
156
195
|
|
|
157
196
|
/**
|
|
@@ -165,7 +204,7 @@ class PosCart {
|
|
|
165
204
|
* @summary: Add items to cart
|
|
166
205
|
* @description: Use this API to add items to the cart.
|
|
167
206
|
*/
|
|
168
|
-
addItems({ body, i, b, areaCode, buyNow } = {}) {
|
|
207
|
+
async addItems({ body, i, b, areaCode, buyNow } = {}) {
|
|
169
208
|
const { error } = PosCartValidator.addItems().validate(
|
|
170
209
|
{ body, i, b, areaCode, buyNow },
|
|
171
210
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -180,8 +219,11 @@ class PosCart {
|
|
|
180
219
|
{ abortEarly: false, allowUnknown: false }
|
|
181
220
|
);
|
|
182
221
|
if (warrning) {
|
|
183
|
-
|
|
184
|
-
|
|
222
|
+
Logger({
|
|
223
|
+
level: "WARN",
|
|
224
|
+
message: "Parameter Validation warrnings for addItems",
|
|
225
|
+
});
|
|
226
|
+
Logger({ level: "WARN", message: warrning });
|
|
185
227
|
}
|
|
186
228
|
|
|
187
229
|
const query_params = {};
|
|
@@ -192,7 +234,7 @@ class PosCart {
|
|
|
192
234
|
|
|
193
235
|
const xHeaders = {};
|
|
194
236
|
|
|
195
|
-
|
|
237
|
+
const response = await APIClient.execute(
|
|
196
238
|
this._conf,
|
|
197
239
|
"post",
|
|
198
240
|
constructUrl({
|
|
@@ -203,6 +245,23 @@ class PosCart {
|
|
|
203
245
|
body,
|
|
204
246
|
xHeaders
|
|
205
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;
|
|
206
265
|
}
|
|
207
266
|
|
|
208
267
|
/**
|
|
@@ -217,7 +276,7 @@ class PosCart {
|
|
|
217
276
|
* @summary: Update items in the cart
|
|
218
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>
|
|
219
278
|
*/
|
|
220
|
-
updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
|
|
279
|
+
async updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
|
|
221
280
|
const { error } = PosCartValidator.updateCart().validate(
|
|
222
281
|
{ body, id, i, b, areaCode, buyNow },
|
|
223
282
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -232,8 +291,11 @@ class PosCart {
|
|
|
232
291
|
{ abortEarly: false, allowUnknown: false }
|
|
233
292
|
);
|
|
234
293
|
if (warrning) {
|
|
235
|
-
|
|
236
|
-
|
|
294
|
+
Logger({
|
|
295
|
+
level: "WARN",
|
|
296
|
+
message: "Parameter Validation warrnings for updateCart",
|
|
297
|
+
});
|
|
298
|
+
Logger({ level: "WARN", message: warrning });
|
|
237
299
|
}
|
|
238
300
|
|
|
239
301
|
const query_params = {};
|
|
@@ -245,7 +307,7 @@ class PosCart {
|
|
|
245
307
|
|
|
246
308
|
const xHeaders = {};
|
|
247
309
|
|
|
248
|
-
|
|
310
|
+
const response = await APIClient.execute(
|
|
249
311
|
this._conf,
|
|
250
312
|
"put",
|
|
251
313
|
constructUrl({
|
|
@@ -256,6 +318,23 @@ class PosCart {
|
|
|
256
318
|
body,
|
|
257
319
|
xHeaders
|
|
258
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;
|
|
259
338
|
}
|
|
260
339
|
|
|
261
340
|
/**
|
|
@@ -266,7 +345,7 @@ class PosCart {
|
|
|
266
345
|
* @summary: Count items in the cart
|
|
267
346
|
* @description: Use this API to get the total number of items present in cart.
|
|
268
347
|
*/
|
|
269
|
-
getItemCount({ id, buyNow } = {}) {
|
|
348
|
+
async getItemCount({ id, buyNow } = {}) {
|
|
270
349
|
const { error } = PosCartValidator.getItemCount().validate(
|
|
271
350
|
{ id, buyNow },
|
|
272
351
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -281,8 +360,11 @@ class PosCart {
|
|
|
281
360
|
{ abortEarly: false, allowUnknown: false }
|
|
282
361
|
);
|
|
283
362
|
if (warrning) {
|
|
284
|
-
|
|
285
|
-
|
|
363
|
+
Logger({
|
|
364
|
+
level: "WARN",
|
|
365
|
+
message: "Parameter Validation warrnings for getItemCount",
|
|
366
|
+
});
|
|
367
|
+
Logger({ level: "WARN", message: warrning });
|
|
286
368
|
}
|
|
287
369
|
|
|
288
370
|
const query_params = {};
|
|
@@ -291,7 +373,7 @@ class PosCart {
|
|
|
291
373
|
|
|
292
374
|
const xHeaders = {};
|
|
293
375
|
|
|
294
|
-
|
|
376
|
+
const response = await APIClient.execute(
|
|
295
377
|
this._conf,
|
|
296
378
|
"get",
|
|
297
379
|
constructUrl({
|
|
@@ -302,6 +384,23 @@ class PosCart {
|
|
|
302
384
|
undefined,
|
|
303
385
|
xHeaders
|
|
304
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;
|
|
305
404
|
}
|
|
306
405
|
|
|
307
406
|
/**
|
|
@@ -312,7 +411,7 @@ class PosCart {
|
|
|
312
411
|
* @summary: Fetch Coupon
|
|
313
412
|
* @description: Use this API to get a list of available coupons along with their details.
|
|
314
413
|
*/
|
|
315
|
-
getCoupons({ id, buyNow } = {}) {
|
|
414
|
+
async getCoupons({ id, buyNow } = {}) {
|
|
316
415
|
const { error } = PosCartValidator.getCoupons().validate(
|
|
317
416
|
{ id, buyNow },
|
|
318
417
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -327,8 +426,11 @@ class PosCart {
|
|
|
327
426
|
{ abortEarly: false, allowUnknown: false }
|
|
328
427
|
);
|
|
329
428
|
if (warrning) {
|
|
330
|
-
|
|
331
|
-
|
|
429
|
+
Logger({
|
|
430
|
+
level: "WARN",
|
|
431
|
+
message: "Parameter Validation warrnings for getCoupons",
|
|
432
|
+
});
|
|
433
|
+
Logger({ level: "WARN", message: warrning });
|
|
332
434
|
}
|
|
333
435
|
|
|
334
436
|
const query_params = {};
|
|
@@ -337,7 +439,7 @@ class PosCart {
|
|
|
337
439
|
|
|
338
440
|
const xHeaders = {};
|
|
339
441
|
|
|
340
|
-
|
|
442
|
+
const response = await APIClient.execute(
|
|
341
443
|
this._conf,
|
|
342
444
|
"get",
|
|
343
445
|
constructUrl({
|
|
@@ -348,6 +450,23 @@ class PosCart {
|
|
|
348
450
|
undefined,
|
|
349
451
|
xHeaders
|
|
350
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;
|
|
351
470
|
}
|
|
352
471
|
|
|
353
472
|
/**
|
|
@@ -362,7 +481,7 @@ class PosCart {
|
|
|
362
481
|
* @summary: Apply Coupon
|
|
363
482
|
* @description: Use this API to apply coupons on items in the cart.
|
|
364
483
|
*/
|
|
365
|
-
applyCoupon({ body, i, b, p, id, buyNow } = {}) {
|
|
484
|
+
async applyCoupon({ body, i, b, p, id, buyNow } = {}) {
|
|
366
485
|
const { error } = PosCartValidator.applyCoupon().validate(
|
|
367
486
|
{ body, i, b, p, id, buyNow },
|
|
368
487
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -377,8 +496,11 @@ class PosCart {
|
|
|
377
496
|
{ abortEarly: false, allowUnknown: false }
|
|
378
497
|
);
|
|
379
498
|
if (warrning) {
|
|
380
|
-
|
|
381
|
-
|
|
499
|
+
Logger({
|
|
500
|
+
level: "WARN",
|
|
501
|
+
message: "Parameter Validation warrnings for applyCoupon",
|
|
502
|
+
});
|
|
503
|
+
Logger({ level: "WARN", message: warrning });
|
|
382
504
|
}
|
|
383
505
|
|
|
384
506
|
const query_params = {};
|
|
@@ -390,7 +512,7 @@ class PosCart {
|
|
|
390
512
|
|
|
391
513
|
const xHeaders = {};
|
|
392
514
|
|
|
393
|
-
|
|
515
|
+
const response = await APIClient.execute(
|
|
394
516
|
this._conf,
|
|
395
517
|
"post",
|
|
396
518
|
constructUrl({
|
|
@@ -401,6 +523,23 @@ class PosCart {
|
|
|
401
523
|
body,
|
|
402
524
|
xHeaders
|
|
403
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;
|
|
404
543
|
}
|
|
405
544
|
|
|
406
545
|
/**
|
|
@@ -411,7 +550,7 @@ class PosCart {
|
|
|
411
550
|
* @summary: Remove Coupon Applied
|
|
412
551
|
* @description: Remove Coupon applied on the cart by passing uid in request body.
|
|
413
552
|
*/
|
|
414
|
-
removeCoupon({ id, buyNow } = {}) {
|
|
553
|
+
async removeCoupon({ id, buyNow } = {}) {
|
|
415
554
|
const { error } = PosCartValidator.removeCoupon().validate(
|
|
416
555
|
{ id, buyNow },
|
|
417
556
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -426,8 +565,11 @@ class PosCart {
|
|
|
426
565
|
{ abortEarly: false, allowUnknown: false }
|
|
427
566
|
);
|
|
428
567
|
if (warrning) {
|
|
429
|
-
|
|
430
|
-
|
|
568
|
+
Logger({
|
|
569
|
+
level: "WARN",
|
|
570
|
+
message: "Parameter Validation warrnings for removeCoupon",
|
|
571
|
+
});
|
|
572
|
+
Logger({ level: "WARN", message: warrning });
|
|
431
573
|
}
|
|
432
574
|
|
|
433
575
|
const query_params = {};
|
|
@@ -436,7 +578,7 @@ class PosCart {
|
|
|
436
578
|
|
|
437
579
|
const xHeaders = {};
|
|
438
580
|
|
|
439
|
-
|
|
581
|
+
const response = await APIClient.execute(
|
|
440
582
|
this._conf,
|
|
441
583
|
"delete",
|
|
442
584
|
constructUrl({
|
|
@@ -447,6 +589,23 @@ class PosCart {
|
|
|
447
589
|
undefined,
|
|
448
590
|
xHeaders
|
|
449
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;
|
|
450
609
|
}
|
|
451
610
|
|
|
452
611
|
/**
|
|
@@ -461,7 +620,7 @@ class PosCart {
|
|
|
461
620
|
* @summary: Get discount offers based on quantity
|
|
462
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.
|
|
463
622
|
*/
|
|
464
|
-
getBulkDiscountOffers({ itemId, articleId, uid, slug } = {}) {
|
|
623
|
+
async getBulkDiscountOffers({ itemId, articleId, uid, slug } = {}) {
|
|
465
624
|
const { error } = PosCartValidator.getBulkDiscountOffers().validate(
|
|
466
625
|
{ itemId, articleId, uid, slug },
|
|
467
626
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -478,8 +637,11 @@ class PosCart {
|
|
|
478
637
|
{ abortEarly: false, allowUnknown: false }
|
|
479
638
|
);
|
|
480
639
|
if (warrning) {
|
|
481
|
-
|
|
482
|
-
|
|
640
|
+
Logger({
|
|
641
|
+
level: "WARN",
|
|
642
|
+
message: "Parameter Validation warrnings for getBulkDiscountOffers",
|
|
643
|
+
});
|
|
644
|
+
Logger({ level: "WARN", message: warrning });
|
|
483
645
|
}
|
|
484
646
|
|
|
485
647
|
const query_params = {};
|
|
@@ -490,7 +652,7 @@ class PosCart {
|
|
|
490
652
|
|
|
491
653
|
const xHeaders = {};
|
|
492
654
|
|
|
493
|
-
|
|
655
|
+
const response = await APIClient.execute(
|
|
494
656
|
this._conf,
|
|
495
657
|
"get",
|
|
496
658
|
constructUrl({
|
|
@@ -501,6 +663,23 @@ class PosCart {
|
|
|
501
663
|
undefined,
|
|
502
664
|
xHeaders
|
|
503
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;
|
|
504
683
|
}
|
|
505
684
|
|
|
506
685
|
/**
|
|
@@ -514,7 +693,7 @@ class PosCart {
|
|
|
514
693
|
* @summary: Apply reward points at cart
|
|
515
694
|
* @description: Use this API to redeem a fixed no. of reward points by applying it to the cart.
|
|
516
695
|
*/
|
|
517
|
-
applyRewardPoints({ body, id, i, b, buyNow } = {}) {
|
|
696
|
+
async applyRewardPoints({ body, id, i, b, buyNow } = {}) {
|
|
518
697
|
const { error } = PosCartValidator.applyRewardPoints().validate(
|
|
519
698
|
{ body, id, i, b, buyNow },
|
|
520
699
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -529,8 +708,11 @@ class PosCart {
|
|
|
529
708
|
{ abortEarly: false, allowUnknown: false }
|
|
530
709
|
);
|
|
531
710
|
if (warrning) {
|
|
532
|
-
|
|
533
|
-
|
|
711
|
+
Logger({
|
|
712
|
+
level: "WARN",
|
|
713
|
+
message: "Parameter Validation warrnings for applyRewardPoints",
|
|
714
|
+
});
|
|
715
|
+
Logger({ level: "WARN", message: warrning });
|
|
534
716
|
}
|
|
535
717
|
|
|
536
718
|
const query_params = {};
|
|
@@ -541,7 +723,7 @@ class PosCart {
|
|
|
541
723
|
|
|
542
724
|
const xHeaders = {};
|
|
543
725
|
|
|
544
|
-
|
|
726
|
+
const response = await APIClient.execute(
|
|
545
727
|
this._conf,
|
|
546
728
|
"post",
|
|
547
729
|
constructUrl({
|
|
@@ -552,6 +734,23 @@ class PosCart {
|
|
|
552
734
|
body,
|
|
553
735
|
xHeaders
|
|
554
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;
|
|
555
754
|
}
|
|
556
755
|
|
|
557
756
|
/**
|
|
@@ -566,7 +765,7 @@ class PosCart {
|
|
|
566
765
|
* @summary: Fetch address
|
|
567
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>
|
|
568
767
|
*/
|
|
569
|
-
getAddresses({
|
|
768
|
+
async getAddresses({
|
|
570
769
|
cartId,
|
|
571
770
|
buyNow,
|
|
572
771
|
mobileNo,
|
|
@@ -588,8 +787,11 @@ class PosCart {
|
|
|
588
787
|
{ abortEarly: false, allowUnknown: false }
|
|
589
788
|
);
|
|
590
789
|
if (warrning) {
|
|
591
|
-
|
|
592
|
-
|
|
790
|
+
Logger({
|
|
791
|
+
level: "WARN",
|
|
792
|
+
message: "Parameter Validation warrnings for getAddresses",
|
|
793
|
+
});
|
|
794
|
+
Logger({ level: "WARN", message: warrning });
|
|
593
795
|
}
|
|
594
796
|
|
|
595
797
|
const query_params = {};
|
|
@@ -602,7 +804,7 @@ class PosCart {
|
|
|
602
804
|
|
|
603
805
|
const xHeaders = {};
|
|
604
806
|
|
|
605
|
-
|
|
807
|
+
const response = await APIClient.execute(
|
|
606
808
|
this._conf,
|
|
607
809
|
"get",
|
|
608
810
|
constructUrl({
|
|
@@ -613,6 +815,23 @@ class PosCart {
|
|
|
613
815
|
undefined,
|
|
614
816
|
xHeaders
|
|
615
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;
|
|
616
835
|
}
|
|
617
836
|
|
|
618
837
|
/**
|
|
@@ -622,7 +841,7 @@ class PosCart {
|
|
|
622
841
|
* @summary: Add address to an account
|
|
623
842
|
* @description: Use this API to add an address to an account.
|
|
624
843
|
*/
|
|
625
|
-
addAddress({ body } = {}) {
|
|
844
|
+
async addAddress({ body } = {}) {
|
|
626
845
|
const { error } = PosCartValidator.addAddress().validate(
|
|
627
846
|
{ body },
|
|
628
847
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -637,15 +856,18 @@ class PosCart {
|
|
|
637
856
|
{ abortEarly: false, allowUnknown: false }
|
|
638
857
|
);
|
|
639
858
|
if (warrning) {
|
|
640
|
-
|
|
641
|
-
|
|
859
|
+
Logger({
|
|
860
|
+
level: "WARN",
|
|
861
|
+
message: "Parameter Validation warrnings for addAddress",
|
|
862
|
+
});
|
|
863
|
+
Logger({ level: "WARN", message: warrning });
|
|
642
864
|
}
|
|
643
865
|
|
|
644
866
|
const query_params = {};
|
|
645
867
|
|
|
646
868
|
const xHeaders = {};
|
|
647
869
|
|
|
648
|
-
|
|
870
|
+
const response = await APIClient.execute(
|
|
649
871
|
this._conf,
|
|
650
872
|
"post",
|
|
651
873
|
constructUrl({
|
|
@@ -656,6 +878,23 @@ class PosCart {
|
|
|
656
878
|
body,
|
|
657
879
|
xHeaders
|
|
658
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;
|
|
659
898
|
}
|
|
660
899
|
|
|
661
900
|
/**
|
|
@@ -671,7 +910,7 @@ class PosCart {
|
|
|
671
910
|
* @summary: Fetch a single address by its ID
|
|
672
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>
|
|
673
912
|
*/
|
|
674
|
-
getAddressById({
|
|
913
|
+
async getAddressById({
|
|
675
914
|
id,
|
|
676
915
|
cartId,
|
|
677
916
|
buyNow,
|
|
@@ -694,8 +933,11 @@ class PosCart {
|
|
|
694
933
|
{ abortEarly: false, allowUnknown: false }
|
|
695
934
|
);
|
|
696
935
|
if (warrning) {
|
|
697
|
-
|
|
698
|
-
|
|
936
|
+
Logger({
|
|
937
|
+
level: "WARN",
|
|
938
|
+
message: "Parameter Validation warrnings for getAddressById",
|
|
939
|
+
});
|
|
940
|
+
Logger({ level: "WARN", message: warrning });
|
|
699
941
|
}
|
|
700
942
|
|
|
701
943
|
const query_params = {};
|
|
@@ -708,7 +950,7 @@ class PosCart {
|
|
|
708
950
|
|
|
709
951
|
const xHeaders = {};
|
|
710
952
|
|
|
711
|
-
|
|
953
|
+
const response = await APIClient.execute(
|
|
712
954
|
this._conf,
|
|
713
955
|
"get",
|
|
714
956
|
constructUrl({
|
|
@@ -719,6 +961,21 @@ class PosCart {
|
|
|
719
961
|
undefined,
|
|
720
962
|
xHeaders
|
|
721
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;
|
|
722
979
|
}
|
|
723
980
|
|
|
724
981
|
/**
|
|
@@ -729,7 +986,7 @@ class PosCart {
|
|
|
729
986
|
* @summary: Update address added to an account
|
|
730
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>
|
|
731
988
|
*/
|
|
732
|
-
updateAddress({ id, body } = {}) {
|
|
989
|
+
async updateAddress({ id, body } = {}) {
|
|
733
990
|
const { error } = PosCartValidator.updateAddress().validate(
|
|
734
991
|
{ id, body },
|
|
735
992
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -744,15 +1001,18 @@ class PosCart {
|
|
|
744
1001
|
{ abortEarly: false, allowUnknown: false }
|
|
745
1002
|
);
|
|
746
1003
|
if (warrning) {
|
|
747
|
-
|
|
748
|
-
|
|
1004
|
+
Logger({
|
|
1005
|
+
level: "WARN",
|
|
1006
|
+
message: "Parameter Validation warrnings for updateAddress",
|
|
1007
|
+
});
|
|
1008
|
+
Logger({ level: "WARN", message: warrning });
|
|
749
1009
|
}
|
|
750
1010
|
|
|
751
1011
|
const query_params = {};
|
|
752
1012
|
|
|
753
1013
|
const xHeaders = {};
|
|
754
1014
|
|
|
755
|
-
|
|
1015
|
+
const response = await APIClient.execute(
|
|
756
1016
|
this._conf,
|
|
757
1017
|
"put",
|
|
758
1018
|
constructUrl({
|
|
@@ -763,6 +1023,23 @@ class PosCart {
|
|
|
763
1023
|
body,
|
|
764
1024
|
xHeaders
|
|
765
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;
|
|
766
1043
|
}
|
|
767
1044
|
|
|
768
1045
|
/**
|
|
@@ -772,7 +1049,7 @@ class PosCart {
|
|
|
772
1049
|
* @summary: Remove address associated with an account
|
|
773
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.
|
|
774
1051
|
*/
|
|
775
|
-
removeAddress({ id } = {}) {
|
|
1052
|
+
async removeAddress({ id } = {}) {
|
|
776
1053
|
const { error } = PosCartValidator.removeAddress().validate(
|
|
777
1054
|
{ id },
|
|
778
1055
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -787,15 +1064,18 @@ class PosCart {
|
|
|
787
1064
|
{ abortEarly: false, allowUnknown: false }
|
|
788
1065
|
);
|
|
789
1066
|
if (warrning) {
|
|
790
|
-
|
|
791
|
-
|
|
1067
|
+
Logger({
|
|
1068
|
+
level: "WARN",
|
|
1069
|
+
message: "Parameter Validation warrnings for removeAddress",
|
|
1070
|
+
});
|
|
1071
|
+
Logger({ level: "WARN", message: warrning });
|
|
792
1072
|
}
|
|
793
1073
|
|
|
794
1074
|
const query_params = {};
|
|
795
1075
|
|
|
796
1076
|
const xHeaders = {};
|
|
797
1077
|
|
|
798
|
-
|
|
1078
|
+
const response = await APIClient.execute(
|
|
799
1079
|
this._conf,
|
|
800
1080
|
"delete",
|
|
801
1081
|
constructUrl({
|
|
@@ -806,6 +1086,23 @@ class PosCart {
|
|
|
806
1086
|
undefined,
|
|
807
1087
|
xHeaders
|
|
808
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;
|
|
809
1106
|
}
|
|
810
1107
|
|
|
811
1108
|
/**
|
|
@@ -819,7 +1116,7 @@ class PosCart {
|
|
|
819
1116
|
* @summary: Select an address from available addresses
|
|
820
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>
|
|
821
1118
|
*/
|
|
822
|
-
selectAddress({ body, cartId, buyNow, i, b } = {}) {
|
|
1119
|
+
async selectAddress({ body, cartId, buyNow, i, b } = {}) {
|
|
823
1120
|
const { error } = PosCartValidator.selectAddress().validate(
|
|
824
1121
|
{ body, cartId, buyNow, i, b },
|
|
825
1122
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -834,8 +1131,11 @@ class PosCart {
|
|
|
834
1131
|
{ abortEarly: false, allowUnknown: false }
|
|
835
1132
|
);
|
|
836
1133
|
if (warrning) {
|
|
837
|
-
|
|
838
|
-
|
|
1134
|
+
Logger({
|
|
1135
|
+
level: "WARN",
|
|
1136
|
+
message: "Parameter Validation warrnings for selectAddress",
|
|
1137
|
+
});
|
|
1138
|
+
Logger({ level: "WARN", message: warrning });
|
|
839
1139
|
}
|
|
840
1140
|
|
|
841
1141
|
const query_params = {};
|
|
@@ -846,7 +1146,7 @@ class PosCart {
|
|
|
846
1146
|
|
|
847
1147
|
const xHeaders = {};
|
|
848
1148
|
|
|
849
|
-
|
|
1149
|
+
const response = await APIClient.execute(
|
|
850
1150
|
this._conf,
|
|
851
1151
|
"post",
|
|
852
1152
|
constructUrl({
|
|
@@ -857,6 +1157,23 @@ class PosCart {
|
|
|
857
1157
|
body,
|
|
858
1158
|
xHeaders
|
|
859
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;
|
|
860
1177
|
}
|
|
861
1178
|
|
|
862
1179
|
/**
|
|
@@ -868,7 +1185,7 @@ class PosCart {
|
|
|
868
1185
|
* @summary: Update cart payment
|
|
869
1186
|
* @description: Use this API to update cart payment.
|
|
870
1187
|
*/
|
|
871
|
-
selectPaymentMode({ body, id, buyNow } = {}) {
|
|
1188
|
+
async selectPaymentMode({ body, id, buyNow } = {}) {
|
|
872
1189
|
const { error } = PosCartValidator.selectPaymentMode().validate(
|
|
873
1190
|
{ body, id, buyNow },
|
|
874
1191
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -883,8 +1200,11 @@ class PosCart {
|
|
|
883
1200
|
{ abortEarly: false, allowUnknown: false }
|
|
884
1201
|
);
|
|
885
1202
|
if (warrning) {
|
|
886
|
-
|
|
887
|
-
|
|
1203
|
+
Logger({
|
|
1204
|
+
level: "WARN",
|
|
1205
|
+
message: "Parameter Validation warrnings for selectPaymentMode",
|
|
1206
|
+
});
|
|
1207
|
+
Logger({ level: "WARN", message: warrning });
|
|
888
1208
|
}
|
|
889
1209
|
|
|
890
1210
|
const query_params = {};
|
|
@@ -893,7 +1213,7 @@ class PosCart {
|
|
|
893
1213
|
|
|
894
1214
|
const xHeaders = {};
|
|
895
1215
|
|
|
896
|
-
|
|
1216
|
+
const response = await APIClient.execute(
|
|
897
1217
|
this._conf,
|
|
898
1218
|
"put",
|
|
899
1219
|
constructUrl({
|
|
@@ -904,6 +1224,23 @@ class PosCart {
|
|
|
904
1224
|
body,
|
|
905
1225
|
xHeaders
|
|
906
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;
|
|
907
1244
|
}
|
|
908
1245
|
|
|
909
1246
|
/**
|
|
@@ -919,7 +1256,7 @@ class PosCart {
|
|
|
919
1256
|
* @summary: Verify the coupon eligibility against the payment mode
|
|
920
1257
|
* @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
|
|
921
1258
|
*/
|
|
922
|
-
validateCouponForPayment({
|
|
1259
|
+
async validateCouponForPayment({
|
|
923
1260
|
id,
|
|
924
1261
|
buyNow,
|
|
925
1262
|
addressId,
|
|
@@ -960,10 +1297,11 @@ class PosCart {
|
|
|
960
1297
|
{ abortEarly: false, allowUnknown: false }
|
|
961
1298
|
);
|
|
962
1299
|
if (warrning) {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1300
|
+
Logger({
|
|
1301
|
+
level: "WARN",
|
|
1302
|
+
message: "Parameter Validation warrnings for validateCouponForPayment",
|
|
1303
|
+
});
|
|
1304
|
+
Logger({ level: "WARN", message: warrning });
|
|
967
1305
|
}
|
|
968
1306
|
|
|
969
1307
|
const query_params = {};
|
|
@@ -977,7 +1315,7 @@ class PosCart {
|
|
|
977
1315
|
|
|
978
1316
|
const xHeaders = {};
|
|
979
1317
|
|
|
980
|
-
|
|
1318
|
+
const response = await APIClient.execute(
|
|
981
1319
|
this._conf,
|
|
982
1320
|
"get",
|
|
983
1321
|
constructUrl({
|
|
@@ -988,6 +1326,23 @@ class PosCart {
|
|
|
988
1326
|
undefined,
|
|
989
1327
|
xHeaders
|
|
990
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;
|
|
991
1346
|
}
|
|
992
1347
|
|
|
993
1348
|
/**
|
|
@@ -1007,7 +1362,7 @@ class PosCart {
|
|
|
1007
1362
|
* @summary: Get delivery date and options before checkout
|
|
1008
1363
|
* @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
|
|
1009
1364
|
*/
|
|
1010
|
-
getShipments({
|
|
1365
|
+
async getShipments({
|
|
1011
1366
|
pickAtStoreUid,
|
|
1012
1367
|
orderingStoreId,
|
|
1013
1368
|
p,
|
|
@@ -1046,8 +1401,11 @@ class PosCart {
|
|
|
1046
1401
|
{ abortEarly: false, allowUnknown: false }
|
|
1047
1402
|
);
|
|
1048
1403
|
if (warrning) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1404
|
+
Logger({
|
|
1405
|
+
level: "WARN",
|
|
1406
|
+
message: "Parameter Validation warrnings for getShipments",
|
|
1407
|
+
});
|
|
1408
|
+
Logger({ level: "WARN", message: warrning });
|
|
1051
1409
|
}
|
|
1052
1410
|
|
|
1053
1411
|
const query_params = {};
|
|
@@ -1061,7 +1419,7 @@ class PosCart {
|
|
|
1061
1419
|
|
|
1062
1420
|
const xHeaders = {};
|
|
1063
1421
|
|
|
1064
|
-
|
|
1422
|
+
const response = await APIClient.execute(
|
|
1065
1423
|
this._conf,
|
|
1066
1424
|
"get",
|
|
1067
1425
|
constructUrl({
|
|
@@ -1072,6 +1430,23 @@ class PosCart {
|
|
|
1072
1430
|
undefined,
|
|
1073
1431
|
xHeaders
|
|
1074
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;
|
|
1075
1450
|
}
|
|
1076
1451
|
|
|
1077
1452
|
/**
|
|
@@ -1090,7 +1465,7 @@ class PosCart {
|
|
|
1090
1465
|
* @summary: Update shipment delivery type and quantity before checkout
|
|
1091
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.
|
|
1092
1467
|
*/
|
|
1093
|
-
updateShipments({ body, i, p, id, addressId, orderType } = {}) {
|
|
1468
|
+
async updateShipments({ body, i, p, id, addressId, orderType } = {}) {
|
|
1094
1469
|
const { error } = PosCartValidator.updateShipments().validate(
|
|
1095
1470
|
{ body, i, p, id, addressId, orderType },
|
|
1096
1471
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1105,8 +1480,11 @@ class PosCart {
|
|
|
1105
1480
|
{ abortEarly: false, allowUnknown: false }
|
|
1106
1481
|
);
|
|
1107
1482
|
if (warrning) {
|
|
1108
|
-
|
|
1109
|
-
|
|
1483
|
+
Logger({
|
|
1484
|
+
level: "WARN",
|
|
1485
|
+
message: "Parameter Validation warrnings for updateShipments",
|
|
1486
|
+
});
|
|
1487
|
+
Logger({ level: "WARN", message: warrning });
|
|
1110
1488
|
}
|
|
1111
1489
|
|
|
1112
1490
|
const query_params = {};
|
|
@@ -1118,7 +1496,7 @@ class PosCart {
|
|
|
1118
1496
|
|
|
1119
1497
|
const xHeaders = {};
|
|
1120
1498
|
|
|
1121
|
-
|
|
1499
|
+
const response = await APIClient.execute(
|
|
1122
1500
|
this._conf,
|
|
1123
1501
|
"put",
|
|
1124
1502
|
constructUrl({
|
|
@@ -1129,6 +1507,23 @@ class PosCart {
|
|
|
1129
1507
|
body,
|
|
1130
1508
|
xHeaders
|
|
1131
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;
|
|
1132
1527
|
}
|
|
1133
1528
|
|
|
1134
1529
|
/**
|
|
@@ -1139,7 +1534,7 @@ class PosCart {
|
|
|
1139
1534
|
* @summary: Checkout all items in the cart
|
|
1140
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.
|
|
1141
1536
|
*/
|
|
1142
|
-
checkoutCart({ body, id } = {}) {
|
|
1537
|
+
async checkoutCart({ body, id } = {}) {
|
|
1143
1538
|
const { error } = PosCartValidator.checkoutCart().validate(
|
|
1144
1539
|
{ body, id },
|
|
1145
1540
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1154,8 +1549,11 @@ class PosCart {
|
|
|
1154
1549
|
{ abortEarly: false, allowUnknown: false }
|
|
1155
1550
|
);
|
|
1156
1551
|
if (warrning) {
|
|
1157
|
-
|
|
1158
|
-
|
|
1552
|
+
Logger({
|
|
1553
|
+
level: "WARN",
|
|
1554
|
+
message: "Parameter Validation warrnings for checkoutCart",
|
|
1555
|
+
});
|
|
1556
|
+
Logger({ level: "WARN", message: warrning });
|
|
1159
1557
|
}
|
|
1160
1558
|
|
|
1161
1559
|
const query_params = {};
|
|
@@ -1163,7 +1561,7 @@ class PosCart {
|
|
|
1163
1561
|
|
|
1164
1562
|
const xHeaders = {};
|
|
1165
1563
|
|
|
1166
|
-
|
|
1564
|
+
const response = await APIClient.execute(
|
|
1167
1565
|
this._conf,
|
|
1168
1566
|
"post",
|
|
1169
1567
|
constructUrl({
|
|
@@ -1174,6 +1572,23 @@ class PosCart {
|
|
|
1174
1572
|
body,
|
|
1175
1573
|
xHeaders
|
|
1176
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;
|
|
1177
1592
|
}
|
|
1178
1593
|
|
|
1179
1594
|
/**
|
|
@@ -1185,7 +1600,7 @@ class PosCart {
|
|
|
1185
1600
|
* @summary: Update the cart meta
|
|
1186
1601
|
* @description: Use this API to update cart meta like checkout_mode and gstin.
|
|
1187
1602
|
*/
|
|
1188
|
-
updateCartMeta({ body, id, buyNow } = {}) {
|
|
1603
|
+
async updateCartMeta({ body, id, buyNow } = {}) {
|
|
1189
1604
|
const { error } = PosCartValidator.updateCartMeta().validate(
|
|
1190
1605
|
{ body, id, buyNow },
|
|
1191
1606
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1200,8 +1615,11 @@ class PosCart {
|
|
|
1200
1615
|
{ abortEarly: false, allowUnknown: false }
|
|
1201
1616
|
);
|
|
1202
1617
|
if (warrning) {
|
|
1203
|
-
|
|
1204
|
-
|
|
1618
|
+
Logger({
|
|
1619
|
+
level: "WARN",
|
|
1620
|
+
message: "Parameter Validation warrnings for updateCartMeta",
|
|
1621
|
+
});
|
|
1622
|
+
Logger({ level: "WARN", message: warrning });
|
|
1205
1623
|
}
|
|
1206
1624
|
|
|
1207
1625
|
const query_params = {};
|
|
@@ -1210,7 +1628,7 @@ class PosCart {
|
|
|
1210
1628
|
|
|
1211
1629
|
const xHeaders = {};
|
|
1212
1630
|
|
|
1213
|
-
|
|
1631
|
+
const response = await APIClient.execute(
|
|
1214
1632
|
this._conf,
|
|
1215
1633
|
"put",
|
|
1216
1634
|
constructUrl({
|
|
@@ -1221,6 +1639,23 @@ class PosCart {
|
|
|
1221
1639
|
body,
|
|
1222
1640
|
xHeaders
|
|
1223
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;
|
|
1224
1659
|
}
|
|
1225
1660
|
|
|
1226
1661
|
/**
|
|
@@ -1231,7 +1666,7 @@ class PosCart {
|
|
|
1231
1666
|
* @summary: Get available delivery modes for cart
|
|
1232
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.
|
|
1233
1668
|
*/
|
|
1234
|
-
getAvailableDeliveryModes({ areaCode, id } = {}) {
|
|
1669
|
+
async getAvailableDeliveryModes({ areaCode, id } = {}) {
|
|
1235
1670
|
const { error } = PosCartValidator.getAvailableDeliveryModes().validate(
|
|
1236
1671
|
{ areaCode, id },
|
|
1237
1672
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1248,10 +1683,11 @@ class PosCart {
|
|
|
1248
1683
|
{ abortEarly: false, allowUnknown: false }
|
|
1249
1684
|
);
|
|
1250
1685
|
if (warrning) {
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1686
|
+
Logger({
|
|
1687
|
+
level: "WARN",
|
|
1688
|
+
message: "Parameter Validation warrnings for getAvailableDeliveryModes",
|
|
1689
|
+
});
|
|
1690
|
+
Logger({ level: "WARN", message: warrning });
|
|
1255
1691
|
}
|
|
1256
1692
|
|
|
1257
1693
|
const query_params = {};
|
|
@@ -1260,7 +1696,7 @@ class PosCart {
|
|
|
1260
1696
|
|
|
1261
1697
|
const xHeaders = {};
|
|
1262
1698
|
|
|
1263
|
-
|
|
1699
|
+
const response = await APIClient.execute(
|
|
1264
1700
|
this._conf,
|
|
1265
1701
|
"get",
|
|
1266
1702
|
constructUrl({
|
|
@@ -1271,6 +1707,23 @@ class PosCart {
|
|
|
1271
1707
|
undefined,
|
|
1272
1708
|
xHeaders
|
|
1273
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;
|
|
1274
1727
|
}
|
|
1275
1728
|
|
|
1276
1729
|
/**
|
|
@@ -1280,7 +1733,7 @@ class PosCart {
|
|
|
1280
1733
|
* @summary: Get list of stores for give uids
|
|
1281
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.
|
|
1282
1735
|
*/
|
|
1283
|
-
getStoreAddressByUid({ storeUid } = {}) {
|
|
1736
|
+
async getStoreAddressByUid({ storeUid } = {}) {
|
|
1284
1737
|
const { error } = PosCartValidator.getStoreAddressByUid().validate(
|
|
1285
1738
|
{ storeUid },
|
|
1286
1739
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1297,8 +1750,11 @@ class PosCart {
|
|
|
1297
1750
|
{ abortEarly: false, allowUnknown: false }
|
|
1298
1751
|
);
|
|
1299
1752
|
if (warrning) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1753
|
+
Logger({
|
|
1754
|
+
level: "WARN",
|
|
1755
|
+
message: "Parameter Validation warrnings for getStoreAddressByUid",
|
|
1756
|
+
});
|
|
1757
|
+
Logger({ level: "WARN", message: warrning });
|
|
1302
1758
|
}
|
|
1303
1759
|
|
|
1304
1760
|
const query_params = {};
|
|
@@ -1306,7 +1762,7 @@ class PosCart {
|
|
|
1306
1762
|
|
|
1307
1763
|
const xHeaders = {};
|
|
1308
1764
|
|
|
1309
|
-
|
|
1765
|
+
const response = await APIClient.execute(
|
|
1310
1766
|
this._conf,
|
|
1311
1767
|
"get",
|
|
1312
1768
|
constructUrl({
|
|
@@ -1317,6 +1773,23 @@ class PosCart {
|
|
|
1317
1773
|
undefined,
|
|
1318
1774
|
xHeaders
|
|
1319
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;
|
|
1320
1793
|
}
|
|
1321
1794
|
|
|
1322
1795
|
/**
|
|
@@ -1326,7 +1799,7 @@ class PosCart {
|
|
|
1326
1799
|
* @summary: Generate token for sharing the cart
|
|
1327
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.
|
|
1328
1801
|
*/
|
|
1329
|
-
getCartShareLink({ body } = {}) {
|
|
1802
|
+
async getCartShareLink({ body } = {}) {
|
|
1330
1803
|
const { error } = PosCartValidator.getCartShareLink().validate(
|
|
1331
1804
|
{ body },
|
|
1332
1805
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1341,15 +1814,18 @@ class PosCart {
|
|
|
1341
1814
|
{ abortEarly: false, allowUnknown: false }
|
|
1342
1815
|
);
|
|
1343
1816
|
if (warrning) {
|
|
1344
|
-
|
|
1345
|
-
|
|
1817
|
+
Logger({
|
|
1818
|
+
level: "WARN",
|
|
1819
|
+
message: "Parameter Validation warrnings for getCartShareLink",
|
|
1820
|
+
});
|
|
1821
|
+
Logger({ level: "WARN", message: warrning });
|
|
1346
1822
|
}
|
|
1347
1823
|
|
|
1348
1824
|
const query_params = {};
|
|
1349
1825
|
|
|
1350
1826
|
const xHeaders = {};
|
|
1351
1827
|
|
|
1352
|
-
|
|
1828
|
+
const response = await APIClient.execute(
|
|
1353
1829
|
this._conf,
|
|
1354
1830
|
"post",
|
|
1355
1831
|
constructUrl({
|
|
@@ -1360,6 +1836,23 @@ class PosCart {
|
|
|
1360
1836
|
body,
|
|
1361
1837
|
xHeaders
|
|
1362
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;
|
|
1363
1856
|
}
|
|
1364
1857
|
|
|
1365
1858
|
/**
|
|
@@ -1369,7 +1862,7 @@ class PosCart {
|
|
|
1369
1862
|
* @summary: Get details of a shared cart
|
|
1370
1863
|
* @description: Use this API to get the shared cart details as per the token generated using the share-cart API.
|
|
1371
1864
|
*/
|
|
1372
|
-
getCartSharedItems({ token } = {}) {
|
|
1865
|
+
async getCartSharedItems({ token } = {}) {
|
|
1373
1866
|
const { error } = PosCartValidator.getCartSharedItems().validate(
|
|
1374
1867
|
{ token },
|
|
1375
1868
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1384,15 +1877,18 @@ class PosCart {
|
|
|
1384
1877
|
{ abortEarly: false, allowUnknown: false }
|
|
1385
1878
|
);
|
|
1386
1879
|
if (warrning) {
|
|
1387
|
-
|
|
1388
|
-
|
|
1880
|
+
Logger({
|
|
1881
|
+
level: "WARN",
|
|
1882
|
+
message: "Parameter Validation warrnings for getCartSharedItems",
|
|
1883
|
+
});
|
|
1884
|
+
Logger({ level: "WARN", message: warrning });
|
|
1389
1885
|
}
|
|
1390
1886
|
|
|
1391
1887
|
const query_params = {};
|
|
1392
1888
|
|
|
1393
1889
|
const xHeaders = {};
|
|
1394
1890
|
|
|
1395
|
-
|
|
1891
|
+
const response = await APIClient.execute(
|
|
1396
1892
|
this._conf,
|
|
1397
1893
|
"get",
|
|
1398
1894
|
constructUrl({
|
|
@@ -1403,6 +1899,23 @@ class PosCart {
|
|
|
1403
1899
|
undefined,
|
|
1404
1900
|
xHeaders
|
|
1405
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;
|
|
1406
1919
|
}
|
|
1407
1920
|
|
|
1408
1921
|
/**
|
|
@@ -1414,7 +1927,7 @@ class PosCart {
|
|
|
1414
1927
|
* @summary: Merge or replace existing cart
|
|
1415
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.
|
|
1416
1929
|
*/
|
|
1417
|
-
updateCartWithSharedItems({ token, action } = {}) {
|
|
1930
|
+
async updateCartWithSharedItems({ token, action } = {}) {
|
|
1418
1931
|
const { error } = PosCartValidator.updateCartWithSharedItems().validate(
|
|
1419
1932
|
{ token, action },
|
|
1420
1933
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1431,17 +1944,18 @@ class PosCart {
|
|
|
1431
1944
|
{ abortEarly: false, allowUnknown: false }
|
|
1432
1945
|
);
|
|
1433
1946
|
if (warrning) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1947
|
+
Logger({
|
|
1948
|
+
level: "WARN",
|
|
1949
|
+
message: "Parameter Validation warrnings for updateCartWithSharedItems",
|
|
1950
|
+
});
|
|
1951
|
+
Logger({ level: "WARN", message: warrning });
|
|
1438
1952
|
}
|
|
1439
1953
|
|
|
1440
1954
|
const query_params = {};
|
|
1441
1955
|
|
|
1442
1956
|
const xHeaders = {};
|
|
1443
1957
|
|
|
1444
|
-
|
|
1958
|
+
const response = await APIClient.execute(
|
|
1445
1959
|
this._conf,
|
|
1446
1960
|
"post",
|
|
1447
1961
|
constructUrl({
|
|
@@ -1452,6 +1966,23 @@ class PosCart {
|
|
|
1452
1966
|
undefined,
|
|
1453
1967
|
xHeaders
|
|
1454
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;
|
|
1455
1986
|
}
|
|
1456
1987
|
}
|
|
1457
1988
|
|