@gofynd/fdk-client-javascript 3.16.3 → 3.17.0
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 +1 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationClient.d.ts +0 -2
- package/sdk/application/ApplicationClient.js +0 -2
- package/sdk/application/Content/ContentApplicationClient.d.ts +10 -0
- package/sdk/application/Content/ContentApplicationClient.js +53 -0
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +11 -21
- package/sdk/application/Logistic/LogisticApplicationClient.js +34 -83
- package/sdk/application/Order/OrderApplicationClient.d.ts +11 -0
- package/sdk/application/Order/OrderApplicationClient.js +50 -0
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +4 -4
- package/sdk/application/Payment/PaymentApplicationClient.js +3 -4
- package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +84 -0
- package/sdk/partner/Logistics/LogisticsPartnerClient.js +712 -0
- package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +237 -1
- package/sdk/partner/Logistics/LogisticsPartnerModel.js +157 -0
- package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +8 -0
- package/sdk/partner/Logistics/LogisticsPartnerValidator.js +70 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +3 -3
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +3 -3
- package/sdk/platform/Cart/CartPlatformModel.d.ts +1 -4
- package/sdk/platform/Cart/CartPlatformModel.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +2 -2
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2 -2
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +0 -11
- package/sdk/platform/Catalog/CatalogPlatformClient.js +0 -80
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +6 -131
- package/sdk/platform/Catalog/CatalogPlatformModel.js +4 -141
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +1 -10
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +0 -12
- package/sdk/platform/Common/CommonPlatformModel.d.ts +18 -1
- package/sdk/platform/Common/CommonPlatformModel.js +14 -0
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +1 -73
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +4 -462
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +7 -45
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +4 -55
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +10 -2
- package/sdk/platform/Communication/CommunicationPlatformModel.js +3 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +14 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +6 -0
- package/sdk/platform/Order/OrderPlatformClient.d.ts +26 -18
- package/sdk/platform/Order/OrderPlatformClient.js +175 -107
- package/sdk/platform/Order/OrderPlatformModel.d.ts +339 -43
- package/sdk/platform/Order/OrderPlatformModel.js +209 -43
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +40 -43
- package/sdk/platform/Order/OrderPlatformValidator.js +35 -30
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +20 -10
- package/sdk/platform/Payment/PaymentPlatformModel.js +14 -10
- package/sdk/platform/PlatformApplicationClient.d.ts +0 -2
- package/sdk/platform/PlatformApplicationClient.js +0 -4
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +0 -13
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +0 -82
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +1 -10
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +0 -12
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +212 -28
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +133 -13
- package/sdk/platform/User/UserPlatformModel.d.ts +2 -2
- package/sdk/platform/User/UserPlatformModel.js +4 -4
- package/sdk/platform/index.d.ts +0 -1
- package/sdk/platform/index.js +0 -2
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +27 -1
- package/sdk/public/Configuration/ConfigurationPublicModel.js +19 -0
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +0 -79
- package/sdk/application/Rewards/RewardsApplicationClient.js +0 -315
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +0 -136
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +0 -976
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +0 -152
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +0 -157
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +0 -387
- package/sdk/platform/Rewards/RewardsPlatformModel.js +0 -410
|
@@ -324,7 +324,7 @@ export = UserPlatformModel;
|
|
|
324
324
|
* @property {string} [user_attribute_definition_id] - ID of the user attribute
|
|
325
325
|
* definition used in the condition
|
|
326
326
|
* @property {string} [type] - Type of condition to apply on the attribute value.
|
|
327
|
-
* @property {
|
|
327
|
+
* @property {Object} [value] - Value of the condition
|
|
328
328
|
* @property {boolean} [ignore_year] - Indicates if the year should be ignored
|
|
329
329
|
* for the condition
|
|
330
330
|
*/
|
|
@@ -1347,7 +1347,7 @@ type ConditionsSchema = {
|
|
|
1347
1347
|
/**
|
|
1348
1348
|
* - Value of the condition
|
|
1349
1349
|
*/
|
|
1350
|
-
value?:
|
|
1350
|
+
value?: any;
|
|
1351
1351
|
/**
|
|
1352
1352
|
* - Indicates if the year should be ignored
|
|
1353
1353
|
* for the condition
|
|
@@ -364,7 +364,7 @@ const Joi = require("joi");
|
|
|
364
364
|
* @property {string} [user_attribute_definition_id] - ID of the user attribute
|
|
365
365
|
* definition used in the condition
|
|
366
366
|
* @property {string} [type] - Type of condition to apply on the attribute value.
|
|
367
|
-
* @property {
|
|
367
|
+
* @property {Object} [value] - Value of the condition
|
|
368
368
|
* @property {boolean} [ignore_year] - Indicates if the year should be ignored
|
|
369
369
|
* for the condition
|
|
370
370
|
*/
|
|
@@ -926,7 +926,7 @@ class UserPlatformModel {
|
|
|
926
926
|
static BulkUserAttributeRequestBody() {
|
|
927
927
|
return Joi.object({
|
|
928
928
|
definition_id: Joi.string().allow("").required(),
|
|
929
|
-
value: Joi.any().required(),
|
|
929
|
+
value: Joi.object().pattern(/\S/, Joi.any()).required(),
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
932
|
|
|
@@ -1206,7 +1206,7 @@ class UserPlatformModel {
|
|
|
1206
1206
|
return Joi.object({
|
|
1207
1207
|
user_attribute_definition_id: Joi.string().allow(""),
|
|
1208
1208
|
type: Joi.string().allow(""),
|
|
1209
|
-
value: Joi.
|
|
1209
|
+
value: Joi.object().pattern(/\S/, Joi.any()),
|
|
1210
1210
|
ignore_year: Joi.boolean(),
|
|
1211
1211
|
});
|
|
1212
1212
|
}
|
|
@@ -1247,7 +1247,7 @@ class UserPlatformModel {
|
|
|
1247
1247
|
return Joi.object({
|
|
1248
1248
|
definition_id: Joi.string().allow("").required(),
|
|
1249
1249
|
type: Joi.string().allow("").required(),
|
|
1250
|
-
value: Joi.any().required(),
|
|
1250
|
+
value: Joi.object().pattern(/\S/, Joi.any()).required(),
|
|
1251
1251
|
});
|
|
1252
1252
|
}
|
|
1253
1253
|
|
package/sdk/platform/index.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export namespace PlatformModel {
|
|
|
18
18
|
const OrderPlatformModel: typeof import("./Order/OrderPlatformModel");
|
|
19
19
|
const PartnerPlatformModel: typeof import("./Partner/PartnerPlatformModel");
|
|
20
20
|
const PaymentPlatformModel: typeof import("./Payment/PaymentPlatformModel");
|
|
21
|
-
const RewardsPlatformModel: typeof import("./Rewards/RewardsPlatformModel");
|
|
22
21
|
const SharePlatformModel: typeof import("./Share/SharePlatformModel");
|
|
23
22
|
const ThemePlatformModel: typeof import("./Theme/ThemePlatformModel");
|
|
24
23
|
const UserPlatformModel: typeof import("./User/UserPlatformModel");
|
package/sdk/platform/index.js
CHANGED
|
@@ -36,8 +36,6 @@ module.exports = {
|
|
|
36
36
|
|
|
37
37
|
PaymentPlatformModel: require("./Payment/PaymentPlatformModel"),
|
|
38
38
|
|
|
39
|
-
RewardsPlatformModel: require("./Rewards/RewardsPlatformModel"),
|
|
40
|
-
|
|
41
39
|
SharePlatformModel: require("./Share/SharePlatformModel"),
|
|
42
40
|
|
|
43
41
|
ThemePlatformModel: require("./Theme/ThemePlatformModel"),
|
|
@@ -37,6 +37,11 @@ export = ConfigurationPublicModel;
|
|
|
37
37
|
* redirection is for long time period redirection, and temporary redirection
|
|
38
38
|
* for a short time period.
|
|
39
39
|
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef RegionDetails
|
|
42
|
+
* @property {string} [slug] - Region slug identifier.
|
|
43
|
+
* @property {string} [zone] - Zone identifier within the region.
|
|
44
|
+
*/
|
|
40
45
|
/**
|
|
41
46
|
* @typedef ApplicationMeta
|
|
42
47
|
* @property {string} [name] - Indicates the name of application meta
|
|
@@ -82,6 +87,9 @@ export = ConfigurationPublicModel;
|
|
|
82
87
|
* @property {SecureUrl} [mobile_logo]
|
|
83
88
|
* @property {Domain} [domain]
|
|
84
89
|
* @property {string} [slug]
|
|
90
|
+
* @property {string} [region] - Region identifier for the sales channel. When
|
|
91
|
+
* zone is "default", this equals the slug. Otherwise, it is formatted as "slug/zone".
|
|
92
|
+
* @property {RegionDetails} [region_details]
|
|
85
93
|
*/
|
|
86
94
|
/**
|
|
87
95
|
* @typedef NotFound
|
|
@@ -129,7 +137,7 @@ export = ConfigurationPublicModel;
|
|
|
129
137
|
declare class ConfigurationPublicModel {
|
|
130
138
|
}
|
|
131
139
|
declare namespace ConfigurationPublicModel {
|
|
132
|
-
export { ApplicationResponseSchema, Domain, ApplicationWebsite, ApplicationCors, ApplicationAuth, ApplicationRedirections, ApplicationMeta, SecureUrl, Application, NotFound, BadRequestSchema, LocationDefaultLanguage, LocationDefaultCurrency, LocationCountry, Locations };
|
|
140
|
+
export { ApplicationResponseSchema, Domain, ApplicationWebsite, ApplicationCors, ApplicationAuth, ApplicationRedirections, RegionDetails, ApplicationMeta, SecureUrl, Application, NotFound, BadRequestSchema, LocationDefaultLanguage, LocationDefaultCurrency, LocationCountry, Locations };
|
|
133
141
|
}
|
|
134
142
|
/** @returns {ApplicationResponseSchema} */
|
|
135
143
|
declare function ApplicationResponseSchema(): ApplicationResponseSchema;
|
|
@@ -208,6 +216,18 @@ type ApplicationRedirections = {
|
|
|
208
216
|
*/
|
|
209
217
|
type?: string;
|
|
210
218
|
};
|
|
219
|
+
/** @returns {RegionDetails} */
|
|
220
|
+
declare function RegionDetails(): RegionDetails;
|
|
221
|
+
type RegionDetails = {
|
|
222
|
+
/**
|
|
223
|
+
* - Region slug identifier.
|
|
224
|
+
*/
|
|
225
|
+
slug?: string;
|
|
226
|
+
/**
|
|
227
|
+
* - Zone identifier within the region.
|
|
228
|
+
*/
|
|
229
|
+
zone?: string;
|
|
230
|
+
};
|
|
211
231
|
/** @returns {ApplicationMeta} */
|
|
212
232
|
declare function ApplicationMeta(): ApplicationMeta;
|
|
213
233
|
type ApplicationMeta = {
|
|
@@ -307,6 +327,12 @@ type Application = {
|
|
|
307
327
|
mobile_logo?: SecureUrl;
|
|
308
328
|
domain?: Domain;
|
|
309
329
|
slug?: string;
|
|
330
|
+
/**
|
|
331
|
+
* - Region identifier for the sales channel. When
|
|
332
|
+
* zone is "default", this equals the slug. Otherwise, it is formatted as "slug/zone".
|
|
333
|
+
*/
|
|
334
|
+
region?: string;
|
|
335
|
+
region_details?: RegionDetails;
|
|
310
336
|
};
|
|
311
337
|
/** @returns {NotFound} */
|
|
312
338
|
declare function NotFound(): NotFound;
|
|
@@ -44,6 +44,12 @@ const Joi = require("joi");
|
|
|
44
44
|
* for a short time period.
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* @typedef RegionDetails
|
|
49
|
+
* @property {string} [slug] - Region slug identifier.
|
|
50
|
+
* @property {string} [zone] - Zone identifier within the region.
|
|
51
|
+
*/
|
|
52
|
+
|
|
47
53
|
/**
|
|
48
54
|
* @typedef ApplicationMeta
|
|
49
55
|
* @property {string} [name] - Indicates the name of application meta
|
|
@@ -91,6 +97,9 @@ const Joi = require("joi");
|
|
|
91
97
|
* @property {SecureUrl} [mobile_logo]
|
|
92
98
|
* @property {Domain} [domain]
|
|
93
99
|
* @property {string} [slug]
|
|
100
|
+
* @property {string} [region] - Region identifier for the sales channel. When
|
|
101
|
+
* zone is "default", this equals the slug. Otherwise, it is formatted as "slug/zone".
|
|
102
|
+
* @property {RegionDetails} [region_details]
|
|
94
103
|
*/
|
|
95
104
|
|
|
96
105
|
/**
|
|
@@ -193,6 +202,14 @@ class ConfigurationPublicModel {
|
|
|
193
202
|
});
|
|
194
203
|
}
|
|
195
204
|
|
|
205
|
+
/** @returns {RegionDetails} */
|
|
206
|
+
static RegionDetails() {
|
|
207
|
+
return Joi.object({
|
|
208
|
+
slug: Joi.string().allow(""),
|
|
209
|
+
zone: Joi.string().allow(""),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
196
213
|
/** @returns {ApplicationMeta} */
|
|
197
214
|
static ApplicationMeta() {
|
|
198
215
|
return Joi.object({
|
|
@@ -239,6 +256,8 @@ class ConfigurationPublicModel {
|
|
|
239
256
|
mobile_logo: ConfigurationPublicModel.SecureUrl(),
|
|
240
257
|
domain: ConfigurationPublicModel.Domain(),
|
|
241
258
|
slug: Joi.string().allow(""),
|
|
259
|
+
region: Joi.string().allow(""),
|
|
260
|
+
region_details: ConfigurationPublicModel.RegionDetails(),
|
|
242
261
|
});
|
|
243
262
|
}
|
|
244
263
|
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
export = Rewards;
|
|
2
|
-
declare class Rewards {
|
|
3
|
-
constructor(_conf: any);
|
|
4
|
-
_conf: any;
|
|
5
|
-
_relativeUrls: {
|
|
6
|
-
catalogueOrder: string;
|
|
7
|
-
getOfferByName: string;
|
|
8
|
-
getOrderDiscount: string;
|
|
9
|
-
getUserPoints: string;
|
|
10
|
-
getUserPointsHistory: string;
|
|
11
|
-
getUserReferralDetails: string;
|
|
12
|
-
redeemReferralCode: string;
|
|
13
|
-
};
|
|
14
|
-
_urls: {};
|
|
15
|
-
updateUrls(urls: any): void;
|
|
16
|
-
/**
|
|
17
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
18
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
19
|
-
* @returns {Promise<CatalogueOrderDetails>} - Success response
|
|
20
|
-
* @name catalogueOrder
|
|
21
|
-
* @summary: Order from catalogue
|
|
22
|
-
* @description: Place a reward on order items available in the catalogue. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/catalogueOrder/).
|
|
23
|
-
*/
|
|
24
|
-
catalogueOrder({ body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<CatalogueOrderDetails>;
|
|
25
|
-
/**
|
|
26
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
27
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
28
|
-
* @returns {Promise<Offer>} - Success response
|
|
29
|
-
* @name getOfferByName
|
|
30
|
-
* @summary: Get specific offer
|
|
31
|
-
* @description: Retrieves detailed information about an offer by its name. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getOfferByName/).
|
|
32
|
-
*/
|
|
33
|
-
getOfferByName({ name, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<Offer>;
|
|
34
|
-
/**
|
|
35
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
36
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
37
|
-
* @returns {Promise<OrderDiscountDetails>} - Success response
|
|
38
|
-
* @name getOrderDiscount
|
|
39
|
-
* @summary: Order discount
|
|
40
|
-
* @description: Retrieve the discount applied to a specific order. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getOrderDiscount/).
|
|
41
|
-
*/
|
|
42
|
-
getOrderDiscount({ body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<OrderDiscountDetails>;
|
|
43
|
-
/**
|
|
44
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
45
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
46
|
-
* @returns {Promise<PointsDetails>} - Success response
|
|
47
|
-
* @name getUserPoints
|
|
48
|
-
* @summary: Current points
|
|
49
|
-
* @description: Retrieves the current reward points balance for the user. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getUserPoints/).
|
|
50
|
-
*/
|
|
51
|
-
getUserPoints({ requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<PointsDetails>;
|
|
52
|
-
/**
|
|
53
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
54
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
55
|
-
* @returns {Promise<PointsHistoryDetails>} - Success response
|
|
56
|
-
* @name getUserPointsHistory
|
|
57
|
-
* @summary: Points history
|
|
58
|
-
* @description: Gets the historical data of points earned or spent by the user. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getUserPointsHistory/).
|
|
59
|
-
*/
|
|
60
|
-
getUserPointsHistory({ pageId, pageSize, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<PointsHistoryDetails>;
|
|
61
|
-
/**
|
|
62
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
63
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
64
|
-
* @returns {Promise<ReferralDetails>} - Success response
|
|
65
|
-
* @name getUserReferralDetails
|
|
66
|
-
* @summary: Referral details
|
|
67
|
-
* @description: Gets the details of the user’s referral status and codes. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getUserReferralDetails/).
|
|
68
|
-
*/
|
|
69
|
-
getUserReferralDetails({ requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<ReferralDetails>;
|
|
70
|
-
/**
|
|
71
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
72
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
73
|
-
* @returns {Promise<RedeemReferralCodeDetails>} - Success response
|
|
74
|
-
* @name redeemReferralCode
|
|
75
|
-
* @summary: Redeem code
|
|
76
|
-
* @description: Applies a referral code to earn or redeem rewards. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/redeemReferralCode/).
|
|
77
|
-
*/
|
|
78
|
-
redeemReferralCode({ body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<RedeemReferralCodeDetails>;
|
|
79
|
-
}
|
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
const {
|
|
2
|
-
FDKClientValidationError,
|
|
3
|
-
FDKResponseValidationError,
|
|
4
|
-
} = require("../../common/FDKError");
|
|
5
|
-
|
|
6
|
-
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
7
|
-
const constructUrl = require("../constructUrl");
|
|
8
|
-
const Paginator = require("../../common/Paginator");
|
|
9
|
-
const { validateRequiredParams } = require("../../common/Validator");
|
|
10
|
-
|
|
11
|
-
class Rewards {
|
|
12
|
-
constructor(_conf) {
|
|
13
|
-
this._conf = _conf;
|
|
14
|
-
this._relativeUrls = {
|
|
15
|
-
catalogueOrder:
|
|
16
|
-
"/service/application/rewards/v1.0/catalogue/offer/order/",
|
|
17
|
-
getOfferByName: "/service/application/rewards/v1.0/offers/{name}/",
|
|
18
|
-
getOrderDiscount:
|
|
19
|
-
"/service/application/rewards/v1.0/user/offer/order-discount/",
|
|
20
|
-
getUserPoints: "/service/application/rewards/v1.0/user/points/",
|
|
21
|
-
getUserPointsHistory:
|
|
22
|
-
"/service/application/rewards/v1.0/user/points/history/",
|
|
23
|
-
getUserReferralDetails:
|
|
24
|
-
"/service/application/rewards/v1.0/user/referral/",
|
|
25
|
-
redeemReferralCode:
|
|
26
|
-
"/service/application/rewards/v1.0/user/referral/redeem/",
|
|
27
|
-
};
|
|
28
|
-
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
29
|
-
(urls, [method, relativeUrl]) => {
|
|
30
|
-
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
31
|
-
return urls;
|
|
32
|
-
},
|
|
33
|
-
{}
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
updateUrls(urls) {
|
|
38
|
-
this._urls = {
|
|
39
|
-
...this._urls,
|
|
40
|
-
...urls,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
46
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
47
|
-
* @returns {Promise<CatalogueOrderDetails>} - Success response
|
|
48
|
-
* @name catalogueOrder
|
|
49
|
-
* @summary: Order from catalogue
|
|
50
|
-
* @description: Place a reward on order items available in the catalogue. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/catalogueOrder/).
|
|
51
|
-
*/
|
|
52
|
-
async catalogueOrder(
|
|
53
|
-
{ body, requestHeaders } = { requestHeaders: {} },
|
|
54
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
55
|
-
) {
|
|
56
|
-
const query_params = {};
|
|
57
|
-
|
|
58
|
-
const xHeaders = {};
|
|
59
|
-
|
|
60
|
-
const response = await ApplicationAPIClient.execute(
|
|
61
|
-
this._conf,
|
|
62
|
-
"post",
|
|
63
|
-
constructUrl({
|
|
64
|
-
url: this._urls["catalogueOrder"],
|
|
65
|
-
params: {},
|
|
66
|
-
}),
|
|
67
|
-
query_params,
|
|
68
|
-
body,
|
|
69
|
-
{ ...xHeaders, ...requestHeaders },
|
|
70
|
-
{ responseHeaders }
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
let responseData = response;
|
|
74
|
-
if (responseHeaders) {
|
|
75
|
-
responseData = response[0];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return response;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
83
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
84
|
-
* @returns {Promise<Offer>} - Success response
|
|
85
|
-
* @name getOfferByName
|
|
86
|
-
* @summary: Get specific offer
|
|
87
|
-
* @description: Retrieves detailed information about an offer by its name. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getOfferByName/).
|
|
88
|
-
*/
|
|
89
|
-
async getOfferByName(
|
|
90
|
-
{ name, requestHeaders } = { requestHeaders: {} },
|
|
91
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
92
|
-
) {
|
|
93
|
-
const errors = validateRequiredParams(arguments[0], ["name"]);
|
|
94
|
-
if (errors.length > 0) {
|
|
95
|
-
const error = new FDKClientValidationError({
|
|
96
|
-
message: "Missing required field",
|
|
97
|
-
details: errors,
|
|
98
|
-
});
|
|
99
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const query_params = {};
|
|
103
|
-
|
|
104
|
-
const xHeaders = {};
|
|
105
|
-
|
|
106
|
-
const response = await ApplicationAPIClient.execute(
|
|
107
|
-
this._conf,
|
|
108
|
-
"get",
|
|
109
|
-
constructUrl({
|
|
110
|
-
url: this._urls["getOfferByName"],
|
|
111
|
-
params: { name },
|
|
112
|
-
}),
|
|
113
|
-
query_params,
|
|
114
|
-
undefined,
|
|
115
|
-
{ ...xHeaders, ...requestHeaders },
|
|
116
|
-
{ responseHeaders }
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
let responseData = response;
|
|
120
|
-
if (responseHeaders) {
|
|
121
|
-
responseData = response[0];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return response;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
129
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
130
|
-
* @returns {Promise<OrderDiscountDetails>} - Success response
|
|
131
|
-
* @name getOrderDiscount
|
|
132
|
-
* @summary: Order discount
|
|
133
|
-
* @description: Retrieve the discount applied to a specific order. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getOrderDiscount/).
|
|
134
|
-
*/
|
|
135
|
-
async getOrderDiscount(
|
|
136
|
-
{ body, requestHeaders } = { requestHeaders: {} },
|
|
137
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
138
|
-
) {
|
|
139
|
-
const query_params = {};
|
|
140
|
-
|
|
141
|
-
const xHeaders = {};
|
|
142
|
-
|
|
143
|
-
const response = await ApplicationAPIClient.execute(
|
|
144
|
-
this._conf,
|
|
145
|
-
"post",
|
|
146
|
-
constructUrl({
|
|
147
|
-
url: this._urls["getOrderDiscount"],
|
|
148
|
-
params: {},
|
|
149
|
-
}),
|
|
150
|
-
query_params,
|
|
151
|
-
body,
|
|
152
|
-
{ ...xHeaders, ...requestHeaders },
|
|
153
|
-
{ responseHeaders }
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
let responseData = response;
|
|
157
|
-
if (responseHeaders) {
|
|
158
|
-
responseData = response[0];
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return response;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
166
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
167
|
-
* @returns {Promise<PointsDetails>} - Success response
|
|
168
|
-
* @name getUserPoints
|
|
169
|
-
* @summary: Current points
|
|
170
|
-
* @description: Retrieves the current reward points balance for the user. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getUserPoints/).
|
|
171
|
-
*/
|
|
172
|
-
async getUserPoints(
|
|
173
|
-
{ requestHeaders } = { requestHeaders: {} },
|
|
174
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
175
|
-
) {
|
|
176
|
-
const query_params = {};
|
|
177
|
-
|
|
178
|
-
const xHeaders = {};
|
|
179
|
-
|
|
180
|
-
const response = await ApplicationAPIClient.execute(
|
|
181
|
-
this._conf,
|
|
182
|
-
"get",
|
|
183
|
-
constructUrl({
|
|
184
|
-
url: this._urls["getUserPoints"],
|
|
185
|
-
params: {},
|
|
186
|
-
}),
|
|
187
|
-
query_params,
|
|
188
|
-
undefined,
|
|
189
|
-
{ ...xHeaders, ...requestHeaders },
|
|
190
|
-
{ responseHeaders }
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
let responseData = response;
|
|
194
|
-
if (responseHeaders) {
|
|
195
|
-
responseData = response[0];
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return response;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
203
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
204
|
-
* @returns {Promise<PointsHistoryDetails>} - Success response
|
|
205
|
-
* @name getUserPointsHistory
|
|
206
|
-
* @summary: Points history
|
|
207
|
-
* @description: Gets the historical data of points earned or spent by the user. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getUserPointsHistory/).
|
|
208
|
-
*/
|
|
209
|
-
async getUserPointsHistory(
|
|
210
|
-
{ pageId, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
211
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
212
|
-
) {
|
|
213
|
-
const query_params = {};
|
|
214
|
-
query_params["page_id"] = pageId;
|
|
215
|
-
query_params["page_size"] = pageSize;
|
|
216
|
-
|
|
217
|
-
const xHeaders = {};
|
|
218
|
-
|
|
219
|
-
const response = await ApplicationAPIClient.execute(
|
|
220
|
-
this._conf,
|
|
221
|
-
"get",
|
|
222
|
-
constructUrl({
|
|
223
|
-
url: this._urls["getUserPointsHistory"],
|
|
224
|
-
params: {},
|
|
225
|
-
}),
|
|
226
|
-
query_params,
|
|
227
|
-
undefined,
|
|
228
|
-
{ ...xHeaders, ...requestHeaders },
|
|
229
|
-
{ responseHeaders }
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
let responseData = response;
|
|
233
|
-
if (responseHeaders) {
|
|
234
|
-
responseData = response[0];
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return response;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
242
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
243
|
-
* @returns {Promise<ReferralDetails>} - Success response
|
|
244
|
-
* @name getUserReferralDetails
|
|
245
|
-
* @summary: Referral details
|
|
246
|
-
* @description: Gets the details of the user’s referral status and codes. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/getUserReferralDetails/).
|
|
247
|
-
*/
|
|
248
|
-
async getUserReferralDetails(
|
|
249
|
-
{ requestHeaders } = { requestHeaders: {} },
|
|
250
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
251
|
-
) {
|
|
252
|
-
const query_params = {};
|
|
253
|
-
|
|
254
|
-
const xHeaders = {};
|
|
255
|
-
|
|
256
|
-
const response = await ApplicationAPIClient.execute(
|
|
257
|
-
this._conf,
|
|
258
|
-
"get",
|
|
259
|
-
constructUrl({
|
|
260
|
-
url: this._urls["getUserReferralDetails"],
|
|
261
|
-
params: {},
|
|
262
|
-
}),
|
|
263
|
-
query_params,
|
|
264
|
-
undefined,
|
|
265
|
-
{ ...xHeaders, ...requestHeaders },
|
|
266
|
-
{ responseHeaders }
|
|
267
|
-
);
|
|
268
|
-
|
|
269
|
-
let responseData = response;
|
|
270
|
-
if (responseHeaders) {
|
|
271
|
-
responseData = response[0];
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return response;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
279
|
-
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
280
|
-
* @returns {Promise<RedeemReferralCodeDetails>} - Success response
|
|
281
|
-
* @name redeemReferralCode
|
|
282
|
-
* @summary: Redeem code
|
|
283
|
-
* @description: Applies a referral code to earn or redeem rewards. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/application/rewards/redeemReferralCode/).
|
|
284
|
-
*/
|
|
285
|
-
async redeemReferralCode(
|
|
286
|
-
{ body, requestHeaders } = { requestHeaders: {} },
|
|
287
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
288
|
-
) {
|
|
289
|
-
const query_params = {};
|
|
290
|
-
|
|
291
|
-
const xHeaders = {};
|
|
292
|
-
|
|
293
|
-
const response = await ApplicationAPIClient.execute(
|
|
294
|
-
this._conf,
|
|
295
|
-
"post",
|
|
296
|
-
constructUrl({
|
|
297
|
-
url: this._urls["redeemReferralCode"],
|
|
298
|
-
params: {},
|
|
299
|
-
}),
|
|
300
|
-
query_params,
|
|
301
|
-
body,
|
|
302
|
-
{ ...xHeaders, ...requestHeaders },
|
|
303
|
-
{ responseHeaders }
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
let responseData = response;
|
|
307
|
-
if (responseHeaders) {
|
|
308
|
-
responseData = response[0];
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return response;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
module.exports = Rewards;
|