@gofynd/fdk-client-javascript 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +5934 -4502
- package/documentation/application/CATALOG.md +6338 -7245
- package/documentation/application/COMMON.md +95 -222
- package/documentation/application/COMMUNICATION.md +106 -186
- package/documentation/application/CONFIGURATION.md +903 -1597
- package/documentation/application/CONTENT.md +562 -1270
- package/documentation/application/FILESTORAGE.md +84 -220
- package/documentation/application/LEAD.md +314 -660
- package/documentation/application/LOGISTIC.md +229 -305
- package/documentation/application/ORDER.md +642 -1137
- package/documentation/application/PAYMENT.md +2285 -3031
- package/documentation/application/POSCART.md +6079 -4642
- package/documentation/application/REWARDS.md +94 -248
- package/documentation/application/SHARE.md +152 -250
- package/documentation/application/THEME.md +952 -1235
- package/documentation/application/USER.md +1228 -1765
- package/documentation/platform/ANALYTICS.md +207 -349
- package/documentation/platform/AUDITTRAIL.md +121 -204
- package/documentation/platform/BILLING.md +865 -1376
- package/documentation/platform/CART.md +2814 -3662
- package/documentation/platform/CATALOG.md +15266 -17619
- package/documentation/platform/COMMON.md +95 -222
- package/documentation/platform/COMMUNICATION.md +1632 -2380
- package/documentation/platform/COMPANYPROFILE.md +572 -957
- package/documentation/platform/CONFIGURATION.md +3050 -4073
- package/documentation/platform/CONTENT.md +3509 -4121
- package/documentation/platform/DISCOUNT.md +140 -236
- package/documentation/platform/FILESTORAGE.md +187 -323
- package/documentation/platform/INVENTORY.md +268 -911
- package/documentation/platform/LEAD.md +2195 -2541
- package/documentation/platform/ORDER.md +3750 -5636
- package/documentation/platform/PARTNER.md +9 -36
- package/documentation/platform/PAYMENT.md +903 -1213
- package/documentation/platform/REWARDS.md +183 -347
- package/documentation/platform/SHARE.md +120 -213
- package/documentation/platform/THEME.md +12956 -13239
- package/documentation/platform/USER.md +975 -1120
- package/documentation/platform/WEBHOOK.md +78 -184
- package/documentation/public/CONFIGURATION.md +95 -222
- package/documentation/public/INVENTORY.md +100 -282
- package/documentation/public/WEBHOOK.md +27 -133
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
- package/sdk/application/Cart/CartApplicationClient.js +1058 -547
- package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
- package/sdk/application/Cart/CartApplicationModel.js +489 -886
- 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 +1545 -949
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
- package/sdk/application/Catalog/CatalogApplicationModel.js +692 -1258
- 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 +76 -36
- 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 +92 -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 +638 -312
- 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 +581 -213
- package/sdk/application/Content/ContentApplicationModel.d.ts +76 -75
- package/sdk/application/Content/ContentApplicationModel.js +468 -875
- 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 +121 -59
- 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 +230 -96
- 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 +30 -19
- package/sdk/application/Logistic/LogisticApplicationClient.js +196 -47
- 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 -8
- package/sdk/application/Order/OrderApplicationClient.d.ts +86 -86
- package/sdk/application/Order/OrderApplicationClient.js +448 -215
- package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
- package/sdk/application/Order/OrderApplicationModel.js +357 -661
- 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 +1525 -750
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
- package/sdk/application/Payment/PaymentApplicationModel.js +565 -1033
- 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 +1137 -606
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +61 -60
- package/sdk/application/PosCart/PosCartApplicationModel.js +477 -873
- 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 +253 -113
- 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 +221 -96
- 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 +115 -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 +1201 -543
- 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 +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +55 -47
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +308 -151
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +20 -20
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +16 -12
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +131 -44
- 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 +6 -6
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +68 -56
- package/sdk/platform/Billing/BillingPlatformClient.js +416 -171
- 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 +25 -25
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +176 -159
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +837 -500
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +63 -63
- package/sdk/platform/Cart/CartPlatformModel.d.ts +86 -85
- package/sdk/platform/Cart/CartPlatformModel.js +677 -1211
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +582 -529
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2642 -1533
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +175 -175
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +708 -590
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3103 -1362
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +293 -284
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2149 -3660
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -64
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +235 -216
- package/sdk/platform/Common/CommonPlatformClient.d.ts +14 -12
- package/sdk/platform/Common/CommonPlatformClient.js +80 -37
- 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 +6 -6
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +333 -293
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1687 -855
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +87 -87
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
- package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +70 -57
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +463 -182
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +28 -28
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +294 -557
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +24 -24
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +175 -137
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1168 -521
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +69 -63
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +137 -119
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +691 -316
- 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 +38 -38
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +542 -461
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2600 -1160
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +50 -49
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +159 -152
- package/sdk/platform/Content/ContentPlatformModel.d.ts +79 -75
- package/sdk/platform/Content/ContentPlatformModel.js +486 -867
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +72 -61
- package/sdk/platform/Discount/DiscountPlatformClient.js +424 -198
- 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 +29 -29
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +26 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +145 -59
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +8 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +58 -52
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +240 -114
- 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 +11 -11
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +76 -63
- package/sdk/platform/Inventory/InventoryPlatformClient.js +461 -197
- 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 +28 -28
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +84 -71
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +441 -182
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +28 -28
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +86 -75
- package/sdk/platform/Lead/LeadPlatformClient.js +434 -212
- 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 +24 -24
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +14 -11
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +113 -49
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +367 -315
- package/sdk/platform/Order/OrderPlatformClient.js +1775 -893
- package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -192
- package/sdk/platform/Order/OrderPlatformModel.js +1591 -2822
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
- package/sdk/platform/Order/OrderPlatformValidator.js +160 -155
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.js +6 -22
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +65 -54
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +395 -164
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +23 -23
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +55 -45
- package/sdk/platform/Payment/PaymentPlatformClient.js +362 -147
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
- package/sdk/platform/Payment/PaymentPlatformModel.js +220 -408
- package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
- package/sdk/platform/Payment/PaymentPlatformValidator.js +21 -21
- package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10153
- package/sdk/platform/PlatformApplicationClient.js +1584 -13691
- package/sdk/platform/PlatformClient.d.ts +7918 -7666
- package/sdk/platform/PlatformClient.js +8701 -9926
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +91 -78
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +507 -253
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +34 -34
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
- package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +16 -12
- package/sdk/platform/Share/SharePlatformApplicationClient.js +130 -52
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -6
- package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
- package/sdk/platform/Share/SharePlatformModel.js +60 -118
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +148 -124
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +770 -295
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +44 -44
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
- package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +146 -67
- package/sdk/platform/User/UserPlatformApplicationClient.js +742 -155
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
- package/sdk/platform/User/UserPlatformApplicationValidator.js +61 -23
- package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
- package/sdk/platform/User/UserPlatformModel.js +440 -689
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +35 -29
- package/sdk/platform/Webhook/WebhookPlatformClient.js +218 -91
- 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 +14 -14
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
- package/sdk/public/Configuration/ConfigurationPublicClient.js +81 -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 +228 -105
- 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 +51 -10
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
- package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
- package/tests/application/catalog.spec.js +7 -0
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const CartValidator = require("./CartPlatformApplicationValidator");
|
|
5
|
+
const CartModel = require("./CartPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Cart {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -11,37 +13,19 @@ class Cart {
|
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @param {Object} arg - Arg object.
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @param {string} [arg.typeSlug] -
|
|
21
|
-
* @param {string} [arg.code] -
|
|
22
|
-
* @summary: Get with single coupon details or coupon list
|
|
23
|
-
* @description: Get coupon list with pagination
|
|
16
|
+
* @param {string} arg.cartId - Current Cart _id
|
|
17
|
+
* @param {boolean} [arg.b] -
|
|
18
|
+
* @param {AddCartRequest} arg.body
|
|
19
|
+
* @returns {Promise<AddCartDetailResponse>} - Success response
|
|
20
|
+
* @summary: Add items to abandoned cart
|
|
21
|
+
* @description: Use this API to add items to the abandoned cart.
|
|
24
22
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
pageSize,
|
|
28
|
-
isArchived,
|
|
29
|
-
title,
|
|
30
|
-
isPublic,
|
|
31
|
-
isDisplay,
|
|
32
|
-
typeSlug,
|
|
33
|
-
code,
|
|
34
|
-
} = {}) {
|
|
35
|
-
const { error } = CartValidator.getCoupons().validate(
|
|
23
|
+
async addItems({ cartId, body, b } = {}) {
|
|
24
|
+
const { error } = CartValidator.addItems().validate(
|
|
36
25
|
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
title,
|
|
41
|
-
isPublic,
|
|
42
|
-
isDisplay,
|
|
43
|
-
typeSlug,
|
|
44
|
-
code,
|
|
26
|
+
cartId,
|
|
27
|
+
body,
|
|
28
|
+
b,
|
|
45
29
|
},
|
|
46
30
|
{ abortEarly: false, allowUnknown: true }
|
|
47
31
|
);
|
|
@@ -50,103 +34,60 @@ class Cart {
|
|
|
50
34
|
}
|
|
51
35
|
|
|
52
36
|
// Showing warrnings if extra unknown parameters are found
|
|
53
|
-
const { error: warrning } = CartValidator.
|
|
37
|
+
const { error: warrning } = CartValidator.addItems().validate(
|
|
54
38
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
title,
|
|
59
|
-
isPublic,
|
|
60
|
-
isDisplay,
|
|
61
|
-
typeSlug,
|
|
62
|
-
code,
|
|
39
|
+
cartId,
|
|
40
|
+
body,
|
|
41
|
+
b,
|
|
63
42
|
},
|
|
64
43
|
{ abortEarly: false, allowUnknown: false }
|
|
65
44
|
);
|
|
66
45
|
if (warrning) {
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
Logger({
|
|
47
|
+
level: "WARN",
|
|
48
|
+
message: "Parameter Validation warrnings for addItems",
|
|
49
|
+
});
|
|
50
|
+
Logger({ level: "WARN", message: warrning });
|
|
69
51
|
}
|
|
70
52
|
|
|
71
53
|
const query_params = {};
|
|
72
|
-
query_params["
|
|
73
|
-
query_params["page_size"] = pageSize;
|
|
74
|
-
query_params["is_archived"] = isArchived;
|
|
75
|
-
query_params["title"] = title;
|
|
76
|
-
query_params["is_public"] = isPublic;
|
|
77
|
-
query_params["is_display"] = isDisplay;
|
|
78
|
-
query_params["type_slug"] = typeSlug;
|
|
79
|
-
query_params["code"] = code;
|
|
54
|
+
query_params["b"] = b;
|
|
80
55
|
|
|
81
|
-
|
|
56
|
+
const response = await PlatformAPIClient.execute(
|
|
82
57
|
this.config,
|
|
83
|
-
"
|
|
84
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
58
|
+
"post",
|
|
59
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts/${cartId}`,
|
|
85
60
|
query_params,
|
|
86
|
-
|
|
61
|
+
body
|
|
87
62
|
);
|
|
88
|
-
}
|
|
89
63
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* @summary: Get with single coupon details or coupon list
|
|
102
|
-
* @description: Get coupon list with pagination
|
|
103
|
-
*/
|
|
104
|
-
getCouponsPaginator({
|
|
105
|
-
companyId,
|
|
106
|
-
applicationId,
|
|
107
|
-
pageSize,
|
|
108
|
-
isArchived,
|
|
109
|
-
title,
|
|
110
|
-
isPublic,
|
|
111
|
-
isDisplay,
|
|
112
|
-
typeSlug,
|
|
113
|
-
code,
|
|
114
|
-
} = {}) {
|
|
115
|
-
const paginator = new Paginator();
|
|
116
|
-
const callback = async () => {
|
|
117
|
-
const pageId = paginator.nextId;
|
|
118
|
-
const pageNo = paginator.pageNo;
|
|
119
|
-
const pageType = "number";
|
|
120
|
-
const data = await this.getCoupons({
|
|
121
|
-
companyId: companyId,
|
|
122
|
-
applicationId: applicationId,
|
|
123
|
-
pageNo: pageNo,
|
|
124
|
-
pageSize: pageSize,
|
|
125
|
-
isArchived: isArchived,
|
|
126
|
-
title: title,
|
|
127
|
-
isPublic: isPublic,
|
|
128
|
-
isDisplay: isDisplay,
|
|
129
|
-
typeSlug: typeSlug,
|
|
130
|
-
code: code,
|
|
131
|
-
});
|
|
132
|
-
paginator.setPaginator({
|
|
133
|
-
hasNext: data.page.has_next ? true : false,
|
|
134
|
-
nextId: data.page.next_id,
|
|
64
|
+
const {
|
|
65
|
+
error: res_error,
|
|
66
|
+
} = CartModel.AddCartDetailResponse().validate(response, {
|
|
67
|
+
abortEarly: false,
|
|
68
|
+
allowUnknown: false,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (res_error) {
|
|
72
|
+
Logger({
|
|
73
|
+
level: "WARN",
|
|
74
|
+
message: "Response Validation Warnnings for addItems",
|
|
135
75
|
});
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return
|
|
76
|
+
Logger({ level: "WARN", message: res_error });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return response;
|
|
140
80
|
}
|
|
141
81
|
|
|
142
82
|
/**
|
|
143
83
|
* @param {Object} arg - Arg object.
|
|
144
|
-
* @param {
|
|
145
|
-
* @
|
|
146
|
-
* @
|
|
84
|
+
* @param {OpenApiCartServiceabilityRequest} arg.body
|
|
85
|
+
* @returns {Promise<OpenApiCartServiceabilityResponse>} - Success response
|
|
86
|
+
* @summary: Check Pincode Serviceability
|
|
87
|
+
* @description: Check Pincode serviceability for cart items provided in `cart_items` and address pincode in `shipping_address`
|
|
147
88
|
*/
|
|
148
|
-
|
|
149
|
-
const { error } = CartValidator.
|
|
89
|
+
async checkCartServiceability({ body } = {}) {
|
|
90
|
+
const { error } = CartValidator.checkCartServiceability().validate(
|
|
150
91
|
{
|
|
151
92
|
body,
|
|
152
93
|
},
|
|
@@ -157,38 +98,61 @@ class Cart {
|
|
|
157
98
|
}
|
|
158
99
|
|
|
159
100
|
// Showing warrnings if extra unknown parameters are found
|
|
160
|
-
const {
|
|
101
|
+
const {
|
|
102
|
+
error: warrning,
|
|
103
|
+
} = CartValidator.checkCartServiceability().validate(
|
|
161
104
|
{
|
|
162
105
|
body,
|
|
163
106
|
},
|
|
164
107
|
{ abortEarly: false, allowUnknown: false }
|
|
165
108
|
);
|
|
166
109
|
if (warrning) {
|
|
167
|
-
|
|
168
|
-
|
|
110
|
+
Logger({
|
|
111
|
+
level: "WARN",
|
|
112
|
+
message: "Parameter Validation warrnings for checkCartServiceability",
|
|
113
|
+
});
|
|
114
|
+
Logger({ level: "WARN", message: warrning });
|
|
169
115
|
}
|
|
170
116
|
|
|
171
117
|
const query_params = {};
|
|
172
118
|
|
|
173
|
-
|
|
119
|
+
const response = await PlatformAPIClient.execute(
|
|
174
120
|
this.config,
|
|
175
121
|
"post",
|
|
176
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
122
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/serviceability`,
|
|
177
123
|
query_params,
|
|
178
124
|
body
|
|
179
125
|
);
|
|
126
|
+
|
|
127
|
+
const {
|
|
128
|
+
error: res_error,
|
|
129
|
+
} = CartModel.OpenApiCartServiceabilityResponse().validate(response, {
|
|
130
|
+
abortEarly: false,
|
|
131
|
+
allowUnknown: false,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (res_error) {
|
|
135
|
+
Logger({
|
|
136
|
+
level: "WARN",
|
|
137
|
+
message: "Response Validation Warnnings for checkCartServiceability",
|
|
138
|
+
});
|
|
139
|
+
Logger({ level: "WARN", message: res_error });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return response;
|
|
180
143
|
}
|
|
181
144
|
|
|
182
145
|
/**
|
|
183
146
|
* @param {Object} arg - Arg object.
|
|
184
|
-
* @param {
|
|
185
|
-
* @
|
|
186
|
-
* @
|
|
147
|
+
* @param {OpenApiPlatformCheckoutReq} arg.body
|
|
148
|
+
* @returns {Promise<OpenApiCheckoutResponse>} - Success response
|
|
149
|
+
* @summary: Create Fynd order with cart details
|
|
150
|
+
* @description: Generate Fynd order for cart details send with provided `cart_items`
|
|
187
151
|
*/
|
|
188
|
-
|
|
189
|
-
const { error } = CartValidator.
|
|
152
|
+
async checkoutCart({ body } = {}) {
|
|
153
|
+
const { error } = CartValidator.checkoutCart().validate(
|
|
190
154
|
{
|
|
191
|
-
|
|
155
|
+
body,
|
|
192
156
|
},
|
|
193
157
|
{ abortEarly: false, allowUnknown: true }
|
|
194
158
|
);
|
|
@@ -197,39 +161,58 @@ class Cart {
|
|
|
197
161
|
}
|
|
198
162
|
|
|
199
163
|
// Showing warrnings if extra unknown parameters are found
|
|
200
|
-
const { error: warrning } = CartValidator.
|
|
164
|
+
const { error: warrning } = CartValidator.checkoutCart().validate(
|
|
201
165
|
{
|
|
202
|
-
|
|
166
|
+
body,
|
|
203
167
|
},
|
|
204
168
|
{ abortEarly: false, allowUnknown: false }
|
|
205
169
|
);
|
|
206
170
|
if (warrning) {
|
|
207
|
-
|
|
208
|
-
|
|
171
|
+
Logger({
|
|
172
|
+
level: "WARN",
|
|
173
|
+
message: "Parameter Validation warrnings for checkoutCart",
|
|
174
|
+
});
|
|
175
|
+
Logger({ level: "WARN", message: warrning });
|
|
209
176
|
}
|
|
210
177
|
|
|
211
178
|
const query_params = {};
|
|
212
179
|
|
|
213
|
-
|
|
180
|
+
const response = await PlatformAPIClient.execute(
|
|
214
181
|
this.config,
|
|
215
|
-
"
|
|
216
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
182
|
+
"post",
|
|
183
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/checkout`,
|
|
217
184
|
query_params,
|
|
218
|
-
|
|
185
|
+
body
|
|
219
186
|
);
|
|
187
|
+
|
|
188
|
+
const {
|
|
189
|
+
error: res_error,
|
|
190
|
+
} = CartModel.OpenApiCheckoutResponse().validate(response, {
|
|
191
|
+
abortEarly: false,
|
|
192
|
+
allowUnknown: false,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
if (res_error) {
|
|
196
|
+
Logger({
|
|
197
|
+
level: "WARN",
|
|
198
|
+
message: "Response Validation Warnnings for checkoutCart",
|
|
199
|
+
});
|
|
200
|
+
Logger({ level: "WARN", message: res_error });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return response;
|
|
220
204
|
}
|
|
221
205
|
|
|
222
206
|
/**
|
|
223
207
|
* @param {Object} arg - Arg object.
|
|
224
|
-
* @param {
|
|
225
|
-
* @
|
|
226
|
-
* @summary:
|
|
227
|
-
* @description:
|
|
208
|
+
* @param {CouponAdd} arg.body
|
|
209
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
210
|
+
* @summary: Create new coupon
|
|
211
|
+
* @description: Create new coupon
|
|
228
212
|
*/
|
|
229
|
-
|
|
230
|
-
const { error } = CartValidator.
|
|
213
|
+
async createCoupon({ body } = {}) {
|
|
214
|
+
const { error } = CartValidator.createCoupon().validate(
|
|
231
215
|
{
|
|
232
|
-
id,
|
|
233
216
|
body,
|
|
234
217
|
},
|
|
235
218
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -239,40 +222,56 @@ class Cart {
|
|
|
239
222
|
}
|
|
240
223
|
|
|
241
224
|
// Showing warrnings if extra unknown parameters are found
|
|
242
|
-
const { error: warrning } = CartValidator.
|
|
225
|
+
const { error: warrning } = CartValidator.createCoupon().validate(
|
|
243
226
|
{
|
|
244
|
-
id,
|
|
245
227
|
body,
|
|
246
228
|
},
|
|
247
229
|
{ abortEarly: false, allowUnknown: false }
|
|
248
230
|
);
|
|
249
231
|
if (warrning) {
|
|
250
|
-
|
|
251
|
-
|
|
232
|
+
Logger({
|
|
233
|
+
level: "WARN",
|
|
234
|
+
message: "Parameter Validation warrnings for createCoupon",
|
|
235
|
+
});
|
|
236
|
+
Logger({ level: "WARN", message: warrning });
|
|
252
237
|
}
|
|
253
238
|
|
|
254
239
|
const query_params = {};
|
|
255
240
|
|
|
256
|
-
|
|
241
|
+
const response = await PlatformAPIClient.execute(
|
|
257
242
|
this.config,
|
|
258
|
-
"
|
|
259
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon
|
|
243
|
+
"post",
|
|
244
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon`,
|
|
260
245
|
query_params,
|
|
261
246
|
body
|
|
262
247
|
);
|
|
248
|
+
|
|
249
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
250
|
+
abortEarly: false,
|
|
251
|
+
allowUnknown: false,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
if (res_error) {
|
|
255
|
+
Logger({
|
|
256
|
+
level: "WARN",
|
|
257
|
+
message: "Response Validation Warnnings for createCoupon",
|
|
258
|
+
});
|
|
259
|
+
Logger({ level: "WARN", message: res_error });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return response;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
266
|
* @param {Object} arg - Arg object.
|
|
267
|
-
* @param {
|
|
268
|
-
* @
|
|
269
|
-
* @summary:
|
|
270
|
-
* @description:
|
|
267
|
+
* @param {PromotionAdd} arg.body
|
|
268
|
+
* @returns {Promise<PromotionAdd>} - Success response
|
|
269
|
+
* @summary: Create new promotion
|
|
270
|
+
* @description: Create new promotion
|
|
271
271
|
*/
|
|
272
|
-
|
|
273
|
-
const { error } = CartValidator.
|
|
272
|
+
async createPromotion({ body } = {}) {
|
|
273
|
+
const { error } = CartValidator.createPromotion().validate(
|
|
274
274
|
{
|
|
275
|
-
id,
|
|
276
275
|
body,
|
|
277
276
|
},
|
|
278
277
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -282,62 +281,57 @@ class Cart {
|
|
|
282
281
|
}
|
|
283
282
|
|
|
284
283
|
// Showing warrnings if extra unknown parameters are found
|
|
285
|
-
const { error: warrning } = CartValidator.
|
|
284
|
+
const { error: warrning } = CartValidator.createPromotion().validate(
|
|
286
285
|
{
|
|
287
|
-
id,
|
|
288
286
|
body,
|
|
289
287
|
},
|
|
290
288
|
{ abortEarly: false, allowUnknown: false }
|
|
291
289
|
);
|
|
292
290
|
if (warrning) {
|
|
293
|
-
|
|
294
|
-
|
|
291
|
+
Logger({
|
|
292
|
+
level: "WARN",
|
|
293
|
+
message: "Parameter Validation warrnings for createPromotion",
|
|
294
|
+
});
|
|
295
|
+
Logger({ level: "WARN", message: warrning });
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
const query_params = {};
|
|
298
299
|
|
|
299
|
-
|
|
300
|
+
const response = await PlatformAPIClient.execute(
|
|
300
301
|
this.config,
|
|
301
|
-
"
|
|
302
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
302
|
+
"post",
|
|
303
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion`,
|
|
303
304
|
query_params,
|
|
304
305
|
body
|
|
305
306
|
);
|
|
307
|
+
|
|
308
|
+
const { error: res_error } = CartModel.PromotionAdd().validate(response, {
|
|
309
|
+
abortEarly: false,
|
|
310
|
+
allowUnknown: false,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
if (res_error) {
|
|
314
|
+
Logger({
|
|
315
|
+
level: "WARN",
|
|
316
|
+
message: "Response Validation Warnnings for createPromotion",
|
|
317
|
+
});
|
|
318
|
+
Logger({ level: "WARN", message: res_error });
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return response;
|
|
306
322
|
}
|
|
307
323
|
|
|
308
324
|
/**
|
|
309
325
|
* @param {Object} arg - Arg object.
|
|
310
|
-
* @param {
|
|
311
|
-
* @
|
|
312
|
-
* @
|
|
313
|
-
* @
|
|
314
|
-
* @param {string} [arg.promoGroup] -
|
|
315
|
-
* @param {string} [arg.promotionType] -
|
|
316
|
-
* @param {string} [arg.fpPanel] -
|
|
317
|
-
* @param {string} [arg.promotionId] -
|
|
318
|
-
* @summary: Get promotion list
|
|
319
|
-
* @description: Get promotion list with pagination
|
|
326
|
+
* @param {OpenapiCartDetailsRequest} arg.body
|
|
327
|
+
* @returns {Promise<OpenapiCartDetailsResponse>} - Success response
|
|
328
|
+
* @summary: Fetch Cart Details
|
|
329
|
+
* @description: Get all the details of cart for a list of provided `cart_items`
|
|
320
330
|
*/
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
pageSize,
|
|
324
|
-
q,
|
|
325
|
-
isActive,
|
|
326
|
-
promoGroup,
|
|
327
|
-
promotionType,
|
|
328
|
-
fpPanel,
|
|
329
|
-
promotionId,
|
|
330
|
-
} = {}) {
|
|
331
|
-
const { error } = CartValidator.getPromotions().validate(
|
|
331
|
+
async fetchAndvalidateCartItems({ body } = {}) {
|
|
332
|
+
const { error } = CartValidator.fetchAndvalidateCartItems().validate(
|
|
332
333
|
{
|
|
333
|
-
|
|
334
|
-
pageSize,
|
|
335
|
-
q,
|
|
336
|
-
isActive,
|
|
337
|
-
promoGroup,
|
|
338
|
-
promotionType,
|
|
339
|
-
fpPanel,
|
|
340
|
-
promotionId,
|
|
334
|
+
body,
|
|
341
335
|
},
|
|
342
336
|
{ abortEarly: false, allowUnknown: true }
|
|
343
337
|
);
|
|
@@ -346,41 +340,142 @@ class Cart {
|
|
|
346
340
|
}
|
|
347
341
|
|
|
348
342
|
// Showing warrnings if extra unknown parameters are found
|
|
349
|
-
const {
|
|
343
|
+
const {
|
|
344
|
+
error: warrning,
|
|
345
|
+
} = CartValidator.fetchAndvalidateCartItems().validate(
|
|
350
346
|
{
|
|
351
|
-
|
|
352
|
-
pageSize,
|
|
353
|
-
q,
|
|
354
|
-
isActive,
|
|
355
|
-
promoGroup,
|
|
356
|
-
promotionType,
|
|
357
|
-
fpPanel,
|
|
358
|
-
promotionId,
|
|
347
|
+
body,
|
|
359
348
|
},
|
|
360
349
|
{ abortEarly: false, allowUnknown: false }
|
|
361
350
|
);
|
|
362
351
|
if (warrning) {
|
|
363
|
-
|
|
364
|
-
|
|
352
|
+
Logger({
|
|
353
|
+
level: "WARN",
|
|
354
|
+
message: "Parameter Validation warrnings for fetchAndvalidateCartItems",
|
|
355
|
+
});
|
|
356
|
+
Logger({ level: "WARN", message: warrning });
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const query_params = {};
|
|
360
|
+
|
|
361
|
+
const response = await PlatformAPIClient.execute(
|
|
362
|
+
this.config,
|
|
363
|
+
"post",
|
|
364
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/validate`,
|
|
365
|
+
query_params,
|
|
366
|
+
body
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
const {
|
|
370
|
+
error: res_error,
|
|
371
|
+
} = CartModel.OpenapiCartDetailsResponse().validate(response, {
|
|
372
|
+
abortEarly: false,
|
|
373
|
+
allowUnknown: false,
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
if (res_error) {
|
|
377
|
+
Logger({
|
|
378
|
+
level: "WARN",
|
|
379
|
+
message: "Response Validation Warnnings for fetchAndvalidateCartItems",
|
|
380
|
+
});
|
|
381
|
+
Logger({ level: "WARN", message: res_error });
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return response;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* @param {Object} arg - Arg object.
|
|
389
|
+
* @param {number} [arg.pageNo] -
|
|
390
|
+
* @param {number} [arg.pageSize] -
|
|
391
|
+
* @param {string} [arg.fromDate] -
|
|
392
|
+
* @param {string} [arg.toDate] -
|
|
393
|
+
* @param {boolean} [arg.anonymousCart] -
|
|
394
|
+
* @param {string} [arg.lastId] -
|
|
395
|
+
* @param {string} [arg.sortOn] -
|
|
396
|
+
* @returns {Promise<AbandonedCartResponse>} - Success response
|
|
397
|
+
* @summary: Get with abandoned cart list
|
|
398
|
+
* @description: Get abandoned cart list with pagination
|
|
399
|
+
*/
|
|
400
|
+
async getAbandonedCart({
|
|
401
|
+
pageNo,
|
|
402
|
+
pageSize,
|
|
403
|
+
fromDate,
|
|
404
|
+
toDate,
|
|
405
|
+
anonymousCart,
|
|
406
|
+
lastId,
|
|
407
|
+
sortOn,
|
|
408
|
+
} = {}) {
|
|
409
|
+
const { error } = CartValidator.getAbandonedCart().validate(
|
|
410
|
+
{
|
|
411
|
+
pageNo,
|
|
412
|
+
pageSize,
|
|
413
|
+
fromDate,
|
|
414
|
+
toDate,
|
|
415
|
+
anonymousCart,
|
|
416
|
+
lastId,
|
|
417
|
+
sortOn,
|
|
418
|
+
},
|
|
419
|
+
{ abortEarly: false, allowUnknown: true }
|
|
420
|
+
);
|
|
421
|
+
if (error) {
|
|
422
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Showing warrnings if extra unknown parameters are found
|
|
426
|
+
const { error: warrning } = CartValidator.getAbandonedCart().validate(
|
|
427
|
+
{
|
|
428
|
+
pageNo,
|
|
429
|
+
pageSize,
|
|
430
|
+
fromDate,
|
|
431
|
+
toDate,
|
|
432
|
+
anonymousCart,
|
|
433
|
+
lastId,
|
|
434
|
+
sortOn,
|
|
435
|
+
},
|
|
436
|
+
{ abortEarly: false, allowUnknown: false }
|
|
437
|
+
);
|
|
438
|
+
if (warrning) {
|
|
439
|
+
Logger({
|
|
440
|
+
level: "WARN",
|
|
441
|
+
message: "Parameter Validation warrnings for getAbandonedCart",
|
|
442
|
+
});
|
|
443
|
+
Logger({ level: "WARN", message: warrning });
|
|
365
444
|
}
|
|
366
445
|
|
|
367
446
|
const query_params = {};
|
|
368
447
|
query_params["page_no"] = pageNo;
|
|
369
448
|
query_params["page_size"] = pageSize;
|
|
370
|
-
query_params["
|
|
371
|
-
query_params["
|
|
372
|
-
query_params["
|
|
373
|
-
query_params["
|
|
374
|
-
query_params["
|
|
375
|
-
query_params["promotion_id"] = promotionId;
|
|
449
|
+
query_params["from_date"] = fromDate;
|
|
450
|
+
query_params["to_date"] = toDate;
|
|
451
|
+
query_params["anonymous_cart"] = anonymousCart;
|
|
452
|
+
query_params["last_id"] = lastId;
|
|
453
|
+
query_params["sort_on"] = sortOn;
|
|
376
454
|
|
|
377
|
-
|
|
455
|
+
const response = await PlatformAPIClient.execute(
|
|
378
456
|
this.config,
|
|
379
457
|
"get",
|
|
380
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
458
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts`,
|
|
381
459
|
query_params,
|
|
382
460
|
undefined
|
|
383
461
|
);
|
|
462
|
+
|
|
463
|
+
const {
|
|
464
|
+
error: res_error,
|
|
465
|
+
} = CartModel.AbandonedCartResponse().validate(response, {
|
|
466
|
+
abortEarly: false,
|
|
467
|
+
allowUnknown: false,
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
if (res_error) {
|
|
471
|
+
Logger({
|
|
472
|
+
level: "WARN",
|
|
473
|
+
message: "Response Validation Warnnings for getAbandonedCart",
|
|
474
|
+
});
|
|
475
|
+
Logger({ level: "WARN", message: res_error });
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return response;
|
|
384
479
|
}
|
|
385
480
|
|
|
386
481
|
/**
|
|
@@ -388,42 +483,39 @@ class Cart {
|
|
|
388
483
|
* @param {string} arg.companyId - Current company id
|
|
389
484
|
* @param {string} arg.applicationId - Current Application _id
|
|
390
485
|
* @param {number} [arg.pageSize] -
|
|
391
|
-
* @param {string} [arg.
|
|
392
|
-
* @param {
|
|
393
|
-
* @param {
|
|
394
|
-
* @param {string} [arg.
|
|
395
|
-
* @param {string} [arg.
|
|
396
|
-
* @
|
|
397
|
-
* @
|
|
398
|
-
* @description: Get promotion list with pagination
|
|
486
|
+
* @param {string} [arg.fromDate] -
|
|
487
|
+
* @param {string} [arg.toDate] -
|
|
488
|
+
* @param {boolean} [arg.anonymousCart] -
|
|
489
|
+
* @param {string} [arg.lastId] -
|
|
490
|
+
* @param {string} [arg.sortOn] -
|
|
491
|
+
* @summary: Get with abandoned cart list
|
|
492
|
+
* @description: Get abandoned cart list with pagination
|
|
399
493
|
*/
|
|
400
|
-
|
|
494
|
+
getAbandonedCartPaginator({
|
|
401
495
|
companyId,
|
|
402
496
|
applicationId,
|
|
403
497
|
pageSize,
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
promotionId,
|
|
498
|
+
fromDate,
|
|
499
|
+
toDate,
|
|
500
|
+
anonymousCart,
|
|
501
|
+
lastId,
|
|
502
|
+
sortOn,
|
|
410
503
|
} = {}) {
|
|
411
504
|
const paginator = new Paginator();
|
|
412
505
|
const callback = async () => {
|
|
413
506
|
const pageId = paginator.nextId;
|
|
414
507
|
const pageNo = paginator.pageNo;
|
|
415
508
|
const pageType = "number";
|
|
416
|
-
const data = await this.
|
|
509
|
+
const data = await this.getAbandonedCart({
|
|
417
510
|
companyId: companyId,
|
|
418
511
|
applicationId: applicationId,
|
|
419
512
|
pageNo: pageNo,
|
|
420
513
|
pageSize: pageSize,
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
promotionId: promotionId,
|
|
514
|
+
fromDate: fromDate,
|
|
515
|
+
toDate: toDate,
|
|
516
|
+
anonymousCart: anonymousCart,
|
|
517
|
+
lastId: lastId,
|
|
518
|
+
sortOn: sortOn,
|
|
427
519
|
});
|
|
428
520
|
paginator.setPaginator({
|
|
429
521
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -437,14 +529,19 @@ class Cart {
|
|
|
437
529
|
|
|
438
530
|
/**
|
|
439
531
|
* @param {Object} arg - Arg object.
|
|
440
|
-
* @param {
|
|
441
|
-
* @
|
|
442
|
-
* @
|
|
532
|
+
* @param {string} [arg.id] -
|
|
533
|
+
* @param {boolean} [arg.i] -
|
|
534
|
+
* @param {boolean} [arg.b] -
|
|
535
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
536
|
+
* @summary: Fetch all items added to the cart
|
|
537
|
+
* @description: Use this API to get details of all the items added to a cart.
|
|
443
538
|
*/
|
|
444
|
-
|
|
445
|
-
const { error } = CartValidator.
|
|
539
|
+
async getAbandonedCartDetails({ id, i, b } = {}) {
|
|
540
|
+
const { error } = CartValidator.getAbandonedCartDetails().validate(
|
|
446
541
|
{
|
|
447
|
-
|
|
542
|
+
id,
|
|
543
|
+
i,
|
|
544
|
+
b,
|
|
448
545
|
},
|
|
449
546
|
{ abortEarly: false, allowUnknown: true }
|
|
450
547
|
);
|
|
@@ -453,36 +550,64 @@ class Cart {
|
|
|
453
550
|
}
|
|
454
551
|
|
|
455
552
|
// Showing warrnings if extra unknown parameters are found
|
|
456
|
-
const {
|
|
553
|
+
const {
|
|
554
|
+
error: warrning,
|
|
555
|
+
} = CartValidator.getAbandonedCartDetails().validate(
|
|
457
556
|
{
|
|
458
|
-
|
|
557
|
+
id,
|
|
558
|
+
i,
|
|
559
|
+
b,
|
|
459
560
|
},
|
|
460
561
|
{ abortEarly: false, allowUnknown: false }
|
|
461
562
|
);
|
|
462
563
|
if (warrning) {
|
|
463
|
-
|
|
464
|
-
|
|
564
|
+
Logger({
|
|
565
|
+
level: "WARN",
|
|
566
|
+
message: "Parameter Validation warrnings for getAbandonedCartDetails",
|
|
567
|
+
});
|
|
568
|
+
Logger({ level: "WARN", message: warrning });
|
|
465
569
|
}
|
|
466
570
|
|
|
467
571
|
const query_params = {};
|
|
572
|
+
query_params["id"] = id;
|
|
573
|
+
query_params["i"] = i;
|
|
574
|
+
query_params["b"] = b;
|
|
468
575
|
|
|
469
|
-
|
|
576
|
+
const response = await PlatformAPIClient.execute(
|
|
470
577
|
this.config,
|
|
471
|
-
"
|
|
472
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
578
|
+
"get",
|
|
579
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/cart/detail`,
|
|
473
580
|
query_params,
|
|
474
|
-
|
|
581
|
+
undefined
|
|
475
582
|
);
|
|
583
|
+
|
|
584
|
+
const {
|
|
585
|
+
error: res_error,
|
|
586
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
587
|
+
abortEarly: false,
|
|
588
|
+
allowUnknown: false,
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
if (res_error) {
|
|
592
|
+
Logger({
|
|
593
|
+
level: "WARN",
|
|
594
|
+
message: "Response Validation Warnnings for getAbandonedCartDetails",
|
|
595
|
+
});
|
|
596
|
+
Logger({ level: "WARN", message: res_error });
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return response;
|
|
476
600
|
}
|
|
477
601
|
|
|
478
602
|
/**
|
|
479
603
|
* @param {Object} arg - Arg object.
|
|
480
604
|
* @param {string} arg.id -
|
|
481
|
-
* @
|
|
482
|
-
* @
|
|
605
|
+
* @returns {Promise<CouponUpdate>} - Success response
|
|
606
|
+
* @summary: Get with single coupon details or coupon list
|
|
607
|
+
* @description: Get single coupon details with `id` in path param
|
|
483
608
|
*/
|
|
484
|
-
|
|
485
|
-
const { error } = CartValidator.
|
|
609
|
+
async getCouponById({ id } = {}) {
|
|
610
|
+
const { error } = CartValidator.getCouponById().validate(
|
|
486
611
|
{
|
|
487
612
|
id,
|
|
488
613
|
},
|
|
@@ -493,40 +618,80 @@ class Cart {
|
|
|
493
618
|
}
|
|
494
619
|
|
|
495
620
|
// Showing warrnings if extra unknown parameters are found
|
|
496
|
-
const { error: warrning } = CartValidator.
|
|
621
|
+
const { error: warrning } = CartValidator.getCouponById().validate(
|
|
497
622
|
{
|
|
498
623
|
id,
|
|
499
624
|
},
|
|
500
625
|
{ abortEarly: false, allowUnknown: false }
|
|
501
626
|
);
|
|
502
627
|
if (warrning) {
|
|
503
|
-
|
|
504
|
-
|
|
628
|
+
Logger({
|
|
629
|
+
level: "WARN",
|
|
630
|
+
message: "Parameter Validation warrnings for getCouponById",
|
|
631
|
+
});
|
|
632
|
+
Logger({ level: "WARN", message: warrning });
|
|
505
633
|
}
|
|
506
634
|
|
|
507
635
|
const query_params = {};
|
|
508
636
|
|
|
509
|
-
|
|
637
|
+
const response = await PlatformAPIClient.execute(
|
|
510
638
|
this.config,
|
|
511
639
|
"get",
|
|
512
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
640
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
513
641
|
query_params,
|
|
514
642
|
undefined
|
|
515
643
|
);
|
|
644
|
+
|
|
645
|
+
const { error: res_error } = CartModel.CouponUpdate().validate(response, {
|
|
646
|
+
abortEarly: false,
|
|
647
|
+
allowUnknown: false,
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
if (res_error) {
|
|
651
|
+
Logger({
|
|
652
|
+
level: "WARN",
|
|
653
|
+
message: "Response Validation Warnnings for getCouponById",
|
|
654
|
+
});
|
|
655
|
+
Logger({ level: "WARN", message: res_error });
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
return response;
|
|
516
659
|
}
|
|
517
660
|
|
|
518
661
|
/**
|
|
519
662
|
* @param {Object} arg - Arg object.
|
|
520
|
-
* @param {
|
|
521
|
-
* @param {
|
|
522
|
-
* @
|
|
523
|
-
* @
|
|
663
|
+
* @param {number} [arg.pageNo] -
|
|
664
|
+
* @param {number} [arg.pageSize] -
|
|
665
|
+
* @param {boolean} [arg.isArchived] -
|
|
666
|
+
* @param {string} [arg.title] -
|
|
667
|
+
* @param {boolean} [arg.isPublic] -
|
|
668
|
+
* @param {boolean} [arg.isDisplay] -
|
|
669
|
+
* @param {string} [arg.typeSlug] -
|
|
670
|
+
* @param {string} [arg.code] -
|
|
671
|
+
* @returns {Promise<CouponsResponse>} - Success response
|
|
672
|
+
* @summary: Get with single coupon details or coupon list
|
|
673
|
+
* @description: Get coupon list with pagination
|
|
524
674
|
*/
|
|
525
|
-
|
|
526
|
-
|
|
675
|
+
async getCoupons({
|
|
676
|
+
pageNo,
|
|
677
|
+
pageSize,
|
|
678
|
+
isArchived,
|
|
679
|
+
title,
|
|
680
|
+
isPublic,
|
|
681
|
+
isDisplay,
|
|
682
|
+
typeSlug,
|
|
683
|
+
code,
|
|
684
|
+
} = {}) {
|
|
685
|
+
const { error } = CartValidator.getCoupons().validate(
|
|
527
686
|
{
|
|
528
|
-
|
|
529
|
-
|
|
687
|
+
pageNo,
|
|
688
|
+
pageSize,
|
|
689
|
+
isArchived,
|
|
690
|
+
title,
|
|
691
|
+
isPublic,
|
|
692
|
+
isDisplay,
|
|
693
|
+
typeSlug,
|
|
694
|
+
code,
|
|
530
695
|
},
|
|
531
696
|
{ abortEarly: false, allowUnknown: true }
|
|
532
697
|
);
|
|
@@ -535,41 +700,124 @@ class Cart {
|
|
|
535
700
|
}
|
|
536
701
|
|
|
537
702
|
// Showing warrnings if extra unknown parameters are found
|
|
538
|
-
const { error: warrning } = CartValidator.
|
|
703
|
+
const { error: warrning } = CartValidator.getCoupons().validate(
|
|
539
704
|
{
|
|
540
|
-
|
|
541
|
-
|
|
705
|
+
pageNo,
|
|
706
|
+
pageSize,
|
|
707
|
+
isArchived,
|
|
708
|
+
title,
|
|
709
|
+
isPublic,
|
|
710
|
+
isDisplay,
|
|
711
|
+
typeSlug,
|
|
712
|
+
code,
|
|
542
713
|
},
|
|
543
714
|
{ abortEarly: false, allowUnknown: false }
|
|
544
715
|
);
|
|
545
716
|
if (warrning) {
|
|
546
|
-
|
|
547
|
-
|
|
717
|
+
Logger({
|
|
718
|
+
level: "WARN",
|
|
719
|
+
message: "Parameter Validation warrnings for getCoupons",
|
|
720
|
+
});
|
|
721
|
+
Logger({ level: "WARN", message: warrning });
|
|
548
722
|
}
|
|
549
723
|
|
|
550
724
|
const query_params = {};
|
|
725
|
+
query_params["page_no"] = pageNo;
|
|
726
|
+
query_params["page_size"] = pageSize;
|
|
727
|
+
query_params["is_archived"] = isArchived;
|
|
728
|
+
query_params["title"] = title;
|
|
729
|
+
query_params["is_public"] = isPublic;
|
|
730
|
+
query_params["is_display"] = isDisplay;
|
|
731
|
+
query_params["type_slug"] = typeSlug;
|
|
732
|
+
query_params["code"] = code;
|
|
551
733
|
|
|
552
|
-
|
|
734
|
+
const response = await PlatformAPIClient.execute(
|
|
553
735
|
this.config,
|
|
554
|
-
"
|
|
555
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
736
|
+
"get",
|
|
737
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon`,
|
|
556
738
|
query_params,
|
|
557
|
-
|
|
739
|
+
undefined
|
|
558
740
|
);
|
|
741
|
+
|
|
742
|
+
const { error: res_error } = CartModel.CouponsResponse().validate(
|
|
743
|
+
response,
|
|
744
|
+
{ abortEarly: false, allowUnknown: false }
|
|
745
|
+
);
|
|
746
|
+
|
|
747
|
+
if (res_error) {
|
|
748
|
+
Logger({
|
|
749
|
+
level: "WARN",
|
|
750
|
+
message: "Response Validation Warnnings for getCoupons",
|
|
751
|
+
});
|
|
752
|
+
Logger({ level: "WARN", message: res_error });
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return response;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* @param {Object} arg - Arg object.
|
|
760
|
+
* @param {string} arg.companyId - Current company id
|
|
761
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
762
|
+
* @param {number} [arg.pageSize] -
|
|
763
|
+
* @param {boolean} [arg.isArchived] -
|
|
764
|
+
* @param {string} [arg.title] -
|
|
765
|
+
* @param {boolean} [arg.isPublic] -
|
|
766
|
+
* @param {boolean} [arg.isDisplay] -
|
|
767
|
+
* @param {string} [arg.typeSlug] -
|
|
768
|
+
* @param {string} [arg.code] -
|
|
769
|
+
* @summary: Get with single coupon details or coupon list
|
|
770
|
+
* @description: Get coupon list with pagination
|
|
771
|
+
*/
|
|
772
|
+
getCouponsPaginator({
|
|
773
|
+
companyId,
|
|
774
|
+
applicationId,
|
|
775
|
+
pageSize,
|
|
776
|
+
isArchived,
|
|
777
|
+
title,
|
|
778
|
+
isPublic,
|
|
779
|
+
isDisplay,
|
|
780
|
+
typeSlug,
|
|
781
|
+
code,
|
|
782
|
+
} = {}) {
|
|
783
|
+
const paginator = new Paginator();
|
|
784
|
+
const callback = async () => {
|
|
785
|
+
const pageId = paginator.nextId;
|
|
786
|
+
const pageNo = paginator.pageNo;
|
|
787
|
+
const pageType = "number";
|
|
788
|
+
const data = await this.getCoupons({
|
|
789
|
+
companyId: companyId,
|
|
790
|
+
applicationId: applicationId,
|
|
791
|
+
pageNo: pageNo,
|
|
792
|
+
pageSize: pageSize,
|
|
793
|
+
isArchived: isArchived,
|
|
794
|
+
title: title,
|
|
795
|
+
isPublic: isPublic,
|
|
796
|
+
isDisplay: isDisplay,
|
|
797
|
+
typeSlug: typeSlug,
|
|
798
|
+
code: code,
|
|
799
|
+
});
|
|
800
|
+
paginator.setPaginator({
|
|
801
|
+
hasNext: data.page.has_next ? true : false,
|
|
802
|
+
nextId: data.page.next_id,
|
|
803
|
+
});
|
|
804
|
+
return data;
|
|
805
|
+
};
|
|
806
|
+
paginator.setCallback(callback.bind(this));
|
|
807
|
+
return paginator;
|
|
559
808
|
}
|
|
560
809
|
|
|
561
810
|
/**
|
|
562
811
|
* @param {Object} arg - Arg object.
|
|
563
812
|
* @param {string} arg.id -
|
|
564
|
-
* @
|
|
565
|
-
* @summary:
|
|
566
|
-
* @description:
|
|
813
|
+
* @returns {Promise<PromotionUpdate>} - Success response
|
|
814
|
+
* @summary: Get with single promotion details or promotion list
|
|
815
|
+
* @description: Get single promotion details with `id` in path param
|
|
567
816
|
*/
|
|
568
|
-
|
|
569
|
-
const { error } = CartValidator.
|
|
817
|
+
async getPromotionById({ id } = {}) {
|
|
818
|
+
const { error } = CartValidator.getPromotionById().validate(
|
|
570
819
|
{
|
|
571
820
|
id,
|
|
572
|
-
body,
|
|
573
821
|
},
|
|
574
822
|
{ abortEarly: false, allowUnknown: true }
|
|
575
823
|
);
|
|
@@ -578,43 +826,80 @@ class Cart {
|
|
|
578
826
|
}
|
|
579
827
|
|
|
580
828
|
// Showing warrnings if extra unknown parameters are found
|
|
581
|
-
const {
|
|
582
|
-
error: warrning,
|
|
583
|
-
} = CartValidator.updatePromotionPartially().validate(
|
|
829
|
+
const { error: warrning } = CartValidator.getPromotionById().validate(
|
|
584
830
|
{
|
|
585
831
|
id,
|
|
586
|
-
body,
|
|
587
832
|
},
|
|
588
833
|
{ abortEarly: false, allowUnknown: false }
|
|
589
834
|
);
|
|
590
835
|
if (warrning) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
836
|
+
Logger({
|
|
837
|
+
level: "WARN",
|
|
838
|
+
message: "Parameter Validation warrnings for getPromotionById",
|
|
839
|
+
});
|
|
840
|
+
Logger({ level: "WARN", message: warrning });
|
|
595
841
|
}
|
|
596
842
|
|
|
597
843
|
const query_params = {};
|
|
598
844
|
|
|
599
|
-
|
|
845
|
+
const response = await PlatformAPIClient.execute(
|
|
600
846
|
this.config,
|
|
601
|
-
"
|
|
847
|
+
"get",
|
|
602
848
|
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
603
849
|
query_params,
|
|
604
|
-
|
|
850
|
+
undefined
|
|
605
851
|
);
|
|
852
|
+
|
|
853
|
+
const { error: res_error } = CartModel.PromotionUpdate().validate(
|
|
854
|
+
response,
|
|
855
|
+
{ abortEarly: false, allowUnknown: false }
|
|
856
|
+
);
|
|
857
|
+
|
|
858
|
+
if (res_error) {
|
|
859
|
+
Logger({
|
|
860
|
+
level: "WARN",
|
|
861
|
+
message: "Response Validation Warnnings for getPromotionById",
|
|
862
|
+
});
|
|
863
|
+
Logger({ level: "WARN", message: res_error });
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
return response;
|
|
606
867
|
}
|
|
607
868
|
|
|
608
869
|
/**
|
|
609
870
|
* @param {Object} arg - Arg object.
|
|
610
|
-
* @param {
|
|
611
|
-
* @
|
|
612
|
-
* @
|
|
871
|
+
* @param {number} [arg.pageNo] -
|
|
872
|
+
* @param {number} [arg.pageSize] -
|
|
873
|
+
* @param {string} [arg.q] -
|
|
874
|
+
* @param {boolean} [arg.isActive] -
|
|
875
|
+
* @param {string} [arg.promoGroup] -
|
|
876
|
+
* @param {string} [arg.promotionType] -
|
|
877
|
+
* @param {string} [arg.fpPanel] -
|
|
878
|
+
* @param {string} [arg.promotionId] -
|
|
879
|
+
* @returns {Promise<PromotionsResponse>} - Success response
|
|
880
|
+
* @summary: Get promotion list
|
|
881
|
+
* @description: Get promotion list with pagination
|
|
613
882
|
*/
|
|
614
|
-
|
|
615
|
-
|
|
883
|
+
async getPromotions({
|
|
884
|
+
pageNo,
|
|
885
|
+
pageSize,
|
|
886
|
+
q,
|
|
887
|
+
isActive,
|
|
888
|
+
promoGroup,
|
|
889
|
+
promotionType,
|
|
890
|
+
fpPanel,
|
|
891
|
+
promotionId,
|
|
892
|
+
} = {}) {
|
|
893
|
+
const { error } = CartValidator.getPromotions().validate(
|
|
616
894
|
{
|
|
617
|
-
|
|
895
|
+
pageNo,
|
|
896
|
+
pageSize,
|
|
897
|
+
q,
|
|
898
|
+
isActive,
|
|
899
|
+
promoGroup,
|
|
900
|
+
promotionType,
|
|
901
|
+
fpPanel,
|
|
902
|
+
promotionId,
|
|
618
903
|
},
|
|
619
904
|
{ abortEarly: false, allowUnknown: true }
|
|
620
905
|
);
|
|
@@ -623,42 +908,130 @@ class Cart {
|
|
|
623
908
|
}
|
|
624
909
|
|
|
625
910
|
// Showing warrnings if extra unknown parameters are found
|
|
626
|
-
const {
|
|
627
|
-
error: warrning,
|
|
628
|
-
} = CartValidator.fetchAndvalidateCartItems().validate(
|
|
911
|
+
const { error: warrning } = CartValidator.getPromotions().validate(
|
|
629
912
|
{
|
|
630
|
-
|
|
913
|
+
pageNo,
|
|
914
|
+
pageSize,
|
|
915
|
+
q,
|
|
916
|
+
isActive,
|
|
917
|
+
promoGroup,
|
|
918
|
+
promotionType,
|
|
919
|
+
fpPanel,
|
|
920
|
+
promotionId,
|
|
631
921
|
},
|
|
632
922
|
{ abortEarly: false, allowUnknown: false }
|
|
633
923
|
);
|
|
634
924
|
if (warrning) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
925
|
+
Logger({
|
|
926
|
+
level: "WARN",
|
|
927
|
+
message: "Parameter Validation warrnings for getPromotions",
|
|
928
|
+
});
|
|
929
|
+
Logger({ level: "WARN", message: warrning });
|
|
639
930
|
}
|
|
640
931
|
|
|
641
932
|
const query_params = {};
|
|
933
|
+
query_params["page_no"] = pageNo;
|
|
934
|
+
query_params["page_size"] = pageSize;
|
|
935
|
+
query_params["q"] = q;
|
|
936
|
+
query_params["is_active"] = isActive;
|
|
937
|
+
query_params["promo_group"] = promoGroup;
|
|
938
|
+
query_params["promotion_type"] = promotionType;
|
|
939
|
+
query_params["fp_panel"] = fpPanel;
|
|
940
|
+
query_params["promotion_id"] = promotionId;
|
|
642
941
|
|
|
643
|
-
|
|
942
|
+
const response = await PlatformAPIClient.execute(
|
|
644
943
|
this.config,
|
|
645
|
-
"
|
|
646
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
944
|
+
"get",
|
|
945
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion`,
|
|
647
946
|
query_params,
|
|
648
|
-
|
|
947
|
+
undefined
|
|
649
948
|
);
|
|
949
|
+
|
|
950
|
+
const {
|
|
951
|
+
error: res_error,
|
|
952
|
+
} = CartModel.PromotionsResponse().validate(response, {
|
|
953
|
+
abortEarly: false,
|
|
954
|
+
allowUnknown: false,
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
if (res_error) {
|
|
958
|
+
Logger({
|
|
959
|
+
level: "WARN",
|
|
960
|
+
message: "Response Validation Warnnings for getPromotions",
|
|
961
|
+
});
|
|
962
|
+
Logger({ level: "WARN", message: res_error });
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
return response;
|
|
650
966
|
}
|
|
651
967
|
|
|
652
968
|
/**
|
|
653
969
|
* @param {Object} arg - Arg object.
|
|
654
|
-
* @param {
|
|
655
|
-
* @
|
|
656
|
-
* @
|
|
970
|
+
* @param {string} arg.companyId - Current company id
|
|
971
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
972
|
+
* @param {number} [arg.pageSize] -
|
|
973
|
+
* @param {string} [arg.q] -
|
|
974
|
+
* @param {boolean} [arg.isActive] -
|
|
975
|
+
* @param {string} [arg.promoGroup] -
|
|
976
|
+
* @param {string} [arg.promotionType] -
|
|
977
|
+
* @param {string} [arg.fpPanel] -
|
|
978
|
+
* @param {string} [arg.promotionId] -
|
|
979
|
+
* @summary: Get promotion list
|
|
980
|
+
* @description: Get promotion list with pagination
|
|
981
|
+
*/
|
|
982
|
+
getPromotionsPaginator({
|
|
983
|
+
companyId,
|
|
984
|
+
applicationId,
|
|
985
|
+
pageSize,
|
|
986
|
+
q,
|
|
987
|
+
isActive,
|
|
988
|
+
promoGroup,
|
|
989
|
+
promotionType,
|
|
990
|
+
fpPanel,
|
|
991
|
+
promotionId,
|
|
992
|
+
} = {}) {
|
|
993
|
+
const paginator = new Paginator();
|
|
994
|
+
const callback = async () => {
|
|
995
|
+
const pageId = paginator.nextId;
|
|
996
|
+
const pageNo = paginator.pageNo;
|
|
997
|
+
const pageType = "number";
|
|
998
|
+
const data = await this.getPromotions({
|
|
999
|
+
companyId: companyId,
|
|
1000
|
+
applicationId: applicationId,
|
|
1001
|
+
pageNo: pageNo,
|
|
1002
|
+
pageSize: pageSize,
|
|
1003
|
+
q: q,
|
|
1004
|
+
isActive: isActive,
|
|
1005
|
+
promoGroup: promoGroup,
|
|
1006
|
+
promotionType: promotionType,
|
|
1007
|
+
fpPanel: fpPanel,
|
|
1008
|
+
promotionId: promotionId,
|
|
1009
|
+
});
|
|
1010
|
+
paginator.setPaginator({
|
|
1011
|
+
hasNext: data.page.has_next ? true : false,
|
|
1012
|
+
nextId: data.page.next_id,
|
|
1013
|
+
});
|
|
1014
|
+
return data;
|
|
1015
|
+
};
|
|
1016
|
+
paginator.setCallback(callback.bind(this));
|
|
1017
|
+
return paginator;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* @param {Object} arg - Arg object.
|
|
1022
|
+
* @param {string} arg.cartId - Current Cart _id
|
|
1023
|
+
* @param {boolean} [arg.b] -
|
|
1024
|
+
* @param {UpdateCartRequest} arg.body
|
|
1025
|
+
* @returns {Promise<UpdateCartDetailResponse>} - Success response
|
|
1026
|
+
* @summary: Update items in the abandoned cart
|
|
1027
|
+
* @description: <p>Use this API to update items added to the cart with the help of a request object containing attributes like item_quantity and item_size. These attributes will be fetched from the following APIs</p> <ul> <li><font color="monochrome">operation</font> Operation for current api call. <b>update_item</b> for update items. <b>remove_item</b> for removing items.</li> <li> <font color="monochrome">item_id</font> "/platform/content/v1/products/"</li> <li> <font color="monochrome">item_size</font> "/platform/content/v1/products/:slug/sizes/"</li> <li> <font color="monochrome">quantity</font> item quantity (must be greater than or equal to 1)</li> <li> <font color="monochrome">article_id</font> "/content/v1/products/:identifier/sizes/price/"</li> <li> <font color="monochrome">item_index</font> item position in the cart (must be greater than or equal to 0)</li> </ul>
|
|
657
1028
|
*/
|
|
658
|
-
|
|
659
|
-
const { error } = CartValidator.
|
|
1029
|
+
async updateCart({ cartId, body, b } = {}) {
|
|
1030
|
+
const { error } = CartValidator.updateCart().validate(
|
|
660
1031
|
{
|
|
1032
|
+
cartId,
|
|
661
1033
|
body,
|
|
1034
|
+
b,
|
|
662
1035
|
},
|
|
663
1036
|
{ abortEarly: false, allowUnknown: true }
|
|
664
1037
|
);
|
|
@@ -667,39 +1040,63 @@ class Cart {
|
|
|
667
1040
|
}
|
|
668
1041
|
|
|
669
1042
|
// Showing warrnings if extra unknown parameters are found
|
|
670
|
-
const {
|
|
671
|
-
error: warrning,
|
|
672
|
-
} = CartValidator.checkCartServiceability().validate(
|
|
1043
|
+
const { error: warrning } = CartValidator.updateCart().validate(
|
|
673
1044
|
{
|
|
1045
|
+
cartId,
|
|
674
1046
|
body,
|
|
1047
|
+
b,
|
|
675
1048
|
},
|
|
676
1049
|
{ abortEarly: false, allowUnknown: false }
|
|
677
1050
|
);
|
|
678
1051
|
if (warrning) {
|
|
679
|
-
|
|
680
|
-
|
|
1052
|
+
Logger({
|
|
1053
|
+
level: "WARN",
|
|
1054
|
+
message: "Parameter Validation warrnings for updateCart",
|
|
1055
|
+
});
|
|
1056
|
+
Logger({ level: "WARN", message: warrning });
|
|
681
1057
|
}
|
|
682
1058
|
|
|
683
1059
|
const query_params = {};
|
|
1060
|
+
query_params["b"] = b;
|
|
684
1061
|
|
|
685
|
-
|
|
1062
|
+
const response = await PlatformAPIClient.execute(
|
|
686
1063
|
this.config,
|
|
687
|
-
"
|
|
688
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1064
|
+
"put",
|
|
1065
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts/${cartId}`,
|
|
689
1066
|
query_params,
|
|
690
1067
|
body
|
|
691
1068
|
);
|
|
1069
|
+
|
|
1070
|
+
const {
|
|
1071
|
+
error: res_error,
|
|
1072
|
+
} = CartModel.UpdateCartDetailResponse().validate(response, {
|
|
1073
|
+
abortEarly: false,
|
|
1074
|
+
allowUnknown: false,
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
if (res_error) {
|
|
1078
|
+
Logger({
|
|
1079
|
+
level: "WARN",
|
|
1080
|
+
message: "Response Validation Warnnings for updateCart",
|
|
1081
|
+
});
|
|
1082
|
+
Logger({ level: "WARN", message: res_error });
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
return response;
|
|
692
1086
|
}
|
|
693
1087
|
|
|
694
1088
|
/**
|
|
695
1089
|
* @param {Object} arg - Arg object.
|
|
696
|
-
* @param {
|
|
697
|
-
* @
|
|
698
|
-
* @
|
|
1090
|
+
* @param {string} arg.id -
|
|
1091
|
+
* @param {CouponUpdate} arg.body
|
|
1092
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
1093
|
+
* @summary: Update existing coupon configuration
|
|
1094
|
+
* @description: Update coupon with id sent in `id`
|
|
699
1095
|
*/
|
|
700
|
-
|
|
701
|
-
const { error } = CartValidator.
|
|
1096
|
+
async updateCoupon({ id, body } = {}) {
|
|
1097
|
+
const { error } = CartValidator.updateCoupon().validate(
|
|
702
1098
|
{
|
|
1099
|
+
id,
|
|
703
1100
|
body,
|
|
704
1101
|
},
|
|
705
1102
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -709,164 +1106,60 @@ class Cart {
|
|
|
709
1106
|
}
|
|
710
1107
|
|
|
711
1108
|
// Showing warrnings if extra unknown parameters are found
|
|
712
|
-
const { error: warrning } = CartValidator.
|
|
1109
|
+
const { error: warrning } = CartValidator.updateCoupon().validate(
|
|
713
1110
|
{
|
|
1111
|
+
id,
|
|
714
1112
|
body,
|
|
715
1113
|
},
|
|
716
1114
|
{ abortEarly: false, allowUnknown: false }
|
|
717
1115
|
);
|
|
718
1116
|
if (warrning) {
|
|
719
|
-
|
|
720
|
-
|
|
1117
|
+
Logger({
|
|
1118
|
+
level: "WARN",
|
|
1119
|
+
message: "Parameter Validation warrnings for updateCoupon",
|
|
1120
|
+
});
|
|
1121
|
+
Logger({ level: "WARN", message: warrning });
|
|
721
1122
|
}
|
|
722
1123
|
|
|
723
1124
|
const query_params = {};
|
|
724
1125
|
|
|
725
|
-
|
|
1126
|
+
const response = await PlatformAPIClient.execute(
|
|
726
1127
|
this.config,
|
|
727
|
-
"
|
|
728
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1128
|
+
"put",
|
|
1129
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
729
1130
|
query_params,
|
|
730
1131
|
body
|
|
731
1132
|
);
|
|
732
|
-
}
|
|
733
1133
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
* @param {string} [arg.fromDate] -
|
|
739
|
-
* @param {string} [arg.toDate] -
|
|
740
|
-
* @param {boolean} [arg.anonymousCart] -
|
|
741
|
-
* @param {string} [arg.lastId] -
|
|
742
|
-
* @param {string} [arg.sortOn] -
|
|
743
|
-
* @summary: Get with abandoned cart list
|
|
744
|
-
* @description: Get abandoned cart list with pagination
|
|
745
|
-
*/
|
|
746
|
-
getAbandonedCart({
|
|
747
|
-
pageNo,
|
|
748
|
-
pageSize,
|
|
749
|
-
fromDate,
|
|
750
|
-
toDate,
|
|
751
|
-
anonymousCart,
|
|
752
|
-
lastId,
|
|
753
|
-
sortOn,
|
|
754
|
-
} = {}) {
|
|
755
|
-
const { error } = CartValidator.getAbandonedCart().validate(
|
|
756
|
-
{
|
|
757
|
-
pageNo,
|
|
758
|
-
pageSize,
|
|
759
|
-
fromDate,
|
|
760
|
-
toDate,
|
|
761
|
-
anonymousCart,
|
|
762
|
-
lastId,
|
|
763
|
-
sortOn,
|
|
764
|
-
},
|
|
765
|
-
{ abortEarly: false, allowUnknown: true }
|
|
766
|
-
);
|
|
767
|
-
if (error) {
|
|
768
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
769
|
-
}
|
|
1134
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
1135
|
+
abortEarly: false,
|
|
1136
|
+
allowUnknown: false,
|
|
1137
|
+
});
|
|
770
1138
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
toDate,
|
|
778
|
-
anonymousCart,
|
|
779
|
-
lastId,
|
|
780
|
-
sortOn,
|
|
781
|
-
},
|
|
782
|
-
{ abortEarly: false, allowUnknown: false }
|
|
783
|
-
);
|
|
784
|
-
if (warrning) {
|
|
785
|
-
console.log("Parameter Validation warrnings for getAbandonedCart");
|
|
786
|
-
console.log(warrning);
|
|
1139
|
+
if (res_error) {
|
|
1140
|
+
Logger({
|
|
1141
|
+
level: "WARN",
|
|
1142
|
+
message: "Response Validation Warnnings for updateCoupon",
|
|
1143
|
+
});
|
|
1144
|
+
Logger({ level: "WARN", message: res_error });
|
|
787
1145
|
}
|
|
788
1146
|
|
|
789
|
-
|
|
790
|
-
query_params["page_no"] = pageNo;
|
|
791
|
-
query_params["page_size"] = pageSize;
|
|
792
|
-
query_params["from_date"] = fromDate;
|
|
793
|
-
query_params["to_date"] = toDate;
|
|
794
|
-
query_params["anonymous_cart"] = anonymousCart;
|
|
795
|
-
query_params["last_id"] = lastId;
|
|
796
|
-
query_params["sort_on"] = sortOn;
|
|
797
|
-
|
|
798
|
-
return PlatformAPIClient.execute(
|
|
799
|
-
this.config,
|
|
800
|
-
"get",
|
|
801
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts`,
|
|
802
|
-
query_params,
|
|
803
|
-
undefined
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* @param {Object} arg - Arg object.
|
|
809
|
-
* @param {string} arg.companyId - Current company id
|
|
810
|
-
* @param {string} arg.applicationId - Current Application _id
|
|
811
|
-
* @param {number} [arg.pageSize] -
|
|
812
|
-
* @param {string} [arg.fromDate] -
|
|
813
|
-
* @param {string} [arg.toDate] -
|
|
814
|
-
* @param {boolean} [arg.anonymousCart] -
|
|
815
|
-
* @param {string} [arg.lastId] -
|
|
816
|
-
* @param {string} [arg.sortOn] -
|
|
817
|
-
* @summary: Get with abandoned cart list
|
|
818
|
-
* @description: Get abandoned cart list with pagination
|
|
819
|
-
*/
|
|
820
|
-
getAbandonedCartPaginator({
|
|
821
|
-
companyId,
|
|
822
|
-
applicationId,
|
|
823
|
-
pageSize,
|
|
824
|
-
fromDate,
|
|
825
|
-
toDate,
|
|
826
|
-
anonymousCart,
|
|
827
|
-
lastId,
|
|
828
|
-
sortOn,
|
|
829
|
-
} = {}) {
|
|
830
|
-
const paginator = new Paginator();
|
|
831
|
-
const callback = async () => {
|
|
832
|
-
const pageId = paginator.nextId;
|
|
833
|
-
const pageNo = paginator.pageNo;
|
|
834
|
-
const pageType = "number";
|
|
835
|
-
const data = await this.getAbandonedCart({
|
|
836
|
-
companyId: companyId,
|
|
837
|
-
applicationId: applicationId,
|
|
838
|
-
pageNo: pageNo,
|
|
839
|
-
pageSize: pageSize,
|
|
840
|
-
fromDate: fromDate,
|
|
841
|
-
toDate: toDate,
|
|
842
|
-
anonymousCart: anonymousCart,
|
|
843
|
-
lastId: lastId,
|
|
844
|
-
sortOn: sortOn,
|
|
845
|
-
});
|
|
846
|
-
paginator.setPaginator({
|
|
847
|
-
hasNext: data.page.has_next ? true : false,
|
|
848
|
-
nextId: data.page.next_id,
|
|
849
|
-
});
|
|
850
|
-
return data;
|
|
851
|
-
};
|
|
852
|
-
paginator.setCallback(callback.bind(this));
|
|
853
|
-
return paginator;
|
|
1147
|
+
return response;
|
|
854
1148
|
}
|
|
855
1149
|
|
|
856
1150
|
/**
|
|
857
1151
|
* @param {Object} arg - Arg object.
|
|
858
|
-
* @param {string}
|
|
859
|
-
* @param {
|
|
860
|
-
* @
|
|
861
|
-
* @summary:
|
|
862
|
-
* @description:
|
|
1152
|
+
* @param {string} arg.id -
|
|
1153
|
+
* @param {CouponPartialUpdate} arg.body
|
|
1154
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
1155
|
+
* @summary: Update coupon archive state and schedule
|
|
1156
|
+
* @description: Update archive/unarchive and change schedule for coupon
|
|
863
1157
|
*/
|
|
864
|
-
|
|
865
|
-
const { error } = CartValidator.
|
|
1158
|
+
async updateCouponPartially({ id, body } = {}) {
|
|
1159
|
+
const { error } = CartValidator.updateCouponPartially().validate(
|
|
866
1160
|
{
|
|
867
1161
|
id,
|
|
868
|
-
|
|
869
|
-
b,
|
|
1162
|
+
body,
|
|
870
1163
|
},
|
|
871
1164
|
{ abortEarly: false, allowUnknown: true }
|
|
872
1165
|
);
|
|
@@ -875,49 +1168,60 @@ class Cart {
|
|
|
875
1168
|
}
|
|
876
1169
|
|
|
877
1170
|
// Showing warrnings if extra unknown parameters are found
|
|
878
|
-
const {
|
|
879
|
-
error: warrning,
|
|
880
|
-
} = CartValidator.getAbandonedCartDetails().validate(
|
|
1171
|
+
const { error: warrning } = CartValidator.updateCouponPartially().validate(
|
|
881
1172
|
{
|
|
882
1173
|
id,
|
|
883
|
-
|
|
884
|
-
b,
|
|
1174
|
+
body,
|
|
885
1175
|
},
|
|
886
1176
|
{ abortEarly: false, allowUnknown: false }
|
|
887
1177
|
);
|
|
888
1178
|
if (warrning) {
|
|
889
|
-
|
|
890
|
-
|
|
1179
|
+
Logger({
|
|
1180
|
+
level: "WARN",
|
|
1181
|
+
message: "Parameter Validation warrnings for updateCouponPartially",
|
|
1182
|
+
});
|
|
1183
|
+
Logger({ level: "WARN", message: warrning });
|
|
891
1184
|
}
|
|
892
1185
|
|
|
893
1186
|
const query_params = {};
|
|
894
|
-
query_params["id"] = id;
|
|
895
|
-
query_params["i"] = i;
|
|
896
|
-
query_params["b"] = b;
|
|
897
1187
|
|
|
898
|
-
|
|
1188
|
+
const response = await PlatformAPIClient.execute(
|
|
899
1189
|
this.config,
|
|
900
|
-
"
|
|
901
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1190
|
+
"patch",
|
|
1191
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
902
1192
|
query_params,
|
|
903
|
-
|
|
1193
|
+
body
|
|
904
1194
|
);
|
|
1195
|
+
|
|
1196
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
1197
|
+
abortEarly: false,
|
|
1198
|
+
allowUnknown: false,
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
if (res_error) {
|
|
1202
|
+
Logger({
|
|
1203
|
+
level: "WARN",
|
|
1204
|
+
message: "Response Validation Warnnings for updateCouponPartially",
|
|
1205
|
+
});
|
|
1206
|
+
Logger({ level: "WARN", message: res_error });
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
return response;
|
|
905
1210
|
}
|
|
906
1211
|
|
|
907
1212
|
/**
|
|
908
1213
|
* @param {Object} arg - Arg object.
|
|
909
|
-
* @param {string} arg.
|
|
910
|
-
* @param {
|
|
911
|
-
* @
|
|
912
|
-
* @summary:
|
|
913
|
-
* @description:
|
|
1214
|
+
* @param {string} arg.id -
|
|
1215
|
+
* @param {PromotionUpdate} arg.body
|
|
1216
|
+
* @returns {Promise<PromotionUpdate>} - Success response
|
|
1217
|
+
* @summary: Update existing promotion configuration
|
|
1218
|
+
* @description: Update promotion with id sent in `id`
|
|
914
1219
|
*/
|
|
915
|
-
|
|
916
|
-
const { error } = CartValidator.
|
|
1220
|
+
async updatePromotion({ id, body } = {}) {
|
|
1221
|
+
const { error } = CartValidator.updatePromotion().validate(
|
|
917
1222
|
{
|
|
918
|
-
|
|
1223
|
+
id,
|
|
919
1224
|
body,
|
|
920
|
-
b,
|
|
921
1225
|
},
|
|
922
1226
|
{ abortEarly: false, allowUnknown: true }
|
|
923
1227
|
);
|
|
@@ -926,45 +1230,60 @@ class Cart {
|
|
|
926
1230
|
}
|
|
927
1231
|
|
|
928
1232
|
// Showing warrnings if extra unknown parameters are found
|
|
929
|
-
const { error: warrning } = CartValidator.
|
|
1233
|
+
const { error: warrning } = CartValidator.updatePromotion().validate(
|
|
930
1234
|
{
|
|
931
|
-
|
|
1235
|
+
id,
|
|
932
1236
|
body,
|
|
933
|
-
b,
|
|
934
1237
|
},
|
|
935
1238
|
{ abortEarly: false, allowUnknown: false }
|
|
936
1239
|
);
|
|
937
1240
|
if (warrning) {
|
|
938
|
-
|
|
939
|
-
|
|
1241
|
+
Logger({
|
|
1242
|
+
level: "WARN",
|
|
1243
|
+
message: "Parameter Validation warrnings for updatePromotion",
|
|
1244
|
+
});
|
|
1245
|
+
Logger({ level: "WARN", message: warrning });
|
|
940
1246
|
}
|
|
941
1247
|
|
|
942
1248
|
const query_params = {};
|
|
943
|
-
query_params["b"] = b;
|
|
944
1249
|
|
|
945
|
-
|
|
1250
|
+
const response = await PlatformAPIClient.execute(
|
|
946
1251
|
this.config,
|
|
947
|
-
"
|
|
948
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1252
|
+
"put",
|
|
1253
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
949
1254
|
query_params,
|
|
950
1255
|
body
|
|
951
1256
|
);
|
|
1257
|
+
|
|
1258
|
+
const { error: res_error } = CartModel.PromotionUpdate().validate(
|
|
1259
|
+
response,
|
|
1260
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1261
|
+
);
|
|
1262
|
+
|
|
1263
|
+
if (res_error) {
|
|
1264
|
+
Logger({
|
|
1265
|
+
level: "WARN",
|
|
1266
|
+
message: "Response Validation Warnnings for updatePromotion",
|
|
1267
|
+
});
|
|
1268
|
+
Logger({ level: "WARN", message: res_error });
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
return response;
|
|
952
1272
|
}
|
|
953
1273
|
|
|
954
1274
|
/**
|
|
955
1275
|
* @param {Object} arg - Arg object.
|
|
956
|
-
* @param {string} arg.
|
|
957
|
-
* @param {
|
|
958
|
-
* @
|
|
959
|
-
* @summary: Update
|
|
960
|
-
* @description:
|
|
1276
|
+
* @param {string} arg.id -
|
|
1277
|
+
* @param {PromotionPartialUpdate} arg.body
|
|
1278
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
1279
|
+
* @summary: Update promotion publish state and schedule
|
|
1280
|
+
* @description: Update publish/unpublish and change schedule for promotion
|
|
961
1281
|
*/
|
|
962
|
-
|
|
963
|
-
const { error } = CartValidator.
|
|
1282
|
+
async updatePromotionPartially({ id, body } = {}) {
|
|
1283
|
+
const { error } = CartValidator.updatePromotionPartially().validate(
|
|
964
1284
|
{
|
|
965
|
-
|
|
1285
|
+
id,
|
|
966
1286
|
body,
|
|
967
|
-
b,
|
|
968
1287
|
},
|
|
969
1288
|
{ abortEarly: false, allowUnknown: true }
|
|
970
1289
|
);
|
|
@@ -973,29 +1292,47 @@ class Cart {
|
|
|
973
1292
|
}
|
|
974
1293
|
|
|
975
1294
|
// Showing warrnings if extra unknown parameters are found
|
|
976
|
-
const {
|
|
1295
|
+
const {
|
|
1296
|
+
error: warrning,
|
|
1297
|
+
} = CartValidator.updatePromotionPartially().validate(
|
|
977
1298
|
{
|
|
978
|
-
|
|
1299
|
+
id,
|
|
979
1300
|
body,
|
|
980
|
-
b,
|
|
981
1301
|
},
|
|
982
1302
|
{ abortEarly: false, allowUnknown: false }
|
|
983
1303
|
);
|
|
984
1304
|
if (warrning) {
|
|
985
|
-
|
|
986
|
-
|
|
1305
|
+
Logger({
|
|
1306
|
+
level: "WARN",
|
|
1307
|
+
message: "Parameter Validation warrnings for updatePromotionPartially",
|
|
1308
|
+
});
|
|
1309
|
+
Logger({ level: "WARN", message: warrning });
|
|
987
1310
|
}
|
|
988
1311
|
|
|
989
1312
|
const query_params = {};
|
|
990
|
-
query_params["b"] = b;
|
|
991
1313
|
|
|
992
|
-
|
|
1314
|
+
const response = await PlatformAPIClient.execute(
|
|
993
1315
|
this.config,
|
|
994
|
-
"
|
|
995
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1316
|
+
"patch",
|
|
1317
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
996
1318
|
query_params,
|
|
997
1319
|
body
|
|
998
1320
|
);
|
|
1321
|
+
|
|
1322
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
1323
|
+
abortEarly: false,
|
|
1324
|
+
allowUnknown: false,
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
if (res_error) {
|
|
1328
|
+
Logger({
|
|
1329
|
+
level: "WARN",
|
|
1330
|
+
message: "Response Validation Warnnings for updatePromotionPartially",
|
|
1331
|
+
});
|
|
1332
|
+
Logger({ level: "WARN", message: res_error });
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
return response;
|
|
999
1336
|
}
|
|
1000
1337
|
}
|
|
1001
1338
|
module.exports = Cart;
|