@gofynd/fdk-client-javascript 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
|
|
|
3
3
|
const Paginator = require("../../common/Paginator");
|
|
4
4
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
5
|
const RewardsValidator = require("./RewardsApplicationValidator");
|
|
6
|
+
const RewardsModel = require("./RewardsApplicationModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
6
8
|
|
|
7
9
|
class Rewards {
|
|
8
10
|
constructor(_conf) {
|
|
@@ -44,7 +46,7 @@ class Rewards {
|
|
|
44
46
|
* @summary: Get offer by name
|
|
45
47
|
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
46
48
|
*/
|
|
47
|
-
getOfferByName({ name } = {}) {
|
|
49
|
+
async getOfferByName({ name } = {}) {
|
|
48
50
|
const { error } = RewardsValidator.getOfferByName().validate(
|
|
49
51
|
{ name },
|
|
50
52
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -59,15 +61,18 @@ class Rewards {
|
|
|
59
61
|
{ abortEarly: false, allowUnknown: false }
|
|
60
62
|
);
|
|
61
63
|
if (warrning) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
Logger({
|
|
65
|
+
level: "WARN",
|
|
66
|
+
message: "Parameter Validation warrnings for getOfferByName",
|
|
67
|
+
});
|
|
68
|
+
Logger({ level: "WARN", message: warrning });
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
const query_params = {};
|
|
67
72
|
|
|
68
73
|
const xHeaders = {};
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
const response = await APIClient.execute(
|
|
71
76
|
this._conf,
|
|
72
77
|
"get",
|
|
73
78
|
constructUrl({
|
|
@@ -78,6 +83,21 @@ class Rewards {
|
|
|
78
83
|
undefined,
|
|
79
84
|
xHeaders
|
|
80
85
|
);
|
|
86
|
+
|
|
87
|
+
const { error: res_error } = RewardsModel.Offer().validate(response, {
|
|
88
|
+
abortEarly: false,
|
|
89
|
+
allowUnknown: false,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (res_error) {
|
|
93
|
+
Logger({
|
|
94
|
+
level: "WARN",
|
|
95
|
+
message: "Response Validation Warnnings for getOfferByName",
|
|
96
|
+
});
|
|
97
|
+
Logger({ level: "WARN", message: res_error });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return response;
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
/**
|
|
@@ -87,7 +107,7 @@ class Rewards {
|
|
|
87
107
|
* @summary: Get all transactions of reward points
|
|
88
108
|
* @description: Use this API to evaluate the amount of reward points that could be earned on any catalogue product.
|
|
89
109
|
*/
|
|
90
|
-
catalogueOrder({ body } = {}) {
|
|
110
|
+
async catalogueOrder({ body } = {}) {
|
|
91
111
|
const { error } = RewardsValidator.catalogueOrder().validate(
|
|
92
112
|
{ body },
|
|
93
113
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -102,15 +122,18 @@ class Rewards {
|
|
|
102
122
|
{ abortEarly: false, allowUnknown: false }
|
|
103
123
|
);
|
|
104
124
|
if (warrning) {
|
|
105
|
-
|
|
106
|
-
|
|
125
|
+
Logger({
|
|
126
|
+
level: "WARN",
|
|
127
|
+
message: "Parameter Validation warrnings for catalogueOrder",
|
|
128
|
+
});
|
|
129
|
+
Logger({ level: "WARN", message: warrning });
|
|
107
130
|
}
|
|
108
131
|
|
|
109
132
|
const query_params = {};
|
|
110
133
|
|
|
111
134
|
const xHeaders = {};
|
|
112
135
|
|
|
113
|
-
|
|
136
|
+
const response = await APIClient.execute(
|
|
114
137
|
this._conf,
|
|
115
138
|
"post",
|
|
116
139
|
constructUrl({
|
|
@@ -121,6 +144,23 @@ class Rewards {
|
|
|
121
144
|
body,
|
|
122
145
|
xHeaders
|
|
123
146
|
);
|
|
147
|
+
|
|
148
|
+
const {
|
|
149
|
+
error: res_error,
|
|
150
|
+
} = RewardsModel.CatalogueOrderResponse().validate(response, {
|
|
151
|
+
abortEarly: false,
|
|
152
|
+
allowUnknown: false,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
if (res_error) {
|
|
156
|
+
Logger({
|
|
157
|
+
level: "WARN",
|
|
158
|
+
message: "Response Validation Warnnings for catalogueOrder",
|
|
159
|
+
});
|
|
160
|
+
Logger({ level: "WARN", message: res_error });
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return response;
|
|
124
164
|
}
|
|
125
165
|
|
|
126
166
|
/**
|
|
@@ -132,7 +172,7 @@ class Rewards {
|
|
|
132
172
|
* @summary: Get all transactions of reward points
|
|
133
173
|
* @description: Use this API to get a list of points transactions.
|
|
134
174
|
*/
|
|
135
|
-
getUserPointsHistory({ pageId, pageSize } = {}) {
|
|
175
|
+
async getUserPointsHistory({ pageId, pageSize } = {}) {
|
|
136
176
|
const { error } = RewardsValidator.getUserPointsHistory().validate(
|
|
137
177
|
{ pageId, pageSize },
|
|
138
178
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -149,8 +189,11 @@ class Rewards {
|
|
|
149
189
|
{ abortEarly: false, allowUnknown: false }
|
|
150
190
|
);
|
|
151
191
|
if (warrning) {
|
|
152
|
-
|
|
153
|
-
|
|
192
|
+
Logger({
|
|
193
|
+
level: "WARN",
|
|
194
|
+
message: "Parameter Validation warrnings for getUserPointsHistory",
|
|
195
|
+
});
|
|
196
|
+
Logger({ level: "WARN", message: warrning });
|
|
154
197
|
}
|
|
155
198
|
|
|
156
199
|
const query_params = {};
|
|
@@ -159,7 +202,7 @@ class Rewards {
|
|
|
159
202
|
|
|
160
203
|
const xHeaders = {};
|
|
161
204
|
|
|
162
|
-
|
|
205
|
+
const response = await APIClient.execute(
|
|
163
206
|
this._conf,
|
|
164
207
|
"get",
|
|
165
208
|
constructUrl({
|
|
@@ -170,6 +213,23 @@ class Rewards {
|
|
|
170
213
|
undefined,
|
|
171
214
|
xHeaders
|
|
172
215
|
);
|
|
216
|
+
|
|
217
|
+
const {
|
|
218
|
+
error: res_error,
|
|
219
|
+
} = RewardsModel.PointsHistoryResponse().validate(response, {
|
|
220
|
+
abortEarly: false,
|
|
221
|
+
allowUnknown: false,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
if (res_error) {
|
|
225
|
+
Logger({
|
|
226
|
+
level: "WARN",
|
|
227
|
+
message: "Response Validation Warnnings for getUserPointsHistory",
|
|
228
|
+
});
|
|
229
|
+
Logger({ level: "WARN", message: res_error });
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return response;
|
|
173
233
|
}
|
|
174
234
|
|
|
175
235
|
/**
|
|
@@ -204,7 +264,7 @@ class Rewards {
|
|
|
204
264
|
* @summary: Get referral details of a user
|
|
205
265
|
* @description: Use this API to retrieve total available points of a user for current application
|
|
206
266
|
*/
|
|
207
|
-
getUserPoints({} = {}) {
|
|
267
|
+
async getUserPoints({} = {}) {
|
|
208
268
|
const { error } = RewardsValidator.getUserPoints().validate(
|
|
209
269
|
{},
|
|
210
270
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -219,15 +279,18 @@ class Rewards {
|
|
|
219
279
|
{ abortEarly: false, allowUnknown: false }
|
|
220
280
|
);
|
|
221
281
|
if (warrning) {
|
|
222
|
-
|
|
223
|
-
|
|
282
|
+
Logger({
|
|
283
|
+
level: "WARN",
|
|
284
|
+
message: "Parameter Validation warrnings for getUserPoints",
|
|
285
|
+
});
|
|
286
|
+
Logger({ level: "WARN", message: warrning });
|
|
224
287
|
}
|
|
225
288
|
|
|
226
289
|
const query_params = {};
|
|
227
290
|
|
|
228
291
|
const xHeaders = {};
|
|
229
292
|
|
|
230
|
-
|
|
293
|
+
const response = await APIClient.execute(
|
|
231
294
|
this._conf,
|
|
232
295
|
"get",
|
|
233
296
|
constructUrl({
|
|
@@ -238,6 +301,23 @@ class Rewards {
|
|
|
238
301
|
undefined,
|
|
239
302
|
xHeaders
|
|
240
303
|
);
|
|
304
|
+
|
|
305
|
+
const {
|
|
306
|
+
error: res_error,
|
|
307
|
+
} = RewardsModel.PointsResponse().validate(response, {
|
|
308
|
+
abortEarly: false,
|
|
309
|
+
allowUnknown: false,
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
if (res_error) {
|
|
313
|
+
Logger({
|
|
314
|
+
level: "WARN",
|
|
315
|
+
message: "Response Validation Warnnings for getUserPoints",
|
|
316
|
+
});
|
|
317
|
+
Logger({ level: "WARN", message: res_error });
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return response;
|
|
241
321
|
}
|
|
242
322
|
|
|
243
323
|
/**
|
|
@@ -246,7 +326,7 @@ class Rewards {
|
|
|
246
326
|
* @summary: Get referral details of a user
|
|
247
327
|
* @description: Use this API to retrieve the referral details a user has configured in the application.
|
|
248
328
|
*/
|
|
249
|
-
getUserReferralDetails({} = {}) {
|
|
329
|
+
async getUserReferralDetails({} = {}) {
|
|
250
330
|
const { error } = RewardsValidator.getUserReferralDetails().validate(
|
|
251
331
|
{},
|
|
252
332
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -263,15 +343,18 @@ class Rewards {
|
|
|
263
343
|
{ abortEarly: false, allowUnknown: false }
|
|
264
344
|
);
|
|
265
345
|
if (warrning) {
|
|
266
|
-
|
|
267
|
-
|
|
346
|
+
Logger({
|
|
347
|
+
level: "WARN",
|
|
348
|
+
message: "Parameter Validation warrnings for getUserReferralDetails",
|
|
349
|
+
});
|
|
350
|
+
Logger({ level: "WARN", message: warrning });
|
|
268
351
|
}
|
|
269
352
|
|
|
270
353
|
const query_params = {};
|
|
271
354
|
|
|
272
355
|
const xHeaders = {};
|
|
273
356
|
|
|
274
|
-
|
|
357
|
+
const response = await APIClient.execute(
|
|
275
358
|
this._conf,
|
|
276
359
|
"get",
|
|
277
360
|
constructUrl({
|
|
@@ -282,6 +365,23 @@ class Rewards {
|
|
|
282
365
|
undefined,
|
|
283
366
|
xHeaders
|
|
284
367
|
);
|
|
368
|
+
|
|
369
|
+
const {
|
|
370
|
+
error: res_error,
|
|
371
|
+
} = RewardsModel.ReferralDetailsResponse().validate(response, {
|
|
372
|
+
abortEarly: false,
|
|
373
|
+
allowUnknown: false,
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
if (res_error) {
|
|
377
|
+
Logger({
|
|
378
|
+
level: "WARN",
|
|
379
|
+
message: "Response Validation Warnnings for getUserReferralDetails",
|
|
380
|
+
});
|
|
381
|
+
Logger({ level: "WARN", message: res_error });
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return response;
|
|
285
385
|
}
|
|
286
386
|
|
|
287
387
|
/**
|
|
@@ -291,7 +391,7 @@ class Rewards {
|
|
|
291
391
|
* @summary: Calculates the discount on order-amount
|
|
292
392
|
* @description: Use this API to calculate the discount on order-amount based on all the amount range configured in order_discount.
|
|
293
393
|
*/
|
|
294
|
-
getOrderDiscount({ body } = {}) {
|
|
394
|
+
async getOrderDiscount({ body } = {}) {
|
|
295
395
|
const { error } = RewardsValidator.getOrderDiscount().validate(
|
|
296
396
|
{ body },
|
|
297
397
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -306,15 +406,18 @@ class Rewards {
|
|
|
306
406
|
{ abortEarly: false, allowUnknown: false }
|
|
307
407
|
);
|
|
308
408
|
if (warrning) {
|
|
309
|
-
|
|
310
|
-
|
|
409
|
+
Logger({
|
|
410
|
+
level: "WARN",
|
|
411
|
+
message: "Parameter Validation warrnings for getOrderDiscount",
|
|
412
|
+
});
|
|
413
|
+
Logger({ level: "WARN", message: warrning });
|
|
311
414
|
}
|
|
312
415
|
|
|
313
416
|
const query_params = {};
|
|
314
417
|
|
|
315
418
|
const xHeaders = {};
|
|
316
419
|
|
|
317
|
-
|
|
420
|
+
const response = await APIClient.execute(
|
|
318
421
|
this._conf,
|
|
319
422
|
"post",
|
|
320
423
|
constructUrl({
|
|
@@ -325,6 +428,23 @@ class Rewards {
|
|
|
325
428
|
body,
|
|
326
429
|
xHeaders
|
|
327
430
|
);
|
|
431
|
+
|
|
432
|
+
const {
|
|
433
|
+
error: res_error,
|
|
434
|
+
} = RewardsModel.OrderDiscountResponse().validate(response, {
|
|
435
|
+
abortEarly: false,
|
|
436
|
+
allowUnknown: false,
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
if (res_error) {
|
|
440
|
+
Logger({
|
|
441
|
+
level: "WARN",
|
|
442
|
+
message: "Response Validation Warnnings for getOrderDiscount",
|
|
443
|
+
});
|
|
444
|
+
Logger({ level: "WARN", message: res_error });
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return response;
|
|
328
448
|
}
|
|
329
449
|
|
|
330
450
|
/**
|
|
@@ -334,7 +454,7 @@ class Rewards {
|
|
|
334
454
|
* @summary: Redeems a referral code and credits reward points to users
|
|
335
455
|
* @description: Use this API to enter a referral code following which, the configured points would be credited to a user's reward points account.
|
|
336
456
|
*/
|
|
337
|
-
redeemReferralCode({ body } = {}) {
|
|
457
|
+
async redeemReferralCode({ body } = {}) {
|
|
338
458
|
const { error } = RewardsValidator.redeemReferralCode().validate(
|
|
339
459
|
{ body },
|
|
340
460
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -349,15 +469,18 @@ class Rewards {
|
|
|
349
469
|
{ abortEarly: false, allowUnknown: false }
|
|
350
470
|
);
|
|
351
471
|
if (warrning) {
|
|
352
|
-
|
|
353
|
-
|
|
472
|
+
Logger({
|
|
473
|
+
level: "WARN",
|
|
474
|
+
message: "Parameter Validation warrnings for redeemReferralCode",
|
|
475
|
+
});
|
|
476
|
+
Logger({ level: "WARN", message: warrning });
|
|
354
477
|
}
|
|
355
478
|
|
|
356
479
|
const query_params = {};
|
|
357
480
|
|
|
358
481
|
const xHeaders = {};
|
|
359
482
|
|
|
360
|
-
|
|
483
|
+
const response = await APIClient.execute(
|
|
361
484
|
this._conf,
|
|
362
485
|
"post",
|
|
363
486
|
constructUrl({
|
|
@@ -368,6 +491,23 @@ class Rewards {
|
|
|
368
491
|
body,
|
|
369
492
|
xHeaders
|
|
370
493
|
);
|
|
494
|
+
|
|
495
|
+
const {
|
|
496
|
+
error: res_error,
|
|
497
|
+
} = RewardsModel.RedeemReferralCodeResponse().validate(response, {
|
|
498
|
+
abortEarly: false,
|
|
499
|
+
allowUnknown: false,
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
if (res_error) {
|
|
503
|
+
Logger({
|
|
504
|
+
level: "WARN",
|
|
505
|
+
message: "Response Validation Warnnings for redeemReferralCode",
|
|
506
|
+
});
|
|
507
|
+
Logger({ level: "WARN", message: res_error });
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return response;
|
|
371
511
|
}
|
|
372
512
|
}
|
|
373
513
|
|