@gofynd/fdk-client-javascript 0.1.35
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/.github/workflows/on_create_release.yml +23 -0
- package/.github/workflows/on_merge_main.yml +38 -0
- package/.github/workflows/on_pull_request.yml +35 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/application.d.ts +3 -0
- package/application.js +6 -0
- package/common.d.ts +4 -0
- package/common.js +9 -0
- package/documentation/application/CART.md +7290 -0
- package/documentation/application/CATALOG.md +9570 -0
- package/documentation/application/COMMON.md +448 -0
- package/documentation/application/COMMUNICATION.md +463 -0
- package/documentation/application/CONFIGURATION.md +2902 -0
- package/documentation/application/CONTENT.md +3350 -0
- package/documentation/application/FILESTORAGE.md +491 -0
- package/documentation/application/LEAD.md +1891 -0
- package/documentation/application/LOGISTIC.md +439 -0
- package/documentation/application/ORDER.md +3428 -0
- package/documentation/application/PAYMENT.md +5035 -0
- package/documentation/application/POSCART.md +7889 -0
- package/documentation/application/README.md +21 -0
- package/documentation/application/REWARDS.md +714 -0
- package/documentation/application/SHARE.md +729 -0
- package/documentation/application/THEME.md +5796 -0
- package/documentation/application/USER.md +4326 -0
- package/documentation/platform/ANALYTICS.md +1150 -0
- package/documentation/platform/AUDITTRAIL.md +572 -0
- package/documentation/platform/BILLING.md +2396 -0
- package/documentation/platform/CART.md +5539 -0
- package/documentation/platform/CATALOG.md +21624 -0
- package/documentation/platform/COMMON.md +448 -0
- package/documentation/platform/COMMUNICATION.md +5714 -0
- package/documentation/platform/COMPANYPROFILE.md +2141 -0
- package/documentation/platform/CONFIGURATION.md +7335 -0
- package/documentation/platform/CONTENT.md +8989 -0
- package/documentation/platform/DISCOUNT.md +773 -0
- package/documentation/platform/FILESTORAGE.md +994 -0
- package/documentation/platform/INVENTORY.md +1775 -0
- package/documentation/platform/LEAD.md +4736 -0
- package/documentation/platform/ORDER.md +3764 -0
- package/documentation/platform/PARTNER.md +216 -0
- package/documentation/platform/PAYMENT.md +3444 -0
- package/documentation/platform/README.md +27 -0
- package/documentation/platform/REWARDS.md +871 -0
- package/documentation/platform/SHARE.md +602 -0
- package/documentation/platform/THEME.md +35725 -0
- package/documentation/platform/USER.md +2305 -0
- package/documentation/platform/WEBHOOK.md +587 -0
- package/documentation/public/CONFIGURATION.md +448 -0
- package/documentation/public/INVENTORY.md +686 -0
- package/documentation/public/WEBHOOK.md +348 -0
- package/index.d.ts +10 -0
- package/index.js +18 -0
- package/jest.config.d.ts +4 -0
- package/jest.config.js +6 -0
- package/package.json +35 -0
- package/platform.d.ts +3 -0
- package/platform.js +6 -0
- package/public.d.ts +3 -0
- package/public.js +6 -0
- package/sdk/application/ApplicationAPIClient.d.ts +11 -0
- package/sdk/application/ApplicationAPIClient.js +44 -0
- package/sdk/application/ApplicationClient.d.ts +40 -0
- package/sdk/application/ApplicationClient.js +84 -0
- package/sdk/application/ApplicationConfig.d.ts +19 -0
- package/sdk/application/ApplicationConfig.js +55 -0
- package/sdk/application/ApplicationModels.d.ts +826 -0
- package/sdk/application/ApplicationModels.js +10474 -0
- package/sdk/application/client/CartApplicationClient.d.ts +432 -0
- package/sdk/application/client/CartApplicationClient.js +1066 -0
- package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
- package/sdk/application/client/CatalogApplicationClient.js +1629 -0
- package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
- package/sdk/application/client/CommonApplicationClient.js +105 -0
- package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
- package/sdk/application/client/CommunicationApplicationClient.js +131 -0
- package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
- package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
- package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
- package/sdk/application/client/ContentApplicationClient.js +785 -0
- package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
- package/sdk/application/client/FileStorageApplicationClient.js +214 -0
- package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
- package/sdk/application/client/LeadApplicationClient.js +264 -0
- package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
- package/sdk/application/client/LogisticApplicationClient.js +128 -0
- package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
- package/sdk/application/client/OrderApplicationClient.js +479 -0
- package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
- package/sdk/application/client/PaymentApplicationClient.js +1378 -0
- package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
- package/sdk/application/client/PosCartApplicationClient.js +1123 -0
- package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
- package/sdk/application/client/RewardsApplicationClient.js +293 -0
- package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
- package/sdk/application/client/ShareApplicationClient.js +268 -0
- package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
- package/sdk/application/client/ThemeApplicationClient.js +161 -0
- package/sdk/application/client/UserApplicationClient.d.ts +446 -0
- package/sdk/application/client/UserApplicationClient.js +1275 -0
- package/sdk/application/constructUrl.d.ts +5 -0
- package/sdk/application/constructUrl.js +13 -0
- package/sdk/application/index.d.ts +2 -0
- package/sdk/application/index.js +4 -0
- package/sdk/application/models/CartValidator.d.ts +29 -0
- package/sdk/application/models/CartValidator.js +223 -0
- package/sdk/application/models/CatalogValidator.d.ts +33 -0
- package/sdk/application/models/CatalogValidator.js +233 -0
- package/sdk/application/models/CommonValidator.d.ts +5 -0
- package/sdk/application/models/CommonValidator.js +18 -0
- package/sdk/application/models/CommunicationValidator.d.ts +6 -0
- package/sdk/application/models/CommunicationValidator.js +20 -0
- package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
- package/sdk/application/models/ConfigurationValidator.js +88 -0
- package/sdk/application/models/ContentValidator.d.ts +22 -0
- package/sdk/application/models/ContentValidator.js +106 -0
- package/sdk/application/models/FileStorageValidator.d.ts +6 -0
- package/sdk/application/models/FileStorageValidator.js +24 -0
- package/sdk/application/models/LeadValidator.d.ts +10 -0
- package/sdk/application/models/LeadValidator.js +48 -0
- package/sdk/application/models/LogisticValidator.d.ts +6 -0
- package/sdk/application/models/LogisticValidator.js +22 -0
- package/sdk/application/models/OrderValidator.d.ts +15 -0
- package/sdk/application/models/OrderValidator.js +87 -0
- package/sdk/application/models/PaymentValidator.d.ts +40 -0
- package/sdk/application/models/PaymentValidator.js +235 -0
- package/sdk/application/models/PosCartValidator.d.ts +30 -0
- package/sdk/application/models/PosCartValidator.js +232 -0
- package/sdk/application/models/RewardsValidator.d.ts +10 -0
- package/sdk/application/models/RewardsValidator.js +43 -0
- package/sdk/application/models/ShareValidator.d.ts +10 -0
- package/sdk/application/models/ShareValidator.js +44 -0
- package/sdk/application/models/ThemeValidator.d.ts +7 -0
- package/sdk/application/models/ThemeValidator.js +27 -0
- package/sdk/application/models/UserValidator.d.ts +38 -0
- package/sdk/application/models/UserValidator.js +233 -0
- package/sdk/common/AxiosHelper.d.ts +1 -0
- package/sdk/common/AxiosHelper.js +141 -0
- package/sdk/common/Constant.d.ts +294 -0
- package/sdk/common/Constant.js +332 -0
- package/sdk/common/FDKError.d.ts +26 -0
- package/sdk/common/FDKError.js +51 -0
- package/sdk/common/Logger.d.ts +2 -0
- package/sdk/common/Logger.js +85 -0
- package/sdk/common/Paginator.d.ts +16 -0
- package/sdk/common/Paginator.js +26 -0
- package/sdk/common/RequestSigner.d.ts +1 -0
- package/sdk/common/RequestSigner.js +306 -0
- package/sdk/common/Utility.d.ts +9 -0
- package/sdk/common/Utility.js +86 -0
- package/sdk/common/utils.d.ts +14 -0
- package/sdk/common/utils.js +165 -0
- package/sdk/platform/OAuthClient.d.ts +26 -0
- package/sdk/platform/OAuthClient.js +221 -0
- package/sdk/platform/PlatformAPIClient.d.ts +12 -0
- package/sdk/platform/PlatformAPIClient.js +43 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
- package/sdk/platform/PlatformApplicationClient.js +23185 -0
- package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
- package/sdk/platform/PlatformApplicationModels.js +21262 -0
- package/sdk/platform/PlatformClient.d.ts +9535 -0
- package/sdk/platform/PlatformClient.js +12336 -0
- package/sdk/platform/PlatformConfig.d.ts +29 -0
- package/sdk/platform/PlatformConfig.js +36 -0
- package/sdk/platform/PlatformModels.d.ts +1396 -0
- package/sdk/platform/PlatformModels.js +19222 -0
- package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
- package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
- package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
- package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
- package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
- package/sdk/platform/client/BillingPlatformClient.js +381 -0
- package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
- package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
- package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
- package/sdk/platform/client/CommonPlatformClient.js +84 -0
- package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
- package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
- package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
- package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
- package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
- package/sdk/platform/client/DiscountPlatformClient.js +364 -0
- package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
- package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
- package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
- package/sdk/platform/client/InventoryPlatformClient.js +409 -0
- package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
- package/sdk/platform/client/LeadPlatformClient.js +439 -0
- package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
- package/sdk/platform/client/OrderPlatformClient.js +521 -0
- package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
- package/sdk/platform/client/PaymentPlatformClient.js +331 -0
- package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
- package/sdk/platform/client/WebhookPlatformClient.js +207 -0
- package/sdk/platform/index.d.ts +2 -0
- package/sdk/platform/index.js +4 -0
- package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
- package/sdk/platform/models/AnalyticsValidator.js +36 -0
- package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
- package/sdk/platform/models/AuditTrailValidator.js +26 -0
- package/sdk/platform/models/BillingValidator.d.ts +15 -0
- package/sdk/platform/models/BillingValidator.js +72 -0
- package/sdk/platform/models/CartValidator.d.ts +0 -0
- package/sdk/platform/models/CartValidator.js +0 -0
- package/sdk/platform/models/CatalogValidator.d.ts +74 -0
- package/sdk/platform/models/CatalogValidator.js +484 -0
- package/sdk/platform/models/CommonValidator.d.ts +5 -0
- package/sdk/platform/models/CommonValidator.js +18 -0
- package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
- package/sdk/platform/models/CommunicationValidator.js +11 -0
- package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
- package/sdk/platform/models/CompanyProfileValidator.js +93 -0
- package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
- package/sdk/platform/models/ConfigurationValidator.js +134 -0
- package/sdk/platform/models/ContentValidator.d.ts +0 -0
- package/sdk/platform/models/ContentValidator.js +0 -0
- package/sdk/platform/models/DiscountValidator.d.ts +13 -0
- package/sdk/platform/models/DiscountValidator.js +75 -0
- package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
- package/sdk/platform/models/FileStorageValidator.js +44 -0
- package/sdk/platform/models/InventoryValidator.d.ts +15 -0
- package/sdk/platform/models/InventoryValidator.js +81 -0
- package/sdk/platform/models/LeadValidator.d.ts +14 -0
- package/sdk/platform/models/LeadValidator.js +78 -0
- package/sdk/platform/models/OrderValidator.d.ts +14 -0
- package/sdk/platform/models/OrderValidator.js +110 -0
- package/sdk/platform/models/PartnerValidator.d.ts +0 -0
- package/sdk/platform/models/PartnerValidator.js +0 -0
- package/sdk/platform/models/PaymentValidator.d.ts +13 -0
- package/sdk/platform/models/PaymentValidator.js +65 -0
- package/sdk/platform/models/RewardsValidator.d.ts +0 -0
- package/sdk/platform/models/RewardsValidator.js +0 -0
- package/sdk/platform/models/ShareValidator.d.ts +0 -0
- package/sdk/platform/models/ShareValidator.js +0 -0
- package/sdk/platform/models/ThemeValidator.d.ts +0 -0
- package/sdk/platform/models/ThemeValidator.js +0 -0
- package/sdk/platform/models/UserValidator.d.ts +0 -0
- package/sdk/platform/models/UserValidator.js +0 -0
- package/sdk/platform/models/WebhookValidator.d.ts +9 -0
- package/sdk/platform/models/WebhookValidator.js +42 -0
- package/sdk/public/PublicAPIClient.d.ts +11 -0
- package/sdk/public/PublicAPIClient.js +38 -0
- package/sdk/public/PublicClient.d.ts +12 -0
- package/sdk/public/PublicClient.js +24 -0
- package/sdk/public/PublicConfig.d.ts +10 -0
- package/sdk/public/PublicConfig.js +12 -0
- package/sdk/public/PublicModels.d.ts +50 -0
- package/sdk/public/PublicModels.js +712 -0
- package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
- package/sdk/public/client/ConfigurationPublicClient.js +102 -0
- package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
- package/sdk/public/client/InventoryPublicClient.js +239 -0
- package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
- package/sdk/public/client/WebhookPublicClient.js +92 -0
- package/sdk/public/constructUrl.d.ts +5 -0
- package/sdk/public/constructUrl.js +13 -0
- package/sdk/public/index.d.ts +2 -0
- package/sdk/public/index.js +4 -0
- package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
- package/sdk/public/models/ConfigurationValidator.js +18 -0
- package/sdk/public/models/InventoryValidator.d.ts +9 -0
- package/sdk/public/models/InventoryValidator.js +43 -0
- package/sdk/public/models/WebhookValidator.d.ts +5 -0
- package/sdk/public/models/WebhookValidator.js +14 -0
- package/tests/application/catalog.spec.js +47 -0
- package/tests/common/action-url.spec.js +35 -0
- package/tests/common/schema/action-url.json +163 -0
- package/tests/common/schema/url-action.json +667 -0
- package/tests/common/url-action.spec.js +48 -0
- package/tests/helpers/cookie.helper.js +31 -0
- package/tests/helpers/oauth.helper.js +43 -0
- package/tests/platform/catalog.spec.js +49 -0
- package/tests/public/location.spec.js +39 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export = Rewards;
|
|
2
|
+
declare class Rewards {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getPointsOnProduct: 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 - Arg object.
|
|
18
|
+
* @param {CatalogueOrderRequest} arg.body
|
|
19
|
+
* @returns {Promise<CatalogueOrderResponse>} - Success response
|
|
20
|
+
* @summary: Get the eligibility of reward points on a product
|
|
21
|
+
* @description: Use this API to evaluate the amount of reward points that could be earned on any catalogue product.
|
|
22
|
+
*/
|
|
23
|
+
getPointsOnProduct({ body }?: {
|
|
24
|
+
body: any;
|
|
25
|
+
}): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* @param {Object} arg - Arg object.
|
|
28
|
+
* @param {string} arg.name - The name given to the offer.
|
|
29
|
+
* @returns {Promise<Offer>} - Success response
|
|
30
|
+
* @summary: Get offer by name
|
|
31
|
+
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
32
|
+
*/
|
|
33
|
+
getOfferByName({ name }?: {
|
|
34
|
+
name: string;
|
|
35
|
+
}): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* @param {Object} arg - Arg object.
|
|
38
|
+
* @param {OrderDiscountRequest} arg.body
|
|
39
|
+
* @returns {Promise<OrderDiscountResponse>} - Success response
|
|
40
|
+
* @summary: Calculates the discount on order-amount
|
|
41
|
+
* @description: Use this API to calculate the discount on order-amount based on all the amount range configured in order_discount.
|
|
42
|
+
*/
|
|
43
|
+
getOrderDiscount({ body }?: {
|
|
44
|
+
body: any;
|
|
45
|
+
}): Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* @param {Object} arg - Arg object.
|
|
48
|
+
* @returns {Promise<PointsResponse>} - Success response
|
|
49
|
+
* @summary: Get reward points available with a user
|
|
50
|
+
* @description: Use this API to retrieve total available points of a user for current application
|
|
51
|
+
*/
|
|
52
|
+
getUserPoints({}?: any): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* @param {Object} arg - Arg object.
|
|
55
|
+
* @param {string} [arg.pageId] - PageID is the ID of the requested page.
|
|
56
|
+
* For first request it should be kept empty.
|
|
57
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
58
|
+
* @returns {Promise<PointsHistoryResponse>} - Success response
|
|
59
|
+
* @summary: Get all transactions of reward points
|
|
60
|
+
* @description: Use this API to get a list of points transactions. The list of points history is paginated.
|
|
61
|
+
*/
|
|
62
|
+
getUserPointsHistory({ pageId, pageSize }?: {
|
|
63
|
+
pageId?: string;
|
|
64
|
+
pageSize?: number;
|
|
65
|
+
}): Promise<any>;
|
|
66
|
+
/**
|
|
67
|
+
* @param {Object} arg - Arg object.
|
|
68
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
69
|
+
* @summary: Get all transactions of reward points
|
|
70
|
+
* @description: Use this API to get a list of points transactions. The list of points history is paginated.
|
|
71
|
+
*/
|
|
72
|
+
getUserPointsHistoryPaginator({ pageSize }?: {
|
|
73
|
+
pageSize?: number;
|
|
74
|
+
}): Paginator;
|
|
75
|
+
/**
|
|
76
|
+
* @param {Object} arg - Arg object.
|
|
77
|
+
* @returns {Promise<ReferralDetailsResponse>} - Success response
|
|
78
|
+
* @summary: Get referral details of a user
|
|
79
|
+
* @description: Use this API to retrieve the referral details a user has configured in the application.
|
|
80
|
+
*/
|
|
81
|
+
getUserReferralDetails({}?: any): Promise<any>;
|
|
82
|
+
/**
|
|
83
|
+
* @param {Object} arg - Arg object.
|
|
84
|
+
* @param {RedeemReferralCodeRequest} arg.body
|
|
85
|
+
* @returns {Promise<RedeemReferralCodeResponse>} - Success response
|
|
86
|
+
* @summary: Redeems a referral code and credits reward points to users
|
|
87
|
+
* @description: Use this API to enter a referral code following which, the configured points would be credited to a user's reward points account.
|
|
88
|
+
*/
|
|
89
|
+
redeemReferralCode({ body }?: {
|
|
90
|
+
body: any;
|
|
91
|
+
}): Promise<any>;
|
|
92
|
+
}
|
|
93
|
+
import Paginator = require("../../common/Paginator");
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const RewardsValidator = require("../models/RewardsValidator");
|
|
6
|
+
|
|
7
|
+
class Rewards {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
getPointsOnProduct:
|
|
12
|
+
"/service/application/rewards/v1.0/catalogue/offer/order/",
|
|
13
|
+
getOfferByName: "/service/application/rewards/v1.0/offers/{name}/",
|
|
14
|
+
getOrderDiscount:
|
|
15
|
+
"/service/application/rewards/v1.0/user/offers/order-discount/",
|
|
16
|
+
getUserPoints: "/service/application/rewards/v1.0/user/points/",
|
|
17
|
+
getUserPointsHistory:
|
|
18
|
+
"/service/application/rewards/v1.0/user/points/history/",
|
|
19
|
+
getUserReferralDetails:
|
|
20
|
+
"/service/application/rewards/v1.0/user/referral/",
|
|
21
|
+
redeemReferralCode:
|
|
22
|
+
"/service/application/rewards/v1.0/user/referral/redeem/",
|
|
23
|
+
};
|
|
24
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
25
|
+
(urls, [method, relativeUrl]) => {
|
|
26
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
27
|
+
return urls;
|
|
28
|
+
},
|
|
29
|
+
{}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
updateUrls(urls) {
|
|
34
|
+
this._urls = {
|
|
35
|
+
...this._urls,
|
|
36
|
+
...urls,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {Object} arg - Arg object.
|
|
42
|
+
* @param {CatalogueOrderRequest} arg.body
|
|
43
|
+
* @returns {Promise<CatalogueOrderResponse>} - Success response
|
|
44
|
+
* @summary: Get the eligibility of reward points on a product
|
|
45
|
+
* @description: Use this API to evaluate the amount of reward points that could be earned on any catalogue product.
|
|
46
|
+
*/
|
|
47
|
+
getPointsOnProduct({ body } = {}) {
|
|
48
|
+
const { error } = RewardsValidator.getPointsOnProduct().validate(
|
|
49
|
+
{ body },
|
|
50
|
+
{ abortEarly: false, allowUnknown: true }
|
|
51
|
+
);
|
|
52
|
+
if (error) {
|
|
53
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
54
|
+
}
|
|
55
|
+
const query_params = {};
|
|
56
|
+
|
|
57
|
+
const xHeaders = {};
|
|
58
|
+
|
|
59
|
+
return APIClient.execute(
|
|
60
|
+
this._conf,
|
|
61
|
+
"post",
|
|
62
|
+
constructUrl({
|
|
63
|
+
url: this._urls["getPointsOnProduct"],
|
|
64
|
+
params: {},
|
|
65
|
+
}),
|
|
66
|
+
query_params,
|
|
67
|
+
body,
|
|
68
|
+
xHeaders
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {Object} arg - Arg object.
|
|
74
|
+
* @param {string} arg.name - The name given to the offer.
|
|
75
|
+
* @returns {Promise<Offer>} - Success response
|
|
76
|
+
* @summary: Get offer by name
|
|
77
|
+
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
78
|
+
*/
|
|
79
|
+
getOfferByName({ name } = {}) {
|
|
80
|
+
const { error } = RewardsValidator.getOfferByName().validate(
|
|
81
|
+
{ name },
|
|
82
|
+
{ abortEarly: false, allowUnknown: true }
|
|
83
|
+
);
|
|
84
|
+
if (error) {
|
|
85
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
86
|
+
}
|
|
87
|
+
const query_params = {};
|
|
88
|
+
|
|
89
|
+
const xHeaders = {};
|
|
90
|
+
|
|
91
|
+
return APIClient.execute(
|
|
92
|
+
this._conf,
|
|
93
|
+
"get",
|
|
94
|
+
constructUrl({
|
|
95
|
+
url: this._urls["getOfferByName"],
|
|
96
|
+
params: { name },
|
|
97
|
+
}),
|
|
98
|
+
query_params,
|
|
99
|
+
undefined,
|
|
100
|
+
xHeaders
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param {Object} arg - Arg object.
|
|
106
|
+
* @param {OrderDiscountRequest} arg.body
|
|
107
|
+
* @returns {Promise<OrderDiscountResponse>} - Success response
|
|
108
|
+
* @summary: Calculates the discount on order-amount
|
|
109
|
+
* @description: Use this API to calculate the discount on order-amount based on all the amount range configured in order_discount.
|
|
110
|
+
*/
|
|
111
|
+
getOrderDiscount({ body } = {}) {
|
|
112
|
+
const { error } = RewardsValidator.getOrderDiscount().validate(
|
|
113
|
+
{ body },
|
|
114
|
+
{ abortEarly: false, allowUnknown: true }
|
|
115
|
+
);
|
|
116
|
+
if (error) {
|
|
117
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
118
|
+
}
|
|
119
|
+
const query_params = {};
|
|
120
|
+
|
|
121
|
+
const xHeaders = {};
|
|
122
|
+
|
|
123
|
+
return APIClient.execute(
|
|
124
|
+
this._conf,
|
|
125
|
+
"post",
|
|
126
|
+
constructUrl({
|
|
127
|
+
url: this._urls["getOrderDiscount"],
|
|
128
|
+
params: {},
|
|
129
|
+
}),
|
|
130
|
+
query_params,
|
|
131
|
+
body,
|
|
132
|
+
xHeaders
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @param {Object} arg - Arg object.
|
|
138
|
+
* @returns {Promise<PointsResponse>} - Success response
|
|
139
|
+
* @summary: Get reward points available with a user
|
|
140
|
+
* @description: Use this API to retrieve total available points of a user for current application
|
|
141
|
+
*/
|
|
142
|
+
getUserPoints({} = {}) {
|
|
143
|
+
const { error } = RewardsValidator.getUserPoints().validate(
|
|
144
|
+
{},
|
|
145
|
+
{ abortEarly: false, allowUnknown: true }
|
|
146
|
+
);
|
|
147
|
+
if (error) {
|
|
148
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
149
|
+
}
|
|
150
|
+
const query_params = {};
|
|
151
|
+
|
|
152
|
+
const xHeaders = {};
|
|
153
|
+
|
|
154
|
+
return APIClient.execute(
|
|
155
|
+
this._conf,
|
|
156
|
+
"get",
|
|
157
|
+
constructUrl({
|
|
158
|
+
url: this._urls["getUserPoints"],
|
|
159
|
+
params: {},
|
|
160
|
+
}),
|
|
161
|
+
query_params,
|
|
162
|
+
undefined,
|
|
163
|
+
xHeaders
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @param {Object} arg - Arg object.
|
|
169
|
+
* @param {string} [arg.pageId] - PageID is the ID of the requested page.
|
|
170
|
+
* For first request it should be kept empty.
|
|
171
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
172
|
+
* @returns {Promise<PointsHistoryResponse>} - Success response
|
|
173
|
+
* @summary: Get all transactions of reward points
|
|
174
|
+
* @description: Use this API to get a list of points transactions. The list of points history is paginated.
|
|
175
|
+
*/
|
|
176
|
+
getUserPointsHistory({ pageId, pageSize } = {}) {
|
|
177
|
+
const { error } = RewardsValidator.getUserPointsHistory().validate(
|
|
178
|
+
{ pageId, pageSize },
|
|
179
|
+
{ abortEarly: false, allowUnknown: true }
|
|
180
|
+
);
|
|
181
|
+
if (error) {
|
|
182
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
183
|
+
}
|
|
184
|
+
const query_params = {};
|
|
185
|
+
query_params["page_id"] = pageId;
|
|
186
|
+
query_params["page_size"] = pageSize;
|
|
187
|
+
|
|
188
|
+
const xHeaders = {};
|
|
189
|
+
|
|
190
|
+
return APIClient.execute(
|
|
191
|
+
this._conf,
|
|
192
|
+
"get",
|
|
193
|
+
constructUrl({
|
|
194
|
+
url: this._urls["getUserPointsHistory"],
|
|
195
|
+
params: {},
|
|
196
|
+
}),
|
|
197
|
+
query_params,
|
|
198
|
+
undefined,
|
|
199
|
+
xHeaders
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @param {Object} arg - Arg object.
|
|
205
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
206
|
+
* @summary: Get all transactions of reward points
|
|
207
|
+
* @description: Use this API to get a list of points transactions. The list of points history is paginated.
|
|
208
|
+
*/
|
|
209
|
+
getUserPointsHistoryPaginator({ pageSize } = {}) {
|
|
210
|
+
const paginator = new Paginator();
|
|
211
|
+
const callback = async () => {
|
|
212
|
+
const pageId = paginator.nextId;
|
|
213
|
+
const pageNo = paginator.pageNo;
|
|
214
|
+
const pageType = "cursor";
|
|
215
|
+
const data = await this.getUserPointsHistory({
|
|
216
|
+
pageId: pageId,
|
|
217
|
+
pageSize: pageSize,
|
|
218
|
+
});
|
|
219
|
+
paginator.setPaginator({
|
|
220
|
+
hasNext: data.page.has_next ? true : false,
|
|
221
|
+
nextId: data.page.next_id,
|
|
222
|
+
});
|
|
223
|
+
return data;
|
|
224
|
+
};
|
|
225
|
+
paginator.setCallback(callback);
|
|
226
|
+
return paginator;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @param {Object} arg - Arg object.
|
|
231
|
+
* @returns {Promise<ReferralDetailsResponse>} - Success response
|
|
232
|
+
* @summary: Get referral details of a user
|
|
233
|
+
* @description: Use this API to retrieve the referral details a user has configured in the application.
|
|
234
|
+
*/
|
|
235
|
+
getUserReferralDetails({} = {}) {
|
|
236
|
+
const { error } = RewardsValidator.getUserReferralDetails().validate(
|
|
237
|
+
{},
|
|
238
|
+
{ abortEarly: false, allowUnknown: true }
|
|
239
|
+
);
|
|
240
|
+
if (error) {
|
|
241
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
242
|
+
}
|
|
243
|
+
const query_params = {};
|
|
244
|
+
|
|
245
|
+
const xHeaders = {};
|
|
246
|
+
|
|
247
|
+
return APIClient.execute(
|
|
248
|
+
this._conf,
|
|
249
|
+
"get",
|
|
250
|
+
constructUrl({
|
|
251
|
+
url: this._urls["getUserReferralDetails"],
|
|
252
|
+
params: {},
|
|
253
|
+
}),
|
|
254
|
+
query_params,
|
|
255
|
+
undefined,
|
|
256
|
+
xHeaders
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @param {Object} arg - Arg object.
|
|
262
|
+
* @param {RedeemReferralCodeRequest} arg.body
|
|
263
|
+
* @returns {Promise<RedeemReferralCodeResponse>} - Success response
|
|
264
|
+
* @summary: Redeems a referral code and credits reward points to users
|
|
265
|
+
* @description: Use this API to enter a referral code following which, the configured points would be credited to a user's reward points account.
|
|
266
|
+
*/
|
|
267
|
+
redeemReferralCode({ body } = {}) {
|
|
268
|
+
const { error } = RewardsValidator.redeemReferralCode().validate(
|
|
269
|
+
{ body },
|
|
270
|
+
{ abortEarly: false, allowUnknown: true }
|
|
271
|
+
);
|
|
272
|
+
if (error) {
|
|
273
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
274
|
+
}
|
|
275
|
+
const query_params = {};
|
|
276
|
+
|
|
277
|
+
const xHeaders = {};
|
|
278
|
+
|
|
279
|
+
return APIClient.execute(
|
|
280
|
+
this._conf,
|
|
281
|
+
"post",
|
|
282
|
+
constructUrl({
|
|
283
|
+
url: this._urls["redeemReferralCode"],
|
|
284
|
+
params: {},
|
|
285
|
+
}),
|
|
286
|
+
query_params,
|
|
287
|
+
body,
|
|
288
|
+
xHeaders
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
module.exports = Rewards;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export = Share;
|
|
2
|
+
declare class Share {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getApplicationQRCode: string;
|
|
7
|
+
getProductQRCodeBySlug: string;
|
|
8
|
+
getCollectionQRCodeBySlug: string;
|
|
9
|
+
getUrlQRCode: string;
|
|
10
|
+
createShortLink: string;
|
|
11
|
+
getShortLinkByHash: string;
|
|
12
|
+
getOriginalShortLinkByHash: string;
|
|
13
|
+
};
|
|
14
|
+
_urls: {};
|
|
15
|
+
updateUrls(urls: any): void;
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} arg - Arg object.
|
|
18
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
19
|
+
* @summary: Create QR Code of an app
|
|
20
|
+
* @description: Use this API to create a QR code of an app for sharing it with users who want to use the app.
|
|
21
|
+
*/
|
|
22
|
+
getApplicationQRCode({}?: any): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} arg - Arg object.
|
|
25
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
26
|
+
* identifier of a product. You can get slug value from the endpoint.
|
|
27
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
28
|
+
* @summary: Create QR Code of a product
|
|
29
|
+
* @description: Use this API to create a QR code of a product for sharing it with users who want to view/purchase the product.
|
|
30
|
+
*/
|
|
31
|
+
getProductQRCodeBySlug({ slug }?: {
|
|
32
|
+
slug: string;
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* @param {Object} arg - Arg object.
|
|
36
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
37
|
+
* identifier of a collection. You can get slug value from the endpoint.
|
|
38
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
39
|
+
* @summary: Create QR Code of a collection
|
|
40
|
+
* @description: Use this API to create a QR code of a collection of products for sharing it with users who want to view/purchase the collection.
|
|
41
|
+
*/
|
|
42
|
+
getCollectionQRCodeBySlug({ slug }?: {
|
|
43
|
+
slug: string;
|
|
44
|
+
}): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* @param {Object} arg - Arg object.
|
|
47
|
+
* @param {string} arg.url - A link or a web address
|
|
48
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
49
|
+
* @summary: Create QR Code of a URL
|
|
50
|
+
* @description: Use this API to create a QR code of a URL for sharing it with users who want to visit the link.
|
|
51
|
+
*/
|
|
52
|
+
getUrlQRCode({ url }?: {
|
|
53
|
+
url: string;
|
|
54
|
+
}): Promise<any>;
|
|
55
|
+
/**
|
|
56
|
+
* @param {Object} arg - Arg object.
|
|
57
|
+
* @param {ShortLinkReq} arg.body
|
|
58
|
+
* @returns {Promise<ShortLinkRes>} - Success response
|
|
59
|
+
* @summary: Create a short link
|
|
60
|
+
* @description: Use this API to create a short link that is easy to write/share/read as compared to long URLs.
|
|
61
|
+
*/
|
|
62
|
+
createShortLink({ body }?: {
|
|
63
|
+
body: any;
|
|
64
|
+
}): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* @param {Object} arg - Arg object.
|
|
67
|
+
* @param {string} arg.hash - A string value used for converting long URL to
|
|
68
|
+
* short URL and vice-versa.
|
|
69
|
+
* @returns {Promise<ShortLinkRes>} - Success response
|
|
70
|
+
* @summary: Get short link by hash
|
|
71
|
+
* @description: Use this API to get a short link by using a hash value.
|
|
72
|
+
*/
|
|
73
|
+
getShortLinkByHash({ hash }?: {
|
|
74
|
+
hash: string;
|
|
75
|
+
}): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* @param {Object} arg - Arg object.
|
|
78
|
+
* @param {string} arg.hash - A string value used for converting long URL to
|
|
79
|
+
* short URL and vice-versa.
|
|
80
|
+
* @returns {Promise<ShortLinkRes>} - Success response
|
|
81
|
+
* @summary: Get original link by hash
|
|
82
|
+
* @description: Use this API to retrieve the original link from a short-link by using a hash value.
|
|
83
|
+
*/
|
|
84
|
+
getOriginalShortLinkByHash({ hash }?: {
|
|
85
|
+
hash: string;
|
|
86
|
+
}): Promise<any>;
|
|
87
|
+
}
|