@gofynd/fdk-client-javascript 1.0.0 → 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 +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- 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 +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- 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 +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -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 }
|
|
@@ -52,11 +54,25 @@ class Rewards {
|
|
|
52
54
|
if (error) {
|
|
53
55
|
return Promise.reject(new FDKClientValidationError(error));
|
|
54
56
|
}
|
|
57
|
+
|
|
58
|
+
// Showing warrnings if extra unknown parameters are found
|
|
59
|
+
const { error: warrning } = RewardsValidator.getOfferByName().validate(
|
|
60
|
+
{ name },
|
|
61
|
+
{ abortEarly: false, allowUnknown: false }
|
|
62
|
+
);
|
|
63
|
+
if (warrning) {
|
|
64
|
+
Logger({
|
|
65
|
+
level: "WARN",
|
|
66
|
+
message: "Parameter Validation warrnings for getOfferByName",
|
|
67
|
+
});
|
|
68
|
+
Logger({ level: "WARN", message: warrning });
|
|
69
|
+
}
|
|
70
|
+
|
|
55
71
|
const query_params = {};
|
|
56
72
|
|
|
57
73
|
const xHeaders = {};
|
|
58
74
|
|
|
59
|
-
|
|
75
|
+
const response = await APIClient.execute(
|
|
60
76
|
this._conf,
|
|
61
77
|
"get",
|
|
62
78
|
constructUrl({
|
|
@@ -67,6 +83,21 @@ class Rewards {
|
|
|
67
83
|
undefined,
|
|
68
84
|
xHeaders
|
|
69
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;
|
|
70
101
|
}
|
|
71
102
|
|
|
72
103
|
/**
|
|
@@ -76,7 +107,7 @@ class Rewards {
|
|
|
76
107
|
* @summary: Get all transactions of reward points
|
|
77
108
|
* @description: Use this API to evaluate the amount of reward points that could be earned on any catalogue product.
|
|
78
109
|
*/
|
|
79
|
-
catalogueOrder({ body } = {}) {
|
|
110
|
+
async catalogueOrder({ body } = {}) {
|
|
80
111
|
const { error } = RewardsValidator.catalogueOrder().validate(
|
|
81
112
|
{ body },
|
|
82
113
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -84,11 +115,25 @@ class Rewards {
|
|
|
84
115
|
if (error) {
|
|
85
116
|
return Promise.reject(new FDKClientValidationError(error));
|
|
86
117
|
}
|
|
118
|
+
|
|
119
|
+
// Showing warrnings if extra unknown parameters are found
|
|
120
|
+
const { error: warrning } = RewardsValidator.catalogueOrder().validate(
|
|
121
|
+
{ body },
|
|
122
|
+
{ abortEarly: false, allowUnknown: false }
|
|
123
|
+
);
|
|
124
|
+
if (warrning) {
|
|
125
|
+
Logger({
|
|
126
|
+
level: "WARN",
|
|
127
|
+
message: "Parameter Validation warrnings for catalogueOrder",
|
|
128
|
+
});
|
|
129
|
+
Logger({ level: "WARN", message: warrning });
|
|
130
|
+
}
|
|
131
|
+
|
|
87
132
|
const query_params = {};
|
|
88
133
|
|
|
89
134
|
const xHeaders = {};
|
|
90
135
|
|
|
91
|
-
|
|
136
|
+
const response = await APIClient.execute(
|
|
92
137
|
this._conf,
|
|
93
138
|
"post",
|
|
94
139
|
constructUrl({
|
|
@@ -99,6 +144,23 @@ class Rewards {
|
|
|
99
144
|
body,
|
|
100
145
|
xHeaders
|
|
101
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;
|
|
102
164
|
}
|
|
103
165
|
|
|
104
166
|
/**
|
|
@@ -110,7 +172,7 @@ class Rewards {
|
|
|
110
172
|
* @summary: Get all transactions of reward points
|
|
111
173
|
* @description: Use this API to get a list of points transactions.
|
|
112
174
|
*/
|
|
113
|
-
getUserPointsHistory({ pageId, pageSize } = {}) {
|
|
175
|
+
async getUserPointsHistory({ pageId, pageSize } = {}) {
|
|
114
176
|
const { error } = RewardsValidator.getUserPointsHistory().validate(
|
|
115
177
|
{ pageId, pageSize },
|
|
116
178
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -118,13 +180,29 @@ class Rewards {
|
|
|
118
180
|
if (error) {
|
|
119
181
|
return Promise.reject(new FDKClientValidationError(error));
|
|
120
182
|
}
|
|
183
|
+
|
|
184
|
+
// Showing warrnings if extra unknown parameters are found
|
|
185
|
+
const {
|
|
186
|
+
error: warrning,
|
|
187
|
+
} = RewardsValidator.getUserPointsHistory().validate(
|
|
188
|
+
{ pageId, pageSize },
|
|
189
|
+
{ abortEarly: false, allowUnknown: false }
|
|
190
|
+
);
|
|
191
|
+
if (warrning) {
|
|
192
|
+
Logger({
|
|
193
|
+
level: "WARN",
|
|
194
|
+
message: "Parameter Validation warrnings for getUserPointsHistory",
|
|
195
|
+
});
|
|
196
|
+
Logger({ level: "WARN", message: warrning });
|
|
197
|
+
}
|
|
198
|
+
|
|
121
199
|
const query_params = {};
|
|
122
200
|
query_params["page_id"] = pageId;
|
|
123
201
|
query_params["page_size"] = pageSize;
|
|
124
202
|
|
|
125
203
|
const xHeaders = {};
|
|
126
204
|
|
|
127
|
-
|
|
205
|
+
const response = await APIClient.execute(
|
|
128
206
|
this._conf,
|
|
129
207
|
"get",
|
|
130
208
|
constructUrl({
|
|
@@ -135,6 +213,23 @@ class Rewards {
|
|
|
135
213
|
undefined,
|
|
136
214
|
xHeaders
|
|
137
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;
|
|
138
233
|
}
|
|
139
234
|
|
|
140
235
|
/**
|
|
@@ -169,7 +264,7 @@ class Rewards {
|
|
|
169
264
|
* @summary: Get referral details of a user
|
|
170
265
|
* @description: Use this API to retrieve total available points of a user for current application
|
|
171
266
|
*/
|
|
172
|
-
getUserPoints({} = {}) {
|
|
267
|
+
async getUserPoints({} = {}) {
|
|
173
268
|
const { error } = RewardsValidator.getUserPoints().validate(
|
|
174
269
|
{},
|
|
175
270
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -177,11 +272,25 @@ class Rewards {
|
|
|
177
272
|
if (error) {
|
|
178
273
|
return Promise.reject(new FDKClientValidationError(error));
|
|
179
274
|
}
|
|
275
|
+
|
|
276
|
+
// Showing warrnings if extra unknown parameters are found
|
|
277
|
+
const { error: warrning } = RewardsValidator.getUserPoints().validate(
|
|
278
|
+
{},
|
|
279
|
+
{ abortEarly: false, allowUnknown: false }
|
|
280
|
+
);
|
|
281
|
+
if (warrning) {
|
|
282
|
+
Logger({
|
|
283
|
+
level: "WARN",
|
|
284
|
+
message: "Parameter Validation warrnings for getUserPoints",
|
|
285
|
+
});
|
|
286
|
+
Logger({ level: "WARN", message: warrning });
|
|
287
|
+
}
|
|
288
|
+
|
|
180
289
|
const query_params = {};
|
|
181
290
|
|
|
182
291
|
const xHeaders = {};
|
|
183
292
|
|
|
184
|
-
|
|
293
|
+
const response = await APIClient.execute(
|
|
185
294
|
this._conf,
|
|
186
295
|
"get",
|
|
187
296
|
constructUrl({
|
|
@@ -192,6 +301,23 @@ class Rewards {
|
|
|
192
301
|
undefined,
|
|
193
302
|
xHeaders
|
|
194
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;
|
|
195
321
|
}
|
|
196
322
|
|
|
197
323
|
/**
|
|
@@ -200,7 +326,7 @@ class Rewards {
|
|
|
200
326
|
* @summary: Get referral details of a user
|
|
201
327
|
* @description: Use this API to retrieve the referral details a user has configured in the application.
|
|
202
328
|
*/
|
|
203
|
-
getUserReferralDetails({} = {}) {
|
|
329
|
+
async getUserReferralDetails({} = {}) {
|
|
204
330
|
const { error } = RewardsValidator.getUserReferralDetails().validate(
|
|
205
331
|
{},
|
|
206
332
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -208,11 +334,27 @@ class Rewards {
|
|
|
208
334
|
if (error) {
|
|
209
335
|
return Promise.reject(new FDKClientValidationError(error));
|
|
210
336
|
}
|
|
337
|
+
|
|
338
|
+
// Showing warrnings if extra unknown parameters are found
|
|
339
|
+
const {
|
|
340
|
+
error: warrning,
|
|
341
|
+
} = RewardsValidator.getUserReferralDetails().validate(
|
|
342
|
+
{},
|
|
343
|
+
{ abortEarly: false, allowUnknown: false }
|
|
344
|
+
);
|
|
345
|
+
if (warrning) {
|
|
346
|
+
Logger({
|
|
347
|
+
level: "WARN",
|
|
348
|
+
message: "Parameter Validation warrnings for getUserReferralDetails",
|
|
349
|
+
});
|
|
350
|
+
Logger({ level: "WARN", message: warrning });
|
|
351
|
+
}
|
|
352
|
+
|
|
211
353
|
const query_params = {};
|
|
212
354
|
|
|
213
355
|
const xHeaders = {};
|
|
214
356
|
|
|
215
|
-
|
|
357
|
+
const response = await APIClient.execute(
|
|
216
358
|
this._conf,
|
|
217
359
|
"get",
|
|
218
360
|
constructUrl({
|
|
@@ -223,6 +365,23 @@ class Rewards {
|
|
|
223
365
|
undefined,
|
|
224
366
|
xHeaders
|
|
225
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;
|
|
226
385
|
}
|
|
227
386
|
|
|
228
387
|
/**
|
|
@@ -232,7 +391,7 @@ class Rewards {
|
|
|
232
391
|
* @summary: Calculates the discount on order-amount
|
|
233
392
|
* @description: Use this API to calculate the discount on order-amount based on all the amount range configured in order_discount.
|
|
234
393
|
*/
|
|
235
|
-
getOrderDiscount({ body } = {}) {
|
|
394
|
+
async getOrderDiscount({ body } = {}) {
|
|
236
395
|
const { error } = RewardsValidator.getOrderDiscount().validate(
|
|
237
396
|
{ body },
|
|
238
397
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -240,11 +399,25 @@ class Rewards {
|
|
|
240
399
|
if (error) {
|
|
241
400
|
return Promise.reject(new FDKClientValidationError(error));
|
|
242
401
|
}
|
|
402
|
+
|
|
403
|
+
// Showing warrnings if extra unknown parameters are found
|
|
404
|
+
const { error: warrning } = RewardsValidator.getOrderDiscount().validate(
|
|
405
|
+
{ body },
|
|
406
|
+
{ abortEarly: false, allowUnknown: false }
|
|
407
|
+
);
|
|
408
|
+
if (warrning) {
|
|
409
|
+
Logger({
|
|
410
|
+
level: "WARN",
|
|
411
|
+
message: "Parameter Validation warrnings for getOrderDiscount",
|
|
412
|
+
});
|
|
413
|
+
Logger({ level: "WARN", message: warrning });
|
|
414
|
+
}
|
|
415
|
+
|
|
243
416
|
const query_params = {};
|
|
244
417
|
|
|
245
418
|
const xHeaders = {};
|
|
246
419
|
|
|
247
|
-
|
|
420
|
+
const response = await APIClient.execute(
|
|
248
421
|
this._conf,
|
|
249
422
|
"post",
|
|
250
423
|
constructUrl({
|
|
@@ -255,6 +428,23 @@ class Rewards {
|
|
|
255
428
|
body,
|
|
256
429
|
xHeaders
|
|
257
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;
|
|
258
448
|
}
|
|
259
449
|
|
|
260
450
|
/**
|
|
@@ -264,7 +454,7 @@ class Rewards {
|
|
|
264
454
|
* @summary: Redeems a referral code and credits reward points to users
|
|
265
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.
|
|
266
456
|
*/
|
|
267
|
-
redeemReferralCode({ body } = {}) {
|
|
457
|
+
async redeemReferralCode({ body } = {}) {
|
|
268
458
|
const { error } = RewardsValidator.redeemReferralCode().validate(
|
|
269
459
|
{ body },
|
|
270
460
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -272,11 +462,25 @@ class Rewards {
|
|
|
272
462
|
if (error) {
|
|
273
463
|
return Promise.reject(new FDKClientValidationError(error));
|
|
274
464
|
}
|
|
465
|
+
|
|
466
|
+
// Showing warrnings if extra unknown parameters are found
|
|
467
|
+
const { error: warrning } = RewardsValidator.redeemReferralCode().validate(
|
|
468
|
+
{ body },
|
|
469
|
+
{ abortEarly: false, allowUnknown: false }
|
|
470
|
+
);
|
|
471
|
+
if (warrning) {
|
|
472
|
+
Logger({
|
|
473
|
+
level: "WARN",
|
|
474
|
+
message: "Parameter Validation warrnings for redeemReferralCode",
|
|
475
|
+
});
|
|
476
|
+
Logger({ level: "WARN", message: warrning });
|
|
477
|
+
}
|
|
478
|
+
|
|
275
479
|
const query_params = {};
|
|
276
480
|
|
|
277
481
|
const xHeaders = {};
|
|
278
482
|
|
|
279
|
-
|
|
483
|
+
const response = await APIClient.execute(
|
|
280
484
|
this._conf,
|
|
281
485
|
"post",
|
|
282
486
|
constructUrl({
|
|
@@ -287,6 +491,23 @@ class Rewards {
|
|
|
287
491
|
body,
|
|
288
492
|
xHeaders
|
|
289
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;
|
|
290
511
|
}
|
|
291
512
|
}
|
|
292
513
|
|