@gofynd/fdk-client-javascript 1.4.15-beta.2 → 1.4.15-beta.4
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/README.md +2 -2
- package/application.d.ts +1 -2
- package/application.js +2 -3
- package/index.d.ts +1 -2
- package/index.js +7 -1
- package/package.json +2 -3
- package/sdk/application/ApplicationClient.js +0 -18
- package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
- package/sdk/application/Cart/CartApplicationClient.js +27 -1203
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +80 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +40 -1344
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
- package/sdk/application/Common/CommonApplicationClient.js +2 -92
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
- package/sdk/application/Communication/CommunicationApplicationClient.js +3 -148
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +16 -727
- package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
- package/sdk/application/Content/ContentApplicationClient.js +23 -941
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +4 -134
- package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
- package/sdk/application/Lead/LeadApplicationClient.js +5 -217
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
- package/sdk/application/Logistic/LogisticApplicationClient.js +11 -496
- package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
- package/sdk/application/Order/OrderApplicationClient.js +11 -505
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
- package/sdk/application/Payment/PaymentApplicationClient.js +46 -2106
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
- package/sdk/application/Rewards/RewardsApplicationClient.js +7 -311
- package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
- package/sdk/application/Share/ShareApplicationClient.js +7 -309
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
- package/sdk/application/Theme/ThemeApplicationClient.js +4 -174
- package/sdk/application/User/UserApplicationClient.d.ts +85 -136
- package/sdk/application/User/UserApplicationClient.js +42 -1818
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
- package/sdk/application/Webhook/WebhookApplicationClient.js +1 -50
- package/sdk/application/index.d.ts +0 -18
- package/sdk/application/index.js +0 -33
- package/sdk/partner/OAuthClient.js +1 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +7 -0
- package/sdk/platform/Cart/CartPlatformModel.js +3 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
- package/sdk/platform/Catalog/CatalogPlatformModel.js +0 -3
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +7 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +3 -0
- package/sdk/public/Configuration/ConfigurationPublicClient.js +4 -2
- package/sdk/public/Content/ContentPublicClient.js +4 -2
- package/sdk/public/Partner/PartnerPublicClient.js +4 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +4 -2
- package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
- package/sdk/application/Cart/CartApplicationModel.js +0 -2497
- package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
- package/sdk/application/Cart/CartApplicationValidator.js +0 -530
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
- package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
- package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
- package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
- package/sdk/application/Common/CommonApplicationModel.js +0 -308
- package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
- package/sdk/application/Common/CommonApplicationValidator.js +0 -38
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
- package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
- package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
- package/sdk/application/Content/ContentApplicationModel.js +0 -1589
- package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
- package/sdk/application/Content/ContentApplicationValidator.js +0 -264
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
- package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
- package/sdk/application/Lead/LeadApplicationModel.js +0 -480
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
- package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
- package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
- package/sdk/application/Order/OrderApplicationModel.js +0 -1471
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
- package/sdk/application/Order/OrderApplicationValidator.js +0 -197
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
- package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
- package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
- package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
- package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
- package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
- package/sdk/application/Share/ShareApplicationModel.js +0 -234
- package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
- package/sdk/application/Share/ShareApplicationValidator.js +0 -91
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
- package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
- package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
- package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
- package/sdk/application/User/UserApplicationModel.js +0 -1382
- package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
- package/sdk/application/User/UserApplicationValidator.js +0 -573
- package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
- package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
- package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
- package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
- package/sdk/common/Clickstream.d.ts +0 -1
- package/sdk/common/Clickstream.js +0 -464
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
|
-
const {
|
|
3
|
-
FDKClientValidationError,
|
|
4
|
-
FDKResponseValidationError,
|
|
5
|
-
} = require("../../common/FDKError");
|
|
6
2
|
const constructUrl = require("../constructUrl");
|
|
7
3
|
const Paginator = require("../../common/Paginator");
|
|
8
|
-
const CartApplicationValidator = require("./CartApplicationValidator");
|
|
9
|
-
const CartApplicationModel = require("./CartApplicationModel");
|
|
10
|
-
const { Logger } = require("./../../common/Logger");
|
|
11
|
-
const Joi = require("joi");
|
|
12
4
|
|
|
13
5
|
class Cart {
|
|
14
6
|
constructor(_conf) {
|
|
@@ -63,10 +55,9 @@ class Cart {
|
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
/**
|
|
66
|
-
* @param {CartApplicationValidator.AddAddressParam} arg - Arg object.
|
|
67
58
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
68
59
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
69
|
-
* @returns {Promise<
|
|
60
|
+
* @returns {Promise<SaveAddressResponse>} - Success response
|
|
70
61
|
* @name addAddress
|
|
71
62
|
* @summary: Creates a new address for a customer
|
|
72
63
|
* @description: Add a new address to their cart to save details such as name, email, contact information, and address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/addAddress/).
|
|
@@ -75,26 +66,6 @@ class Cart {
|
|
|
75
66
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
76
67
|
{ responseHeaders } = { responseHeaders: false }
|
|
77
68
|
) {
|
|
78
|
-
const { error } = CartApplicationValidator.addAddress().validate(
|
|
79
|
-
{ body },
|
|
80
|
-
{ abortEarly: false, allowUnknown: true }
|
|
81
|
-
);
|
|
82
|
-
if (error) {
|
|
83
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Showing warrnings if extra unknown parameters are found
|
|
87
|
-
const { error: warrning } = CartApplicationValidator.addAddress().validate(
|
|
88
|
-
{ body },
|
|
89
|
-
{ abortEarly: false, allowUnknown: false }
|
|
90
|
-
);
|
|
91
|
-
if (warrning) {
|
|
92
|
-
Logger({
|
|
93
|
-
level: "WARN",
|
|
94
|
-
message: `Parameter Validation warrnings for application > Cart > addAddress \n ${warrning}`,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
69
|
const query_params = {};
|
|
99
70
|
|
|
100
71
|
const xHeaders = {};
|
|
@@ -117,32 +88,13 @@ class Cart {
|
|
|
117
88
|
responseData = response[0];
|
|
118
89
|
}
|
|
119
90
|
|
|
120
|
-
const {
|
|
121
|
-
error: res_error,
|
|
122
|
-
} = CartApplicationModel.SaveAddressResponse().validate(responseData, {
|
|
123
|
-
abortEarly: false,
|
|
124
|
-
allowUnknown: true,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (res_error) {
|
|
128
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
129
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
130
|
-
} else {
|
|
131
|
-
Logger({
|
|
132
|
-
level: "WARN",
|
|
133
|
-
message: `Response Validation Warnings for application > Cart > addAddress \n ${res_error}`,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
91
|
return response;
|
|
139
92
|
}
|
|
140
93
|
|
|
141
94
|
/**
|
|
142
|
-
* @param {CartApplicationValidator.AddItemsParam} arg - Arg object.
|
|
143
95
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
144
96
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
145
|
-
* @returns {Promise<
|
|
97
|
+
* @returns {Promise<AddCartDetailResponse>} - Success response
|
|
146
98
|
* @name addItems
|
|
147
99
|
* @summary: Add items to a cart
|
|
148
100
|
* @description: Add product items to the customer's existing shopping cart. If there is no existing cart associated with the customer, it creates a new one and adds the items to it. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/addItems/).
|
|
@@ -153,26 +105,6 @@ class Cart {
|
|
|
153
105
|
},
|
|
154
106
|
{ responseHeaders } = { responseHeaders: false }
|
|
155
107
|
) {
|
|
156
|
-
const { error } = CartApplicationValidator.addItems().validate(
|
|
157
|
-
{ body, i, b, areaCode, buyNow, id, orderType },
|
|
158
|
-
{ abortEarly: false, allowUnknown: true }
|
|
159
|
-
);
|
|
160
|
-
if (error) {
|
|
161
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Showing warrnings if extra unknown parameters are found
|
|
165
|
-
const { error: warrning } = CartApplicationValidator.addItems().validate(
|
|
166
|
-
{ body, i, b, areaCode, buyNow, id, orderType },
|
|
167
|
-
{ abortEarly: false, allowUnknown: false }
|
|
168
|
-
);
|
|
169
|
-
if (warrning) {
|
|
170
|
-
Logger({
|
|
171
|
-
level: "WARN",
|
|
172
|
-
message: `Parameter Validation warrnings for application > Cart > addItems \n ${warrning}`,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
108
|
const query_params = {};
|
|
177
109
|
query_params["i"] = i;
|
|
178
110
|
query_params["b"] = b;
|
|
@@ -201,32 +133,13 @@ class Cart {
|
|
|
201
133
|
responseData = response[0];
|
|
202
134
|
}
|
|
203
135
|
|
|
204
|
-
const {
|
|
205
|
-
error: res_error,
|
|
206
|
-
} = CartApplicationModel.AddCartDetailResponse().validate(responseData, {
|
|
207
|
-
abortEarly: false,
|
|
208
|
-
allowUnknown: true,
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
if (res_error) {
|
|
212
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
213
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
214
|
-
} else {
|
|
215
|
-
Logger({
|
|
216
|
-
level: "WARN",
|
|
217
|
-
message: `Response Validation Warnings for application > Cart > addItems \n ${res_error}`,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
136
|
return response;
|
|
223
137
|
}
|
|
224
138
|
|
|
225
139
|
/**
|
|
226
|
-
* @param {CartApplicationValidator.ApplyCouponParam} arg - Arg object.
|
|
227
140
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
228
141
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
229
|
-
* @returns {Promise<
|
|
142
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
230
143
|
* @name applyCoupon
|
|
231
144
|
* @summary: Apply coupon
|
|
232
145
|
* @description: Apply a coupon code to the cart to trigger discounts on eligible items. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/applyCoupon/).
|
|
@@ -237,26 +150,6 @@ class Cart {
|
|
|
237
150
|
},
|
|
238
151
|
{ responseHeaders } = { responseHeaders: false }
|
|
239
152
|
) {
|
|
240
|
-
const { error } = CartApplicationValidator.applyCoupon().validate(
|
|
241
|
-
{ body, i, b, p, id, buyNow, cartType },
|
|
242
|
-
{ abortEarly: false, allowUnknown: true }
|
|
243
|
-
);
|
|
244
|
-
if (error) {
|
|
245
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Showing warrnings if extra unknown parameters are found
|
|
249
|
-
const { error: warrning } = CartApplicationValidator.applyCoupon().validate(
|
|
250
|
-
{ body, i, b, p, id, buyNow, cartType },
|
|
251
|
-
{ abortEarly: false, allowUnknown: false }
|
|
252
|
-
);
|
|
253
|
-
if (warrning) {
|
|
254
|
-
Logger({
|
|
255
|
-
level: "WARN",
|
|
256
|
-
message: `Parameter Validation warrnings for application > Cart > applyCoupon \n ${warrning}`,
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
|
|
260
153
|
const query_params = {};
|
|
261
154
|
query_params["i"] = i;
|
|
262
155
|
query_params["b"] = b;
|
|
@@ -285,32 +178,13 @@ class Cart {
|
|
|
285
178
|
responseData = response[0];
|
|
286
179
|
}
|
|
287
180
|
|
|
288
|
-
const {
|
|
289
|
-
error: res_error,
|
|
290
|
-
} = CartApplicationModel.CartDetailResponse().validate(responseData, {
|
|
291
|
-
abortEarly: false,
|
|
292
|
-
allowUnknown: true,
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
if (res_error) {
|
|
296
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
297
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
298
|
-
} else {
|
|
299
|
-
Logger({
|
|
300
|
-
level: "WARN",
|
|
301
|
-
message: `Response Validation Warnings for application > Cart > applyCoupon \n ${res_error}`,
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
181
|
return response;
|
|
307
182
|
}
|
|
308
183
|
|
|
309
184
|
/**
|
|
310
|
-
* @param {CartApplicationValidator.ApplyRewardPointsParam} arg - Arg object.
|
|
311
185
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
312
186
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
313
|
-
* @returns {Promise<
|
|
187
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
314
188
|
* @name applyRewardPoints
|
|
315
189
|
* @summary: Use reward points
|
|
316
190
|
* @description: Users can redeem their accumulated reward points and apply them to the items in their cart, thereby availing discounts on their current purchases. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/applyRewardPoints/).
|
|
@@ -319,28 +193,6 @@ class Cart {
|
|
|
319
193
|
{ body, id, i, b, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
320
194
|
{ responseHeaders } = { responseHeaders: false }
|
|
321
195
|
) {
|
|
322
|
-
const { error } = CartApplicationValidator.applyRewardPoints().validate(
|
|
323
|
-
{ body, id, i, b, buyNow },
|
|
324
|
-
{ abortEarly: false, allowUnknown: true }
|
|
325
|
-
);
|
|
326
|
-
if (error) {
|
|
327
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// Showing warrnings if extra unknown parameters are found
|
|
331
|
-
const {
|
|
332
|
-
error: warrning,
|
|
333
|
-
} = CartApplicationValidator.applyRewardPoints().validate(
|
|
334
|
-
{ body, id, i, b, buyNow },
|
|
335
|
-
{ abortEarly: false, allowUnknown: false }
|
|
336
|
-
);
|
|
337
|
-
if (warrning) {
|
|
338
|
-
Logger({
|
|
339
|
-
level: "WARN",
|
|
340
|
-
message: `Parameter Validation warrnings for application > Cart > applyRewardPoints \n ${warrning}`,
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
|
|
344
196
|
const query_params = {};
|
|
345
197
|
query_params["id"] = id;
|
|
346
198
|
query_params["i"] = i;
|
|
@@ -367,32 +219,13 @@ class Cart {
|
|
|
367
219
|
responseData = response[0];
|
|
368
220
|
}
|
|
369
221
|
|
|
370
|
-
const {
|
|
371
|
-
error: res_error,
|
|
372
|
-
} = CartApplicationModel.CartDetailResponse().validate(responseData, {
|
|
373
|
-
abortEarly: false,
|
|
374
|
-
allowUnknown: true,
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
if (res_error) {
|
|
378
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
379
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
380
|
-
} else {
|
|
381
|
-
Logger({
|
|
382
|
-
level: "WARN",
|
|
383
|
-
message: `Response Validation Warnings for application > Cart > applyRewardPoints \n ${res_error}`,
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
222
|
return response;
|
|
389
223
|
}
|
|
390
224
|
|
|
391
225
|
/**
|
|
392
|
-
* @param {CartApplicationValidator.CheckoutCartV2Param} arg - Arg object.
|
|
393
226
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
394
227
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
395
|
-
* @returns {Promise<
|
|
228
|
+
* @returns {Promise<CartCheckoutResponse>} - Success response
|
|
396
229
|
* @name checkoutCartV2
|
|
397
230
|
* @summary: Checkout cart
|
|
398
231
|
* @description: The checkout cart initiates the order creation process based on the items in the user’s cart, their selected address, and chosen payment methods. It also supports multiple payment method options and revalidates the cart details to ensure a secure and seamless order placement. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/checkoutCartV2/).
|
|
@@ -401,28 +234,6 @@ class Cart {
|
|
|
401
234
|
{ body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
|
|
402
235
|
{ responseHeaders } = { responseHeaders: false }
|
|
403
236
|
) {
|
|
404
|
-
const { error } = CartApplicationValidator.checkoutCartV2().validate(
|
|
405
|
-
{ body, buyNow, cartType },
|
|
406
|
-
{ abortEarly: false, allowUnknown: true }
|
|
407
|
-
);
|
|
408
|
-
if (error) {
|
|
409
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Showing warrnings if extra unknown parameters are found
|
|
413
|
-
const {
|
|
414
|
-
error: warrning,
|
|
415
|
-
} = CartApplicationValidator.checkoutCartV2().validate(
|
|
416
|
-
{ body, buyNow, cartType },
|
|
417
|
-
{ abortEarly: false, allowUnknown: false }
|
|
418
|
-
);
|
|
419
|
-
if (warrning) {
|
|
420
|
-
Logger({
|
|
421
|
-
level: "WARN",
|
|
422
|
-
message: `Parameter Validation warrnings for application > Cart > checkoutCartV2 \n ${warrning}`,
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
|
|
426
237
|
const query_params = {};
|
|
427
238
|
query_params["buy_now"] = buyNow;
|
|
428
239
|
query_params["cart_type"] = cartType;
|
|
@@ -447,33 +258,13 @@ class Cart {
|
|
|
447
258
|
responseData = response[0];
|
|
448
259
|
}
|
|
449
260
|
|
|
450
|
-
const {
|
|
451
|
-
error: res_error,
|
|
452
|
-
} = CartApplicationModel.CartCheckoutResponse().validate(responseData, {
|
|
453
|
-
abortEarly: false,
|
|
454
|
-
allowUnknown: true,
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
if (res_error) {
|
|
458
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
459
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
460
|
-
} else {
|
|
461
|
-
Logger({
|
|
462
|
-
level: "WARN",
|
|
463
|
-
message: `Response Validation Warnings for application > Cart > checkoutCartV2 \n ${res_error}`,
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
261
|
return response;
|
|
469
262
|
}
|
|
470
263
|
|
|
471
264
|
/**
|
|
472
|
-
* @param {CartApplicationValidator.DeleteCartParam} arg - Arg object.
|
|
473
265
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
474
266
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
475
|
-
* @returns {Promise<
|
|
476
|
-
* Success response
|
|
267
|
+
* @returns {Promise<DeleteCartDetailResponse>} - Success response
|
|
477
268
|
* @name deleteCart
|
|
478
269
|
* @summary: Delete a cart
|
|
479
270
|
* @description: Delete all items from the user's cart and resets it to its initial state, providing a clean slate for new selections. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/deleteCart/).
|
|
@@ -482,26 +273,6 @@ class Cart {
|
|
|
482
273
|
{ id, requestHeaders } = { requestHeaders: {} },
|
|
483
274
|
{ responseHeaders } = { responseHeaders: false }
|
|
484
275
|
) {
|
|
485
|
-
const { error } = CartApplicationValidator.deleteCart().validate(
|
|
486
|
-
{ id },
|
|
487
|
-
{ abortEarly: false, allowUnknown: true }
|
|
488
|
-
);
|
|
489
|
-
if (error) {
|
|
490
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// Showing warrnings if extra unknown parameters are found
|
|
494
|
-
const { error: warrning } = CartApplicationValidator.deleteCart().validate(
|
|
495
|
-
{ id },
|
|
496
|
-
{ abortEarly: false, allowUnknown: false }
|
|
497
|
-
);
|
|
498
|
-
if (warrning) {
|
|
499
|
-
Logger({
|
|
500
|
-
level: "WARN",
|
|
501
|
-
message: `Parameter Validation warrnings for application > Cart > deleteCart \n ${warrning}`,
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
|
|
505
276
|
const query_params = {};
|
|
506
277
|
query_params["id"] = id;
|
|
507
278
|
|
|
@@ -525,32 +296,13 @@ class Cart {
|
|
|
525
296
|
responseData = response[0];
|
|
526
297
|
}
|
|
527
298
|
|
|
528
|
-
const {
|
|
529
|
-
error: res_error,
|
|
530
|
-
} = CartApplicationModel.DeleteCartDetailResponse().validate(responseData, {
|
|
531
|
-
abortEarly: false,
|
|
532
|
-
allowUnknown: true,
|
|
533
|
-
});
|
|
534
|
-
|
|
535
|
-
if (res_error) {
|
|
536
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
537
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
538
|
-
} else {
|
|
539
|
-
Logger({
|
|
540
|
-
level: "WARN",
|
|
541
|
-
message: `Response Validation Warnings for application > Cart > deleteCart \n ${res_error}`,
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
299
|
return response;
|
|
547
300
|
}
|
|
548
301
|
|
|
549
302
|
/**
|
|
550
|
-
* @param {CartApplicationValidator.GetAddressByIdParam} arg - Arg object.
|
|
551
303
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
552
304
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
553
|
-
* @returns {Promise<
|
|
305
|
+
* @returns {Promise<Address>} - Success response
|
|
554
306
|
* @name getAddressById
|
|
555
307
|
* @summary: Get details for a single customer address
|
|
556
308
|
* @description: Get a specific customer address stored in the system by providing its unique identifier. This API provides detailed information about the address, including the recipient's name, address, city, postal code, and other relevant details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddressById/).
|
|
@@ -568,28 +320,6 @@ class Cart {
|
|
|
568
320
|
} = { requestHeaders: {} },
|
|
569
321
|
{ responseHeaders } = { responseHeaders: false }
|
|
570
322
|
) {
|
|
571
|
-
const { error } = CartApplicationValidator.getAddressById().validate(
|
|
572
|
-
{ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
573
|
-
{ abortEarly: false, allowUnknown: true }
|
|
574
|
-
);
|
|
575
|
-
if (error) {
|
|
576
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// Showing warrnings if extra unknown parameters are found
|
|
580
|
-
const {
|
|
581
|
-
error: warrning,
|
|
582
|
-
} = CartApplicationValidator.getAddressById().validate(
|
|
583
|
-
{ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
584
|
-
{ abortEarly: false, allowUnknown: false }
|
|
585
|
-
);
|
|
586
|
-
if (warrning) {
|
|
587
|
-
Logger({
|
|
588
|
-
level: "WARN",
|
|
589
|
-
message: `Parameter Validation warrnings for application > Cart > getAddressById \n ${warrning}`,
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
|
|
593
323
|
const query_params = {};
|
|
594
324
|
query_params["cart_id"] = cartId;
|
|
595
325
|
query_params["buy_now"] = buyNow;
|
|
@@ -618,32 +348,13 @@ class Cart {
|
|
|
618
348
|
responseData = response[0];
|
|
619
349
|
}
|
|
620
350
|
|
|
621
|
-
const {
|
|
622
|
-
error: res_error,
|
|
623
|
-
} = CartApplicationModel.Address().validate(responseData, {
|
|
624
|
-
abortEarly: false,
|
|
625
|
-
allowUnknown: true,
|
|
626
|
-
});
|
|
627
|
-
|
|
628
|
-
if (res_error) {
|
|
629
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
630
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
631
|
-
} else {
|
|
632
|
-
Logger({
|
|
633
|
-
level: "WARN",
|
|
634
|
-
message: `Response Validation Warnings for application > Cart > getAddressById \n ${res_error}`,
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
|
|
639
351
|
return response;
|
|
640
352
|
}
|
|
641
353
|
|
|
642
354
|
/**
|
|
643
|
-
* @param {CartApplicationValidator.GetAddressesParam} arg - Arg object.
|
|
644
355
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
645
356
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
646
|
-
* @returns {Promise<
|
|
357
|
+
* @returns {Promise<GetAddressesResponse>} - Success response
|
|
647
358
|
* @name getAddresses
|
|
648
359
|
* @summary: Get a list of addresses for a customer
|
|
649
360
|
* @description: List all addresses saved by the customer, simplifying the checkout process by offering pre-saved address options for delivery. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddresses/).
|
|
@@ -660,28 +371,6 @@ class Cart {
|
|
|
660
371
|
} = { requestHeaders: {} },
|
|
661
372
|
{ responseHeaders } = { responseHeaders: false }
|
|
662
373
|
) {
|
|
663
|
-
const { error } = CartApplicationValidator.getAddresses().validate(
|
|
664
|
-
{ cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
665
|
-
{ abortEarly: false, allowUnknown: true }
|
|
666
|
-
);
|
|
667
|
-
if (error) {
|
|
668
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
// Showing warrnings if extra unknown parameters are found
|
|
672
|
-
const {
|
|
673
|
-
error: warrning,
|
|
674
|
-
} = CartApplicationValidator.getAddresses().validate(
|
|
675
|
-
{ cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
676
|
-
{ abortEarly: false, allowUnknown: false }
|
|
677
|
-
);
|
|
678
|
-
if (warrning) {
|
|
679
|
-
Logger({
|
|
680
|
-
level: "WARN",
|
|
681
|
-
message: `Parameter Validation warrnings for application > Cart > getAddresses \n ${warrning}`,
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
|
|
685
374
|
const query_params = {};
|
|
686
375
|
query_params["cart_id"] = cartId;
|
|
687
376
|
query_params["buy_now"] = buyNow;
|
|
@@ -710,32 +399,13 @@ class Cart {
|
|
|
710
399
|
responseData = response[0];
|
|
711
400
|
}
|
|
712
401
|
|
|
713
|
-
const {
|
|
714
|
-
error: res_error,
|
|
715
|
-
} = CartApplicationModel.GetAddressesResponse().validate(responseData, {
|
|
716
|
-
abortEarly: false,
|
|
717
|
-
allowUnknown: true,
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
if (res_error) {
|
|
721
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
722
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
723
|
-
} else {
|
|
724
|
-
Logger({
|
|
725
|
-
level: "WARN",
|
|
726
|
-
message: `Response Validation Warnings for application > Cart > getAddresses \n ${res_error}`,
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
402
|
return response;
|
|
732
403
|
}
|
|
733
404
|
|
|
734
405
|
/**
|
|
735
|
-
* @param {CartApplicationValidator.GetBulkDiscountOffersParam} arg - Arg object.
|
|
736
406
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
737
407
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
738
|
-
* @returns {Promise<
|
|
408
|
+
* @returns {Promise<BulkPriceResponse>} - Success response
|
|
739
409
|
* @name getBulkDiscountOffers
|
|
740
410
|
* @summary: List bulk discounts
|
|
741
411
|
* @description: List offer discounts with information about quantity and seller. One offer is marked with a "best" flag, indicating it as the best offer among the list. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getBulkDiscountOffers/).
|
|
@@ -744,28 +414,6 @@ class Cart {
|
|
|
744
414
|
{ itemId, articleId, uid, slug, requestHeaders } = { requestHeaders: {} },
|
|
745
415
|
{ responseHeaders } = { responseHeaders: false }
|
|
746
416
|
) {
|
|
747
|
-
const { error } = CartApplicationValidator.getBulkDiscountOffers().validate(
|
|
748
|
-
{ itemId, articleId, uid, slug },
|
|
749
|
-
{ abortEarly: false, allowUnknown: true }
|
|
750
|
-
);
|
|
751
|
-
if (error) {
|
|
752
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
// Showing warrnings if extra unknown parameters are found
|
|
756
|
-
const {
|
|
757
|
-
error: warrning,
|
|
758
|
-
} = CartApplicationValidator.getBulkDiscountOffers().validate(
|
|
759
|
-
{ itemId, articleId, uid, slug },
|
|
760
|
-
{ abortEarly: false, allowUnknown: false }
|
|
761
|
-
);
|
|
762
|
-
if (warrning) {
|
|
763
|
-
Logger({
|
|
764
|
-
level: "WARN",
|
|
765
|
-
message: `Parameter Validation warrnings for application > Cart > getBulkDiscountOffers \n ${warrning}`,
|
|
766
|
-
});
|
|
767
|
-
}
|
|
768
|
-
|
|
769
417
|
const query_params = {};
|
|
770
418
|
query_params["item_id"] = itemId;
|
|
771
419
|
query_params["article_id"] = articleId;
|
|
@@ -792,32 +440,13 @@ class Cart {
|
|
|
792
440
|
responseData = response[0];
|
|
793
441
|
}
|
|
794
442
|
|
|
795
|
-
const {
|
|
796
|
-
error: res_error,
|
|
797
|
-
} = CartApplicationModel.BulkPriceResponse().validate(responseData, {
|
|
798
|
-
abortEarly: false,
|
|
799
|
-
allowUnknown: true,
|
|
800
|
-
});
|
|
801
|
-
|
|
802
|
-
if (res_error) {
|
|
803
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
804
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
805
|
-
} else {
|
|
806
|
-
Logger({
|
|
807
|
-
level: "WARN",
|
|
808
|
-
message: `Response Validation Warnings for application > Cart > getBulkDiscountOffers \n ${res_error}`,
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
443
|
return response;
|
|
814
444
|
}
|
|
815
445
|
|
|
816
446
|
/**
|
|
817
|
-
* @param {CartApplicationValidator.GetCartParam} arg - Arg object.
|
|
818
447
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
819
448
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
820
|
-
* @returns {Promise<
|
|
449
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
821
450
|
* @name getCart
|
|
822
451
|
* @summary: Get a cart
|
|
823
452
|
* @description: Get details of a cart linked to a specific customer using a unique cart ID. It offers an overview of the items, quantities, prices, and other relevant information associated with the cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCart/).
|
|
@@ -836,26 +465,6 @@ class Cart {
|
|
|
836
465
|
} = { requestHeaders: {} },
|
|
837
466
|
{ responseHeaders } = { responseHeaders: false }
|
|
838
467
|
) {
|
|
839
|
-
const { error } = CartApplicationValidator.getCart().validate(
|
|
840
|
-
{ id, i, b, c, assignCardId, areaCode, buyNow, orderType },
|
|
841
|
-
{ abortEarly: false, allowUnknown: true }
|
|
842
|
-
);
|
|
843
|
-
if (error) {
|
|
844
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
// Showing warrnings if extra unknown parameters are found
|
|
848
|
-
const { error: warrning } = CartApplicationValidator.getCart().validate(
|
|
849
|
-
{ id, i, b, c, assignCardId, areaCode, buyNow, orderType },
|
|
850
|
-
{ abortEarly: false, allowUnknown: false }
|
|
851
|
-
);
|
|
852
|
-
if (warrning) {
|
|
853
|
-
Logger({
|
|
854
|
-
level: "WARN",
|
|
855
|
-
message: `Parameter Validation warrnings for application > Cart > getCart \n ${warrning}`,
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
|
|
859
468
|
const query_params = {};
|
|
860
469
|
query_params["id"] = id;
|
|
861
470
|
query_params["i"] = i;
|
|
@@ -886,29 +495,10 @@ class Cart {
|
|
|
886
495
|
responseData = response[0];
|
|
887
496
|
}
|
|
888
497
|
|
|
889
|
-
const {
|
|
890
|
-
error: res_error,
|
|
891
|
-
} = CartApplicationModel.CartDetailResponse().validate(responseData, {
|
|
892
|
-
abortEarly: false,
|
|
893
|
-
allowUnknown: true,
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
if (res_error) {
|
|
897
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
898
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
899
|
-
} else {
|
|
900
|
-
Logger({
|
|
901
|
-
level: "WARN",
|
|
902
|
-
message: `Response Validation Warnings for application > Cart > getCart \n ${res_error}`,
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
|
|
907
498
|
return response;
|
|
908
499
|
}
|
|
909
500
|
|
|
910
501
|
/**
|
|
911
|
-
* @param {CartApplicationValidator.GetCartLastModifiedParam} arg - Arg object.
|
|
912
502
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
913
503
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
914
504
|
* @returns {Promise<any>} - Success response
|
|
@@ -920,28 +510,6 @@ class Cart {
|
|
|
920
510
|
{ id, requestHeaders } = { requestHeaders: {} },
|
|
921
511
|
{ responseHeaders } = { responseHeaders: false }
|
|
922
512
|
) {
|
|
923
|
-
const { error } = CartApplicationValidator.getCartLastModified().validate(
|
|
924
|
-
{ id },
|
|
925
|
-
{ abortEarly: false, allowUnknown: true }
|
|
926
|
-
);
|
|
927
|
-
if (error) {
|
|
928
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
// Showing warrnings if extra unknown parameters are found
|
|
932
|
-
const {
|
|
933
|
-
error: warrning,
|
|
934
|
-
} = CartApplicationValidator.getCartLastModified().validate(
|
|
935
|
-
{ id },
|
|
936
|
-
{ abortEarly: false, allowUnknown: false }
|
|
937
|
-
);
|
|
938
|
-
if (warrning) {
|
|
939
|
-
Logger({
|
|
940
|
-
level: "WARN",
|
|
941
|
-
message: `Parameter Validation warrnings for application > Cart > getCartLastModified \n ${warrning}`,
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
|
|
945
513
|
const query_params = {};
|
|
946
514
|
query_params["id"] = id;
|
|
947
515
|
|
|
@@ -965,30 +533,13 @@ class Cart {
|
|
|
965
533
|
responseData = response[0];
|
|
966
534
|
}
|
|
967
535
|
|
|
968
|
-
const { error: res_error } = Joi.string()
|
|
969
|
-
.allow("")
|
|
970
|
-
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
971
|
-
|
|
972
|
-
if (res_error) {
|
|
973
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
974
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
975
|
-
} else {
|
|
976
|
-
Logger({
|
|
977
|
-
level: "WARN",
|
|
978
|
-
message: `Response Validation Warnings for application > Cart > getCartLastModified \n ${res_error}`,
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
|
|
983
536
|
return response;
|
|
984
537
|
}
|
|
985
538
|
|
|
986
539
|
/**
|
|
987
|
-
* @param {CartApplicationValidator.GetCartShareLinkParam} arg - Arg object.
|
|
988
540
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
989
541
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
990
|
-
* @returns {Promise<
|
|
991
|
-
* Success response
|
|
542
|
+
* @returns {Promise<GetShareCartLinkResponse>} - Success response
|
|
992
543
|
* @name getCartShareLink
|
|
993
544
|
* @summary: Create share cart link
|
|
994
545
|
* @description: Generate a unique shareable link for the customer's cart for a specific sales channel. This link enables easy sharing of the cart contents with other users, facilitating collaborative shopping experiences. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCartShareLink/).
|
|
@@ -997,28 +548,6 @@ class Cart {
|
|
|
997
548
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
998
549
|
{ responseHeaders } = { responseHeaders: false }
|
|
999
550
|
) {
|
|
1000
|
-
const { error } = CartApplicationValidator.getCartShareLink().validate(
|
|
1001
|
-
{ body },
|
|
1002
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1003
|
-
);
|
|
1004
|
-
if (error) {
|
|
1005
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1009
|
-
const {
|
|
1010
|
-
error: warrning,
|
|
1011
|
-
} = CartApplicationValidator.getCartShareLink().validate(
|
|
1012
|
-
{ body },
|
|
1013
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1014
|
-
);
|
|
1015
|
-
if (warrning) {
|
|
1016
|
-
Logger({
|
|
1017
|
-
level: "WARN",
|
|
1018
|
-
message: `Parameter Validation warrnings for application > Cart > getCartShareLink \n ${warrning}`,
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
551
|
const query_params = {};
|
|
1023
552
|
|
|
1024
553
|
const xHeaders = {};
|
|
@@ -1041,32 +570,13 @@ class Cart {
|
|
|
1041
570
|
responseData = response[0];
|
|
1042
571
|
}
|
|
1043
572
|
|
|
1044
|
-
const {
|
|
1045
|
-
error: res_error,
|
|
1046
|
-
} = CartApplicationModel.GetShareCartLinkResponse().validate(responseData, {
|
|
1047
|
-
abortEarly: false,
|
|
1048
|
-
allowUnknown: true,
|
|
1049
|
-
});
|
|
1050
|
-
|
|
1051
|
-
if (res_error) {
|
|
1052
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1053
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1054
|
-
} else {
|
|
1055
|
-
Logger({
|
|
1056
|
-
level: "WARN",
|
|
1057
|
-
message: `Response Validation Warnings for application > Cart > getCartShareLink \n ${res_error}`,
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
573
|
return response;
|
|
1063
574
|
}
|
|
1064
575
|
|
|
1065
576
|
/**
|
|
1066
|
-
* @param {CartApplicationValidator.GetCartSharedItemsParam} arg - Arg object.
|
|
1067
577
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1068
578
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1069
|
-
* @returns {Promise<
|
|
579
|
+
* @returns {Promise<SharedCartResponse>} - Success response
|
|
1070
580
|
* @name getCartSharedItems
|
|
1071
581
|
* @summary: List shared cart items
|
|
1072
582
|
* @description: Get cart items from the shared cart link based on unique token. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCartSharedItems/).
|
|
@@ -1075,28 +585,6 @@ class Cart {
|
|
|
1075
585
|
{ token, requestHeaders } = { requestHeaders: {} },
|
|
1076
586
|
{ responseHeaders } = { responseHeaders: false }
|
|
1077
587
|
) {
|
|
1078
|
-
const { error } = CartApplicationValidator.getCartSharedItems().validate(
|
|
1079
|
-
{ token },
|
|
1080
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1081
|
-
);
|
|
1082
|
-
if (error) {
|
|
1083
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1087
|
-
const {
|
|
1088
|
-
error: warrning,
|
|
1089
|
-
} = CartApplicationValidator.getCartSharedItems().validate(
|
|
1090
|
-
{ token },
|
|
1091
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1092
|
-
);
|
|
1093
|
-
if (warrning) {
|
|
1094
|
-
Logger({
|
|
1095
|
-
level: "WARN",
|
|
1096
|
-
message: `Parameter Validation warrnings for application > Cart > getCartSharedItems \n ${warrning}`,
|
|
1097
|
-
});
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
588
|
const query_params = {};
|
|
1101
589
|
|
|
1102
590
|
const xHeaders = {};
|
|
@@ -1119,32 +607,13 @@ class Cart {
|
|
|
1119
607
|
responseData = response[0];
|
|
1120
608
|
}
|
|
1121
609
|
|
|
1122
|
-
const {
|
|
1123
|
-
error: res_error,
|
|
1124
|
-
} = CartApplicationModel.SharedCartResponse().validate(responseData, {
|
|
1125
|
-
abortEarly: false,
|
|
1126
|
-
allowUnknown: true,
|
|
1127
|
-
});
|
|
1128
|
-
|
|
1129
|
-
if (res_error) {
|
|
1130
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1131
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1132
|
-
} else {
|
|
1133
|
-
Logger({
|
|
1134
|
-
level: "WARN",
|
|
1135
|
-
message: `Response Validation Warnings for application > Cart > getCartSharedItems \n ${res_error}`,
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
610
|
return response;
|
|
1141
611
|
}
|
|
1142
612
|
|
|
1143
613
|
/**
|
|
1144
|
-
* @param {CartApplicationValidator.GetCouponsParam} arg - Arg object.
|
|
1145
614
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1146
615
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1147
|
-
* @returns {Promise<
|
|
616
|
+
* @returns {Promise<GetCouponResponse>} - Success response
|
|
1148
617
|
* @name getCoupons
|
|
1149
618
|
* @summary: List available coupons
|
|
1150
619
|
* @description: List all available coupons that customer can apply to their carts. It provides details about each coupon, including its code, discount amount, and applicable conditions. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCoupons/).
|
|
@@ -1153,26 +622,6 @@ class Cart {
|
|
|
1153
622
|
{ id, buyNow, slug, storeId, requestHeaders } = { requestHeaders: {} },
|
|
1154
623
|
{ responseHeaders } = { responseHeaders: false }
|
|
1155
624
|
) {
|
|
1156
|
-
const { error } = CartApplicationValidator.getCoupons().validate(
|
|
1157
|
-
{ id, buyNow, slug, storeId },
|
|
1158
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1159
|
-
);
|
|
1160
|
-
if (error) {
|
|
1161
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1165
|
-
const { error: warrning } = CartApplicationValidator.getCoupons().validate(
|
|
1166
|
-
{ id, buyNow, slug, storeId },
|
|
1167
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1168
|
-
);
|
|
1169
|
-
if (warrning) {
|
|
1170
|
-
Logger({
|
|
1171
|
-
level: "WARN",
|
|
1172
|
-
message: `Parameter Validation warrnings for application > Cart > getCoupons \n ${warrning}`,
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
625
|
const query_params = {};
|
|
1177
626
|
query_params["id"] = id;
|
|
1178
627
|
query_params["buy_now"] = buyNow;
|
|
@@ -1199,32 +648,13 @@ class Cart {
|
|
|
1199
648
|
responseData = response[0];
|
|
1200
649
|
}
|
|
1201
650
|
|
|
1202
|
-
const {
|
|
1203
|
-
error: res_error,
|
|
1204
|
-
} = CartApplicationModel.GetCouponResponse().validate(responseData, {
|
|
1205
|
-
abortEarly: false,
|
|
1206
|
-
allowUnknown: true,
|
|
1207
|
-
});
|
|
1208
|
-
|
|
1209
|
-
if (res_error) {
|
|
1210
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1211
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1212
|
-
} else {
|
|
1213
|
-
Logger({
|
|
1214
|
-
level: "WARN",
|
|
1215
|
-
message: `Response Validation Warnings for application > Cart > getCoupons \n ${res_error}`,
|
|
1216
|
-
});
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
651
|
return response;
|
|
1221
652
|
}
|
|
1222
653
|
|
|
1223
654
|
/**
|
|
1224
|
-
* @param {CartApplicationValidator.GetItemCountParam} arg - Arg object.
|
|
1225
655
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1226
656
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1227
|
-
* @returns {Promise<
|
|
657
|
+
* @returns {Promise<CartItemCountResponse>} - Success response
|
|
1228
658
|
* @name getItemCount
|
|
1229
659
|
* @summary: Get a cart items count
|
|
1230
660
|
* @description: Get total count of items currently present in the customer's cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getItemCount/).
|
|
@@ -1233,28 +663,6 @@ class Cart {
|
|
|
1233
663
|
{ id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
1234
664
|
{ responseHeaders } = { responseHeaders: false }
|
|
1235
665
|
) {
|
|
1236
|
-
const { error } = CartApplicationValidator.getItemCount().validate(
|
|
1237
|
-
{ id, buyNow },
|
|
1238
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1239
|
-
);
|
|
1240
|
-
if (error) {
|
|
1241
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1245
|
-
const {
|
|
1246
|
-
error: warrning,
|
|
1247
|
-
} = CartApplicationValidator.getItemCount().validate(
|
|
1248
|
-
{ id, buyNow },
|
|
1249
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1250
|
-
);
|
|
1251
|
-
if (warrning) {
|
|
1252
|
-
Logger({
|
|
1253
|
-
level: "WARN",
|
|
1254
|
-
message: `Parameter Validation warrnings for application > Cart > getItemCount \n ${warrning}`,
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
666
|
const query_params = {};
|
|
1259
667
|
query_params["id"] = id;
|
|
1260
668
|
query_params["buy_now"] = buyNow;
|
|
@@ -1279,32 +687,13 @@ class Cart {
|
|
|
1279
687
|
responseData = response[0];
|
|
1280
688
|
}
|
|
1281
689
|
|
|
1282
|
-
const {
|
|
1283
|
-
error: res_error,
|
|
1284
|
-
} = CartApplicationModel.CartItemCountResponse().validate(responseData, {
|
|
1285
|
-
abortEarly: false,
|
|
1286
|
-
allowUnknown: true,
|
|
1287
|
-
});
|
|
1288
|
-
|
|
1289
|
-
if (res_error) {
|
|
1290
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1291
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1292
|
-
} else {
|
|
1293
|
-
Logger({
|
|
1294
|
-
level: "WARN",
|
|
1295
|
-
message: `Response Validation Warnings for application > Cart > getItemCount \n ${res_error}`,
|
|
1296
|
-
});
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
690
|
return response;
|
|
1301
691
|
}
|
|
1302
692
|
|
|
1303
693
|
/**
|
|
1304
|
-
* @param {CartApplicationValidator.GetLadderOffersParam} arg - Arg object.
|
|
1305
694
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1306
695
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1307
|
-
* @returns {Promise<
|
|
696
|
+
* @returns {Promise<LadderPriceOffers>} - Success response
|
|
1308
697
|
* @name getLadderOffers
|
|
1309
698
|
* @summary: List ladder offers
|
|
1310
699
|
* @description: Get ladder offers associated for the items in the cart. Ladder offers provide discounts or special pricing based on item quantity, allowing users to benefit from bulk purchases or promotional deals. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getLadderOffers/).
|
|
@@ -1315,28 +704,6 @@ class Cart {
|
|
|
1315
704
|
},
|
|
1316
705
|
{ responseHeaders } = { responseHeaders: false }
|
|
1317
706
|
) {
|
|
1318
|
-
const { error } = CartApplicationValidator.getLadderOffers().validate(
|
|
1319
|
-
{ slug, storeId, promotionId, pageSize },
|
|
1320
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1321
|
-
);
|
|
1322
|
-
if (error) {
|
|
1323
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1327
|
-
const {
|
|
1328
|
-
error: warrning,
|
|
1329
|
-
} = CartApplicationValidator.getLadderOffers().validate(
|
|
1330
|
-
{ slug, storeId, promotionId, pageSize },
|
|
1331
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1332
|
-
);
|
|
1333
|
-
if (warrning) {
|
|
1334
|
-
Logger({
|
|
1335
|
-
level: "WARN",
|
|
1336
|
-
message: `Parameter Validation warrnings for application > Cart > getLadderOffers \n ${warrning}`,
|
|
1337
|
-
});
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
707
|
const query_params = {};
|
|
1341
708
|
query_params["slug"] = slug;
|
|
1342
709
|
query_params["store_id"] = storeId;
|
|
@@ -1363,32 +730,13 @@ class Cart {
|
|
|
1363
730
|
responseData = response[0];
|
|
1364
731
|
}
|
|
1365
732
|
|
|
1366
|
-
const {
|
|
1367
|
-
error: res_error,
|
|
1368
|
-
} = CartApplicationModel.LadderPriceOffers().validate(responseData, {
|
|
1369
|
-
abortEarly: false,
|
|
1370
|
-
allowUnknown: true,
|
|
1371
|
-
});
|
|
1372
|
-
|
|
1373
|
-
if (res_error) {
|
|
1374
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1375
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1376
|
-
} else {
|
|
1377
|
-
Logger({
|
|
1378
|
-
level: "WARN",
|
|
1379
|
-
message: `Response Validation Warnings for application > Cart > getLadderOffers \n ${res_error}`,
|
|
1380
|
-
});
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
733
|
return response;
|
|
1385
734
|
}
|
|
1386
735
|
|
|
1387
736
|
/**
|
|
1388
|
-
* @param {CartApplicationValidator.GetPromotionOffersParam} arg - Arg object.
|
|
1389
737
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1390
738
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1391
|
-
* @returns {Promise<
|
|
739
|
+
* @returns {Promise<PromotionOffersResponse>} - Success response
|
|
1392
740
|
* @name getPromotionOffers
|
|
1393
741
|
* @summary: List available promotion offers
|
|
1394
742
|
* @description: List all promotional offers available for the items in the cart, including details such as offer text, unique promotion ID, and validity period. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getPromotionOffers/).
|
|
@@ -1399,28 +747,6 @@ class Cart {
|
|
|
1399
747
|
},
|
|
1400
748
|
{ responseHeaders } = { responseHeaders: false }
|
|
1401
749
|
) {
|
|
1402
|
-
const { error } = CartApplicationValidator.getPromotionOffers().validate(
|
|
1403
|
-
{ slug, pageSize, promotionGroup, storeId, cartType },
|
|
1404
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1405
|
-
);
|
|
1406
|
-
if (error) {
|
|
1407
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1411
|
-
const {
|
|
1412
|
-
error: warrning,
|
|
1413
|
-
} = CartApplicationValidator.getPromotionOffers().validate(
|
|
1414
|
-
{ slug, pageSize, promotionGroup, storeId, cartType },
|
|
1415
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1416
|
-
);
|
|
1417
|
-
if (warrning) {
|
|
1418
|
-
Logger({
|
|
1419
|
-
level: "WARN",
|
|
1420
|
-
message: `Parameter Validation warrnings for application > Cart > getPromotionOffers \n ${warrning}`,
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
750
|
const query_params = {};
|
|
1425
751
|
query_params["slug"] = slug;
|
|
1426
752
|
query_params["page_size"] = pageSize;
|
|
@@ -1448,34 +774,13 @@ class Cart {
|
|
|
1448
774
|
responseData = response[0];
|
|
1449
775
|
}
|
|
1450
776
|
|
|
1451
|
-
const {
|
|
1452
|
-
error: res_error,
|
|
1453
|
-
} = CartApplicationModel.PromotionOffersResponse().validate(responseData, {
|
|
1454
|
-
abortEarly: false,
|
|
1455
|
-
allowUnknown: true,
|
|
1456
|
-
});
|
|
1457
|
-
|
|
1458
|
-
if (res_error) {
|
|
1459
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1460
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1461
|
-
} else {
|
|
1462
|
-
Logger({
|
|
1463
|
-
level: "WARN",
|
|
1464
|
-
message: `Response Validation Warnings for application > Cart > getPromotionOffers \n ${res_error}`,
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
777
|
return response;
|
|
1470
778
|
}
|
|
1471
779
|
|
|
1472
780
|
/**
|
|
1473
|
-
* @param {CartApplicationValidator.GetPromotionPaymentOffersParam} arg - Arg object.
|
|
1474
781
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1475
782
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1476
|
-
* @returns {Promise<
|
|
1477
|
-
* - Success response
|
|
1478
|
-
*
|
|
783
|
+
* @returns {Promise<PromotionPaymentOffersResponse>} - Success response
|
|
1479
784
|
* @name getPromotionPaymentOffers
|
|
1480
785
|
* @summary: Fetch available promotions payment offers
|
|
1481
786
|
* @description: Use this API to get top 5 payment offers available for current product. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getPromotionPaymentOffers/).
|
|
@@ -1484,30 +789,6 @@ class Cart {
|
|
|
1484
789
|
{ id, uid, requestHeaders } = { requestHeaders: {} },
|
|
1485
790
|
{ responseHeaders } = { responseHeaders: false }
|
|
1486
791
|
) {
|
|
1487
|
-
const {
|
|
1488
|
-
error,
|
|
1489
|
-
} = CartApplicationValidator.getPromotionPaymentOffers().validate(
|
|
1490
|
-
{ id, uid },
|
|
1491
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1492
|
-
);
|
|
1493
|
-
if (error) {
|
|
1494
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1498
|
-
const {
|
|
1499
|
-
error: warrning,
|
|
1500
|
-
} = CartApplicationValidator.getPromotionPaymentOffers().validate(
|
|
1501
|
-
{ id, uid },
|
|
1502
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1503
|
-
);
|
|
1504
|
-
if (warrning) {
|
|
1505
|
-
Logger({
|
|
1506
|
-
level: "WARN",
|
|
1507
|
-
message: `Parameter Validation warrnings for application > Cart > getPromotionPaymentOffers \n ${warrning}`,
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
792
|
const query_params = {};
|
|
1512
793
|
query_params["id"] = id;
|
|
1513
794
|
query_params["uid"] = uid;
|
|
@@ -1532,32 +813,13 @@ class Cart {
|
|
|
1532
813
|
responseData = response[0];
|
|
1533
814
|
}
|
|
1534
815
|
|
|
1535
|
-
const {
|
|
1536
|
-
error: res_error,
|
|
1537
|
-
} = CartApplicationModel.PromotionPaymentOffersResponse().validate(
|
|
1538
|
-
responseData,
|
|
1539
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1540
|
-
);
|
|
1541
|
-
|
|
1542
|
-
if (res_error) {
|
|
1543
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1544
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1545
|
-
} else {
|
|
1546
|
-
Logger({
|
|
1547
|
-
level: "WARN",
|
|
1548
|
-
message: `Response Validation Warnings for application > Cart > getPromotionPaymentOffers \n ${res_error}`,
|
|
1549
|
-
});
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
816
|
return response;
|
|
1554
817
|
}
|
|
1555
818
|
|
|
1556
819
|
/**
|
|
1557
|
-
* @param {CartApplicationValidator.GetShipmentsParam} arg - Arg object.
|
|
1558
820
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1559
821
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1560
|
-
* @returns {Promise<
|
|
822
|
+
* @returns {Promise<CartShipmentsResponse>} - Success response
|
|
1561
823
|
* @name getShipments
|
|
1562
824
|
* @summary: List shipments
|
|
1563
825
|
* @description: Get shipment details for the items in a cart, specific to the selected address. Shipment details include delivery promises, seller information, item details, and other relevant information. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getShipments/).
|
|
@@ -1568,28 +830,6 @@ class Cart {
|
|
|
1568
830
|
},
|
|
1569
831
|
{ responseHeaders } = { responseHeaders: false }
|
|
1570
832
|
) {
|
|
1571
|
-
const { error } = CartApplicationValidator.getShipments().validate(
|
|
1572
|
-
{ p, id, buyNow, addressId, areaCode, orderType },
|
|
1573
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1574
|
-
);
|
|
1575
|
-
if (error) {
|
|
1576
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1580
|
-
const {
|
|
1581
|
-
error: warrning,
|
|
1582
|
-
} = CartApplicationValidator.getShipments().validate(
|
|
1583
|
-
{ p, id, buyNow, addressId, areaCode, orderType },
|
|
1584
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1585
|
-
);
|
|
1586
|
-
if (warrning) {
|
|
1587
|
-
Logger({
|
|
1588
|
-
level: "WARN",
|
|
1589
|
-
message: `Parameter Validation warrnings for application > Cart > getShipments \n ${warrning}`,
|
|
1590
|
-
});
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
833
|
const query_params = {};
|
|
1594
834
|
query_params["p"] = p;
|
|
1595
835
|
query_params["id"] = id;
|
|
@@ -1618,32 +858,13 @@ class Cart {
|
|
|
1618
858
|
responseData = response[0];
|
|
1619
859
|
}
|
|
1620
860
|
|
|
1621
|
-
const {
|
|
1622
|
-
error: res_error,
|
|
1623
|
-
} = CartApplicationModel.CartShipmentsResponse().validate(responseData, {
|
|
1624
|
-
abortEarly: false,
|
|
1625
|
-
allowUnknown: true,
|
|
1626
|
-
});
|
|
1627
|
-
|
|
1628
|
-
if (res_error) {
|
|
1629
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1630
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1631
|
-
} else {
|
|
1632
|
-
Logger({
|
|
1633
|
-
level: "WARN",
|
|
1634
|
-
message: `Response Validation Warnings for application > Cart > getShipments \n ${res_error}`,
|
|
1635
|
-
});
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
861
|
return response;
|
|
1640
862
|
}
|
|
1641
863
|
|
|
1642
864
|
/**
|
|
1643
|
-
* @param {CartApplicationValidator.RemoveAddressParam} arg - Arg object.
|
|
1644
865
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1645
866
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1646
|
-
* @returns {Promise<
|
|
867
|
+
* @returns {Promise<DeleteAddressResponse>} - Success response
|
|
1647
868
|
* @name removeAddress
|
|
1648
869
|
* @summary: Removes an address from a customer's address list
|
|
1649
870
|
* @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
|
|
@@ -1652,28 +873,6 @@ class Cart {
|
|
|
1652
873
|
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1653
874
|
{ responseHeaders } = { responseHeaders: false }
|
|
1654
875
|
) {
|
|
1655
|
-
const { error } = CartApplicationValidator.removeAddress().validate(
|
|
1656
|
-
{ id },
|
|
1657
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1658
|
-
);
|
|
1659
|
-
if (error) {
|
|
1660
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1664
|
-
const {
|
|
1665
|
-
error: warrning,
|
|
1666
|
-
} = CartApplicationValidator.removeAddress().validate(
|
|
1667
|
-
{ id },
|
|
1668
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1669
|
-
);
|
|
1670
|
-
if (warrning) {
|
|
1671
|
-
Logger({
|
|
1672
|
-
level: "WARN",
|
|
1673
|
-
message: `Parameter Validation warrnings for application > Cart > removeAddress \n ${warrning}`,
|
|
1674
|
-
});
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
876
|
const query_params = {};
|
|
1678
877
|
|
|
1679
878
|
const xHeaders = {};
|
|
@@ -1696,32 +895,13 @@ class Cart {
|
|
|
1696
895
|
responseData = response[0];
|
|
1697
896
|
}
|
|
1698
897
|
|
|
1699
|
-
const {
|
|
1700
|
-
error: res_error,
|
|
1701
|
-
} = CartApplicationModel.DeleteAddressResponse().validate(responseData, {
|
|
1702
|
-
abortEarly: false,
|
|
1703
|
-
allowUnknown: true,
|
|
1704
|
-
});
|
|
1705
|
-
|
|
1706
|
-
if (res_error) {
|
|
1707
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1708
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1709
|
-
} else {
|
|
1710
|
-
Logger({
|
|
1711
|
-
level: "WARN",
|
|
1712
|
-
message: `Response Validation Warnings for application > Cart > removeAddress \n ${res_error}`,
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
898
|
return response;
|
|
1718
899
|
}
|
|
1719
900
|
|
|
1720
901
|
/**
|
|
1721
|
-
* @param {CartApplicationValidator.RemoveCouponParam} arg - Arg object.
|
|
1722
902
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1723
903
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1724
|
-
* @returns {Promise<
|
|
904
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1725
905
|
* @name removeCoupon
|
|
1726
906
|
* @summary: Remove coupon
|
|
1727
907
|
* @description: Remove an applied coupon from the customer's cart, thereby removing the associated discount from the cart total. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeCoupon/).
|
|
@@ -1730,28 +910,6 @@ class Cart {
|
|
|
1730
910
|
{ id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
1731
911
|
{ responseHeaders } = { responseHeaders: false }
|
|
1732
912
|
) {
|
|
1733
|
-
const { error } = CartApplicationValidator.removeCoupon().validate(
|
|
1734
|
-
{ id, buyNow },
|
|
1735
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1736
|
-
);
|
|
1737
|
-
if (error) {
|
|
1738
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1742
|
-
const {
|
|
1743
|
-
error: warrning,
|
|
1744
|
-
} = CartApplicationValidator.removeCoupon().validate(
|
|
1745
|
-
{ id, buyNow },
|
|
1746
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1747
|
-
);
|
|
1748
|
-
if (warrning) {
|
|
1749
|
-
Logger({
|
|
1750
|
-
level: "WARN",
|
|
1751
|
-
message: `Parameter Validation warrnings for application > Cart > removeCoupon \n ${warrning}`,
|
|
1752
|
-
});
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
913
|
const query_params = {};
|
|
1756
914
|
query_params["id"] = id;
|
|
1757
915
|
query_params["buy_now"] = buyNow;
|
|
@@ -1776,32 +934,13 @@ class Cart {
|
|
|
1776
934
|
responseData = response[0];
|
|
1777
935
|
}
|
|
1778
936
|
|
|
1779
|
-
const {
|
|
1780
|
-
error: res_error,
|
|
1781
|
-
} = CartApplicationModel.CartDetailResponse().validate(responseData, {
|
|
1782
|
-
abortEarly: false,
|
|
1783
|
-
allowUnknown: true,
|
|
1784
|
-
});
|
|
1785
|
-
|
|
1786
|
-
if (res_error) {
|
|
1787
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1788
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1789
|
-
} else {
|
|
1790
|
-
Logger({
|
|
1791
|
-
level: "WARN",
|
|
1792
|
-
message: `Response Validation Warnings for application > Cart > removeCoupon \n ${res_error}`,
|
|
1793
|
-
});
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
937
|
return response;
|
|
1798
938
|
}
|
|
1799
939
|
|
|
1800
940
|
/**
|
|
1801
|
-
* @param {CartApplicationValidator.SelectAddressParam} arg - Arg object.
|
|
1802
941
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1803
942
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1804
|
-
* @returns {Promise<
|
|
943
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1805
944
|
* @name selectAddress
|
|
1806
945
|
* @summary: Select customer address for order processing
|
|
1807
946
|
* @description: Select an address from the saved customer addresses and validates the availability of items in the cart. Additionally, it verifies and updates the delivery promise based on the selected address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/selectAddress/).
|
|
@@ -1810,28 +949,6 @@ class Cart {
|
|
|
1810
949
|
{ body, cartId, buyNow, i, b, requestHeaders } = { requestHeaders: {} },
|
|
1811
950
|
{ responseHeaders } = { responseHeaders: false }
|
|
1812
951
|
) {
|
|
1813
|
-
const { error } = CartApplicationValidator.selectAddress().validate(
|
|
1814
|
-
{ body, cartId, buyNow, i, b },
|
|
1815
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1816
|
-
);
|
|
1817
|
-
if (error) {
|
|
1818
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1822
|
-
const {
|
|
1823
|
-
error: warrning,
|
|
1824
|
-
} = CartApplicationValidator.selectAddress().validate(
|
|
1825
|
-
{ body, cartId, buyNow, i, b },
|
|
1826
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1827
|
-
);
|
|
1828
|
-
if (warrning) {
|
|
1829
|
-
Logger({
|
|
1830
|
-
level: "WARN",
|
|
1831
|
-
message: `Parameter Validation warrnings for application > Cart > selectAddress \n ${warrning}`,
|
|
1832
|
-
});
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
952
|
const query_params = {};
|
|
1836
953
|
query_params["cart_id"] = cartId;
|
|
1837
954
|
query_params["buy_now"] = buyNow;
|
|
@@ -1858,32 +975,13 @@ class Cart {
|
|
|
1858
975
|
responseData = response[0];
|
|
1859
976
|
}
|
|
1860
977
|
|
|
1861
|
-
const {
|
|
1862
|
-
error: res_error,
|
|
1863
|
-
} = CartApplicationModel.CartDetailResponse().validate(responseData, {
|
|
1864
|
-
abortEarly: false,
|
|
1865
|
-
allowUnknown: true,
|
|
1866
|
-
});
|
|
1867
|
-
|
|
1868
|
-
if (res_error) {
|
|
1869
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1870
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1871
|
-
} else {
|
|
1872
|
-
Logger({
|
|
1873
|
-
level: "WARN",
|
|
1874
|
-
message: `Response Validation Warnings for application > Cart > selectAddress \n ${res_error}`,
|
|
1875
|
-
});
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
978
|
return response;
|
|
1880
979
|
}
|
|
1881
980
|
|
|
1882
981
|
/**
|
|
1883
|
-
* @param {CartApplicationValidator.SelectPaymentModeParam} arg - Arg object.
|
|
1884
982
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1885
983
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1886
|
-
* @returns {Promise<
|
|
984
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1887
985
|
* @name selectPaymentMode
|
|
1888
986
|
* @summary: Select payment mode
|
|
1889
987
|
* @description: Select a preferred payment mode from available options during the cart checkout process to securely and efficiently complete their transaction. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/selectPaymentMode/).
|
|
@@ -1892,28 +990,6 @@ class Cart {
|
|
|
1892
990
|
{ body, id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
1893
991
|
{ responseHeaders } = { responseHeaders: false }
|
|
1894
992
|
) {
|
|
1895
|
-
const { error } = CartApplicationValidator.selectPaymentMode().validate(
|
|
1896
|
-
{ body, id, buyNow },
|
|
1897
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1898
|
-
);
|
|
1899
|
-
if (error) {
|
|
1900
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1904
|
-
const {
|
|
1905
|
-
error: warrning,
|
|
1906
|
-
} = CartApplicationValidator.selectPaymentMode().validate(
|
|
1907
|
-
{ body, id, buyNow },
|
|
1908
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1909
|
-
);
|
|
1910
|
-
if (warrning) {
|
|
1911
|
-
Logger({
|
|
1912
|
-
level: "WARN",
|
|
1913
|
-
message: `Parameter Validation warrnings for application > Cart > selectPaymentMode \n ${warrning}`,
|
|
1914
|
-
});
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
993
|
const query_params = {};
|
|
1918
994
|
query_params["id"] = id;
|
|
1919
995
|
query_params["buy_now"] = buyNow;
|
|
@@ -1938,32 +1014,13 @@ class Cart {
|
|
|
1938
1014
|
responseData = response[0];
|
|
1939
1015
|
}
|
|
1940
1016
|
|
|
1941
|
-
const {
|
|
1942
|
-
error: res_error,
|
|
1943
|
-
} = CartApplicationModel.CartDetailResponse().validate(responseData, {
|
|
1944
|
-
abortEarly: false,
|
|
1945
|
-
allowUnknown: true,
|
|
1946
|
-
});
|
|
1947
|
-
|
|
1948
|
-
if (res_error) {
|
|
1949
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1950
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1951
|
-
} else {
|
|
1952
|
-
Logger({
|
|
1953
|
-
level: "WARN",
|
|
1954
|
-
message: `Response Validation Warnings for application > Cart > selectPaymentMode \n ${res_error}`,
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
|
|
1959
1017
|
return response;
|
|
1960
1018
|
}
|
|
1961
1019
|
|
|
1962
1020
|
/**
|
|
1963
|
-
* @param {CartApplicationValidator.UpdateAddressParam} arg - Arg object.
|
|
1964
1021
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1965
1022
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1966
|
-
* @returns {Promise<
|
|
1023
|
+
* @returns {Promise<UpdateAddressResponse>} - Success response
|
|
1967
1024
|
* @name updateAddress
|
|
1968
1025
|
* @summary: Updates an existing customer address
|
|
1969
1026
|
* @description: Customer can modify the details of a previously saved addresses. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateAddress/).
|
|
@@ -1972,28 +1029,6 @@ class Cart {
|
|
|
1972
1029
|
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
1973
1030
|
{ responseHeaders } = { responseHeaders: false }
|
|
1974
1031
|
) {
|
|
1975
|
-
const { error } = CartApplicationValidator.updateAddress().validate(
|
|
1976
|
-
{ id, body },
|
|
1977
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1978
|
-
);
|
|
1979
|
-
if (error) {
|
|
1980
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1984
|
-
const {
|
|
1985
|
-
error: warrning,
|
|
1986
|
-
} = CartApplicationValidator.updateAddress().validate(
|
|
1987
|
-
{ id, body },
|
|
1988
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1989
|
-
);
|
|
1990
|
-
if (warrning) {
|
|
1991
|
-
Logger({
|
|
1992
|
-
level: "WARN",
|
|
1993
|
-
message: `Parameter Validation warrnings for application > Cart > updateAddress \n ${warrning}`,
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
1032
|
const query_params = {};
|
|
1998
1033
|
|
|
1999
1034
|
const xHeaders = {};
|
|
@@ -2016,33 +1051,13 @@ class Cart {
|
|
|
2016
1051
|
responseData = response[0];
|
|
2017
1052
|
}
|
|
2018
1053
|
|
|
2019
|
-
const {
|
|
2020
|
-
error: res_error,
|
|
2021
|
-
} = CartApplicationModel.UpdateAddressResponse().validate(responseData, {
|
|
2022
|
-
abortEarly: false,
|
|
2023
|
-
allowUnknown: true,
|
|
2024
|
-
});
|
|
2025
|
-
|
|
2026
|
-
if (res_error) {
|
|
2027
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2028
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2029
|
-
} else {
|
|
2030
|
-
Logger({
|
|
2031
|
-
level: "WARN",
|
|
2032
|
-
message: `Response Validation Warnings for application > Cart > updateAddress \n ${res_error}`,
|
|
2033
|
-
});
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
1054
|
return response;
|
|
2038
1055
|
}
|
|
2039
1056
|
|
|
2040
1057
|
/**
|
|
2041
|
-
* @param {CartApplicationValidator.UpdateCartParam} arg - Arg object.
|
|
2042
1058
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2043
1059
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2044
|
-
* @returns {Promise<
|
|
2045
|
-
* Success response
|
|
1060
|
+
* @returns {Promise<UpdateCartDetailResponse>} - Success response
|
|
2046
1061
|
* @name updateCart
|
|
2047
1062
|
* @summary: Update cart items
|
|
2048
1063
|
* @description: Update cart. Customers can modify added product attributes such as quantity and size, as well as remove items from the cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateCart/).
|
|
@@ -2061,26 +1076,6 @@ class Cart {
|
|
|
2061
1076
|
} = { requestHeaders: {} },
|
|
2062
1077
|
{ responseHeaders } = { responseHeaders: false }
|
|
2063
1078
|
) {
|
|
2064
|
-
const { error } = CartApplicationValidator.updateCart().validate(
|
|
2065
|
-
{ body, id, i, b, areaCode, buyNow, cartType, orderType },
|
|
2066
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2067
|
-
);
|
|
2068
|
-
if (error) {
|
|
2069
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2073
|
-
const { error: warrning } = CartApplicationValidator.updateCart().validate(
|
|
2074
|
-
{ body, id, i, b, areaCode, buyNow, cartType, orderType },
|
|
2075
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2076
|
-
);
|
|
2077
|
-
if (warrning) {
|
|
2078
|
-
Logger({
|
|
2079
|
-
level: "WARN",
|
|
2080
|
-
message: `Parameter Validation warrnings for application > Cart > updateCart \n ${warrning}`,
|
|
2081
|
-
});
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
1079
|
const query_params = {};
|
|
2085
1080
|
query_params["id"] = id;
|
|
2086
1081
|
query_params["i"] = i;
|
|
@@ -2110,32 +1105,13 @@ class Cart {
|
|
|
2110
1105
|
responseData = response[0];
|
|
2111
1106
|
}
|
|
2112
1107
|
|
|
2113
|
-
const {
|
|
2114
|
-
error: res_error,
|
|
2115
|
-
} = CartApplicationModel.UpdateCartDetailResponse().validate(responseData, {
|
|
2116
|
-
abortEarly: false,
|
|
2117
|
-
allowUnknown: true,
|
|
2118
|
-
});
|
|
2119
|
-
|
|
2120
|
-
if (res_error) {
|
|
2121
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2122
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2123
|
-
} else {
|
|
2124
|
-
Logger({
|
|
2125
|
-
level: "WARN",
|
|
2126
|
-
message: `Response Validation Warnings for application > Cart > updateCart \n ${res_error}`,
|
|
2127
|
-
});
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
1108
|
return response;
|
|
2132
1109
|
}
|
|
2133
1110
|
|
|
2134
1111
|
/**
|
|
2135
|
-
* @param {CartApplicationValidator.UpdateCartMetaParam} arg - Arg object.
|
|
2136
1112
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2137
1113
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2138
|
-
* @returns {Promise<
|
|
1114
|
+
* @returns {Promise<CartMetaResponse>} - Success response
|
|
2139
1115
|
* @name updateCartMeta
|
|
2140
1116
|
* @summary: Update cart metadata
|
|
2141
1117
|
* @description: Update metadata associated with a cart, which includes customer preferences, delivery instructions, or any special requirements related to the cart items. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateCartMeta/).
|
|
@@ -2144,28 +1120,6 @@ class Cart {
|
|
|
2144
1120
|
{ body, id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
2145
1121
|
{ responseHeaders } = { responseHeaders: false }
|
|
2146
1122
|
) {
|
|
2147
|
-
const { error } = CartApplicationValidator.updateCartMeta().validate(
|
|
2148
|
-
{ body, id, buyNow },
|
|
2149
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2150
|
-
);
|
|
2151
|
-
if (error) {
|
|
2152
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2156
|
-
const {
|
|
2157
|
-
error: warrning,
|
|
2158
|
-
} = CartApplicationValidator.updateCartMeta().validate(
|
|
2159
|
-
{ body, id, buyNow },
|
|
2160
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2161
|
-
);
|
|
2162
|
-
if (warrning) {
|
|
2163
|
-
Logger({
|
|
2164
|
-
level: "WARN",
|
|
2165
|
-
message: `Parameter Validation warrnings for application > Cart > updateCartMeta \n ${warrning}`,
|
|
2166
|
-
});
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
1123
|
const query_params = {};
|
|
2170
1124
|
query_params["id"] = id;
|
|
2171
1125
|
query_params["buy_now"] = buyNow;
|
|
@@ -2190,32 +1144,13 @@ class Cart {
|
|
|
2190
1144
|
responseData = response[0];
|
|
2191
1145
|
}
|
|
2192
1146
|
|
|
2193
|
-
const {
|
|
2194
|
-
error: res_error,
|
|
2195
|
-
} = CartApplicationModel.CartMetaResponse().validate(responseData, {
|
|
2196
|
-
abortEarly: false,
|
|
2197
|
-
allowUnknown: true,
|
|
2198
|
-
});
|
|
2199
|
-
|
|
2200
|
-
if (res_error) {
|
|
2201
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2202
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2203
|
-
} else {
|
|
2204
|
-
Logger({
|
|
2205
|
-
level: "WARN",
|
|
2206
|
-
message: `Response Validation Warnings for application > Cart > updateCartMeta \n ${res_error}`,
|
|
2207
|
-
});
|
|
2208
|
-
}
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
1147
|
return response;
|
|
2212
1148
|
}
|
|
2213
1149
|
|
|
2214
1150
|
/**
|
|
2215
|
-
* @param {CartApplicationValidator.UpdateCartWithSharedItemsParam} arg - Arg object.
|
|
2216
1151
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2217
1152
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2218
|
-
* @returns {Promise<
|
|
1153
|
+
* @returns {Promise<SharedCartResponse>} - Success response
|
|
2219
1154
|
* @name updateCartWithSharedItems
|
|
2220
1155
|
* @summary: Update with shared items
|
|
2221
1156
|
* @description: Merge or replace shared cart items with existing cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateCartWithSharedItems/).
|
|
@@ -2224,30 +1159,6 @@ class Cart {
|
|
|
2224
1159
|
{ token, action, requestHeaders } = { requestHeaders: {} },
|
|
2225
1160
|
{ responseHeaders } = { responseHeaders: false }
|
|
2226
1161
|
) {
|
|
2227
|
-
const {
|
|
2228
|
-
error,
|
|
2229
|
-
} = CartApplicationValidator.updateCartWithSharedItems().validate(
|
|
2230
|
-
{ token, action },
|
|
2231
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2232
|
-
);
|
|
2233
|
-
if (error) {
|
|
2234
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2238
|
-
const {
|
|
2239
|
-
error: warrning,
|
|
2240
|
-
} = CartApplicationValidator.updateCartWithSharedItems().validate(
|
|
2241
|
-
{ token, action },
|
|
2242
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2243
|
-
);
|
|
2244
|
-
if (warrning) {
|
|
2245
|
-
Logger({
|
|
2246
|
-
level: "WARN",
|
|
2247
|
-
message: `Parameter Validation warrnings for application > Cart > updateCartWithSharedItems \n ${warrning}`,
|
|
2248
|
-
});
|
|
2249
|
-
}
|
|
2250
|
-
|
|
2251
1162
|
const query_params = {};
|
|
2252
1163
|
|
|
2253
1164
|
const xHeaders = {};
|
|
@@ -2270,32 +1181,13 @@ class Cart {
|
|
|
2270
1181
|
responseData = response[0];
|
|
2271
1182
|
}
|
|
2272
1183
|
|
|
2273
|
-
const {
|
|
2274
|
-
error: res_error,
|
|
2275
|
-
} = CartApplicationModel.SharedCartResponse().validate(responseData, {
|
|
2276
|
-
abortEarly: false,
|
|
2277
|
-
allowUnknown: true,
|
|
2278
|
-
});
|
|
2279
|
-
|
|
2280
|
-
if (res_error) {
|
|
2281
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2282
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2283
|
-
} else {
|
|
2284
|
-
Logger({
|
|
2285
|
-
level: "WARN",
|
|
2286
|
-
message: `Response Validation Warnings for application > Cart > updateCartWithSharedItems \n ${res_error}`,
|
|
2287
|
-
});
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
1184
|
return response;
|
|
2292
1185
|
}
|
|
2293
1186
|
|
|
2294
1187
|
/**
|
|
2295
|
-
* @param {CartApplicationValidator.ValidateCouponForPaymentParam} arg - Arg object.
|
|
2296
1188
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2297
1189
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2298
|
-
* @returns {Promise<
|
|
1190
|
+
* @returns {Promise<PaymentCouponValidate>} - Success response
|
|
2299
1191
|
* @name validateCouponForPayment
|
|
2300
1192
|
* @summary: Validate applied coupon
|
|
2301
1193
|
* @description: Validate the applicability of a coupon code for the selected payment mode for the existing cart. This ensures the coupon's validity before proceeding with the payment process, enhancing user experience and preventing potential errors during transactions. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/validateCouponForPayment/).
|
|
@@ -2318,56 +1210,6 @@ class Cart {
|
|
|
2318
1210
|
} = { requestHeaders: {} },
|
|
2319
1211
|
{ responseHeaders } = { responseHeaders: false }
|
|
2320
1212
|
) {
|
|
2321
|
-
const {
|
|
2322
|
-
error,
|
|
2323
|
-
} = CartApplicationValidator.validateCouponForPayment().validate(
|
|
2324
|
-
{
|
|
2325
|
-
id,
|
|
2326
|
-
buyNow,
|
|
2327
|
-
addressId,
|
|
2328
|
-
paymentMode,
|
|
2329
|
-
paymentIdentifier,
|
|
2330
|
-
aggregatorName,
|
|
2331
|
-
merchantCode,
|
|
2332
|
-
iin,
|
|
2333
|
-
network,
|
|
2334
|
-
type,
|
|
2335
|
-
cardId,
|
|
2336
|
-
cartType,
|
|
2337
|
-
},
|
|
2338
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2339
|
-
);
|
|
2340
|
-
if (error) {
|
|
2341
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2345
|
-
const {
|
|
2346
|
-
error: warrning,
|
|
2347
|
-
} = CartApplicationValidator.validateCouponForPayment().validate(
|
|
2348
|
-
{
|
|
2349
|
-
id,
|
|
2350
|
-
buyNow,
|
|
2351
|
-
addressId,
|
|
2352
|
-
paymentMode,
|
|
2353
|
-
paymentIdentifier,
|
|
2354
|
-
aggregatorName,
|
|
2355
|
-
merchantCode,
|
|
2356
|
-
iin,
|
|
2357
|
-
network,
|
|
2358
|
-
type,
|
|
2359
|
-
cardId,
|
|
2360
|
-
cartType,
|
|
2361
|
-
},
|
|
2362
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2363
|
-
);
|
|
2364
|
-
if (warrning) {
|
|
2365
|
-
Logger({
|
|
2366
|
-
level: "WARN",
|
|
2367
|
-
message: `Parameter Validation warrnings for application > Cart > validateCouponForPayment \n ${warrning}`,
|
|
2368
|
-
});
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
1213
|
const query_params = {};
|
|
2372
1214
|
query_params["id"] = id;
|
|
2373
1215
|
query_params["buy_now"] = buyNow;
|
|
@@ -2402,24 +1244,6 @@ class Cart {
|
|
|
2402
1244
|
responseData = response[0];
|
|
2403
1245
|
}
|
|
2404
1246
|
|
|
2405
|
-
const {
|
|
2406
|
-
error: res_error,
|
|
2407
|
-
} = CartApplicationModel.PaymentCouponValidate().validate(responseData, {
|
|
2408
|
-
abortEarly: false,
|
|
2409
|
-
allowUnknown: true,
|
|
2410
|
-
});
|
|
2411
|
-
|
|
2412
|
-
if (res_error) {
|
|
2413
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2414
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2415
|
-
} else {
|
|
2416
|
-
Logger({
|
|
2417
|
-
level: "WARN",
|
|
2418
|
-
message: `Response Validation Warnings for application > Cart > validateCouponForPayment \n ${res_error}`,
|
|
2419
|
-
});
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
1247
|
return response;
|
|
2424
1248
|
}
|
|
2425
1249
|
}
|