@gofynd/fdk-client-javascript 1.4.15-beta.1 → 1.4.15-beta.11
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 +3 -4
- package/sdk/application/ApplicationClient.js +0 -18
- package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
- package/sdk/application/Cart/CartApplicationClient.js +60 -1185
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +90 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +187 -1293
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
- package/sdk/application/Common/CommonApplicationClient.js +5 -89
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
- package/sdk/application/Communication/CommunicationApplicationClient.js +6 -145
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +31 -718
- package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
- package/sdk/application/Content/ContentApplicationClient.js +77 -914
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +19 -125
- package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
- package/sdk/application/Lead/LeadApplicationClient.js +32 -202
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
- package/sdk/application/Logistic/LogisticApplicationClient.js +50 -478
- package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
- package/sdk/application/Order/OrderApplicationClient.js +86 -472
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
- package/sdk/application/Payment/PaymentApplicationClient.js +57 -2102
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
- package/sdk/application/Rewards/RewardsApplicationClient.js +16 -305
- package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
- package/sdk/application/Share/ShareApplicationClient.js +34 -294
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
- package/sdk/application/Theme/ThemeApplicationClient.js +28 -162
- package/sdk/application/User/UserApplicationClient.d.ts +85 -136
- package/sdk/application/User/UserApplicationClient.js +45 -1815
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
- package/sdk/application/Webhook/WebhookApplicationClient.js +4 -47
- package/sdk/application/index.d.ts +0 -18
- package/sdk/application/index.js +0 -33
- package/sdk/common/Utility.d.ts +1 -1
- package/sdk/common/Utility.js +10 -7
- package/sdk/common/Validator.d.ts +1 -0
- package/sdk/common/Validator.js +20 -0
- package/sdk/common/utils.d.ts +0 -1
- package/sdk/common/utils.js +0 -14
- package/sdk/partner/OAuthClient.js +1 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -40
- package/sdk/partner/Theme/ThemePartnerModel.js +2 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +39 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +247 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +33 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +37 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +193 -1
- package/sdk/platform/Cart/CartPlatformModel.js +132 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -4
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +14 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +6 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
- package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
- package/sdk/platform/Order/OrderPlatformClient.js +99 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +7 -0
- package/sdk/platform/Order/OrderPlatformModel.js +3 -0
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +1 -1
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +4 -4
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +56 -19
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +42 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +3 -3
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +2 -2
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -40
- package/sdk/platform/Theme/ThemePlatformModel.js +2 -24
- package/sdk/public/Configuration/ConfigurationPublicClient.js +5 -2
- package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
- package/sdk/public/Content/ContentPublicClient.js +14 -2
- package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
- package/sdk/public/Partner/PartnerPublicClient.js +14 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +5 -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,12 @@
|
|
|
1
|
-
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
1
|
const {
|
|
3
2
|
FDKClientValidationError,
|
|
4
3
|
FDKResponseValidationError,
|
|
5
4
|
} = require("../../common/FDKError");
|
|
5
|
+
|
|
6
|
+
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
6
7
|
const constructUrl = require("../constructUrl");
|
|
7
8
|
const Paginator = require("../../common/Paginator");
|
|
8
|
-
const
|
|
9
|
-
const CartApplicationModel = require("./CartApplicationModel");
|
|
10
|
-
const { Logger } = require("./../../common/Logger");
|
|
11
|
-
const Joi = require("joi");
|
|
9
|
+
const { validateRequiredParams } = require("../../common/Validator");
|
|
12
10
|
|
|
13
11
|
class Cart {
|
|
14
12
|
constructor(_conf) {
|
|
@@ -63,10 +61,9 @@ class Cart {
|
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
/**
|
|
66
|
-
* @param {CartApplicationValidator.AddAddressParam} arg - Arg object.
|
|
67
64
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
68
65
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
69
|
-
* @returns {Promise<
|
|
66
|
+
* @returns {Promise<SaveAddressResponse>} - Success response
|
|
70
67
|
* @name addAddress
|
|
71
68
|
* @summary: Creates a new address for a customer
|
|
72
69
|
* @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 +72,6 @@ class Cart {
|
|
|
75
72
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
76
73
|
{ responseHeaders } = { responseHeaders: false }
|
|
77
74
|
) {
|
|
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
75
|
const query_params = {};
|
|
99
76
|
|
|
100
77
|
const xHeaders = {};
|
|
@@ -117,32 +94,13 @@ class Cart {
|
|
|
117
94
|
responseData = response[0];
|
|
118
95
|
}
|
|
119
96
|
|
|
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
97
|
return response;
|
|
139
98
|
}
|
|
140
99
|
|
|
141
100
|
/**
|
|
142
|
-
* @param {CartApplicationValidator.AddItemsParam} arg - Arg object.
|
|
143
101
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
144
102
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
145
|
-
* @returns {Promise<
|
|
103
|
+
* @returns {Promise<AddCartDetailResponse>} - Success response
|
|
146
104
|
* @name addItems
|
|
147
105
|
* @summary: Add items to a cart
|
|
148
106
|
* @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 +111,6 @@ class Cart {
|
|
|
153
111
|
},
|
|
154
112
|
{ responseHeaders } = { responseHeaders: false }
|
|
155
113
|
) {
|
|
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
114
|
const query_params = {};
|
|
177
115
|
query_params["i"] = i;
|
|
178
116
|
query_params["b"] = b;
|
|
@@ -201,32 +139,13 @@ class Cart {
|
|
|
201
139
|
responseData = response[0];
|
|
202
140
|
}
|
|
203
141
|
|
|
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
142
|
return response;
|
|
223
143
|
}
|
|
224
144
|
|
|
225
145
|
/**
|
|
226
|
-
* @param {CartApplicationValidator.ApplyCouponParam} arg - Arg object.
|
|
227
146
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
228
147
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
229
|
-
* @returns {Promise<
|
|
148
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
230
149
|
* @name applyCoupon
|
|
231
150
|
* @summary: Apply coupon
|
|
232
151
|
* @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 +156,6 @@ class Cart {
|
|
|
237
156
|
},
|
|
238
157
|
{ responseHeaders } = { responseHeaders: false }
|
|
239
158
|
) {
|
|
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
159
|
const query_params = {};
|
|
261
160
|
query_params["i"] = i;
|
|
262
161
|
query_params["b"] = b;
|
|
@@ -285,32 +184,13 @@ class Cart {
|
|
|
285
184
|
responseData = response[0];
|
|
286
185
|
}
|
|
287
186
|
|
|
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
187
|
return response;
|
|
307
188
|
}
|
|
308
189
|
|
|
309
190
|
/**
|
|
310
|
-
* @param {CartApplicationValidator.ApplyRewardPointsParam} arg - Arg object.
|
|
311
191
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
312
192
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
313
|
-
* @returns {Promise<
|
|
193
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
314
194
|
* @name applyRewardPoints
|
|
315
195
|
* @summary: Use reward points
|
|
316
196
|
* @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 +199,6 @@ class Cart {
|
|
|
319
199
|
{ body, id, i, b, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
320
200
|
{ responseHeaders } = { responseHeaders: false }
|
|
321
201
|
) {
|
|
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
202
|
const query_params = {};
|
|
345
203
|
query_params["id"] = id;
|
|
346
204
|
query_params["i"] = i;
|
|
@@ -367,32 +225,13 @@ class Cart {
|
|
|
367
225
|
responseData = response[0];
|
|
368
226
|
}
|
|
369
227
|
|
|
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
228
|
return response;
|
|
389
229
|
}
|
|
390
230
|
|
|
391
231
|
/**
|
|
392
|
-
* @param {CartApplicationValidator.CheckoutCartV2Param} arg - Arg object.
|
|
393
232
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
394
233
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
395
|
-
* @returns {Promise<
|
|
234
|
+
* @returns {Promise<CartCheckoutResponse>} - Success response
|
|
396
235
|
* @name checkoutCartV2
|
|
397
236
|
* @summary: Checkout cart
|
|
398
237
|
* @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 +240,6 @@ class Cart {
|
|
|
401
240
|
{ body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
|
|
402
241
|
{ responseHeaders } = { responseHeaders: false }
|
|
403
242
|
) {
|
|
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
243
|
const query_params = {};
|
|
427
244
|
query_params["buy_now"] = buyNow;
|
|
428
245
|
query_params["cart_type"] = cartType;
|
|
@@ -447,33 +264,13 @@ class Cart {
|
|
|
447
264
|
responseData = response[0];
|
|
448
265
|
}
|
|
449
266
|
|
|
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
267
|
return response;
|
|
469
268
|
}
|
|
470
269
|
|
|
471
270
|
/**
|
|
472
|
-
* @param {CartApplicationValidator.DeleteCartParam} arg - Arg object.
|
|
473
271
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
474
272
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
475
|
-
* @returns {Promise<
|
|
476
|
-
* Success response
|
|
273
|
+
* @returns {Promise<DeleteCartDetailResponse>} - Success response
|
|
477
274
|
* @name deleteCart
|
|
478
275
|
* @summary: Delete a cart
|
|
479
276
|
* @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 +279,6 @@ class Cart {
|
|
|
482
279
|
{ id, requestHeaders } = { requestHeaders: {} },
|
|
483
280
|
{ responseHeaders } = { responseHeaders: false }
|
|
484
281
|
) {
|
|
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
282
|
const query_params = {};
|
|
506
283
|
query_params["id"] = id;
|
|
507
284
|
|
|
@@ -525,32 +302,13 @@ class Cart {
|
|
|
525
302
|
responseData = response[0];
|
|
526
303
|
}
|
|
527
304
|
|
|
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
305
|
return response;
|
|
547
306
|
}
|
|
548
307
|
|
|
549
308
|
/**
|
|
550
|
-
* @param {CartApplicationValidator.GetAddressByIdParam} arg - Arg object.
|
|
551
309
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
552
310
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
553
|
-
* @returns {Promise<
|
|
311
|
+
* @returns {Promise<Address>} - Success response
|
|
554
312
|
* @name getAddressById
|
|
555
313
|
* @summary: Get details for a single customer address
|
|
556
314
|
* @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,26 +326,13 @@ class Cart {
|
|
|
568
326
|
} = { requestHeaders: {} },
|
|
569
327
|
{ responseHeaders } = { responseHeaders: false }
|
|
570
328
|
) {
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
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}`,
|
|
329
|
+
const errors = validateRequiredParams(arguments[0], ["id"]);
|
|
330
|
+
if (errors.length > 0) {
|
|
331
|
+
const error = new FDKClientValidationError({
|
|
332
|
+
message: "Missing required field",
|
|
333
|
+
details: errors,
|
|
590
334
|
});
|
|
335
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
591
336
|
}
|
|
592
337
|
|
|
593
338
|
const query_params = {};
|
|
@@ -618,32 +363,13 @@ class Cart {
|
|
|
618
363
|
responseData = response[0];
|
|
619
364
|
}
|
|
620
365
|
|
|
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
366
|
return response;
|
|
640
367
|
}
|
|
641
368
|
|
|
642
369
|
/**
|
|
643
|
-
* @param {CartApplicationValidator.GetAddressesParam} arg - Arg object.
|
|
644
370
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
645
371
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
646
|
-
* @returns {Promise<
|
|
372
|
+
* @returns {Promise<GetAddressesResponse>} - Success response
|
|
647
373
|
* @name getAddresses
|
|
648
374
|
* @summary: Get a list of addresses for a customer
|
|
649
375
|
* @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 +386,6 @@ class Cart {
|
|
|
660
386
|
} = { requestHeaders: {} },
|
|
661
387
|
{ responseHeaders } = { responseHeaders: false }
|
|
662
388
|
) {
|
|
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
389
|
const query_params = {};
|
|
686
390
|
query_params["cart_id"] = cartId;
|
|
687
391
|
query_params["buy_now"] = buyNow;
|
|
@@ -710,32 +414,13 @@ class Cart {
|
|
|
710
414
|
responseData = response[0];
|
|
711
415
|
}
|
|
712
416
|
|
|
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
417
|
return response;
|
|
732
418
|
}
|
|
733
419
|
|
|
734
420
|
/**
|
|
735
|
-
* @param {CartApplicationValidator.GetBulkDiscountOffersParam} arg - Arg object.
|
|
736
421
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
737
422
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
738
|
-
* @returns {Promise<
|
|
423
|
+
* @returns {Promise<BulkPriceResponse>} - Success response
|
|
739
424
|
* @name getBulkDiscountOffers
|
|
740
425
|
* @summary: List bulk discounts
|
|
741
426
|
* @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 +429,6 @@ class Cart {
|
|
|
744
429
|
{ itemId, articleId, uid, slug, requestHeaders } = { requestHeaders: {} },
|
|
745
430
|
{ responseHeaders } = { responseHeaders: false }
|
|
746
431
|
) {
|
|
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
432
|
const query_params = {};
|
|
770
433
|
query_params["item_id"] = itemId;
|
|
771
434
|
query_params["article_id"] = articleId;
|
|
@@ -792,32 +455,13 @@ class Cart {
|
|
|
792
455
|
responseData = response[0];
|
|
793
456
|
}
|
|
794
457
|
|
|
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
458
|
return response;
|
|
814
459
|
}
|
|
815
460
|
|
|
816
461
|
/**
|
|
817
|
-
* @param {CartApplicationValidator.GetCartParam} arg - Arg object.
|
|
818
462
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
819
463
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
820
|
-
* @returns {Promise<
|
|
464
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
821
465
|
* @name getCart
|
|
822
466
|
* @summary: Get a cart
|
|
823
467
|
* @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 +480,6 @@ class Cart {
|
|
|
836
480
|
} = { requestHeaders: {} },
|
|
837
481
|
{ responseHeaders } = { responseHeaders: false }
|
|
838
482
|
) {
|
|
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
483
|
const query_params = {};
|
|
860
484
|
query_params["id"] = id;
|
|
861
485
|
query_params["i"] = i;
|
|
@@ -886,29 +510,10 @@ class Cart {
|
|
|
886
510
|
responseData = response[0];
|
|
887
511
|
}
|
|
888
512
|
|
|
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
513
|
return response;
|
|
908
514
|
}
|
|
909
515
|
|
|
910
516
|
/**
|
|
911
|
-
* @param {CartApplicationValidator.GetCartLastModifiedParam} arg - Arg object.
|
|
912
517
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
913
518
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
914
519
|
* @returns {Promise<any>} - Success response
|
|
@@ -920,28 +525,6 @@ class Cart {
|
|
|
920
525
|
{ id, requestHeaders } = { requestHeaders: {} },
|
|
921
526
|
{ responseHeaders } = { responseHeaders: false }
|
|
922
527
|
) {
|
|
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
528
|
const query_params = {};
|
|
946
529
|
query_params["id"] = id;
|
|
947
530
|
|
|
@@ -965,30 +548,13 @@ class Cart {
|
|
|
965
548
|
responseData = response[0];
|
|
966
549
|
}
|
|
967
550
|
|
|
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
551
|
return response;
|
|
984
552
|
}
|
|
985
553
|
|
|
986
554
|
/**
|
|
987
|
-
* @param {CartApplicationValidator.GetCartShareLinkParam} arg - Arg object.
|
|
988
555
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
989
556
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
990
|
-
* @returns {Promise<
|
|
991
|
-
* Success response
|
|
557
|
+
* @returns {Promise<GetShareCartLinkResponse>} - Success response
|
|
992
558
|
* @name getCartShareLink
|
|
993
559
|
* @summary: Create share cart link
|
|
994
560
|
* @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 +563,6 @@ class Cart {
|
|
|
997
563
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
998
564
|
{ responseHeaders } = { responseHeaders: false }
|
|
999
565
|
) {
|
|
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
566
|
const query_params = {};
|
|
1023
567
|
|
|
1024
568
|
const xHeaders = {};
|
|
@@ -1041,32 +585,13 @@ class Cart {
|
|
|
1041
585
|
responseData = response[0];
|
|
1042
586
|
}
|
|
1043
587
|
|
|
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
588
|
return response;
|
|
1063
589
|
}
|
|
1064
590
|
|
|
1065
591
|
/**
|
|
1066
|
-
* @param {CartApplicationValidator.GetCartSharedItemsParam} arg - Arg object.
|
|
1067
592
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1068
593
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1069
|
-
* @returns {Promise<
|
|
594
|
+
* @returns {Promise<SharedCartResponse>} - Success response
|
|
1070
595
|
* @name getCartSharedItems
|
|
1071
596
|
* @summary: List shared cart items
|
|
1072
597
|
* @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,26 +600,13 @@ class Cart {
|
|
|
1075
600
|
{ token, requestHeaders } = { requestHeaders: {} },
|
|
1076
601
|
{ responseHeaders } = { responseHeaders: false }
|
|
1077
602
|
) {
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
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}`,
|
|
603
|
+
const errors = validateRequiredParams(arguments[0], ["token"]);
|
|
604
|
+
if (errors.length > 0) {
|
|
605
|
+
const error = new FDKClientValidationError({
|
|
606
|
+
message: "Missing required field",
|
|
607
|
+
details: errors,
|
|
1097
608
|
});
|
|
609
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1098
610
|
}
|
|
1099
611
|
|
|
1100
612
|
const query_params = {};
|
|
@@ -1119,32 +631,13 @@ class Cart {
|
|
|
1119
631
|
responseData = response[0];
|
|
1120
632
|
}
|
|
1121
633
|
|
|
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
634
|
return response;
|
|
1141
635
|
}
|
|
1142
636
|
|
|
1143
637
|
/**
|
|
1144
|
-
* @param {CartApplicationValidator.GetCouponsParam} arg - Arg object.
|
|
1145
638
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1146
639
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1147
|
-
* @returns {Promise<
|
|
640
|
+
* @returns {Promise<GetCouponResponse>} - Success response
|
|
1148
641
|
* @name getCoupons
|
|
1149
642
|
* @summary: List available coupons
|
|
1150
643
|
* @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 +646,6 @@ class Cart {
|
|
|
1153
646
|
{ id, buyNow, slug, storeId, requestHeaders } = { requestHeaders: {} },
|
|
1154
647
|
{ responseHeaders } = { responseHeaders: false }
|
|
1155
648
|
) {
|
|
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
649
|
const query_params = {};
|
|
1177
650
|
query_params["id"] = id;
|
|
1178
651
|
query_params["buy_now"] = buyNow;
|
|
@@ -1199,32 +672,13 @@ class Cart {
|
|
|
1199
672
|
responseData = response[0];
|
|
1200
673
|
}
|
|
1201
674
|
|
|
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
675
|
return response;
|
|
1221
676
|
}
|
|
1222
677
|
|
|
1223
678
|
/**
|
|
1224
|
-
* @param {CartApplicationValidator.GetItemCountParam} arg - Arg object.
|
|
1225
679
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1226
680
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1227
|
-
* @returns {Promise<
|
|
681
|
+
* @returns {Promise<CartItemCountResponse>} - Success response
|
|
1228
682
|
* @name getItemCount
|
|
1229
683
|
* @summary: Get a cart items count
|
|
1230
684
|
* @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 +687,6 @@ class Cart {
|
|
|
1233
687
|
{ id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
1234
688
|
{ responseHeaders } = { responseHeaders: false }
|
|
1235
689
|
) {
|
|
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
690
|
const query_params = {};
|
|
1259
691
|
query_params["id"] = id;
|
|
1260
692
|
query_params["buy_now"] = buyNow;
|
|
@@ -1279,32 +711,13 @@ class Cart {
|
|
|
1279
711
|
responseData = response[0];
|
|
1280
712
|
}
|
|
1281
713
|
|
|
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
714
|
return response;
|
|
1301
715
|
}
|
|
1302
716
|
|
|
1303
717
|
/**
|
|
1304
|
-
* @param {CartApplicationValidator.GetLadderOffersParam} arg - Arg object.
|
|
1305
718
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1306
719
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1307
|
-
* @returns {Promise<
|
|
720
|
+
* @returns {Promise<LadderPriceOffers>} - Success response
|
|
1308
721
|
* @name getLadderOffers
|
|
1309
722
|
* @summary: List ladder offers
|
|
1310
723
|
* @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 +728,6 @@ class Cart {
|
|
|
1315
728
|
},
|
|
1316
729
|
{ responseHeaders } = { responseHeaders: false }
|
|
1317
730
|
) {
|
|
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
731
|
const query_params = {};
|
|
1341
732
|
query_params["slug"] = slug;
|
|
1342
733
|
query_params["store_id"] = storeId;
|
|
@@ -1363,32 +754,13 @@ class Cart {
|
|
|
1363
754
|
responseData = response[0];
|
|
1364
755
|
}
|
|
1365
756
|
|
|
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
757
|
return response;
|
|
1385
758
|
}
|
|
1386
759
|
|
|
1387
760
|
/**
|
|
1388
|
-
* @param {CartApplicationValidator.GetPromotionOffersParam} arg - Arg object.
|
|
1389
761
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1390
762
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1391
|
-
* @returns {Promise<
|
|
763
|
+
* @returns {Promise<PromotionOffersResponse>} - Success response
|
|
1392
764
|
* @name getPromotionOffers
|
|
1393
765
|
* @summary: List available promotion offers
|
|
1394
766
|
* @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 +771,6 @@ class Cart {
|
|
|
1399
771
|
},
|
|
1400
772
|
{ responseHeaders } = { responseHeaders: false }
|
|
1401
773
|
) {
|
|
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
774
|
const query_params = {};
|
|
1425
775
|
query_params["slug"] = slug;
|
|
1426
776
|
query_params["page_size"] = pageSize;
|
|
@@ -1448,34 +798,13 @@ class Cart {
|
|
|
1448
798
|
responseData = response[0];
|
|
1449
799
|
}
|
|
1450
800
|
|
|
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
801
|
return response;
|
|
1470
802
|
}
|
|
1471
803
|
|
|
1472
804
|
/**
|
|
1473
|
-
* @param {CartApplicationValidator.GetPromotionPaymentOffersParam} arg - Arg object.
|
|
1474
805
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1475
806
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1476
|
-
* @returns {Promise<
|
|
1477
|
-
* - Success response
|
|
1478
|
-
*
|
|
807
|
+
* @returns {Promise<PromotionPaymentOffersResponse>} - Success response
|
|
1479
808
|
* @name getPromotionPaymentOffers
|
|
1480
809
|
* @summary: Fetch available promotions payment offers
|
|
1481
810
|
* @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 +813,6 @@ class Cart {
|
|
|
1484
813
|
{ id, uid, requestHeaders } = { requestHeaders: {} },
|
|
1485
814
|
{ responseHeaders } = { responseHeaders: false }
|
|
1486
815
|
) {
|
|
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
816
|
const query_params = {};
|
|
1512
817
|
query_params["id"] = id;
|
|
1513
818
|
query_params["uid"] = uid;
|
|
@@ -1532,32 +837,13 @@ class Cart {
|
|
|
1532
837
|
responseData = response[0];
|
|
1533
838
|
}
|
|
1534
839
|
|
|
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
840
|
return response;
|
|
1554
841
|
}
|
|
1555
842
|
|
|
1556
843
|
/**
|
|
1557
|
-
* @param {CartApplicationValidator.GetShipmentsParam} arg - Arg object.
|
|
1558
844
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1559
845
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1560
|
-
* @returns {Promise<
|
|
846
|
+
* @returns {Promise<CartShipmentsResponse>} - Success response
|
|
1561
847
|
* @name getShipments
|
|
1562
848
|
* @summary: List shipments
|
|
1563
849
|
* @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 +854,6 @@ class Cart {
|
|
|
1568
854
|
},
|
|
1569
855
|
{ responseHeaders } = { responseHeaders: false }
|
|
1570
856
|
) {
|
|
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
857
|
const query_params = {};
|
|
1594
858
|
query_params["p"] = p;
|
|
1595
859
|
query_params["id"] = id;
|
|
@@ -1618,32 +882,13 @@ class Cart {
|
|
|
1618
882
|
responseData = response[0];
|
|
1619
883
|
}
|
|
1620
884
|
|
|
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
885
|
return response;
|
|
1640
886
|
}
|
|
1641
887
|
|
|
1642
888
|
/**
|
|
1643
|
-
* @param {CartApplicationValidator.RemoveAddressParam} arg - Arg object.
|
|
1644
889
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1645
890
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1646
|
-
* @returns {Promise<
|
|
891
|
+
* @returns {Promise<DeleteAddressResponse>} - Success response
|
|
1647
892
|
* @name removeAddress
|
|
1648
893
|
* @summary: Removes an address from a customer's address list
|
|
1649
894
|
* @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
|
|
@@ -1652,26 +897,13 @@ class Cart {
|
|
|
1652
897
|
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1653
898
|
{ responseHeaders } = { responseHeaders: false }
|
|
1654
899
|
) {
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
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}`,
|
|
900
|
+
const errors = validateRequiredParams(arguments[0], ["id"]);
|
|
901
|
+
if (errors.length > 0) {
|
|
902
|
+
const error = new FDKClientValidationError({
|
|
903
|
+
message: "Missing required field",
|
|
904
|
+
details: errors,
|
|
1674
905
|
});
|
|
906
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1675
907
|
}
|
|
1676
908
|
|
|
1677
909
|
const query_params = {};
|
|
@@ -1696,32 +928,13 @@ class Cart {
|
|
|
1696
928
|
responseData = response[0];
|
|
1697
929
|
}
|
|
1698
930
|
|
|
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
931
|
return response;
|
|
1718
932
|
}
|
|
1719
933
|
|
|
1720
934
|
/**
|
|
1721
|
-
* @param {CartApplicationValidator.RemoveCouponParam} arg - Arg object.
|
|
1722
935
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1723
936
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1724
|
-
* @returns {Promise<
|
|
937
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1725
938
|
* @name removeCoupon
|
|
1726
939
|
* @summary: Remove coupon
|
|
1727
940
|
* @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 +943,6 @@ class Cart {
|
|
|
1730
943
|
{ id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
1731
944
|
{ responseHeaders } = { responseHeaders: false }
|
|
1732
945
|
) {
|
|
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
946
|
const query_params = {};
|
|
1756
947
|
query_params["id"] = id;
|
|
1757
948
|
query_params["buy_now"] = buyNow;
|
|
@@ -1776,32 +967,13 @@ class Cart {
|
|
|
1776
967
|
responseData = response[0];
|
|
1777
968
|
}
|
|
1778
969
|
|
|
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
970
|
return response;
|
|
1798
971
|
}
|
|
1799
972
|
|
|
1800
973
|
/**
|
|
1801
|
-
* @param {CartApplicationValidator.SelectAddressParam} arg - Arg object.
|
|
1802
974
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1803
975
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1804
|
-
* @returns {Promise<
|
|
976
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1805
977
|
* @name selectAddress
|
|
1806
978
|
* @summary: Select customer address for order processing
|
|
1807
979
|
* @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 +982,6 @@ class Cart {
|
|
|
1810
982
|
{ body, cartId, buyNow, i, b, requestHeaders } = { requestHeaders: {} },
|
|
1811
983
|
{ responseHeaders } = { responseHeaders: false }
|
|
1812
984
|
) {
|
|
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
985
|
const query_params = {};
|
|
1836
986
|
query_params["cart_id"] = cartId;
|
|
1837
987
|
query_params["buy_now"] = buyNow;
|
|
@@ -1858,32 +1008,13 @@ class Cart {
|
|
|
1858
1008
|
responseData = response[0];
|
|
1859
1009
|
}
|
|
1860
1010
|
|
|
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
1011
|
return response;
|
|
1880
1012
|
}
|
|
1881
1013
|
|
|
1882
1014
|
/**
|
|
1883
|
-
* @param {CartApplicationValidator.SelectPaymentModeParam} arg - Arg object.
|
|
1884
1015
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1885
1016
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1886
|
-
* @returns {Promise<
|
|
1017
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1887
1018
|
* @name selectPaymentMode
|
|
1888
1019
|
* @summary: Select payment mode
|
|
1889
1020
|
* @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 +1023,6 @@ class Cart {
|
|
|
1892
1023
|
{ body, id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
1893
1024
|
{ responseHeaders } = { responseHeaders: false }
|
|
1894
1025
|
) {
|
|
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
1026
|
const query_params = {};
|
|
1918
1027
|
query_params["id"] = id;
|
|
1919
1028
|
query_params["buy_now"] = buyNow;
|
|
@@ -1938,32 +1047,13 @@ class Cart {
|
|
|
1938
1047
|
responseData = response[0];
|
|
1939
1048
|
}
|
|
1940
1049
|
|
|
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
1050
|
return response;
|
|
1960
1051
|
}
|
|
1961
1052
|
|
|
1962
1053
|
/**
|
|
1963
|
-
* @param {CartApplicationValidator.UpdateAddressParam} arg - Arg object.
|
|
1964
1054
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1965
1055
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1966
|
-
* @returns {Promise<
|
|
1056
|
+
* @returns {Promise<UpdateAddressResponse>} - Success response
|
|
1967
1057
|
* @name updateAddress
|
|
1968
1058
|
* @summary: Updates an existing customer address
|
|
1969
1059
|
* @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,26 +1062,13 @@ class Cart {
|
|
|
1972
1062
|
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
1973
1063
|
{ responseHeaders } = { responseHeaders: false }
|
|
1974
1064
|
) {
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
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}`,
|
|
1065
|
+
const errors = validateRequiredParams(arguments[0], ["id"]);
|
|
1066
|
+
if (errors.length > 0) {
|
|
1067
|
+
const error = new FDKClientValidationError({
|
|
1068
|
+
message: "Missing required field",
|
|
1069
|
+
details: errors,
|
|
1994
1070
|
});
|
|
1071
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1995
1072
|
}
|
|
1996
1073
|
|
|
1997
1074
|
const query_params = {};
|
|
@@ -2016,33 +1093,13 @@ class Cart {
|
|
|
2016
1093
|
responseData = response[0];
|
|
2017
1094
|
}
|
|
2018
1095
|
|
|
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
1096
|
return response;
|
|
2038
1097
|
}
|
|
2039
1098
|
|
|
2040
1099
|
/**
|
|
2041
|
-
* @param {CartApplicationValidator.UpdateCartParam} arg - Arg object.
|
|
2042
1100
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2043
1101
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2044
|
-
* @returns {Promise<
|
|
2045
|
-
* Success response
|
|
1102
|
+
* @returns {Promise<UpdateCartDetailResponse>} - Success response
|
|
2046
1103
|
* @name updateCart
|
|
2047
1104
|
* @summary: Update cart items
|
|
2048
1105
|
* @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 +1118,6 @@ class Cart {
|
|
|
2061
1118
|
} = { requestHeaders: {} },
|
|
2062
1119
|
{ responseHeaders } = { responseHeaders: false }
|
|
2063
1120
|
) {
|
|
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
1121
|
const query_params = {};
|
|
2085
1122
|
query_params["id"] = id;
|
|
2086
1123
|
query_params["i"] = i;
|
|
@@ -2110,32 +1147,13 @@ class Cart {
|
|
|
2110
1147
|
responseData = response[0];
|
|
2111
1148
|
}
|
|
2112
1149
|
|
|
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
1150
|
return response;
|
|
2132
1151
|
}
|
|
2133
1152
|
|
|
2134
1153
|
/**
|
|
2135
|
-
* @param {CartApplicationValidator.UpdateCartMetaParam} arg - Arg object.
|
|
2136
1154
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2137
1155
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2138
|
-
* @returns {Promise<
|
|
1156
|
+
* @returns {Promise<CartMetaResponse>} - Success response
|
|
2139
1157
|
* @name updateCartMeta
|
|
2140
1158
|
* @summary: Update cart metadata
|
|
2141
1159
|
* @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 +1162,6 @@ class Cart {
|
|
|
2144
1162
|
{ body, id, buyNow, requestHeaders } = { requestHeaders: {} },
|
|
2145
1163
|
{ responseHeaders } = { responseHeaders: false }
|
|
2146
1164
|
) {
|
|
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
1165
|
const query_params = {};
|
|
2170
1166
|
query_params["id"] = id;
|
|
2171
1167
|
query_params["buy_now"] = buyNow;
|
|
@@ -2190,32 +1186,13 @@ class Cart {
|
|
|
2190
1186
|
responseData = response[0];
|
|
2191
1187
|
}
|
|
2192
1188
|
|
|
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
1189
|
return response;
|
|
2212
1190
|
}
|
|
2213
1191
|
|
|
2214
1192
|
/**
|
|
2215
|
-
* @param {CartApplicationValidator.UpdateCartWithSharedItemsParam} arg - Arg object.
|
|
2216
1193
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2217
1194
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2218
|
-
* @returns {Promise<
|
|
1195
|
+
* @returns {Promise<SharedCartResponse>} - Success response
|
|
2219
1196
|
* @name updateCartWithSharedItems
|
|
2220
1197
|
* @summary: Update with shared items
|
|
2221
1198
|
* @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,28 +1201,13 @@ class Cart {
|
|
|
2224
1201
|
{ token, action, requestHeaders } = { requestHeaders: {} },
|
|
2225
1202
|
{ responseHeaders } = { responseHeaders: false }
|
|
2226
1203
|
) {
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
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}`,
|
|
1204
|
+
const errors = validateRequiredParams(arguments[0], ["token", "action"]);
|
|
1205
|
+
if (errors.length > 0) {
|
|
1206
|
+
const error = new FDKClientValidationError({
|
|
1207
|
+
message: "Missing required field",
|
|
1208
|
+
details: errors,
|
|
2248
1209
|
});
|
|
1210
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2249
1211
|
}
|
|
2250
1212
|
|
|
2251
1213
|
const query_params = {};
|
|
@@ -2270,32 +1232,13 @@ class Cart {
|
|
|
2270
1232
|
responseData = response[0];
|
|
2271
1233
|
}
|
|
2272
1234
|
|
|
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
1235
|
return response;
|
|
2292
1236
|
}
|
|
2293
1237
|
|
|
2294
1238
|
/**
|
|
2295
|
-
* @param {CartApplicationValidator.ValidateCouponForPaymentParam} arg - Arg object.
|
|
2296
1239
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2297
1240
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2298
|
-
* @returns {Promise<
|
|
1241
|
+
* @returns {Promise<PaymentCouponValidate>} - Success response
|
|
2299
1242
|
* @name validateCouponForPayment
|
|
2300
1243
|
* @summary: Validate applied coupon
|
|
2301
1244
|
* @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 +1261,6 @@ class Cart {
|
|
|
2318
1261
|
} = { requestHeaders: {} },
|
|
2319
1262
|
{ responseHeaders } = { responseHeaders: false }
|
|
2320
1263
|
) {
|
|
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
1264
|
const query_params = {};
|
|
2372
1265
|
query_params["id"] = id;
|
|
2373
1266
|
query_params["buy_now"] = buyNow;
|
|
@@ -2402,24 +1295,6 @@ class Cart {
|
|
|
2402
1295
|
responseData = response[0];
|
|
2403
1296
|
}
|
|
2404
1297
|
|
|
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
1298
|
return response;
|
|
2424
1299
|
}
|
|
2425
1300
|
}
|