@gofynd/fdk-client-javascript 1.1.1 → 1.1.3
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 -2
- package/index.d.ts +4 -7
- package/index.js +5 -12
- package/package.json +1 -1
- package/sdk/application/ApplicationClient.d.ts +20 -20
- package/sdk/application/ApplicationClient.js +26 -26
- package/sdk/application/Cart/CartApplicationClient.d.ts +45 -4
- package/sdk/application/Cart/CartApplicationClient.js +169 -9
- package/sdk/application/Cart/CartApplicationModel.d.ts +15 -0
- package/sdk/application/Cart/CartApplicationModel.js +177 -1
- package/sdk/application/Cart/CartApplicationValidator.d.ts +2 -0
- package/sdk/application/Cart/CartApplicationValidator.js +20 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +14 -4
- package/sdk/application/Catalog/CatalogApplicationClient.js +18 -6
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +1 -0
- package/sdk/application/Catalog/CatalogApplicationModel.js +13 -0
- package/sdk/application/Catalog/CatalogApplicationValidator.js +2 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +14 -10
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +16 -10
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +4 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +8 -2
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +8 -2
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +2 -2
- package/sdk/application/Logistic/LogisticApplicationModel.js +3 -2
- package/sdk/application/Order/OrderApplicationClient.d.ts +17 -2
- package/sdk/application/Order/OrderApplicationClient.js +70 -2
- package/sdk/application/Order/OrderApplicationModel.d.ts +17 -0
- package/sdk/application/Order/OrderApplicationModel.js +129 -8
- package/sdk/application/Order/OrderApplicationValidator.d.ts +1 -0
- package/sdk/application/Order/OrderApplicationValidator.js +7 -0
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +35 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +200 -0
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +4 -0
- package/sdk/application/Payment/PaymentApplicationModel.js +58 -7
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +3 -0
- package/sdk/application/Payment/PaymentApplicationValidator.js +19 -0
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +16 -3
- package/sdk/application/PosCart/PosCartApplicationClient.js +39 -6
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +10 -0
- package/sdk/application/PosCart/PosCartApplicationModel.js +113 -1
- package/sdk/application/PosCart/PosCartApplicationValidator.js +6 -0
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +8 -8
- package/sdk/application/Rewards/RewardsApplicationClient.js +8 -8
- package/sdk/application/index.d.ts +10 -10
- package/sdk/application/index.js +13 -13
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/common/Constant.d.ts +5 -0
- package/sdk/common/Constant.js +5 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +6 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +479 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +2574 -307
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +31 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +263 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +61 -0
- package/sdk/platform/Cart/CartPlatformModel.js +697 -2
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +8 -2
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +10 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2 -2
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +1 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.js +41 -29
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +1 -0
- package/sdk/platform/Communication/CommunicationPlatformModel.js +9 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +2 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +2 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +5 -4
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +99 -78
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +99 -78
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +87 -71
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +87 -71
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +2 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +26 -0
- package/sdk/platform/Content/ContentPlatformModel.js +4 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +10 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +15 -9
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +8 -2
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +8 -2
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +2 -2
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +135 -0
- package/sdk/platform/Finance/FinancePlatformClient.js +853 -0
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +51 -0
- package/sdk/platform/Finance/FinancePlatformModel.js +342 -0
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +16 -0
- package/sdk/platform/Finance/FinancePlatformValidator.js +84 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +11 -1
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +66 -2
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -0
- package/sdk/platform/Order/OrderPlatformClient.d.ts +161 -81
- package/sdk/platform/Order/OrderPlatformClient.js +546 -119
- package/sdk/platform/Order/OrderPlatformModel.d.ts +42 -6
- package/sdk/platform/Order/OrderPlatformModel.js +570 -158
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +6 -0
- package/sdk/platform/Order/OrderPlatformValidator.js +52 -10
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +22 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +127 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +2 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +13 -0
- package/sdk/platform/Partner/PartnerPlatformClient.d.ts +145 -0
- package/sdk/platform/Partner/PartnerPlatformClient.js +799 -0
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +39 -0
- package/sdk/platform/Partner/PartnerPlatformModel.js +367 -0
- package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +14 -0
- package/sdk/platform/Partner/PartnerPlatformValidator.js +87 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +221 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +1476 -190
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +20 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +126 -0
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +44 -0
- package/sdk/platform/Payment/PaymentPlatformModel.js +410 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +1149 -930
- package/sdk/platform/PlatformApplicationClient.js +1260 -1027
- package/sdk/platform/PlatformClient.d.ts +10360 -8660
- package/sdk/platform/PlatformClient.js +11126 -9093
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +14 -26
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +14 -74
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +0 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +0 -7
- package/sdk/platform/index.d.ts +15 -14
- package/sdk/platform/index.js +20 -18
- package/sdk/public/PublicClient.d.ts +2 -2
- package/sdk/public/PublicClient.js +4 -4
- package/sdk/public/index.d.ts +1 -1
- package/sdk/public/index.js +2 -2
- package/partner.d.ts +0 -4
- package/partner.js +0 -7
- package/sdk/partner/OAuthClient.d.ts +0 -14
- package/sdk/partner/OAuthClient.js +0 -112
- package/sdk/partner/PartnerAPIClient.d.ts +0 -12
- package/sdk/partner/PartnerAPIClient.js +0 -42
- package/sdk/partner/PartnerClient.d.ts +0 -6
- package/sdk/partner/PartnerClient.js +0 -17
- package/sdk/partner/PartnerConfig.d.ts +0 -30
- package/sdk/partner/PartnerConfig.js +0 -39
- package/sdk/partner/index.d.ts +0 -3
- package/sdk/partner/index.js +0 -5
|
@@ -3,24 +3,12 @@ declare class Rewards {
|
|
|
3
3
|
constructor(config: any, applicationId: any);
|
|
4
4
|
config: any;
|
|
5
5
|
applicationId: any;
|
|
6
|
-
/**
|
|
7
|
-
* @param {Object} arg - Arg object.
|
|
8
|
-
* @param {string} arg.id - Giveaway ID
|
|
9
|
-
* @param {string} arg.audienceId - Audience id
|
|
10
|
-
* @returns {Promise<GiveawayAudience>} - Success response
|
|
11
|
-
* @summary: Get the Giveaway audience status
|
|
12
|
-
* @description: Get giveaway audience status
|
|
13
|
-
*/
|
|
14
|
-
getGiveawayAudienceStatus({ id, audienceId }?: {
|
|
15
|
-
id: string;
|
|
16
|
-
audienceId: string;
|
|
17
|
-
}): Promise<GiveawayAudience>;
|
|
18
6
|
/**
|
|
19
7
|
* @param {Object} arg - Arg object.
|
|
20
8
|
* @param {string} arg.id - Giveaway ID
|
|
21
9
|
* @returns {Promise<Giveaway>} - Success response
|
|
22
10
|
* @summary: Get giveaway by ID.
|
|
23
|
-
* @description:
|
|
11
|
+
* @description: Retrieve the specific giveaway by giveaway ID. It will show all the details of the requested giveaway.
|
|
24
12
|
*/
|
|
25
13
|
getGiveawayById({ id }?: {
|
|
26
14
|
id: string;
|
|
@@ -29,8 +17,8 @@ declare class Rewards {
|
|
|
29
17
|
* @param {Object} arg - Arg object.
|
|
30
18
|
* @param {string} arg.name - The name given to the offer.
|
|
31
19
|
* @returns {Promise<Offer>} - Success response
|
|
32
|
-
* @summary:
|
|
33
|
-
* @description:
|
|
20
|
+
* @summary: Fetch a offer by its name
|
|
21
|
+
* @description: Fetch the specific offer details and configuration by the name of the offer.
|
|
34
22
|
*/
|
|
35
23
|
getOfferByName({ name }?: {
|
|
36
24
|
name: string;
|
|
@@ -39,7 +27,7 @@ declare class Rewards {
|
|
|
39
27
|
* @param {Object} arg - Arg object.
|
|
40
28
|
* @returns {Promise<ConfigurationRes>} - Success response
|
|
41
29
|
* @summary: Get all valid android paths
|
|
42
|
-
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a
|
|
30
|
+
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fraudulent device.
|
|
43
31
|
*/
|
|
44
32
|
getRewardsConfiguration({}?: any): Promise<ConfigurationRes>;
|
|
45
33
|
/**
|
|
@@ -47,7 +35,7 @@ declare class Rewards {
|
|
|
47
35
|
* @param {string} arg.userId - User id
|
|
48
36
|
* @returns {Promise<UserRes>} - Success response
|
|
49
37
|
* @summary: Get user reward details
|
|
50
|
-
* @description:
|
|
38
|
+
* @description: Fetches the user details and the user reward details with their current reward points for the specific user.
|
|
51
39
|
*/
|
|
52
40
|
getUserDetails({ userId }?: {
|
|
53
41
|
userId: string;
|
|
@@ -60,7 +48,7 @@ declare class Rewards {
|
|
|
60
48
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
61
49
|
* @returns {Promise<HistoryRes>} - Success response
|
|
62
50
|
* @summary: Get all transactions of reward points
|
|
63
|
-
* @description:
|
|
51
|
+
* @description: Fetches a list of points transactions like giveaway points, signup points, referral points, order earn points, redeem points and expired points.
|
|
64
52
|
*/
|
|
65
53
|
getUserPointsHistory({ userId, pageId, pageSize, }?: {
|
|
66
54
|
userId: string;
|
|
@@ -74,7 +62,7 @@ declare class Rewards {
|
|
|
74
62
|
* @param {string} arg.applicationId - Application id
|
|
75
63
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
76
64
|
* @summary: Get all transactions of reward points
|
|
77
|
-
* @description:
|
|
65
|
+
* @description: Fetches a list of points transactions like giveaway points, signup points, referral points, order earn points, redeem points and expired points.
|
|
78
66
|
*/
|
|
79
67
|
getUserPointsHistoryPaginator({ userId, companyId, applicationId, pageSize, }?: {
|
|
80
68
|
userId: string;
|
|
@@ -87,7 +75,7 @@ declare class Rewards {
|
|
|
87
75
|
* @param {Giveaway} arg.body
|
|
88
76
|
* @returns {Promise<Giveaway>} - Success response
|
|
89
77
|
* @summary: List of giveaways of the current application.
|
|
90
|
-
* @description:
|
|
78
|
+
* @description: Creates a new giveaway in the current application, specifying the target audience, points allocation, as well as the name and display name of the giveaway.
|
|
91
79
|
*/
|
|
92
80
|
saveGiveAway({ body }?: {
|
|
93
81
|
body: Giveaway;
|
|
@@ -97,7 +85,7 @@ declare class Rewards {
|
|
|
97
85
|
* @param {ConfigurationRequest} arg.body
|
|
98
86
|
* @returns {Promise<SetConfigurationRes>} - Success response
|
|
99
87
|
* @summary: Updates the collection with given android paths.
|
|
100
|
-
* @description: Updates the configuration or inserts new records.
|
|
88
|
+
* @description: Updates the configuration or inserts new records with the given android paths.
|
|
101
89
|
*/
|
|
102
90
|
setRewardsConfiguration({ body }?: {
|
|
103
91
|
body: ConfigurationRequest;
|
|
@@ -108,7 +96,7 @@ declare class Rewards {
|
|
|
108
96
|
* @param {number} arg.pageSize - Pagination page size
|
|
109
97
|
* @returns {Promise<GiveawayResponse>} - Success response
|
|
110
98
|
* @summary: List of giveaways of the current application.
|
|
111
|
-
* @description:
|
|
99
|
+
* @description: Fetch the detailed compilation of live, completed, and scheduled point-based giveaways created.
|
|
112
100
|
*/
|
|
113
101
|
showGiveaways({ pageId, pageSize }?: {
|
|
114
102
|
pageId: string;
|
|
@@ -118,7 +106,7 @@ declare class Rewards {
|
|
|
118
106
|
* @param {Object} arg - Arg object.
|
|
119
107
|
* @returns {Promise<Offer[]>} - Success response
|
|
120
108
|
* @summary: List of offers of the current application.
|
|
121
|
-
* @description:
|
|
109
|
+
* @description: Retrieve the list of offers within the current application, including order_discount, order, sign_up, and referral, along with their respective details.
|
|
122
110
|
*/
|
|
123
111
|
showOffers({}?: any): Promise<Offer[]>;
|
|
124
112
|
/**
|
|
@@ -127,7 +115,7 @@ declare class Rewards {
|
|
|
127
115
|
* @param {Giveaway} arg.body
|
|
128
116
|
* @returns {Promise<Giveaway>} - Success response
|
|
129
117
|
* @summary: Updates the giveaway by it's ID.
|
|
130
|
-
* @description:
|
|
118
|
+
* @description: Make the necessary updates to the giveaway based on its giveaway ID.
|
|
131
119
|
*/
|
|
132
120
|
updateGiveAway({ id, body }?: {
|
|
133
121
|
id: string;
|
|
@@ -139,7 +127,7 @@ declare class Rewards {
|
|
|
139
127
|
* @param {Offer} arg.body
|
|
140
128
|
* @returns {Promise<Offer>} - Success response
|
|
141
129
|
* @summary: Update offer by name
|
|
142
|
-
* @description:
|
|
130
|
+
* @description: Update the specific offer details and its configuration by offer name.
|
|
143
131
|
*/
|
|
144
132
|
updateOfferByName({ name, body, }?: {
|
|
145
133
|
name: string;
|
|
@@ -151,7 +139,7 @@ declare class Rewards {
|
|
|
151
139
|
* @param {AppUser} arg.body
|
|
152
140
|
* @returns {Promise<AppUser>} - Success response
|
|
153
141
|
* @summary: Update user status
|
|
154
|
-
* @description:
|
|
142
|
+
* @description: Update the user status by marking them as a block or unblock. It can be done by changing the active flag in request body.
|
|
155
143
|
*/
|
|
156
144
|
updateUserStatus({ userId, body, }?: {
|
|
157
145
|
userId: string;
|
|
@@ -12,72 +12,12 @@ class Rewards {
|
|
|
12
12
|
this.applicationId = applicationId;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @param {Object} arg - Arg object.
|
|
17
|
-
* @param {string} arg.id - Giveaway ID
|
|
18
|
-
* @param {string} arg.audienceId - Audience id
|
|
19
|
-
* @returns {Promise<GiveawayAudience>} - Success response
|
|
20
|
-
* @summary: Get the Giveaway audience status
|
|
21
|
-
* @description: Get giveaway audience status
|
|
22
|
-
*/
|
|
23
|
-
async getGiveawayAudienceStatus({ id, audienceId } = {}) {
|
|
24
|
-
const { error } = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
25
|
-
{ id, audienceId },
|
|
26
|
-
{ abortEarly: false, allowUnknown: true }
|
|
27
|
-
);
|
|
28
|
-
if (error) {
|
|
29
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Showing warrnings if extra unknown parameters are found
|
|
33
|
-
const {
|
|
34
|
-
error: warrning,
|
|
35
|
-
} = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
36
|
-
{ id, audienceId },
|
|
37
|
-
{ abortEarly: false, allowUnknown: false }
|
|
38
|
-
);
|
|
39
|
-
if (warrning) {
|
|
40
|
-
Logger({
|
|
41
|
-
level: "WARN",
|
|
42
|
-
message: "Parameter Validation warrnings for getGiveawayAudienceStatus",
|
|
43
|
-
});
|
|
44
|
-
Logger({ level: "WARN", message: warrning });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const query_params = {};
|
|
48
|
-
|
|
49
|
-
const response = await PlatformAPIClient.execute(
|
|
50
|
-
this.config,
|
|
51
|
-
"get",
|
|
52
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/:id/audience/${audienceId}/status`,
|
|
53
|
-
query_params,
|
|
54
|
-
undefined
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const {
|
|
58
|
-
error: res_error,
|
|
59
|
-
} = RewardsModel.GiveawayAudience().validate(response, {
|
|
60
|
-
abortEarly: false,
|
|
61
|
-
allowUnknown: false,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
if (res_error) {
|
|
65
|
-
Logger({
|
|
66
|
-
level: "WARN",
|
|
67
|
-
message: "Response Validation Warnnings for getGiveawayAudienceStatus",
|
|
68
|
-
});
|
|
69
|
-
Logger({ level: "WARN", message: res_error });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return response;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
15
|
/**
|
|
76
16
|
* @param {Object} arg - Arg object.
|
|
77
17
|
* @param {string} arg.id - Giveaway ID
|
|
78
18
|
* @returns {Promise<Giveaway>} - Success response
|
|
79
19
|
* @summary: Get giveaway by ID.
|
|
80
|
-
* @description:
|
|
20
|
+
* @description: Retrieve the specific giveaway by giveaway ID. It will show all the details of the requested giveaway.
|
|
81
21
|
*/
|
|
82
22
|
async getGiveawayById({ id } = {}) {
|
|
83
23
|
const { error } = RewardsValidator.getGiveawayById().validate(
|
|
@@ -135,8 +75,8 @@ class Rewards {
|
|
|
135
75
|
* @param {Object} arg - Arg object.
|
|
136
76
|
* @param {string} arg.name - The name given to the offer.
|
|
137
77
|
* @returns {Promise<Offer>} - Success response
|
|
138
|
-
* @summary:
|
|
139
|
-
* @description:
|
|
78
|
+
* @summary: Fetch a offer by its name
|
|
79
|
+
* @description: Fetch the specific offer details and configuration by the name of the offer.
|
|
140
80
|
*/
|
|
141
81
|
async getOfferByName({ name } = {}) {
|
|
142
82
|
const { error } = RewardsValidator.getOfferByName().validate(
|
|
@@ -190,7 +130,7 @@ class Rewards {
|
|
|
190
130
|
* @param {Object} arg - Arg object.
|
|
191
131
|
* @returns {Promise<ConfigurationRes>} - Success response
|
|
192
132
|
* @summary: Get all valid android paths
|
|
193
|
-
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a
|
|
133
|
+
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fraudulent device.
|
|
194
134
|
*/
|
|
195
135
|
async getRewardsConfiguration({} = {}) {
|
|
196
136
|
const { error } = RewardsValidator.getRewardsConfiguration().validate(
|
|
@@ -249,7 +189,7 @@ class Rewards {
|
|
|
249
189
|
* @param {string} arg.userId - User id
|
|
250
190
|
* @returns {Promise<UserRes>} - Success response
|
|
251
191
|
* @summary: Get user reward details
|
|
252
|
-
* @description:
|
|
192
|
+
* @description: Fetches the user details and the user reward details with their current reward points for the specific user.
|
|
253
193
|
*/
|
|
254
194
|
async getUserDetails({ userId } = {}) {
|
|
255
195
|
const { error } = RewardsValidator.getUserDetails().validate(
|
|
@@ -307,7 +247,7 @@ class Rewards {
|
|
|
307
247
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
308
248
|
* @returns {Promise<HistoryRes>} - Success response
|
|
309
249
|
* @summary: Get all transactions of reward points
|
|
310
|
-
* @description:
|
|
250
|
+
* @description: Fetches a list of points transactions like giveaway points, signup points, referral points, order earn points, redeem points and expired points.
|
|
311
251
|
*/
|
|
312
252
|
async getUserPointsHistory({
|
|
313
253
|
userId,
|
|
@@ -383,7 +323,7 @@ class Rewards {
|
|
|
383
323
|
* @param {string} arg.applicationId - Application id
|
|
384
324
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
385
325
|
* @summary: Get all transactions of reward points
|
|
386
|
-
* @description:
|
|
326
|
+
* @description: Fetches a list of points transactions like giveaway points, signup points, referral points, order earn points, redeem points and expired points.
|
|
387
327
|
*/
|
|
388
328
|
getUserPointsHistoryPaginator({
|
|
389
329
|
userId,
|
|
@@ -418,7 +358,7 @@ class Rewards {
|
|
|
418
358
|
* @param {Giveaway} arg.body
|
|
419
359
|
* @returns {Promise<Giveaway>} - Success response
|
|
420
360
|
* @summary: List of giveaways of the current application.
|
|
421
|
-
* @description:
|
|
361
|
+
* @description: Creates a new giveaway in the current application, specifying the target audience, points allocation, as well as the name and display name of the giveaway.
|
|
422
362
|
*/
|
|
423
363
|
async saveGiveAway({ body } = {}) {
|
|
424
364
|
const { error } = RewardsValidator.saveGiveAway().validate(
|
|
@@ -477,7 +417,7 @@ class Rewards {
|
|
|
477
417
|
* @param {ConfigurationRequest} arg.body
|
|
478
418
|
* @returns {Promise<SetConfigurationRes>} - Success response
|
|
479
419
|
* @summary: Updates the collection with given android paths.
|
|
480
|
-
* @description: Updates the configuration or inserts new records.
|
|
420
|
+
* @description: Updates the configuration or inserts new records with the given android paths.
|
|
481
421
|
*/
|
|
482
422
|
async setRewardsConfiguration({ body } = {}) {
|
|
483
423
|
const { error } = RewardsValidator.setRewardsConfiguration().validate(
|
|
@@ -541,7 +481,7 @@ class Rewards {
|
|
|
541
481
|
* @param {number} arg.pageSize - Pagination page size
|
|
542
482
|
* @returns {Promise<GiveawayResponse>} - Success response
|
|
543
483
|
* @summary: List of giveaways of the current application.
|
|
544
|
-
* @description:
|
|
484
|
+
* @description: Fetch the detailed compilation of live, completed, and scheduled point-based giveaways created.
|
|
545
485
|
*/
|
|
546
486
|
async showGiveaways({ pageId, pageSize } = {}) {
|
|
547
487
|
const { error } = RewardsValidator.showGiveaways().validate(
|
|
@@ -605,7 +545,7 @@ class Rewards {
|
|
|
605
545
|
* @param {Object} arg - Arg object.
|
|
606
546
|
* @returns {Promise<Offer[]>} - Success response
|
|
607
547
|
* @summary: List of offers of the current application.
|
|
608
|
-
* @description:
|
|
548
|
+
* @description: Retrieve the list of offers within the current application, including order_discount, order, sign_up, and referral, along with their respective details.
|
|
609
549
|
*/
|
|
610
550
|
async showOffers({} = {}) {
|
|
611
551
|
const { error } = RewardsValidator.showOffers().validate(
|
|
@@ -660,7 +600,7 @@ class Rewards {
|
|
|
660
600
|
* @param {Giveaway} arg.body
|
|
661
601
|
* @returns {Promise<Giveaway>} - Success response
|
|
662
602
|
* @summary: Updates the giveaway by it's ID.
|
|
663
|
-
* @description:
|
|
603
|
+
* @description: Make the necessary updates to the giveaway based on its giveaway ID.
|
|
664
604
|
*/
|
|
665
605
|
async updateGiveAway({ id, body } = {}) {
|
|
666
606
|
const { error } = RewardsValidator.updateGiveAway().validate(
|
|
@@ -722,7 +662,7 @@ class Rewards {
|
|
|
722
662
|
* @param {Offer} arg.body
|
|
723
663
|
* @returns {Promise<Offer>} - Success response
|
|
724
664
|
* @summary: Update offer by name
|
|
725
|
-
* @description:
|
|
665
|
+
* @description: Update the specific offer details and its configuration by offer name.
|
|
726
666
|
*/
|
|
727
667
|
async updateOfferByName({
|
|
728
668
|
name,
|
|
@@ -790,7 +730,7 @@ class Rewards {
|
|
|
790
730
|
* @param {AppUser} arg.body
|
|
791
731
|
* @returns {Promise<AppUser>} - Success response
|
|
792
732
|
* @summary: Update user status
|
|
793
|
-
* @description:
|
|
733
|
+
* @description: Update the user status by marking them as a block or unblock. It can be done by changing the active flag in request body.
|
|
794
734
|
*/
|
|
795
735
|
async updateUserStatus({
|
|
796
736
|
userId,
|
|
@@ -2,13 +2,6 @@ const Joi = require("joi");
|
|
|
2
2
|
|
|
3
3
|
const RewardsModel = require("./RewardsPlatformModel");
|
|
4
4
|
class RewardsValidator {
|
|
5
|
-
static getGiveawayAudienceStatus() {
|
|
6
|
-
return Joi.object({
|
|
7
|
-
id: Joi.string().allow("").required(),
|
|
8
|
-
audienceId: Joi.string().allow("").required(),
|
|
9
|
-
}).required();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
5
|
static getGiveawayById() {
|
|
13
6
|
return Joi.object({
|
|
14
7
|
id: Joi.string().allow("").required(),
|
package/sdk/platform/index.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export const PlatformConfig: typeof import("./PlatformConfig");
|
|
2
2
|
export const PlatformClient: typeof import("./PlatformClient");
|
|
3
3
|
export namespace PlatformModel {
|
|
4
|
-
const
|
|
5
|
-
const LeadPlatformModel: typeof import("./Lead/LeadPlatformModel");
|
|
6
|
-
const ThemePlatformModel: typeof import("./Theme/ThemePlatformModel");
|
|
7
|
-
const UserPlatformModel: typeof import("./User/UserPlatformModel");
|
|
8
|
-
const ContentPlatformModel: typeof import("./Content/ContentPlatformModel");
|
|
4
|
+
const AuditTrailPlatformModel: typeof import("./AuditTrail/AuditTrailPlatformModel");
|
|
9
5
|
const BillingPlatformModel: typeof import("./Billing/BillingPlatformModel");
|
|
10
|
-
const
|
|
11
|
-
const PaymentPlatformModel: typeof import("./Payment/PaymentPlatformModel");
|
|
12
|
-
const OrderPlatformModel: typeof import("./Order/OrderPlatformModel");
|
|
6
|
+
const CartPlatformModel: typeof import("./Cart/CartPlatformModel");
|
|
13
7
|
const CatalogPlatformModel: typeof import("./Catalog/CatalogPlatformModel");
|
|
8
|
+
const CommonPlatformModel: typeof import("./Common/CommonPlatformModel");
|
|
9
|
+
const CommunicationPlatformModel: typeof import("./Communication/CommunicationPlatformModel");
|
|
14
10
|
const CompanyProfilePlatformModel: typeof import("./CompanyProfile/CompanyProfilePlatformModel");
|
|
15
|
-
const FileStoragePlatformModel: typeof import("./FileStorage/FileStoragePlatformModel");
|
|
16
|
-
const SharePlatformModel: typeof import("./Share/SharePlatformModel");
|
|
17
|
-
const InventoryPlatformModel: typeof import("./Inventory/InventoryPlatformModel");
|
|
18
11
|
const ConfigurationPlatformModel: typeof import("./Configuration/ConfigurationPlatformModel");
|
|
19
|
-
const
|
|
20
|
-
const RewardsPlatformModel: typeof import("./Rewards/RewardsPlatformModel");
|
|
12
|
+
const ContentPlatformModel: typeof import("./Content/ContentPlatformModel");
|
|
21
13
|
const DiscountPlatformModel: typeof import("./Discount/DiscountPlatformModel");
|
|
14
|
+
const FileStoragePlatformModel: typeof import("./FileStorage/FileStoragePlatformModel");
|
|
15
|
+
const FinancePlatformModel: typeof import("./Finance/FinancePlatformModel");
|
|
16
|
+
const InventoryPlatformModel: typeof import("./Inventory/InventoryPlatformModel");
|
|
17
|
+
const LeadPlatformModel: typeof import("./Lead/LeadPlatformModel");
|
|
18
|
+
const OrderPlatformModel: typeof import("./Order/OrderPlatformModel");
|
|
22
19
|
const PartnerPlatformModel: typeof import("./Partner/PartnerPlatformModel");
|
|
20
|
+
const PaymentPlatformModel: typeof import("./Payment/PaymentPlatformModel");
|
|
21
|
+
const RewardsPlatformModel: typeof import("./Rewards/RewardsPlatformModel");
|
|
22
|
+
const SharePlatformModel: typeof import("./Share/SharePlatformModel");
|
|
23
|
+
const ThemePlatformModel: typeof import("./Theme/ThemePlatformModel");
|
|
24
|
+
const UserPlatformModel: typeof import("./User/UserPlatformModel");
|
|
23
25
|
const WebhookPlatformModel: typeof import("./Webhook/WebhookPlatformModel");
|
|
24
|
-
const AuditTrailPlatformModel: typeof import("./AuditTrail/AuditTrailPlatformModel");
|
|
25
26
|
}
|
package/sdk/platform/index.js
CHANGED
|
@@ -2,46 +2,48 @@ module.exports = {
|
|
|
2
2
|
PlatformConfig: require("./PlatformConfig"),
|
|
3
3
|
PlatformClient: require("./PlatformClient"),
|
|
4
4
|
PlatformModel: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
LeadPlatformModel: require("./Lead/LeadPlatformModel"),
|
|
5
|
+
AuditTrailPlatformModel: require("./AuditTrail/AuditTrailPlatformModel"),
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
BillingPlatformModel: require("./Billing/BillingPlatformModel"),
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
CartPlatformModel: require("./Cart/CartPlatformModel"),
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
CatalogPlatformModel: require("./Catalog/CatalogPlatformModel"),
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
CommonPlatformModel: require("./Common/CommonPlatformModel"),
|
|
16
14
|
|
|
17
15
|
CommunicationPlatformModel: require("./Communication/CommunicationPlatformModel"),
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
CompanyProfilePlatformModel: require("./CompanyProfile/CompanyProfilePlatformModel"),
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
ConfigurationPlatformModel: require("./Configuration/ConfigurationPlatformModel"),
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
ContentPlatformModel: require("./Content/ContentPlatformModel"),
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
DiscountPlatformModel: require("./Discount/DiscountPlatformModel"),
|
|
26
24
|
|
|
27
25
|
FileStoragePlatformModel: require("./FileStorage/FileStoragePlatformModel"),
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
FinancePlatformModel: require("./Finance/FinancePlatformModel"),
|
|
30
28
|
|
|
31
29
|
InventoryPlatformModel: require("./Inventory/InventoryPlatformModel"),
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
LeadPlatformModel: require("./Lead/LeadPlatformModel"),
|
|
34
32
|
|
|
35
|
-
|
|
33
|
+
OrderPlatformModel: require("./Order/OrderPlatformModel"),
|
|
34
|
+
|
|
35
|
+
PartnerPlatformModel: require("./Partner/PartnerPlatformModel"),
|
|
36
|
+
|
|
37
|
+
PaymentPlatformModel: require("./Payment/PaymentPlatformModel"),
|
|
36
38
|
|
|
37
39
|
RewardsPlatformModel: require("./Rewards/RewardsPlatformModel"),
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
SharePlatformModel: require("./Share/SharePlatformModel"),
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
ThemePlatformModel: require("./Theme/ThemePlatformModel"),
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
UserPlatformModel: require("./User/UserPlatformModel"),
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
WebhookPlatformModel: require("./Webhook/WebhookPlatformModel"),
|
|
46
48
|
},
|
|
47
49
|
};
|
|
@@ -3,10 +3,10 @@ declare class PublicClient {
|
|
|
3
3
|
constructor(config: any);
|
|
4
4
|
config: any;
|
|
5
5
|
configuration: Configuration;
|
|
6
|
-
webhook: Webhook;
|
|
7
6
|
inventory: Inventory;
|
|
7
|
+
webhook: Webhook;
|
|
8
8
|
setExtraHeaders(header: any): void;
|
|
9
9
|
}
|
|
10
10
|
import Configuration = require("./Configuration/ConfigurationPublicClient");
|
|
11
|
-
import Webhook = require("./Webhook/WebhookPublicClient");
|
|
12
11
|
import Inventory = require("./Inventory/InventoryPublicClient");
|
|
12
|
+
import Webhook = require("./Webhook/WebhookPublicClient");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const Configuration = require("./Configuration/ConfigurationPublicClient");
|
|
2
2
|
|
|
3
|
-
const Webhook = require("./Webhook/WebhookPublicClient");
|
|
4
|
-
|
|
5
3
|
const Inventory = require("./Inventory/InventoryPublicClient");
|
|
6
4
|
|
|
5
|
+
const Webhook = require("./Webhook/WebhookPublicClient");
|
|
6
|
+
|
|
7
7
|
const { FDKClientValidationError } = require("../common/FDKError");
|
|
8
8
|
|
|
9
9
|
class PublicClient {
|
|
@@ -12,9 +12,9 @@ class PublicClient {
|
|
|
12
12
|
|
|
13
13
|
this.configuration = new Configuration(config);
|
|
14
14
|
|
|
15
|
-
this.webhook = new Webhook(config);
|
|
16
|
-
|
|
17
15
|
this.inventory = new Inventory(config);
|
|
16
|
+
|
|
17
|
+
this.webhook = new Webhook(config);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
setExtraHeaders(header) {
|
package/sdk/public/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export const PublicConfig: typeof import("./PublicConfig");
|
|
|
2
2
|
export const PublicClient: typeof import("./PublicClient");
|
|
3
3
|
export namespace PublicModel {
|
|
4
4
|
const ConfigurationPublicModel: typeof import("./Configuration/ConfigurationPublicModel");
|
|
5
|
-
const WebhookPublicModel: typeof import("./Webhook/WebhookPublicModel");
|
|
6
5
|
const InventoryPublicModel: typeof import("./Inventory/InventoryPublicModel");
|
|
6
|
+
const WebhookPublicModel: typeof import("./Webhook/WebhookPublicModel");
|
|
7
7
|
}
|
package/sdk/public/index.js
CHANGED
|
@@ -4,8 +4,8 @@ module.exports = {
|
|
|
4
4
|
PublicModel: {
|
|
5
5
|
ConfigurationPublicModel: require("./Configuration/ConfigurationPublicModel"),
|
|
6
6
|
|
|
7
|
-
WebhookPublicModel: require("./Webhook/WebhookPublicModel"),
|
|
8
|
-
|
|
9
7
|
InventoryPublicModel: require("./Inventory/InventoryPublicModel"),
|
|
8
|
+
|
|
9
|
+
WebhookPublicModel: require("./Webhook/WebhookPublicModel"),
|
|
10
10
|
},
|
|
11
11
|
};
|
package/partner.d.ts
DELETED
package/partner.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export = OAuthClient;
|
|
2
|
-
declare class OAuthClient extends BaseOAuthClient {
|
|
3
|
-
startAuthorization(options: any): string;
|
|
4
|
-
verifyCallback(query: any): Promise<void>;
|
|
5
|
-
renewAccessToken(isOfflineToken?: boolean): Promise<any>;
|
|
6
|
-
getNewAccessToken(): Promise<any>;
|
|
7
|
-
getAccesstokenObj({ grant_type, client_id, client_secret, scope }: {
|
|
8
|
-
grant_type: any;
|
|
9
|
-
client_id: any;
|
|
10
|
-
client_secret: any;
|
|
11
|
-
scope: any;
|
|
12
|
-
}): Promise<any>;
|
|
13
|
-
}
|
|
14
|
-
import BaseOAuthClient = require("../common/BaseOAuthClient");
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const { fdkAxios } = require("../common/AxiosHelper");
|
|
2
|
-
const { FDKTokenIssueError } = require("../common/FDKError");
|
|
3
|
-
const { Logger } = require("../common/Logger");
|
|
4
|
-
const BaseOAuthClient = require("../common/BaseOAuthClient");
|
|
5
|
-
const querystring = require("querystring");
|
|
6
|
-
const { sign } = require("../common/RequestSigner");
|
|
7
|
-
|
|
8
|
-
class OAuthClient extends BaseOAuthClient {
|
|
9
|
-
constructor(config) {
|
|
10
|
-
super(config);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
startAuthorization(options) {
|
|
14
|
-
Logger({ type: "DEBUG", message: "Starting Authorization" });
|
|
15
|
-
let query = {
|
|
16
|
-
client_id: this.config.apiKey,
|
|
17
|
-
scope: options.scope.join(","),
|
|
18
|
-
redirect_uri: options.redirectUri,
|
|
19
|
-
state: options.state,
|
|
20
|
-
access_mode: options.access_mode,
|
|
21
|
-
response_type: "code",
|
|
22
|
-
extension_id: this.config.extensionId,
|
|
23
|
-
};
|
|
24
|
-
const queryString = querystring.stringify(query);
|
|
25
|
-
|
|
26
|
-
let reqPath = `/service/panel/authentication/v1.0/organization/${this.config.organizationId}/oauth/authorize?${queryString}`;
|
|
27
|
-
let signingOptions = {
|
|
28
|
-
method: "GET",
|
|
29
|
-
host: new URL(this.config.domain).host,
|
|
30
|
-
path: reqPath,
|
|
31
|
-
body: null,
|
|
32
|
-
headers: {},
|
|
33
|
-
signQuery: true,
|
|
34
|
-
};
|
|
35
|
-
signingOptions = sign(signingOptions);
|
|
36
|
-
Logger({ type: "DEBUG", message: "Authorization successful" });
|
|
37
|
-
|
|
38
|
-
return `${this.config.domain}${signingOptions.path}`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async verifyCallback(query) {
|
|
42
|
-
if (query.error) {
|
|
43
|
-
throw new FDKOAuthCodeError(query.error_description, {
|
|
44
|
-
error: query.error,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
let res = await this.getAccesstokenObj({
|
|
50
|
-
grant_type: "authorization_code",
|
|
51
|
-
code: query.code,
|
|
52
|
-
});
|
|
53
|
-
res.expires_at =
|
|
54
|
-
res.expires_at || new Date().getTime() + res.expires_in * 1000;
|
|
55
|
-
this.setToken(res);
|
|
56
|
-
} catch (error) {
|
|
57
|
-
if (error.isAxiosError) {
|
|
58
|
-
throw new FDKTokenIssueError(error.message);
|
|
59
|
-
}
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async renewAccessToken(isOfflineToken = true) {
|
|
65
|
-
if (isOfflineToken) {
|
|
66
|
-
await this.getNewAccessToken();
|
|
67
|
-
} else {
|
|
68
|
-
res = await this.getAccesstokenObj({
|
|
69
|
-
grant_type: "refresh_token",
|
|
70
|
-
refresh_token: this.refreshToken,
|
|
71
|
-
});
|
|
72
|
-
res.expires_at =
|
|
73
|
-
res.expires_at || new Date().getTime() + res.expires_in * 1000;
|
|
74
|
-
this.setToken(res);
|
|
75
|
-
return res;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async getNewAccessToken() {
|
|
80
|
-
try {
|
|
81
|
-
let res = await this.getAccesstokenObj({
|
|
82
|
-
grant_type: "client_credentials",
|
|
83
|
-
client_id: this.config.apiKey,
|
|
84
|
-
client_secret: this.config.apiSecret,
|
|
85
|
-
scope: this.config.scope,
|
|
86
|
-
});
|
|
87
|
-
res.expires_at =
|
|
88
|
-
res.expires_at || new Date().getTime() + res.expires_in * 1000;
|
|
89
|
-
this.setToken(res);
|
|
90
|
-
return this.token;
|
|
91
|
-
} catch (error) {
|
|
92
|
-
if (error.isAxiosError) {
|
|
93
|
-
throw new FDKTokenIssueError(error.message);
|
|
94
|
-
}
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async getAccesstokenObj({ grant_type, client_id, client_secret, scope }) {
|
|
100
|
-
Logger({ type: "DEBUG", message: "Processing Access token object..." });
|
|
101
|
-
let reqData = {
|
|
102
|
-
grant_type: grant_type,
|
|
103
|
-
client_id,
|
|
104
|
-
client_secret,
|
|
105
|
-
scope,
|
|
106
|
-
};
|
|
107
|
-
let url = `${this.config.domain}/service/panel/authentication/v1.0/organization/${this.config.organizationId}/oauth/token`;
|
|
108
|
-
return fdkAxios.post(url, reqData);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
module.exports = OAuthClient;
|