@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.
Files changed (70) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/sdk/application/ApplicationClient.d.ts +0 -2
  4. package/sdk/application/ApplicationClient.js +0 -2
  5. package/sdk/application/Content/ContentApplicationClient.d.ts +10 -0
  6. package/sdk/application/Content/ContentApplicationClient.js +53 -0
  7. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +11 -21
  8. package/sdk/application/Logistic/LogisticApplicationClient.js +34 -83
  9. package/sdk/application/Order/OrderApplicationClient.d.ts +11 -0
  10. package/sdk/application/Order/OrderApplicationClient.js +50 -0
  11. package/sdk/application/Payment/PaymentApplicationClient.d.ts +4 -4
  12. package/sdk/application/Payment/PaymentApplicationClient.js +3 -4
  13. package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +84 -0
  14. package/sdk/partner/Logistics/LogisticsPartnerClient.js +712 -0
  15. package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +237 -1
  16. package/sdk/partner/Logistics/LogisticsPartnerModel.js +157 -0
  17. package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +8 -0
  18. package/sdk/partner/Logistics/LogisticsPartnerValidator.js +70 -0
  19. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +3 -3
  20. package/sdk/platform/Cart/CartPlatformApplicationClient.js +3 -3
  21. package/sdk/platform/Cart/CartPlatformModel.d.ts +1 -4
  22. package/sdk/platform/Cart/CartPlatformModel.js +1 -1
  23. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +2 -2
  24. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2 -2
  25. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +0 -11
  26. package/sdk/platform/Catalog/CatalogPlatformClient.js +0 -80
  27. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +6 -131
  28. package/sdk/platform/Catalog/CatalogPlatformModel.js +4 -141
  29. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +1 -10
  30. package/sdk/platform/Catalog/CatalogPlatformValidator.js +0 -12
  31. package/sdk/platform/Common/CommonPlatformModel.d.ts +18 -1
  32. package/sdk/platform/Common/CommonPlatformModel.js +14 -0
  33. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +1 -73
  34. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +4 -462
  35. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +7 -45
  36. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +4 -55
  37. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +10 -2
  38. package/sdk/platform/Communication/CommunicationPlatformModel.js +3 -2
  39. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +14 -0
  40. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +6 -0
  41. package/sdk/platform/Order/OrderPlatformClient.d.ts +26 -18
  42. package/sdk/platform/Order/OrderPlatformClient.js +175 -107
  43. package/sdk/platform/Order/OrderPlatformModel.d.ts +339 -43
  44. package/sdk/platform/Order/OrderPlatformModel.js +209 -43
  45. package/sdk/platform/Order/OrderPlatformValidator.d.ts +40 -43
  46. package/sdk/platform/Order/OrderPlatformValidator.js +35 -30
  47. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +20 -10
  48. package/sdk/platform/Payment/PaymentPlatformModel.js +14 -10
  49. package/sdk/platform/PlatformApplicationClient.d.ts +0 -2
  50. package/sdk/platform/PlatformApplicationClient.js +0 -4
  51. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +0 -13
  52. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +0 -82
  53. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +1 -10
  54. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +0 -12
  55. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +212 -28
  56. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +133 -13
  57. package/sdk/platform/User/UserPlatformModel.d.ts +2 -2
  58. package/sdk/platform/User/UserPlatformModel.js +4 -4
  59. package/sdk/platform/index.d.ts +0 -1
  60. package/sdk/platform/index.js +0 -2
  61. package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +27 -1
  62. package/sdk/public/Configuration/ConfigurationPublicModel.js +19 -0
  63. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +0 -79
  64. package/sdk/application/Rewards/RewardsApplicationClient.js +0 -315
  65. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +0 -136
  66. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +0 -976
  67. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +0 -152
  68. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +0 -157
  69. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +0 -387
  70. 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 {string} [value] - Value of the condition
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?: string;
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 {string} [value] - Value of the condition
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.string().allow(""),
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
 
@@ -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");
@@ -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;