@gofynd/fdk-client-javascript 1.0.2 → 1.0.4
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 +31 -2
- package/index.d.ts +4 -4
- package/index.js +9 -10
- package/package.json +14 -14
- package/sdk/APIClient.d.ts +11 -0
- package/sdk/APIClient.js +35 -0
- package/sdk/Client.d.ts +6 -0
- package/sdk/Client.js +17 -0
- package/sdk/Config.d.ts +9 -0
- package/sdk/Config.js +17 -0
- package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
- package/sdk/application/Cart/CartApplicationClient.js +595 -594
- package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
- package/sdk/application/Cart/CartApplicationModel.js +490 -885
- package/sdk/application/Cart/CartApplicationValidator.d.ts +17 -17
- package/sdk/application/Cart/CartApplicationValidator.js +98 -98
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +358 -358
- package/sdk/application/Catalog/CatalogApplicationClient.js +1079 -1078
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
- package/sdk/application/Catalog/CatalogApplicationModel.js +683 -1249
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationValidator.js +110 -110
- package/sdk/application/Common/CommonApplicationClient.d.ts +13 -13
- package/sdk/application/Common/CommonApplicationClient.js +43 -42
- package/sdk/application/Common/CommonApplicationModel.d.ts +12 -12
- package/sdk/application/Common/CommonApplicationModel.js +83 -160
- package/sdk/application/Common/CommonApplicationValidator.d.ts +1 -1
- package/sdk/application/Common/CommonApplicationValidator.js +6 -6
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +11 -11
- package/sdk/application/Communication/CommunicationApplicationClient.js +32 -31
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +6 -6
- package/sdk/application/Communication/CommunicationApplicationModel.js +38 -83
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +1 -1
- package/sdk/application/Communication/CommunicationApplicationValidator.js +4 -4
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +116 -116
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +350 -349
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +85 -85
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +480 -851
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +8 -8
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +33 -33
- package/sdk/application/Content/ContentApplicationClient.d.ts +67 -67
- package/sdk/application/Content/ContentApplicationClient.js +216 -215
- package/sdk/application/Content/ContentApplicationModel.d.ts +76 -76
- package/sdk/application/Content/ContentApplicationModel.js +468 -884
- package/sdk/application/Content/ContentApplicationValidator.d.ts +5 -5
- package/sdk/application/Content/ContentApplicationValidator.js +24 -24
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +25 -25
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +65 -64
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +13 -13
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +86 -169
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +1 -1
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +7 -7
- package/sdk/application/Lead/LeadApplicationClient.d.ts +24 -24
- package/sdk/application/Lead/LeadApplicationClient.js +109 -108
- package/sdk/application/Lead/LeadApplicationModel.d.ts +35 -35
- package/sdk/application/Lead/LeadApplicationModel.js +267 -474
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +2 -2
- package/sdk/application/Lead/LeadApplicationValidator.js +11 -11
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +31 -22
- package/sdk/application/Logistic/LogisticApplicationClient.js +115 -49
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +17 -14
- package/sdk/application/Logistic/LogisticApplicationModel.js +133 -201
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +3 -2
- package/sdk/application/Logistic/LogisticApplicationValidator.js +14 -9
- package/sdk/application/Order/OrderApplicationClient.d.ts +85 -85
- package/sdk/application/Order/OrderApplicationClient.js +247 -246
- package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
- package/sdk/application/Order/OrderApplicationModel.js +361 -656
- package/sdk/application/Order/OrderApplicationValidator.d.ts +7 -7
- package/sdk/application/Order/OrderApplicationValidator.js +28 -28
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +318 -318
- package/sdk/application/Payment/PaymentApplicationClient.js +781 -780
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
- package/sdk/application/Payment/PaymentApplicationModel.js +570 -1038
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +28 -28
- package/sdk/application/Payment/PaymentApplicationValidator.js +107 -107
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +254 -254
- package/sdk/application/PosCart/PosCartApplicationClient.js +646 -645
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +64 -63
- package/sdk/application/PosCart/PosCartApplicationModel.js +476 -870
- package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +18 -18
- package/sdk/application/PosCart/PosCartApplicationValidator.js +103 -103
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +27 -27
- package/sdk/application/Rewards/RewardsApplicationClient.js +122 -121
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +14 -14
- package/sdk/application/Rewards/RewardsApplicationModel.js +96 -191
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +3 -3
- package/sdk/application/Rewards/RewardsApplicationValidator.js +12 -12
- package/sdk/application/Share/ShareApplicationClient.d.ts +37 -37
- package/sdk/application/Share/ShareApplicationClient.js +94 -93
- package/sdk/application/Share/ShareApplicationModel.d.ts +8 -8
- package/sdk/application/Share/ShareApplicationModel.js +63 -123
- package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -4
- package/sdk/application/Share/ShareApplicationValidator.js +12 -12
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -8
- package/sdk/application/Theme/ThemeApplicationClient.js +38 -37
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +34 -34
- package/sdk/application/Theme/ThemeApplicationModel.js +190 -336
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +1 -1
- package/sdk/application/Theme/ThemeApplicationValidator.js +4 -4
- package/sdk/application/User/UserApplicationClient.d.ts +280 -280
- package/sdk/application/User/UserApplicationClient.js +619 -618
- package/sdk/application/User/UserApplicationModel.d.ts +79 -72
- package/sdk/application/User/UserApplicationModel.js +440 -689
- package/sdk/application/User/UserApplicationValidator.d.ts +24 -24
- package/sdk/application/User/UserApplicationValidator.js +89 -89
- package/sdk/common/AxiosHelper.js +18 -7
- package/sdk/constructUrl.d.ts +5 -0
- package/sdk/constructUrl.js +13 -0
- package/sdk/index.d.ts +3 -0
- package/sdk/index.js +5 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +51 -51
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +182 -180
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +21 -21
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +10 -10
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +44 -43
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +10 -10
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +50 -89
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -1
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +7 -6
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +60 -60
- package/sdk/platform/Billing/BillingPlatformClient.js +184 -183
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +40 -40
- package/sdk/platform/Billing/BillingPlatformModel.js +342 -668
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +8 -8
- package/sdk/platform/Billing/BillingPlatformValidator.js +26 -25
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +192 -165
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +686 -510
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +14 -11
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +77 -61
- package/sdk/platform/Cart/CartPlatformModel.d.ts +84 -83
- package/sdk/platform/Cart/CartPlatformModel.js +676 -1206
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +632 -632
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1558 -1556
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +175 -175
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +688 -688
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1556 -1559
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +291 -291
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2133 -3910
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -66
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +229 -228
- package/sdk/platform/Common/CommonPlatformClient.d.ts +12 -12
- package/sdk/platform/Common/CommonPlatformClient.js +40 -51
- package/sdk/platform/Common/CommonPlatformModel.d.ts +12 -12
- package/sdk/platform/Common/CommonPlatformModel.js +83 -160
- package/sdk/platform/Common/CommonPlatformValidator.d.ts +1 -1
- package/sdk/platform/Common/CommonPlatformValidator.js +7 -6
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +326 -326
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +945 -943
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +88 -88
- package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
- package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
- package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +55 -55
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +217 -216
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +27 -27
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +279 -542
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +25 -24
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +163 -153
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +617 -552
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +70 -64
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +125 -125
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +348 -347
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +148 -146
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +854 -1508
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +9 -9
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +39 -38
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +524 -534
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1287 -1346
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +49 -50
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +153 -159
- package/sdk/platform/Content/ContentPlatformModel.d.ts +78 -78
- package/sdk/platform/Content/ContentPlatformModel.js +485 -907
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +65 -65
- package/sdk/platform/Discount/DiscountPlatformClient.js +219 -218
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +7 -7
- package/sdk/platform/Discount/DiscountPlatformModel.js +60 -121
- package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +6 -6
- package/sdk/platform/Discount/DiscountPlatformValidator.js +30 -29
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +25 -25
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +83 -61
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +9 -9
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +53 -53
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +147 -125
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +13 -13
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +86 -169
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +12 -11
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +63 -63
- package/sdk/platform/Inventory/InventoryPlatformClient.js +231 -230
- package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +30 -30
- package/sdk/platform/Inventory/InventoryPlatformModel.js +497 -964
- package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +7 -7
- package/sdk/platform/Inventory/InventoryPlatformValidator.js +29 -28
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +73 -73
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +203 -201
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +29 -29
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +80 -80
- package/sdk/platform/Lead/LeadPlatformClient.js +215 -214
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +35 -35
- package/sdk/platform/Lead/LeadPlatformModel.js +267 -474
- package/sdk/platform/Lead/LeadPlatformValidator.d.ts +6 -6
- package/sdk/platform/Lead/LeadPlatformValidator.js +25 -24
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +10 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +68 -66
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +7 -7
- package/sdk/platform/Order/OrderPlatformClient.d.ts +357 -357
- package/sdk/platform/Order/OrderPlatformClient.js +1046 -1033
- package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -196
- package/sdk/platform/Order/OrderPlatformModel.js +1575 -2861
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
- package/sdk/platform/Order/OrderPlatformValidator.js +161 -160
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +10 -26
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +58 -58
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +178 -178
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +24 -24
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +42 -42
- package/sdk/platform/Payment/PaymentPlatformClient.js +156 -155
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
- package/sdk/platform/Payment/PaymentPlatformModel.js +222 -410
- package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
- package/sdk/platform/Payment/PaymentPlatformValidator.js +22 -21
- package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10325
- package/sdk/platform/PlatformApplicationClient.js +1584 -13899
- package/sdk/platform/PlatformClient.d.ts +7972 -7888
- package/sdk/platform/PlatformClient.js +8678 -10107
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +85 -85
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +299 -280
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +35 -35
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
- package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +10 -10
- package/sdk/platform/Share/SharePlatformApplicationClient.js +62 -60
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +7 -7
- package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
- package/sdk/platform/Share/SharePlatformModel.js +60 -118
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +132 -132
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +314 -312
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +45 -45
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
- package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +136 -69
- package/sdk/platform/User/UserPlatformApplicationClient.js +507 -166
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
- package/sdk/platform/User/UserPlatformApplicationValidator.js +62 -24
- package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
- package/sdk/platform/User/UserPlatformModel.js +440 -689
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +31 -31
- package/sdk/platform/Webhook/WebhookPlatformClient.js +91 -90
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +7 -7
- package/sdk/platform/Webhook/WebhookPlatformModel.js +68 -136
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +3 -3
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +15 -14
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
- package/sdk/public/Configuration/ConfigurationPublicClient.js +40 -38
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +12 -12
- package/sdk/public/Configuration/ConfigurationPublicModel.js +85 -162
- package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +1 -1
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +6 -6
- package/sdk/public/Inventory/InventoryPublicClient.d.ts +34 -34
- package/sdk/public/Inventory/InventoryPublicClient.js +115 -113
- package/sdk/public/Inventory/InventoryPublicModel.d.ts +10 -10
- package/sdk/public/Inventory/InventoryPublicModel.js +119 -245
- package/sdk/public/Inventory/InventoryPublicValidator.d.ts +3 -3
- package/sdk/public/Inventory/InventoryPublicValidator.js +15 -15
- package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
- package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
- package/.github/workflows/on_create_release.yml +0 -23
- package/.github/workflows/on_merge_main.yml +0 -38
- package/.github/workflows/on_pull_request.yml +0 -35
- package/.prettierrc +0 -5
- package/documentation/application/CART.md +0 -7339
- package/documentation/application/CATALOG.md +0 -9597
- package/documentation/application/COMMON.md +0 -452
- package/documentation/application/COMMUNICATION.md +0 -467
- package/documentation/application/CONFIGURATION.md +0 -2906
- package/documentation/application/CONTENT.md +0 -3351
- package/documentation/application/FILESTORAGE.md +0 -578
- package/documentation/application/LEAD.md +0 -1895
- package/documentation/application/LOGISTIC.md +0 -765
- package/documentation/application/ORDER.md +0 -3432
- package/documentation/application/PAYMENT.md +0 -5221
- package/documentation/application/POSCART.md +0 -7938
- package/documentation/application/README.md +0 -21
- package/documentation/application/REWARDS.md +0 -708
- package/documentation/application/SHARE.md +0 -733
- package/documentation/application/THEME.md +0 -5800
- package/documentation/application/USER.md +0 -4335
- package/documentation/platform/ANALYTICS.md +0 -1154
- package/documentation/platform/AUDITTRAIL.md +0 -576
- package/documentation/platform/BILLING.md +0 -2400
- package/documentation/platform/CART.md +0 -5559
- package/documentation/platform/CATALOG.md +0 -23261
- package/documentation/platform/COMMON.md +0 -452
- package/documentation/platform/COMMUNICATION.md +0 -5718
- package/documentation/platform/COMPANYPROFILE.md +0 -2031
- package/documentation/platform/CONFIGURATION.md +0 -7339
- package/documentation/platform/CONTENT.md +0 -9098
- package/documentation/platform/DISCOUNT.md +0 -863
- package/documentation/platform/FILESTORAGE.md +0 -1081
- package/documentation/platform/INVENTORY.md +0 -1779
- package/documentation/platform/LEAD.md +0 -4740
- package/documentation/platform/ORDER.md +0 -8486
- package/documentation/platform/PARTNER.md +0 -220
- package/documentation/platform/PAYMENT.md +0 -3448
- package/documentation/platform/README.md +0 -27
- package/documentation/platform/REWARDS.md +0 -1083
- package/documentation/platform/SHARE.md +0 -606
- package/documentation/platform/THEME.md +0 -35729
- package/documentation/platform/USER.md +0 -2319
- package/documentation/platform/WEBHOOK.md +0 -591
- package/documentation/public/CONFIGURATION.md +0 -452
- package/documentation/public/INVENTORY.md +0 -690
- package/documentation/public/WEBHOOK.md +0 -352
- package/jest.config.d.ts +0 -4
- package/jest.config.js +0 -6
- package/tests/application/catalog.spec.js +0 -47
- package/tests/common/action-url.spec.js +0 -35
- package/tests/common/schema/action-url.json +0 -178
- package/tests/common/schema/url-action.json +0 -683
- package/tests/common/url-action.spec.js +0 -48
- package/tests/helpers/cookie.helper.js +0 -31
- package/tests/helpers/oauth.helper.js +0 -43
- package/tests/platform/catalog.spec.js +0 -49
- package/tests/public/location.spec.js +0 -39
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const Paginator = require("../../common/Paginator");
|
|
2
1
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const Paginator = require("../../common/Paginator");
|
|
4
4
|
const RewardsValidator = require("./RewardsPlatformApplicationValidator");
|
|
5
5
|
const RewardsModel = require("./RewardsPlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class Rewards {
|
|
9
10
|
constructor(config, applicationId) {
|
|
@@ -13,18 +14,14 @@ class Rewards {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {Object} arg - Arg object.
|
|
16
|
-
* @param {string} arg.
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @description: List of giveaways of the current application.
|
|
17
|
+
* @param {string} arg.audienceId - Audience id
|
|
18
|
+
* @returns {Promise<GiveawayAudience>} - Success response
|
|
19
|
+
* @summary: Get the Giveaway audience status
|
|
20
|
+
* @description: Get giveaway audience status
|
|
21
21
|
*/
|
|
22
|
-
async
|
|
23
|
-
const { error } = RewardsValidator.
|
|
24
|
-
{
|
|
25
|
-
pageId,
|
|
26
|
-
pageSize,
|
|
27
|
-
},
|
|
22
|
+
async getGiveawayAudienceStatus({ audienceId } = {}) {
|
|
23
|
+
const { error } = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
24
|
+
{ audienceId },
|
|
28
25
|
{ abortEarly: false, allowUnknown: true }
|
|
29
26
|
);
|
|
30
27
|
if (error) {
|
|
@@ -32,36 +29,33 @@ class Rewards {
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
// Showing warrnings if extra unknown parameters are found
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
32
|
+
const {
|
|
33
|
+
error: warrning,
|
|
34
|
+
} = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
35
|
+
{ audienceId },
|
|
40
36
|
{ abortEarly: false, allowUnknown: false }
|
|
41
37
|
);
|
|
42
38
|
if (warrning) {
|
|
43
39
|
Logger({
|
|
44
40
|
level: "WARN",
|
|
45
|
-
message: "Parameter Validation warrnings for
|
|
41
|
+
message: "Parameter Validation warrnings for getGiveawayAudienceStatus",
|
|
46
42
|
});
|
|
47
43
|
Logger({ level: "WARN", message: warrning });
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
const query_params = {};
|
|
51
|
-
query_params["page_id"] = pageId;
|
|
52
|
-
query_params["page_size"] = pageSize;
|
|
53
47
|
|
|
54
48
|
const response = await PlatformAPIClient.execute(
|
|
55
49
|
this.config,
|
|
56
50
|
"get",
|
|
57
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
|
|
51
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/audience/${audienceId}/status`,
|
|
58
52
|
query_params,
|
|
59
53
|
undefined
|
|
60
54
|
);
|
|
61
55
|
|
|
62
56
|
const {
|
|
63
57
|
error: res_error,
|
|
64
|
-
} = RewardsModel.
|
|
58
|
+
} = RewardsModel.GiveawayAudience().validate(response, {
|
|
65
59
|
abortEarly: false,
|
|
66
60
|
allowUnknown: false,
|
|
67
61
|
});
|
|
@@ -69,7 +63,7 @@ class Rewards {
|
|
|
69
63
|
if (res_error) {
|
|
70
64
|
Logger({
|
|
71
65
|
level: "WARN",
|
|
72
|
-
message: "Response Validation Warnnings for
|
|
66
|
+
message: "Response Validation Warnnings for getGiveawayAudienceStatus",
|
|
73
67
|
});
|
|
74
68
|
Logger({ level: "WARN", message: res_error });
|
|
75
69
|
}
|
|
@@ -79,15 +73,15 @@ class Rewards {
|
|
|
79
73
|
|
|
80
74
|
/**
|
|
81
75
|
* @param {Object} arg - Arg object.
|
|
82
|
-
* @param {
|
|
76
|
+
* @param {string} arg.id - Giveaway ID
|
|
83
77
|
* @returns {Promise<Giveaway>} - Success response
|
|
84
|
-
* @summary:
|
|
85
|
-
* @description:
|
|
78
|
+
* @summary: Get giveaway by ID.
|
|
79
|
+
* @description: Get giveaway by ID.
|
|
86
80
|
*/
|
|
87
|
-
async
|
|
88
|
-
const { error } = RewardsValidator.
|
|
81
|
+
async getGiveawayById({ id } = {}) {
|
|
82
|
+
const { error } = RewardsValidator.getGiveawayById().validate(
|
|
89
83
|
{
|
|
90
|
-
|
|
84
|
+
id,
|
|
91
85
|
},
|
|
92
86
|
{ abortEarly: false, allowUnknown: true }
|
|
93
87
|
);
|
|
@@ -96,16 +90,16 @@ class Rewards {
|
|
|
96
90
|
}
|
|
97
91
|
|
|
98
92
|
// Showing warrnings if extra unknown parameters are found
|
|
99
|
-
const { error: warrning } = RewardsValidator.
|
|
93
|
+
const { error: warrning } = RewardsValidator.getGiveawayById().validate(
|
|
100
94
|
{
|
|
101
|
-
|
|
95
|
+
id,
|
|
102
96
|
},
|
|
103
97
|
{ abortEarly: false, allowUnknown: false }
|
|
104
98
|
);
|
|
105
99
|
if (warrning) {
|
|
106
100
|
Logger({
|
|
107
101
|
level: "WARN",
|
|
108
|
-
message: "Parameter Validation warrnings for
|
|
102
|
+
message: "Parameter Validation warrnings for getGiveawayById",
|
|
109
103
|
});
|
|
110
104
|
Logger({ level: "WARN", message: warrning });
|
|
111
105
|
}
|
|
@@ -114,10 +108,10 @@ class Rewards {
|
|
|
114
108
|
|
|
115
109
|
const response = await PlatformAPIClient.execute(
|
|
116
110
|
this.config,
|
|
117
|
-
"
|
|
118
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
|
|
111
|
+
"get",
|
|
112
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
|
|
119
113
|
query_params,
|
|
120
|
-
|
|
114
|
+
undefined
|
|
121
115
|
);
|
|
122
116
|
|
|
123
117
|
const { error: res_error } = RewardsModel.Giveaway().validate(response, {
|
|
@@ -128,7 +122,7 @@ class Rewards {
|
|
|
128
122
|
if (res_error) {
|
|
129
123
|
Logger({
|
|
130
124
|
level: "WARN",
|
|
131
|
-
message: "Response Validation Warnnings for
|
|
125
|
+
message: "Response Validation Warnnings for getGiveawayById",
|
|
132
126
|
});
|
|
133
127
|
Logger({ level: "WARN", message: res_error });
|
|
134
128
|
}
|
|
@@ -138,15 +132,24 @@ class Rewards {
|
|
|
138
132
|
|
|
139
133
|
/**
|
|
140
134
|
* @param {Object} arg - Arg object.
|
|
141
|
-
* @param {string} arg.
|
|
142
|
-
* @
|
|
143
|
-
*
|
|
144
|
-
*
|
|
135
|
+
* @param {string} arg.name - The name given to the offer.
|
|
136
|
+
* @param {string} arg.cookie - User's session cookie. This cookie is set in
|
|
137
|
+
* browser cookie when logged-in to fynd's authentication system i.e.
|
|
138
|
+
* `Grimlock` or by using grimlock-backend SDK for backend implementation.
|
|
139
|
+
* @returns {Promise<Offer>} - Success response
|
|
140
|
+
* @summary: Get offer by name
|
|
141
|
+
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
145
142
|
*/
|
|
146
|
-
async
|
|
147
|
-
|
|
143
|
+
async getOfferByName({
|
|
144
|
+
name,
|
|
145
|
+
|
|
146
|
+
cookie,
|
|
147
|
+
} = {}) {
|
|
148
|
+
const { error } = RewardsValidator.getOfferByName().validate(
|
|
148
149
|
{
|
|
149
|
-
|
|
150
|
+
name,
|
|
151
|
+
|
|
152
|
+
cookie,
|
|
150
153
|
},
|
|
151
154
|
{ abortEarly: false, allowUnknown: true }
|
|
152
155
|
);
|
|
@@ -155,16 +158,18 @@ class Rewards {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
// Showing warrnings if extra unknown parameters are found
|
|
158
|
-
const { error: warrning } = RewardsValidator.
|
|
161
|
+
const { error: warrning } = RewardsValidator.getOfferByName().validate(
|
|
159
162
|
{
|
|
160
|
-
|
|
163
|
+
name,
|
|
164
|
+
|
|
165
|
+
cookie,
|
|
161
166
|
},
|
|
162
167
|
{ abortEarly: false, allowUnknown: false }
|
|
163
168
|
);
|
|
164
169
|
if (warrning) {
|
|
165
170
|
Logger({
|
|
166
171
|
level: "WARN",
|
|
167
|
-
message: "Parameter Validation warrnings for
|
|
172
|
+
message: "Parameter Validation warrnings for getOfferByName",
|
|
168
173
|
});
|
|
169
174
|
Logger({ level: "WARN", message: warrning });
|
|
170
175
|
}
|
|
@@ -174,12 +179,12 @@ class Rewards {
|
|
|
174
179
|
const response = await PlatformAPIClient.execute(
|
|
175
180
|
this.config,
|
|
176
181
|
"get",
|
|
177
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
182
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
|
|
178
183
|
query_params,
|
|
179
184
|
undefined
|
|
180
185
|
);
|
|
181
186
|
|
|
182
|
-
const { error: res_error } = RewardsModel.
|
|
187
|
+
const { error: res_error } = RewardsModel.Offer().validate(response, {
|
|
183
188
|
abortEarly: false,
|
|
184
189
|
allowUnknown: false,
|
|
185
190
|
});
|
|
@@ -187,7 +192,7 @@ class Rewards {
|
|
|
187
192
|
if (res_error) {
|
|
188
193
|
Logger({
|
|
189
194
|
level: "WARN",
|
|
190
|
-
message: "Response Validation Warnnings for
|
|
195
|
+
message: "Response Validation Warnnings for getOfferByName",
|
|
191
196
|
});
|
|
192
197
|
Logger({ level: "WARN", message: res_error });
|
|
193
198
|
}
|
|
@@ -197,18 +202,13 @@ class Rewards {
|
|
|
197
202
|
|
|
198
203
|
/**
|
|
199
204
|
* @param {Object} arg - Arg object.
|
|
200
|
-
* @
|
|
201
|
-
* @
|
|
202
|
-
* @
|
|
203
|
-
* @summary: Updates the giveaway by it's ID.
|
|
204
|
-
* @description: Updates the giveaway by it's ID.
|
|
205
|
+
* @returns {Promise<ConfigurationRes>} - Success response
|
|
206
|
+
* @summary: Get all valid android paths
|
|
207
|
+
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fradualent device.
|
|
205
208
|
*/
|
|
206
|
-
async
|
|
207
|
-
const { error } = RewardsValidator.
|
|
208
|
-
{
|
|
209
|
-
id,
|
|
210
|
-
body,
|
|
211
|
-
},
|
|
209
|
+
async getRewardsConfiguration({} = {}) {
|
|
210
|
+
const { error } = RewardsValidator.getRewardsConfiguration().validate(
|
|
211
|
+
{},
|
|
212
212
|
{ abortEarly: false, allowUnknown: true }
|
|
213
213
|
);
|
|
214
214
|
if (error) {
|
|
@@ -216,17 +216,16 @@ class Rewards {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// Showing warrnings if extra unknown parameters are found
|
|
219
|
-
const {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
},
|
|
219
|
+
const {
|
|
220
|
+
error: warrning,
|
|
221
|
+
} = RewardsValidator.getRewardsConfiguration().validate(
|
|
222
|
+
{},
|
|
224
223
|
{ abortEarly: false, allowUnknown: false }
|
|
225
224
|
);
|
|
226
225
|
if (warrning) {
|
|
227
226
|
Logger({
|
|
228
227
|
level: "WARN",
|
|
229
|
-
message: "Parameter Validation warrnings for
|
|
228
|
+
message: "Parameter Validation warrnings for getRewardsConfiguration",
|
|
230
229
|
});
|
|
231
230
|
Logger({ level: "WARN", message: warrning });
|
|
232
231
|
}
|
|
@@ -235,13 +234,15 @@ class Rewards {
|
|
|
235
234
|
|
|
236
235
|
const response = await PlatformAPIClient.execute(
|
|
237
236
|
this.config,
|
|
238
|
-
"
|
|
239
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
237
|
+
"get",
|
|
238
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
|
|
240
239
|
query_params,
|
|
241
|
-
|
|
240
|
+
undefined
|
|
242
241
|
);
|
|
243
242
|
|
|
244
|
-
const {
|
|
243
|
+
const {
|
|
244
|
+
error: res_error,
|
|
245
|
+
} = RewardsModel.ConfigurationRes().validate(response, {
|
|
245
246
|
abortEarly: false,
|
|
246
247
|
allowUnknown: false,
|
|
247
248
|
});
|
|
@@ -249,7 +250,7 @@ class Rewards {
|
|
|
249
250
|
if (res_error) {
|
|
250
251
|
Logger({
|
|
251
252
|
level: "WARN",
|
|
252
|
-
message: "Response Validation Warnnings for
|
|
253
|
+
message: "Response Validation Warnnings for getRewardsConfiguration",
|
|
253
254
|
});
|
|
254
255
|
Logger({ level: "WARN", message: res_error });
|
|
255
256
|
}
|
|
@@ -259,15 +260,26 @@ class Rewards {
|
|
|
259
260
|
|
|
260
261
|
/**
|
|
261
262
|
* @param {Object} arg - Arg object.
|
|
262
|
-
* @param {string} arg.
|
|
263
|
-
* @
|
|
264
|
-
*
|
|
265
|
-
* @
|
|
263
|
+
* @param {string} arg.userId - User id
|
|
264
|
+
* @param {string} [arg.pageId] - PageID is the ID of the requested page.
|
|
265
|
+
* For first request it should be kept empty.
|
|
266
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
267
|
+
* @returns {Promise<HistoryRes>} - Success response
|
|
268
|
+
* @summary: Get all transactions of reward points
|
|
269
|
+
* @description: Use this API to get a list of points transactions.
|
|
266
270
|
*/
|
|
267
|
-
async
|
|
268
|
-
|
|
271
|
+
async getUserPointsHistory({
|
|
272
|
+
userId,
|
|
273
|
+
|
|
274
|
+
pageId,
|
|
275
|
+
pageSize,
|
|
276
|
+
} = {}) {
|
|
277
|
+
const { error } = RewardsValidator.getUserPointsHistory().validate(
|
|
269
278
|
{
|
|
270
|
-
|
|
279
|
+
userId,
|
|
280
|
+
|
|
281
|
+
pageId,
|
|
282
|
+
pageSize,
|
|
271
283
|
},
|
|
272
284
|
{ abortEarly: false, allowUnknown: true }
|
|
273
285
|
);
|
|
@@ -278,33 +290,36 @@ class Rewards {
|
|
|
278
290
|
// Showing warrnings if extra unknown parameters are found
|
|
279
291
|
const {
|
|
280
292
|
error: warrning,
|
|
281
|
-
} = RewardsValidator.
|
|
293
|
+
} = RewardsValidator.getUserPointsHistory().validate(
|
|
282
294
|
{
|
|
283
|
-
|
|
295
|
+
userId,
|
|
296
|
+
|
|
297
|
+
pageId,
|
|
298
|
+
pageSize,
|
|
284
299
|
},
|
|
285
300
|
{ abortEarly: false, allowUnknown: false }
|
|
286
301
|
);
|
|
287
302
|
if (warrning) {
|
|
288
303
|
Logger({
|
|
289
304
|
level: "WARN",
|
|
290
|
-
message: "Parameter Validation warrnings for
|
|
305
|
+
message: "Parameter Validation warrnings for getUserPointsHistory",
|
|
291
306
|
});
|
|
292
307
|
Logger({ level: "WARN", message: warrning });
|
|
293
308
|
}
|
|
294
309
|
|
|
295
310
|
const query_params = {};
|
|
311
|
+
query_params["page_id"] = pageId;
|
|
312
|
+
query_params["page_size"] = pageSize;
|
|
296
313
|
|
|
297
314
|
const response = await PlatformAPIClient.execute(
|
|
298
315
|
this.config,
|
|
299
316
|
"get",
|
|
300
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
317
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/points/history/`,
|
|
301
318
|
query_params,
|
|
302
319
|
undefined
|
|
303
320
|
);
|
|
304
321
|
|
|
305
|
-
const {
|
|
306
|
-
error: res_error,
|
|
307
|
-
} = RewardsModel.GiveawayAudience().validate(response, {
|
|
322
|
+
const { error: res_error } = RewardsModel.HistoryRes().validate(response, {
|
|
308
323
|
abortEarly: false,
|
|
309
324
|
allowUnknown: false,
|
|
310
325
|
});
|
|
@@ -312,7 +327,7 @@ class Rewards {
|
|
|
312
327
|
if (res_error) {
|
|
313
328
|
Logger({
|
|
314
329
|
level: "WARN",
|
|
315
|
-
message: "Response Validation Warnnings for
|
|
330
|
+
message: "Response Validation Warnnings for getUserPointsHistory",
|
|
316
331
|
});
|
|
317
332
|
Logger({ level: "WARN", message: res_error });
|
|
318
333
|
}
|
|
@@ -322,13 +337,53 @@ class Rewards {
|
|
|
322
337
|
|
|
323
338
|
/**
|
|
324
339
|
* @param {Object} arg - Arg object.
|
|
325
|
-
* @
|
|
326
|
-
* @
|
|
327
|
-
* @
|
|
340
|
+
* @param {string} arg.userId - User id
|
|
341
|
+
* @param {string} arg.companyId - Company id
|
|
342
|
+
* @param {string} arg.applicationId - Application id
|
|
343
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
344
|
+
* @summary: Get all transactions of reward points
|
|
345
|
+
* @description: Use this API to get a list of points transactions.
|
|
328
346
|
*/
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
347
|
+
getUserPointsHistoryPaginator({
|
|
348
|
+
userId,
|
|
349
|
+
companyId,
|
|
350
|
+
applicationId,
|
|
351
|
+
pageSize,
|
|
352
|
+
} = {}) {
|
|
353
|
+
const paginator = new Paginator();
|
|
354
|
+
const callback = async () => {
|
|
355
|
+
const pageId = paginator.nextId;
|
|
356
|
+
const pageNo = paginator.pageNo;
|
|
357
|
+
const pageType = "cursor";
|
|
358
|
+
const data = await this.getUserPointsHistory({
|
|
359
|
+
userId: userId,
|
|
360
|
+
companyId: companyId,
|
|
361
|
+
applicationId: applicationId,
|
|
362
|
+
pageId: pageId,
|
|
363
|
+
pageSize: pageSize,
|
|
364
|
+
});
|
|
365
|
+
paginator.setPaginator({
|
|
366
|
+
hasNext: data.page.has_next ? true : false,
|
|
367
|
+
nextId: data.page.next_id,
|
|
368
|
+
});
|
|
369
|
+
return data;
|
|
370
|
+
};
|
|
371
|
+
paginator.setCallback(callback.bind(this));
|
|
372
|
+
return paginator;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* @param {Object} arg - Arg object.
|
|
377
|
+
* @param {Giveaway} arg.body
|
|
378
|
+
* @returns {Promise<Giveaway>} - Success response
|
|
379
|
+
* @summary: List of giveaways of the current application.
|
|
380
|
+
* @description: Adds a new giveaway.
|
|
381
|
+
*/
|
|
382
|
+
async saveGiveAway({ body } = {}) {
|
|
383
|
+
const { error } = RewardsValidator.saveGiveAway().validate(
|
|
384
|
+
{
|
|
385
|
+
body,
|
|
386
|
+
},
|
|
332
387
|
{ abortEarly: false, allowUnknown: true }
|
|
333
388
|
);
|
|
334
389
|
if (error) {
|
|
@@ -336,14 +391,16 @@ class Rewards {
|
|
|
336
391
|
}
|
|
337
392
|
|
|
338
393
|
// Showing warrnings if extra unknown parameters are found
|
|
339
|
-
const { error: warrning } = RewardsValidator.
|
|
340
|
-
{
|
|
394
|
+
const { error: warrning } = RewardsValidator.saveGiveAway().validate(
|
|
395
|
+
{
|
|
396
|
+
body,
|
|
397
|
+
},
|
|
341
398
|
{ abortEarly: false, allowUnknown: false }
|
|
342
399
|
);
|
|
343
400
|
if (warrning) {
|
|
344
401
|
Logger({
|
|
345
402
|
level: "WARN",
|
|
346
|
-
message: "Parameter Validation warrnings for
|
|
403
|
+
message: "Parameter Validation warrnings for saveGiveAway",
|
|
347
404
|
});
|
|
348
405
|
Logger({ level: "WARN", message: warrning });
|
|
349
406
|
}
|
|
@@ -352,20 +409,21 @@ class Rewards {
|
|
|
352
409
|
|
|
353
410
|
const response = await PlatformAPIClient.execute(
|
|
354
411
|
this.config,
|
|
355
|
-
"
|
|
356
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
412
|
+
"post",
|
|
413
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
|
|
357
414
|
query_params,
|
|
358
|
-
|
|
415
|
+
body
|
|
359
416
|
);
|
|
360
417
|
|
|
361
|
-
const { error: res_error } =
|
|
362
|
-
|
|
363
|
-
|
|
418
|
+
const { error: res_error } = RewardsModel.Giveaway().validate(response, {
|
|
419
|
+
abortEarly: false,
|
|
420
|
+
allowUnknown: false,
|
|
421
|
+
});
|
|
364
422
|
|
|
365
423
|
if (res_error) {
|
|
366
424
|
Logger({
|
|
367
425
|
level: "WARN",
|
|
368
|
-
message: "Response Validation Warnnings for
|
|
426
|
+
message: "Response Validation Warnnings for saveGiveAway",
|
|
369
427
|
});
|
|
370
428
|
Logger({ level: "WARN", message: res_error });
|
|
371
429
|
}
|
|
@@ -375,19 +433,15 @@ class Rewards {
|
|
|
375
433
|
|
|
376
434
|
/**
|
|
377
435
|
* @param {Object} arg - Arg object.
|
|
378
|
-
* @param {
|
|
379
|
-
* @
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* @returns {Promise<Offer>} - Success response
|
|
383
|
-
* @summary: Get offer by name
|
|
384
|
-
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
436
|
+
* @param {ConfigurationRequest} arg.body
|
|
437
|
+
* @returns {Promise<SetConfigurationRes>} - Success response
|
|
438
|
+
* @summary: Updates the collection with given android paths.
|
|
439
|
+
* @description: Updates the configuration or inserts new records.
|
|
385
440
|
*/
|
|
386
|
-
async
|
|
387
|
-
const { error } = RewardsValidator.
|
|
441
|
+
async setRewardsConfiguration({ body } = {}) {
|
|
442
|
+
const { error } = RewardsValidator.setRewardsConfiguration().validate(
|
|
388
443
|
{
|
|
389
|
-
|
|
390
|
-
cookie,
|
|
444
|
+
body,
|
|
391
445
|
},
|
|
392
446
|
{ abortEarly: false, allowUnknown: true }
|
|
393
447
|
);
|
|
@@ -396,17 +450,18 @@ class Rewards {
|
|
|
396
450
|
}
|
|
397
451
|
|
|
398
452
|
// Showing warrnings if extra unknown parameters are found
|
|
399
|
-
const {
|
|
453
|
+
const {
|
|
454
|
+
error: warrning,
|
|
455
|
+
} = RewardsValidator.setRewardsConfiguration().validate(
|
|
400
456
|
{
|
|
401
|
-
|
|
402
|
-
cookie,
|
|
457
|
+
body,
|
|
403
458
|
},
|
|
404
459
|
{ abortEarly: false, allowUnknown: false }
|
|
405
460
|
);
|
|
406
461
|
if (warrning) {
|
|
407
462
|
Logger({
|
|
408
463
|
level: "WARN",
|
|
409
|
-
message: "Parameter Validation warrnings for
|
|
464
|
+
message: "Parameter Validation warrnings for setRewardsConfiguration",
|
|
410
465
|
});
|
|
411
466
|
Logger({ level: "WARN", message: warrning });
|
|
412
467
|
}
|
|
@@ -415,13 +470,15 @@ class Rewards {
|
|
|
415
470
|
|
|
416
471
|
const response = await PlatformAPIClient.execute(
|
|
417
472
|
this.config,
|
|
418
|
-
"
|
|
419
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
473
|
+
"post",
|
|
474
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
|
|
420
475
|
query_params,
|
|
421
|
-
|
|
476
|
+
body
|
|
422
477
|
);
|
|
423
478
|
|
|
424
|
-
const {
|
|
479
|
+
const {
|
|
480
|
+
error: res_error,
|
|
481
|
+
} = RewardsModel.SetConfigurationRes().validate(response, {
|
|
425
482
|
abortEarly: false,
|
|
426
483
|
allowUnknown: false,
|
|
427
484
|
});
|
|
@@ -429,7 +486,7 @@ class Rewards {
|
|
|
429
486
|
if (res_error) {
|
|
430
487
|
Logger({
|
|
431
488
|
level: "WARN",
|
|
432
|
-
message: "Response Validation Warnnings for
|
|
489
|
+
message: "Response Validation Warnnings for setRewardsConfiguration",
|
|
433
490
|
});
|
|
434
491
|
Logger({ level: "WARN", message: res_error });
|
|
435
492
|
}
|
|
@@ -439,17 +496,17 @@ class Rewards {
|
|
|
439
496
|
|
|
440
497
|
/**
|
|
441
498
|
* @param {Object} arg - Arg object.
|
|
442
|
-
* @param {string} arg.
|
|
443
|
-
* @param {
|
|
444
|
-
* @returns {Promise<
|
|
445
|
-
* @summary:
|
|
446
|
-
* @description:
|
|
499
|
+
* @param {string} arg.pageId - Pagination page id
|
|
500
|
+
* @param {number} arg.pageSize - Pagination page size
|
|
501
|
+
* @returns {Promise<GiveawayResponse>} - Success response
|
|
502
|
+
* @summary: List of giveaways of the current application.
|
|
503
|
+
* @description: List of giveaways of the current application.
|
|
447
504
|
*/
|
|
448
|
-
async
|
|
449
|
-
const { error } = RewardsValidator.
|
|
505
|
+
async showGiveaways({ pageId, pageSize } = {}) {
|
|
506
|
+
const { error } = RewardsValidator.showGiveaways().validate(
|
|
450
507
|
{
|
|
451
|
-
|
|
452
|
-
|
|
508
|
+
pageId,
|
|
509
|
+
pageSize,
|
|
453
510
|
},
|
|
454
511
|
{ abortEarly: false, allowUnknown: true }
|
|
455
512
|
);
|
|
@@ -458,32 +515,36 @@ class Rewards {
|
|
|
458
515
|
}
|
|
459
516
|
|
|
460
517
|
// Showing warrnings if extra unknown parameters are found
|
|
461
|
-
const { error: warrning } = RewardsValidator.
|
|
518
|
+
const { error: warrning } = RewardsValidator.showGiveaways().validate(
|
|
462
519
|
{
|
|
463
|
-
|
|
464
|
-
|
|
520
|
+
pageId,
|
|
521
|
+
pageSize,
|
|
465
522
|
},
|
|
466
523
|
{ abortEarly: false, allowUnknown: false }
|
|
467
524
|
);
|
|
468
525
|
if (warrning) {
|
|
469
526
|
Logger({
|
|
470
527
|
level: "WARN",
|
|
471
|
-
message: "Parameter Validation warrnings for
|
|
528
|
+
message: "Parameter Validation warrnings for showGiveaways",
|
|
472
529
|
});
|
|
473
530
|
Logger({ level: "WARN", message: warrning });
|
|
474
531
|
}
|
|
475
532
|
|
|
476
533
|
const query_params = {};
|
|
534
|
+
query_params["page_id"] = pageId;
|
|
535
|
+
query_params["page_size"] = pageSize;
|
|
477
536
|
|
|
478
537
|
const response = await PlatformAPIClient.execute(
|
|
479
538
|
this.config,
|
|
480
|
-
"
|
|
481
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
539
|
+
"get",
|
|
540
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
|
|
482
541
|
query_params,
|
|
483
|
-
|
|
542
|
+
undefined
|
|
484
543
|
);
|
|
485
544
|
|
|
486
|
-
const {
|
|
545
|
+
const {
|
|
546
|
+
error: res_error,
|
|
547
|
+
} = RewardsModel.GiveawayResponse().validate(response, {
|
|
487
548
|
abortEarly: false,
|
|
488
549
|
allowUnknown: false,
|
|
489
550
|
});
|
|
@@ -491,7 +552,7 @@ class Rewards {
|
|
|
491
552
|
if (res_error) {
|
|
492
553
|
Logger({
|
|
493
554
|
level: "WARN",
|
|
494
|
-
message: "Response Validation Warnnings for
|
|
555
|
+
message: "Response Validation Warnnings for showGiveaways",
|
|
495
556
|
});
|
|
496
557
|
Logger({ level: "WARN", message: res_error });
|
|
497
558
|
}
|
|
@@ -501,18 +562,13 @@ class Rewards {
|
|
|
501
562
|
|
|
502
563
|
/**
|
|
503
564
|
* @param {Object} arg - Arg object.
|
|
504
|
-
* @
|
|
505
|
-
* @
|
|
506
|
-
* @
|
|
507
|
-
* @summary: Update user status
|
|
508
|
-
* @description: Use this API to update the user status active/archive
|
|
565
|
+
* @returns {Promise<Offer[]>} - Success response
|
|
566
|
+
* @summary: List of offers of the current application.
|
|
567
|
+
* @description: List of offers of the current application.
|
|
509
568
|
*/
|
|
510
|
-
async
|
|
511
|
-
const { error } = RewardsValidator.
|
|
512
|
-
{
|
|
513
|
-
userId,
|
|
514
|
-
body,
|
|
515
|
-
},
|
|
569
|
+
async showOffers({} = {}) {
|
|
570
|
+
const { error } = RewardsValidator.showOffers().validate(
|
|
571
|
+
{},
|
|
516
572
|
{ abortEarly: false, allowUnknown: true }
|
|
517
573
|
);
|
|
518
574
|
if (error) {
|
|
@@ -520,17 +576,14 @@ class Rewards {
|
|
|
520
576
|
}
|
|
521
577
|
|
|
522
578
|
// Showing warrnings if extra unknown parameters are found
|
|
523
|
-
const { error: warrning } = RewardsValidator.
|
|
524
|
-
{
|
|
525
|
-
userId,
|
|
526
|
-
body,
|
|
527
|
-
},
|
|
579
|
+
const { error: warrning } = RewardsValidator.showOffers().validate(
|
|
580
|
+
{},
|
|
528
581
|
{ abortEarly: false, allowUnknown: false }
|
|
529
582
|
);
|
|
530
583
|
if (warrning) {
|
|
531
584
|
Logger({
|
|
532
585
|
level: "WARN",
|
|
533
|
-
message: "Parameter Validation warrnings for
|
|
586
|
+
message: "Parameter Validation warrnings for showOffers",
|
|
534
587
|
});
|
|
535
588
|
Logger({ level: "WARN", message: warrning });
|
|
536
589
|
}
|
|
@@ -539,21 +592,20 @@ class Rewards {
|
|
|
539
592
|
|
|
540
593
|
const response = await PlatformAPIClient.execute(
|
|
541
594
|
this.config,
|
|
542
|
-
"
|
|
543
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
595
|
+
"get",
|
|
596
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/`,
|
|
544
597
|
query_params,
|
|
545
|
-
|
|
598
|
+
undefined
|
|
546
599
|
);
|
|
547
600
|
|
|
548
|
-
const { error: res_error } =
|
|
549
|
-
|
|
550
|
-
allowUnknown: false
|
|
551
|
-
});
|
|
601
|
+
const { error: res_error } = Joi.array()
|
|
602
|
+
.items(RewardsModel.Offer())
|
|
603
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
552
604
|
|
|
553
605
|
if (res_error) {
|
|
554
606
|
Logger({
|
|
555
607
|
level: "WARN",
|
|
556
|
-
message: "Response Validation Warnnings for
|
|
608
|
+
message: "Response Validation Warnnings for showOffers",
|
|
557
609
|
});
|
|
558
610
|
Logger({ level: "WARN", message: res_error });
|
|
559
611
|
}
|
|
@@ -563,15 +615,17 @@ class Rewards {
|
|
|
563
615
|
|
|
564
616
|
/**
|
|
565
617
|
* @param {Object} arg - Arg object.
|
|
566
|
-
* @param {string} arg.
|
|
567
|
-
* @
|
|
568
|
-
* @
|
|
569
|
-
* @
|
|
618
|
+
* @param {string} arg.id - Giveaway ID
|
|
619
|
+
* @param {Giveaway} arg.body
|
|
620
|
+
* @returns {Promise<Giveaway>} - Success response
|
|
621
|
+
* @summary: Updates the giveaway by it's ID.
|
|
622
|
+
* @description: Updates the giveaway by it's ID.
|
|
570
623
|
*/
|
|
571
|
-
async
|
|
572
|
-
const { error } = RewardsValidator.
|
|
624
|
+
async updateGiveAway({ id, body } = {}) {
|
|
625
|
+
const { error } = RewardsValidator.updateGiveAway().validate(
|
|
573
626
|
{
|
|
574
|
-
|
|
627
|
+
id,
|
|
628
|
+
body,
|
|
575
629
|
},
|
|
576
630
|
{ abortEarly: false, allowUnknown: true }
|
|
577
631
|
);
|
|
@@ -580,16 +634,17 @@ class Rewards {
|
|
|
580
634
|
}
|
|
581
635
|
|
|
582
636
|
// Showing warrnings if extra unknown parameters are found
|
|
583
|
-
const { error: warrning } = RewardsValidator.
|
|
637
|
+
const { error: warrning } = RewardsValidator.updateGiveAway().validate(
|
|
584
638
|
{
|
|
585
|
-
|
|
639
|
+
id,
|
|
640
|
+
body,
|
|
586
641
|
},
|
|
587
642
|
{ abortEarly: false, allowUnknown: false }
|
|
588
643
|
);
|
|
589
644
|
if (warrning) {
|
|
590
645
|
Logger({
|
|
591
646
|
level: "WARN",
|
|
592
|
-
message: "Parameter Validation warrnings for
|
|
647
|
+
message: "Parameter Validation warrnings for updateGiveAway",
|
|
593
648
|
});
|
|
594
649
|
Logger({ level: "WARN", message: warrning });
|
|
595
650
|
}
|
|
@@ -598,13 +653,13 @@ class Rewards {
|
|
|
598
653
|
|
|
599
654
|
const response = await PlatformAPIClient.execute(
|
|
600
655
|
this.config,
|
|
601
|
-
"
|
|
602
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
656
|
+
"put",
|
|
657
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
|
|
603
658
|
query_params,
|
|
604
|
-
|
|
659
|
+
body
|
|
605
660
|
);
|
|
606
661
|
|
|
607
|
-
const { error: res_error } = RewardsModel.
|
|
662
|
+
const { error: res_error } = RewardsModel.Giveaway().validate(response, {
|
|
608
663
|
abortEarly: false,
|
|
609
664
|
allowUnknown: false,
|
|
610
665
|
});
|
|
@@ -612,7 +667,7 @@ class Rewards {
|
|
|
612
667
|
if (res_error) {
|
|
613
668
|
Logger({
|
|
614
669
|
level: "WARN",
|
|
615
|
-
message: "Response Validation Warnnings for
|
|
670
|
+
message: "Response Validation Warnnings for updateGiveAway",
|
|
616
671
|
});
|
|
617
672
|
Logger({ level: "WARN", message: res_error });
|
|
618
673
|
}
|
|
@@ -622,20 +677,22 @@ class Rewards {
|
|
|
622
677
|
|
|
623
678
|
/**
|
|
624
679
|
* @param {Object} arg - Arg object.
|
|
625
|
-
* @param {string} arg.
|
|
626
|
-
* @param {
|
|
627
|
-
*
|
|
628
|
-
* @
|
|
629
|
-
* @
|
|
630
|
-
* @summary: Get all transactions of reward points
|
|
631
|
-
* @description: Use this API to get a list of points transactions.
|
|
680
|
+
* @param {string} arg.name - The name given to the offer.
|
|
681
|
+
* @param {Offer} arg.body
|
|
682
|
+
* @returns {Promise<Offer>} - Success response
|
|
683
|
+
* @summary: Update offer by name
|
|
684
|
+
* @description: Use this API to update the offer details
|
|
632
685
|
*/
|
|
633
|
-
async
|
|
634
|
-
|
|
686
|
+
async updateOfferByName({
|
|
687
|
+
name,
|
|
688
|
+
|
|
689
|
+
body,
|
|
690
|
+
} = {}) {
|
|
691
|
+
const { error } = RewardsValidator.updateOfferByName().validate(
|
|
635
692
|
{
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
693
|
+
name,
|
|
694
|
+
|
|
695
|
+
body,
|
|
639
696
|
},
|
|
640
697
|
{ abortEarly: false, allowUnknown: true }
|
|
641
698
|
);
|
|
@@ -644,37 +701,33 @@ class Rewards {
|
|
|
644
701
|
}
|
|
645
702
|
|
|
646
703
|
// Showing warrnings if extra unknown parameters are found
|
|
647
|
-
const {
|
|
648
|
-
error: warrning,
|
|
649
|
-
} = RewardsValidator.getUserPointsHistory().validate(
|
|
704
|
+
const { error: warrning } = RewardsValidator.updateOfferByName().validate(
|
|
650
705
|
{
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
706
|
+
name,
|
|
707
|
+
|
|
708
|
+
body,
|
|
654
709
|
},
|
|
655
710
|
{ abortEarly: false, allowUnknown: false }
|
|
656
711
|
);
|
|
657
712
|
if (warrning) {
|
|
658
713
|
Logger({
|
|
659
714
|
level: "WARN",
|
|
660
|
-
message: "Parameter Validation warrnings for
|
|
715
|
+
message: "Parameter Validation warrnings for updateOfferByName",
|
|
661
716
|
});
|
|
662
717
|
Logger({ level: "WARN", message: warrning });
|
|
663
718
|
}
|
|
664
719
|
|
|
665
720
|
const query_params = {};
|
|
666
|
-
query_params["page_id"] = pageId;
|
|
667
|
-
query_params["page_size"] = pageSize;
|
|
668
721
|
|
|
669
722
|
const response = await PlatformAPIClient.execute(
|
|
670
723
|
this.config,
|
|
671
|
-
"
|
|
672
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
724
|
+
"put",
|
|
725
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
|
|
673
726
|
query_params,
|
|
674
|
-
|
|
727
|
+
body
|
|
675
728
|
);
|
|
676
729
|
|
|
677
|
-
const { error: res_error } = RewardsModel.
|
|
730
|
+
const { error: res_error } = RewardsModel.Offer().validate(response, {
|
|
678
731
|
abortEarly: false,
|
|
679
732
|
allowUnknown: false,
|
|
680
733
|
});
|
|
@@ -682,7 +735,7 @@ class Rewards {
|
|
|
682
735
|
if (res_error) {
|
|
683
736
|
Logger({
|
|
684
737
|
level: "WARN",
|
|
685
|
-
message: "Response Validation Warnnings for
|
|
738
|
+
message: "Response Validation Warnnings for updateOfferByName",
|
|
686
739
|
});
|
|
687
740
|
Logger({ level: "WARN", message: res_error });
|
|
688
741
|
}
|
|
@@ -693,49 +746,22 @@ class Rewards {
|
|
|
693
746
|
/**
|
|
694
747
|
* @param {Object} arg - Arg object.
|
|
695
748
|
* @param {string} arg.userId - User id
|
|
696
|
-
* @param {
|
|
697
|
-
* @
|
|
698
|
-
* @
|
|
699
|
-
* @
|
|
700
|
-
* @description: Use this API to get a list of points transactions.
|
|
749
|
+
* @param {AppUser} arg.body
|
|
750
|
+
* @returns {Promise<AppUser>} - Success response
|
|
751
|
+
* @summary: Update user status
|
|
752
|
+
* @description: Use this API to update the user status active/archive
|
|
701
753
|
*/
|
|
702
|
-
|
|
754
|
+
async updateUserStatus({
|
|
703
755
|
userId,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
pageSize,
|
|
756
|
+
|
|
757
|
+
body,
|
|
707
758
|
} = {}) {
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const pageNo = paginator.pageNo;
|
|
712
|
-
const pageType = "cursor";
|
|
713
|
-
const data = await this.getUserPointsHistory({
|
|
714
|
-
userId: userId,
|
|
715
|
-
companyId: companyId,
|
|
716
|
-
applicationId: applicationId,
|
|
717
|
-
pageId: pageId,
|
|
718
|
-
pageSize: pageSize,
|
|
719
|
-
});
|
|
720
|
-
paginator.setPaginator({
|
|
721
|
-
hasNext: data.page.has_next ? true : false,
|
|
722
|
-
nextId: data.page.next_id,
|
|
723
|
-
});
|
|
724
|
-
return data;
|
|
725
|
-
};
|
|
726
|
-
paginator.setCallback(callback.bind(this));
|
|
727
|
-
return paginator;
|
|
728
|
-
}
|
|
759
|
+
const { error } = RewardsValidator.updateUserStatus().validate(
|
|
760
|
+
{
|
|
761
|
+
userId,
|
|
729
762
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
* @returns {Promise<ConfigurationRes>} - Success response
|
|
733
|
-
* @summary: Get all valid android paths
|
|
734
|
-
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fradualent device.
|
|
735
|
-
*/
|
|
736
|
-
async getRewardsConfiguration({} = {}) {
|
|
737
|
-
const { error } = RewardsValidator.getRewardsConfiguration().validate(
|
|
738
|
-
{},
|
|
763
|
+
body,
|
|
764
|
+
},
|
|
739
765
|
{ abortEarly: false, allowUnknown: true }
|
|
740
766
|
);
|
|
741
767
|
if (error) {
|
|
@@ -743,16 +769,18 @@ class Rewards {
|
|
|
743
769
|
}
|
|
744
770
|
|
|
745
771
|
// Showing warrnings if extra unknown parameters are found
|
|
746
|
-
const {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
772
|
+
const { error: warrning } = RewardsValidator.updateUserStatus().validate(
|
|
773
|
+
{
|
|
774
|
+
userId,
|
|
775
|
+
|
|
776
|
+
body,
|
|
777
|
+
},
|
|
750
778
|
{ abortEarly: false, allowUnknown: false }
|
|
751
779
|
);
|
|
752
780
|
if (warrning) {
|
|
753
781
|
Logger({
|
|
754
782
|
level: "WARN",
|
|
755
|
-
message: "Parameter Validation warrnings for
|
|
783
|
+
message: "Parameter Validation warrnings for updateUserStatus",
|
|
756
784
|
});
|
|
757
785
|
Logger({ level: "WARN", message: warrning });
|
|
758
786
|
}
|
|
@@ -761,15 +789,13 @@ class Rewards {
|
|
|
761
789
|
|
|
762
790
|
const response = await PlatformAPIClient.execute(
|
|
763
791
|
this.config,
|
|
764
|
-
"
|
|
765
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
792
|
+
"patch",
|
|
793
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
|
|
766
794
|
query_params,
|
|
767
|
-
|
|
795
|
+
body
|
|
768
796
|
);
|
|
769
797
|
|
|
770
|
-
const {
|
|
771
|
-
error: res_error,
|
|
772
|
-
} = RewardsModel.ConfigurationRes().validate(response, {
|
|
798
|
+
const { error: res_error } = RewardsModel.AppUser().validate(response, {
|
|
773
799
|
abortEarly: false,
|
|
774
800
|
allowUnknown: false,
|
|
775
801
|
});
|
|
@@ -777,7 +803,7 @@ class Rewards {
|
|
|
777
803
|
if (res_error) {
|
|
778
804
|
Logger({
|
|
779
805
|
level: "WARN",
|
|
780
|
-
message: "Response Validation Warnnings for
|
|
806
|
+
message: "Response Validation Warnnings for updateUserStatus",
|
|
781
807
|
});
|
|
782
808
|
Logger({ level: "WARN", message: res_error });
|
|
783
809
|
}
|
|
@@ -787,16 +813,14 @@ class Rewards {
|
|
|
787
813
|
|
|
788
814
|
/**
|
|
789
815
|
* @param {Object} arg - Arg object.
|
|
790
|
-
* @param {
|
|
791
|
-
* @returns {Promise<
|
|
792
|
-
* @summary:
|
|
793
|
-
* @description:
|
|
816
|
+
* @param {string} arg.userId - User id
|
|
817
|
+
* @returns {Promise<UserRes>} - Success response
|
|
818
|
+
* @summary: Get user reward details
|
|
819
|
+
* @description: Use this API to get the user reward details
|
|
794
820
|
*/
|
|
795
|
-
async
|
|
796
|
-
const { error } = RewardsValidator.
|
|
797
|
-
{
|
|
798
|
-
body,
|
|
799
|
-
},
|
|
821
|
+
async user({ userId } = {}) {
|
|
822
|
+
const { error } = RewardsValidator.user().validate(
|
|
823
|
+
{ userId },
|
|
800
824
|
{ abortEarly: false, allowUnknown: true }
|
|
801
825
|
);
|
|
802
826
|
if (error) {
|
|
@@ -804,18 +828,14 @@ class Rewards {
|
|
|
804
828
|
}
|
|
805
829
|
|
|
806
830
|
// Showing warrnings if extra unknown parameters are found
|
|
807
|
-
const {
|
|
808
|
-
|
|
809
|
-
} = RewardsValidator.setRewardsConfiguration().validate(
|
|
810
|
-
{
|
|
811
|
-
body,
|
|
812
|
-
},
|
|
831
|
+
const { error: warrning } = RewardsValidator.user().validate(
|
|
832
|
+
{ userId },
|
|
813
833
|
{ abortEarly: false, allowUnknown: false }
|
|
814
834
|
);
|
|
815
835
|
if (warrning) {
|
|
816
836
|
Logger({
|
|
817
837
|
level: "WARN",
|
|
818
|
-
message: "Parameter Validation warrnings for
|
|
838
|
+
message: "Parameter Validation warrnings for user",
|
|
819
839
|
});
|
|
820
840
|
Logger({ level: "WARN", message: warrning });
|
|
821
841
|
}
|
|
@@ -824,15 +844,13 @@ class Rewards {
|
|
|
824
844
|
|
|
825
845
|
const response = await PlatformAPIClient.execute(
|
|
826
846
|
this.config,
|
|
827
|
-
"
|
|
828
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
847
|
+
"get",
|
|
848
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
|
|
829
849
|
query_params,
|
|
830
|
-
|
|
850
|
+
undefined
|
|
831
851
|
);
|
|
832
852
|
|
|
833
|
-
const {
|
|
834
|
-
error: res_error,
|
|
835
|
-
} = RewardsModel.SetConfigurationRes().validate(response, {
|
|
853
|
+
const { error: res_error } = RewardsModel.UserRes().validate(response, {
|
|
836
854
|
abortEarly: false,
|
|
837
855
|
allowUnknown: false,
|
|
838
856
|
});
|
|
@@ -840,7 +858,7 @@ class Rewards {
|
|
|
840
858
|
if (res_error) {
|
|
841
859
|
Logger({
|
|
842
860
|
level: "WARN",
|
|
843
|
-
message: "Response Validation Warnnings for
|
|
861
|
+
message: "Response Validation Warnnings for user",
|
|
844
862
|
});
|
|
845
863
|
Logger({ level: "WARN", message: res_error });
|
|
846
864
|
}
|
|
@@ -848,4 +866,5 @@ class Rewards {
|
|
|
848
866
|
return response;
|
|
849
867
|
}
|
|
850
868
|
}
|
|
869
|
+
|
|
851
870
|
module.exports = Rewards;
|