@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 CartValidator = require("./CartPlatformApplicationValidator");
|
|
5
5
|
const CartModel = require("./CartPlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class Cart {
|
|
9
10
|
constructor(config, applicationId) {
|
|
@@ -13,38 +14,19 @@ class Cart {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {Object} arg - Arg object.
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @param {string} [arg.typeSlug] -
|
|
23
|
-
* @param {string} [arg.code] -
|
|
24
|
-
* @returns {Promise<CouponsResponse>} - Success response
|
|
25
|
-
* @summary: Get with single coupon details or coupon list
|
|
26
|
-
* @description: Get coupon list with pagination
|
|
17
|
+
* @param {string} arg.cartId - Current Cart _id
|
|
18
|
+
* @param {boolean} [arg.b] -
|
|
19
|
+
* @param {AddCartRequest} arg.body
|
|
20
|
+
* @returns {Promise<AddCartDetailResponse>} - Success response
|
|
21
|
+
* @summary: Add items to abandoned cart
|
|
22
|
+
* @description: Use this API to add items to the abandoned cart.
|
|
27
23
|
*/
|
|
28
|
-
async
|
|
29
|
-
|
|
30
|
-
pageSize,
|
|
31
|
-
isArchived,
|
|
32
|
-
title,
|
|
33
|
-
isPublic,
|
|
34
|
-
isDisplay,
|
|
35
|
-
typeSlug,
|
|
36
|
-
code,
|
|
37
|
-
} = {}) {
|
|
38
|
-
const { error } = CartValidator.getCoupons().validate(
|
|
24
|
+
async addItems({ cartId, body, b } = {}) {
|
|
25
|
+
const { error } = CartValidator.addItems().validate(
|
|
39
26
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
title,
|
|
44
|
-
isPublic,
|
|
45
|
-
isDisplay,
|
|
46
|
-
typeSlug,
|
|
47
|
-
code,
|
|
27
|
+
cartId,
|
|
28
|
+
body,
|
|
29
|
+
b,
|
|
48
30
|
},
|
|
49
31
|
{ abortEarly: false, allowUnknown: true }
|
|
50
32
|
);
|
|
@@ -53,54 +35,44 @@ class Cart {
|
|
|
53
35
|
}
|
|
54
36
|
|
|
55
37
|
// Showing warrnings if extra unknown parameters are found
|
|
56
|
-
const { error: warrning } = CartValidator.
|
|
38
|
+
const { error: warrning } = CartValidator.addItems().validate(
|
|
57
39
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
title,
|
|
62
|
-
isPublic,
|
|
63
|
-
isDisplay,
|
|
64
|
-
typeSlug,
|
|
65
|
-
code,
|
|
40
|
+
cartId,
|
|
41
|
+
body,
|
|
42
|
+
b,
|
|
66
43
|
},
|
|
67
44
|
{ abortEarly: false, allowUnknown: false }
|
|
68
45
|
);
|
|
69
46
|
if (warrning) {
|
|
70
47
|
Logger({
|
|
71
48
|
level: "WARN",
|
|
72
|
-
message: "Parameter Validation warrnings for
|
|
49
|
+
message: "Parameter Validation warrnings for addItems",
|
|
73
50
|
});
|
|
74
51
|
Logger({ level: "WARN", message: warrning });
|
|
75
52
|
}
|
|
76
53
|
|
|
77
54
|
const query_params = {};
|
|
78
|
-
query_params["
|
|
79
|
-
query_params["page_size"] = pageSize;
|
|
80
|
-
query_params["is_archived"] = isArchived;
|
|
81
|
-
query_params["title"] = title;
|
|
82
|
-
query_params["is_public"] = isPublic;
|
|
83
|
-
query_params["is_display"] = isDisplay;
|
|
84
|
-
query_params["type_slug"] = typeSlug;
|
|
85
|
-
query_params["code"] = code;
|
|
55
|
+
query_params["b"] = b;
|
|
86
56
|
|
|
87
57
|
const response = await PlatformAPIClient.execute(
|
|
88
58
|
this.config,
|
|
89
|
-
"
|
|
90
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
59
|
+
"post",
|
|
60
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts/${cartId}`,
|
|
91
61
|
query_params,
|
|
92
|
-
|
|
62
|
+
body
|
|
93
63
|
);
|
|
94
64
|
|
|
95
|
-
const {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
65
|
+
const {
|
|
66
|
+
error: res_error,
|
|
67
|
+
} = CartModel.AddCartDetailResponse().validate(response, {
|
|
68
|
+
abortEarly: false,
|
|
69
|
+
allowUnknown: false,
|
|
70
|
+
});
|
|
99
71
|
|
|
100
72
|
if (res_error) {
|
|
101
73
|
Logger({
|
|
102
74
|
level: "WARN",
|
|
103
|
-
message: "Response Validation Warnnings for
|
|
75
|
+
message: "Response Validation Warnnings for addItems",
|
|
104
76
|
});
|
|
105
77
|
Logger({ level: "WARN", message: res_error });
|
|
106
78
|
}
|
|
@@ -110,65 +82,13 @@ class Cart {
|
|
|
110
82
|
|
|
111
83
|
/**
|
|
112
84
|
* @param {Object} arg - Arg object.
|
|
113
|
-
* @param {
|
|
114
|
-
* @
|
|
115
|
-
* @
|
|
116
|
-
* @
|
|
117
|
-
* @param {string} [arg.title] -
|
|
118
|
-
* @param {boolean} [arg.isPublic] -
|
|
119
|
-
* @param {boolean} [arg.isDisplay] -
|
|
120
|
-
* @param {string} [arg.typeSlug] -
|
|
121
|
-
* @param {string} [arg.code] -
|
|
122
|
-
* @summary: Get with single coupon details or coupon list
|
|
123
|
-
* @description: Get coupon list with pagination
|
|
124
|
-
*/
|
|
125
|
-
getCouponsPaginator({
|
|
126
|
-
companyId,
|
|
127
|
-
applicationId,
|
|
128
|
-
pageSize,
|
|
129
|
-
isArchived,
|
|
130
|
-
title,
|
|
131
|
-
isPublic,
|
|
132
|
-
isDisplay,
|
|
133
|
-
typeSlug,
|
|
134
|
-
code,
|
|
135
|
-
} = {}) {
|
|
136
|
-
const paginator = new Paginator();
|
|
137
|
-
const callback = async () => {
|
|
138
|
-
const pageId = paginator.nextId;
|
|
139
|
-
const pageNo = paginator.pageNo;
|
|
140
|
-
const pageType = "number";
|
|
141
|
-
const data = await this.getCoupons({
|
|
142
|
-
companyId: companyId,
|
|
143
|
-
applicationId: applicationId,
|
|
144
|
-
pageNo: pageNo,
|
|
145
|
-
pageSize: pageSize,
|
|
146
|
-
isArchived: isArchived,
|
|
147
|
-
title: title,
|
|
148
|
-
isPublic: isPublic,
|
|
149
|
-
isDisplay: isDisplay,
|
|
150
|
-
typeSlug: typeSlug,
|
|
151
|
-
code: code,
|
|
152
|
-
});
|
|
153
|
-
paginator.setPaginator({
|
|
154
|
-
hasNext: data.page.has_next ? true : false,
|
|
155
|
-
nextId: data.page.next_id,
|
|
156
|
-
});
|
|
157
|
-
return data;
|
|
158
|
-
};
|
|
159
|
-
paginator.setCallback(callback.bind(this));
|
|
160
|
-
return paginator;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* @param {Object} arg - Arg object.
|
|
165
|
-
* @param {CouponAdd} arg.body
|
|
166
|
-
* @returns {Promise<SuccessMessage>} - Success response
|
|
167
|
-
* @summary: Create new coupon
|
|
168
|
-
* @description: Create new coupon
|
|
85
|
+
* @param {OpenApiCartServiceabilityRequest} arg.body
|
|
86
|
+
* @returns {Promise<OpenApiCartServiceabilityResponse>} - Success response
|
|
87
|
+
* @summary: Check Pincode Serviceability
|
|
88
|
+
* @description: Check Pincode serviceability for cart items provided in `cart_items` and address pincode in `shipping_address`
|
|
169
89
|
*/
|
|
170
|
-
async
|
|
171
|
-
const { error } = CartValidator.
|
|
90
|
+
async checkCartServiceability({ body } = {}) {
|
|
91
|
+
const { error } = CartValidator.checkCartServiceability().validate(
|
|
172
92
|
{
|
|
173
93
|
body,
|
|
174
94
|
},
|
|
@@ -179,7 +99,9 @@ class Cart {
|
|
|
179
99
|
}
|
|
180
100
|
|
|
181
101
|
// Showing warrnings if extra unknown parameters are found
|
|
182
|
-
const {
|
|
102
|
+
const {
|
|
103
|
+
error: warrning,
|
|
104
|
+
} = CartValidator.checkCartServiceability().validate(
|
|
183
105
|
{
|
|
184
106
|
body,
|
|
185
107
|
},
|
|
@@ -188,7 +110,7 @@ class Cart {
|
|
|
188
110
|
if (warrning) {
|
|
189
111
|
Logger({
|
|
190
112
|
level: "WARN",
|
|
191
|
-
message: "Parameter Validation warrnings for
|
|
113
|
+
message: "Parameter Validation warrnings for checkCartServiceability",
|
|
192
114
|
});
|
|
193
115
|
Logger({ level: "WARN", message: warrning });
|
|
194
116
|
}
|
|
@@ -198,12 +120,14 @@ class Cart {
|
|
|
198
120
|
const response = await PlatformAPIClient.execute(
|
|
199
121
|
this.config,
|
|
200
122
|
"post",
|
|
201
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
123
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/serviceability`,
|
|
202
124
|
query_params,
|
|
203
125
|
body
|
|
204
126
|
);
|
|
205
127
|
|
|
206
|
-
const {
|
|
128
|
+
const {
|
|
129
|
+
error: res_error,
|
|
130
|
+
} = CartModel.OpenApiCartServiceabilityResponse().validate(response, {
|
|
207
131
|
abortEarly: false,
|
|
208
132
|
allowUnknown: false,
|
|
209
133
|
});
|
|
@@ -211,7 +135,7 @@ class Cart {
|
|
|
211
135
|
if (res_error) {
|
|
212
136
|
Logger({
|
|
213
137
|
level: "WARN",
|
|
214
|
-
message: "Response Validation Warnnings for
|
|
138
|
+
message: "Response Validation Warnnings for checkCartServiceability",
|
|
215
139
|
});
|
|
216
140
|
Logger({ level: "WARN", message: res_error });
|
|
217
141
|
}
|
|
@@ -221,15 +145,15 @@ class Cart {
|
|
|
221
145
|
|
|
222
146
|
/**
|
|
223
147
|
* @param {Object} arg - Arg object.
|
|
224
|
-
* @param {
|
|
225
|
-
* @returns {Promise<
|
|
226
|
-
* @summary:
|
|
227
|
-
* @description:
|
|
148
|
+
* @param {OpenApiPlatformCheckoutReq} arg.body
|
|
149
|
+
* @returns {Promise<OpenApiCheckoutResponse>} - Success response
|
|
150
|
+
* @summary: Create Fynd order with cart details
|
|
151
|
+
* @description: Generate Fynd order for cart details send with provided `cart_items`
|
|
228
152
|
*/
|
|
229
|
-
async
|
|
230
|
-
const { error } = CartValidator.
|
|
153
|
+
async checkoutCart({ body } = {}) {
|
|
154
|
+
const { error } = CartValidator.checkoutCart().validate(
|
|
231
155
|
{
|
|
232
|
-
|
|
156
|
+
body,
|
|
233
157
|
},
|
|
234
158
|
{ abortEarly: false, allowUnknown: true }
|
|
235
159
|
);
|
|
@@ -238,16 +162,16 @@ class Cart {
|
|
|
238
162
|
}
|
|
239
163
|
|
|
240
164
|
// Showing warrnings if extra unknown parameters are found
|
|
241
|
-
const { error: warrning } = CartValidator.
|
|
165
|
+
const { error: warrning } = CartValidator.checkoutCart().validate(
|
|
242
166
|
{
|
|
243
|
-
|
|
167
|
+
body,
|
|
244
168
|
},
|
|
245
169
|
{ abortEarly: false, allowUnknown: false }
|
|
246
170
|
);
|
|
247
171
|
if (warrning) {
|
|
248
172
|
Logger({
|
|
249
173
|
level: "WARN",
|
|
250
|
-
message: "Parameter Validation warrnings for
|
|
174
|
+
message: "Parameter Validation warrnings for checkoutCart",
|
|
251
175
|
});
|
|
252
176
|
Logger({ level: "WARN", message: warrning });
|
|
253
177
|
}
|
|
@@ -256,13 +180,15 @@ class Cart {
|
|
|
256
180
|
|
|
257
181
|
const response = await PlatformAPIClient.execute(
|
|
258
182
|
this.config,
|
|
259
|
-
"
|
|
260
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
183
|
+
"post",
|
|
184
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/checkout`,
|
|
261
185
|
query_params,
|
|
262
|
-
|
|
186
|
+
body
|
|
263
187
|
);
|
|
264
188
|
|
|
265
|
-
const {
|
|
189
|
+
const {
|
|
190
|
+
error: res_error,
|
|
191
|
+
} = CartModel.OpenApiCheckoutResponse().validate(response, {
|
|
266
192
|
abortEarly: false,
|
|
267
193
|
allowUnknown: false,
|
|
268
194
|
});
|
|
@@ -270,7 +196,7 @@ class Cart {
|
|
|
270
196
|
if (res_error) {
|
|
271
197
|
Logger({
|
|
272
198
|
level: "WARN",
|
|
273
|
-
message: "Response Validation Warnnings for
|
|
199
|
+
message: "Response Validation Warnnings for checkoutCart",
|
|
274
200
|
});
|
|
275
201
|
Logger({ level: "WARN", message: res_error });
|
|
276
202
|
}
|
|
@@ -280,16 +206,14 @@ class Cart {
|
|
|
280
206
|
|
|
281
207
|
/**
|
|
282
208
|
* @param {Object} arg - Arg object.
|
|
283
|
-
* @param {
|
|
284
|
-
* @param {CouponUpdate} arg.body
|
|
209
|
+
* @param {CouponAdd} arg.body
|
|
285
210
|
* @returns {Promise<SuccessMessage>} - Success response
|
|
286
|
-
* @summary:
|
|
287
|
-
* @description:
|
|
211
|
+
* @summary: Create new coupon
|
|
212
|
+
* @description: Create new coupon
|
|
288
213
|
*/
|
|
289
|
-
async
|
|
290
|
-
const { error } = CartValidator.
|
|
214
|
+
async createCoupon({ body } = {}) {
|
|
215
|
+
const { error } = CartValidator.createCoupon().validate(
|
|
291
216
|
{
|
|
292
|
-
id,
|
|
293
217
|
body,
|
|
294
218
|
},
|
|
295
219
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -299,9 +223,8 @@ class Cart {
|
|
|
299
223
|
}
|
|
300
224
|
|
|
301
225
|
// Showing warrnings if extra unknown parameters are found
|
|
302
|
-
const { error: warrning } = CartValidator.
|
|
226
|
+
const { error: warrning } = CartValidator.createCoupon().validate(
|
|
303
227
|
{
|
|
304
|
-
id,
|
|
305
228
|
body,
|
|
306
229
|
},
|
|
307
230
|
{ abortEarly: false, allowUnknown: false }
|
|
@@ -309,7 +232,7 @@ class Cart {
|
|
|
309
232
|
if (warrning) {
|
|
310
233
|
Logger({
|
|
311
234
|
level: "WARN",
|
|
312
|
-
message: "Parameter Validation warrnings for
|
|
235
|
+
message: "Parameter Validation warrnings for createCoupon",
|
|
313
236
|
});
|
|
314
237
|
Logger({ level: "WARN", message: warrning });
|
|
315
238
|
}
|
|
@@ -318,8 +241,8 @@ class Cart {
|
|
|
318
241
|
|
|
319
242
|
const response = await PlatformAPIClient.execute(
|
|
320
243
|
this.config,
|
|
321
|
-
"
|
|
322
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon
|
|
244
|
+
"post",
|
|
245
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon`,
|
|
323
246
|
query_params,
|
|
324
247
|
body
|
|
325
248
|
);
|
|
@@ -332,7 +255,7 @@ class Cart {
|
|
|
332
255
|
if (res_error) {
|
|
333
256
|
Logger({
|
|
334
257
|
level: "WARN",
|
|
335
|
-
message: "Response Validation Warnnings for
|
|
258
|
+
message: "Response Validation Warnnings for createCoupon",
|
|
336
259
|
});
|
|
337
260
|
Logger({ level: "WARN", message: res_error });
|
|
338
261
|
}
|
|
@@ -342,16 +265,14 @@ class Cart {
|
|
|
342
265
|
|
|
343
266
|
/**
|
|
344
267
|
* @param {Object} arg - Arg object.
|
|
345
|
-
* @param {
|
|
346
|
-
* @
|
|
347
|
-
* @
|
|
348
|
-
* @
|
|
349
|
-
* @description: Update archive/unarchive and change schedule for coupon
|
|
268
|
+
* @param {PromotionAdd} arg.body
|
|
269
|
+
* @returns {Promise<PromotionAdd>} - Success response
|
|
270
|
+
* @summary: Create new promotion
|
|
271
|
+
* @description: Create new promotion
|
|
350
272
|
*/
|
|
351
|
-
async
|
|
352
|
-
const { error } = CartValidator.
|
|
273
|
+
async createPromotion({ body } = {}) {
|
|
274
|
+
const { error } = CartValidator.createPromotion().validate(
|
|
353
275
|
{
|
|
354
|
-
id,
|
|
355
276
|
body,
|
|
356
277
|
},
|
|
357
278
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -361,9 +282,8 @@ class Cart {
|
|
|
361
282
|
}
|
|
362
283
|
|
|
363
284
|
// Showing warrnings if extra unknown parameters are found
|
|
364
|
-
const { error: warrning } = CartValidator.
|
|
285
|
+
const { error: warrning } = CartValidator.createPromotion().validate(
|
|
365
286
|
{
|
|
366
|
-
id,
|
|
367
287
|
body,
|
|
368
288
|
},
|
|
369
289
|
{ abortEarly: false, allowUnknown: false }
|
|
@@ -371,7 +291,7 @@ class Cart {
|
|
|
371
291
|
if (warrning) {
|
|
372
292
|
Logger({
|
|
373
293
|
level: "WARN",
|
|
374
|
-
message: "Parameter Validation warrnings for
|
|
294
|
+
message: "Parameter Validation warrnings for createPromotion",
|
|
375
295
|
});
|
|
376
296
|
Logger({ level: "WARN", message: warrning });
|
|
377
297
|
}
|
|
@@ -380,13 +300,13 @@ class Cart {
|
|
|
380
300
|
|
|
381
301
|
const response = await PlatformAPIClient.execute(
|
|
382
302
|
this.config,
|
|
383
|
-
"
|
|
384
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
303
|
+
"post",
|
|
304
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion`,
|
|
385
305
|
query_params,
|
|
386
306
|
body
|
|
387
307
|
);
|
|
388
308
|
|
|
389
|
-
const { error: res_error } = CartModel.
|
|
309
|
+
const { error: res_error } = CartModel.PromotionAdd().validate(response, {
|
|
390
310
|
abortEarly: false,
|
|
391
311
|
allowUnknown: false,
|
|
392
312
|
});
|
|
@@ -394,7 +314,7 @@ class Cart {
|
|
|
394
314
|
if (res_error) {
|
|
395
315
|
Logger({
|
|
396
316
|
level: "WARN",
|
|
397
|
-
message: "Response Validation Warnnings for
|
|
317
|
+
message: "Response Validation Warnnings for createPromotion",
|
|
398
318
|
});
|
|
399
319
|
Logger({ level: "WARN", message: res_error });
|
|
400
320
|
}
|
|
@@ -404,38 +324,98 @@ class Cart {
|
|
|
404
324
|
|
|
405
325
|
/**
|
|
406
326
|
* @param {Object} arg - Arg object.
|
|
407
|
-
* @param {
|
|
408
|
-
* @
|
|
409
|
-
* @
|
|
410
|
-
* @
|
|
411
|
-
* @param {string} [arg.promoGroup] -
|
|
412
|
-
* @param {string} [arg.promotionType] -
|
|
413
|
-
* @param {string} [arg.fpPanel] -
|
|
414
|
-
* @param {string} [arg.promotionId] -
|
|
415
|
-
* @returns {Promise<PromotionsResponse>} - Success response
|
|
416
|
-
* @summary: Get promotion list
|
|
417
|
-
* @description: Get promotion list with pagination
|
|
327
|
+
* @param {OpenapiCartDetailsRequest} arg.body
|
|
328
|
+
* @returns {Promise<OpenapiCartDetailsResponse>} - Success response
|
|
329
|
+
* @summary: Fetch Cart Details
|
|
330
|
+
* @description: Get all the details of cart for a list of provided `cart_items`
|
|
418
331
|
*/
|
|
419
|
-
async
|
|
332
|
+
async fetchAndvalidateCartItems({ body } = {}) {
|
|
333
|
+
const { error } = CartValidator.fetchAndvalidateCartItems().validate(
|
|
334
|
+
{
|
|
335
|
+
body,
|
|
336
|
+
},
|
|
337
|
+
{ abortEarly: false, allowUnknown: true }
|
|
338
|
+
);
|
|
339
|
+
if (error) {
|
|
340
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Showing warrnings if extra unknown parameters are found
|
|
344
|
+
const {
|
|
345
|
+
error: warrning,
|
|
346
|
+
} = CartValidator.fetchAndvalidateCartItems().validate(
|
|
347
|
+
{
|
|
348
|
+
body,
|
|
349
|
+
},
|
|
350
|
+
{ abortEarly: false, allowUnknown: false }
|
|
351
|
+
);
|
|
352
|
+
if (warrning) {
|
|
353
|
+
Logger({
|
|
354
|
+
level: "WARN",
|
|
355
|
+
message: "Parameter Validation warrnings for fetchAndvalidateCartItems",
|
|
356
|
+
});
|
|
357
|
+
Logger({ level: "WARN", message: warrning });
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const query_params = {};
|
|
361
|
+
|
|
362
|
+
const response = await PlatformAPIClient.execute(
|
|
363
|
+
this.config,
|
|
364
|
+
"post",
|
|
365
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/validate`,
|
|
366
|
+
query_params,
|
|
367
|
+
body
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
const {
|
|
371
|
+
error: res_error,
|
|
372
|
+
} = CartModel.OpenapiCartDetailsResponse().validate(response, {
|
|
373
|
+
abortEarly: false,
|
|
374
|
+
allowUnknown: false,
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
if (res_error) {
|
|
378
|
+
Logger({
|
|
379
|
+
level: "WARN",
|
|
380
|
+
message: "Response Validation Warnnings for fetchAndvalidateCartItems",
|
|
381
|
+
});
|
|
382
|
+
Logger({ level: "WARN", message: res_error });
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return response;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @param {Object} arg - Arg object.
|
|
390
|
+
* @param {number} [arg.pageNo] -
|
|
391
|
+
* @param {number} [arg.pageSize] -
|
|
392
|
+
* @param {string} [arg.fromDate] -
|
|
393
|
+
* @param {string} [arg.toDate] -
|
|
394
|
+
* @param {boolean} [arg.anonymousCart] -
|
|
395
|
+
* @param {string} [arg.lastId] -
|
|
396
|
+
* @param {string} [arg.sortOn] -
|
|
397
|
+
* @returns {Promise<AbandonedCartResponse>} - Success response
|
|
398
|
+
* @summary: Get with abandoned cart list
|
|
399
|
+
* @description: Get abandoned cart list with pagination
|
|
400
|
+
*/
|
|
401
|
+
async getAbandonedCart({
|
|
420
402
|
pageNo,
|
|
421
403
|
pageSize,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
promotionId,
|
|
404
|
+
fromDate,
|
|
405
|
+
toDate,
|
|
406
|
+
anonymousCart,
|
|
407
|
+
lastId,
|
|
408
|
+
sortOn,
|
|
428
409
|
} = {}) {
|
|
429
|
-
const { error } = CartValidator.
|
|
410
|
+
const { error } = CartValidator.getAbandonedCart().validate(
|
|
430
411
|
{
|
|
431
412
|
pageNo,
|
|
432
413
|
pageSize,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
promotionId,
|
|
414
|
+
fromDate,
|
|
415
|
+
toDate,
|
|
416
|
+
anonymousCart,
|
|
417
|
+
lastId,
|
|
418
|
+
sortOn,
|
|
439
419
|
},
|
|
440
420
|
{ abortEarly: false, allowUnknown: true }
|
|
441
421
|
);
|
|
@@ -444,23 +424,22 @@ class Cart {
|
|
|
444
424
|
}
|
|
445
425
|
|
|
446
426
|
// Showing warrnings if extra unknown parameters are found
|
|
447
|
-
const { error: warrning } = CartValidator.
|
|
427
|
+
const { error: warrning } = CartValidator.getAbandonedCart().validate(
|
|
448
428
|
{
|
|
449
429
|
pageNo,
|
|
450
430
|
pageSize,
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
promotionId,
|
|
431
|
+
fromDate,
|
|
432
|
+
toDate,
|
|
433
|
+
anonymousCart,
|
|
434
|
+
lastId,
|
|
435
|
+
sortOn,
|
|
457
436
|
},
|
|
458
437
|
{ abortEarly: false, allowUnknown: false }
|
|
459
438
|
);
|
|
460
439
|
if (warrning) {
|
|
461
440
|
Logger({
|
|
462
441
|
level: "WARN",
|
|
463
|
-
message: "Parameter Validation warrnings for
|
|
442
|
+
message: "Parameter Validation warrnings for getAbandonedCart",
|
|
464
443
|
});
|
|
465
444
|
Logger({ level: "WARN", message: warrning });
|
|
466
445
|
}
|
|
@@ -468,24 +447,23 @@ class Cart {
|
|
|
468
447
|
const query_params = {};
|
|
469
448
|
query_params["page_no"] = pageNo;
|
|
470
449
|
query_params["page_size"] = pageSize;
|
|
471
|
-
query_params["
|
|
472
|
-
query_params["
|
|
473
|
-
query_params["
|
|
474
|
-
query_params["
|
|
475
|
-
query_params["
|
|
476
|
-
query_params["promotion_id"] = promotionId;
|
|
450
|
+
query_params["from_date"] = fromDate;
|
|
451
|
+
query_params["to_date"] = toDate;
|
|
452
|
+
query_params["anonymous_cart"] = anonymousCart;
|
|
453
|
+
query_params["last_id"] = lastId;
|
|
454
|
+
query_params["sort_on"] = sortOn;
|
|
477
455
|
|
|
478
456
|
const response = await PlatformAPIClient.execute(
|
|
479
457
|
this.config,
|
|
480
458
|
"get",
|
|
481
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
459
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts`,
|
|
482
460
|
query_params,
|
|
483
461
|
undefined
|
|
484
462
|
);
|
|
485
463
|
|
|
486
464
|
const {
|
|
487
465
|
error: res_error,
|
|
488
|
-
} = CartModel.
|
|
466
|
+
} = CartModel.AbandonedCartResponse().validate(response, {
|
|
489
467
|
abortEarly: false,
|
|
490
468
|
allowUnknown: false,
|
|
491
469
|
});
|
|
@@ -493,7 +471,7 @@ class Cart {
|
|
|
493
471
|
if (res_error) {
|
|
494
472
|
Logger({
|
|
495
473
|
level: "WARN",
|
|
496
|
-
message: "Response Validation Warnnings for
|
|
474
|
+
message: "Response Validation Warnnings for getAbandonedCart",
|
|
497
475
|
});
|
|
498
476
|
Logger({ level: "WARN", message: res_error });
|
|
499
477
|
}
|
|
@@ -506,42 +484,39 @@ class Cart {
|
|
|
506
484
|
* @param {string} arg.companyId - Current company id
|
|
507
485
|
* @param {string} arg.applicationId - Current Application _id
|
|
508
486
|
* @param {number} [arg.pageSize] -
|
|
509
|
-
* @param {string} [arg.
|
|
510
|
-
* @param {
|
|
511
|
-
* @param {
|
|
512
|
-
* @param {string} [arg.
|
|
513
|
-
* @param {string} [arg.
|
|
514
|
-
* @
|
|
515
|
-
* @
|
|
516
|
-
* @description: Get promotion list with pagination
|
|
487
|
+
* @param {string} [arg.fromDate] -
|
|
488
|
+
* @param {string} [arg.toDate] -
|
|
489
|
+
* @param {boolean} [arg.anonymousCart] -
|
|
490
|
+
* @param {string} [arg.lastId] -
|
|
491
|
+
* @param {string} [arg.sortOn] -
|
|
492
|
+
* @summary: Get with abandoned cart list
|
|
493
|
+
* @description: Get abandoned cart list with pagination
|
|
517
494
|
*/
|
|
518
|
-
|
|
495
|
+
getAbandonedCartPaginator({
|
|
519
496
|
companyId,
|
|
520
497
|
applicationId,
|
|
521
498
|
pageSize,
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
promotionId,
|
|
499
|
+
fromDate,
|
|
500
|
+
toDate,
|
|
501
|
+
anonymousCart,
|
|
502
|
+
lastId,
|
|
503
|
+
sortOn,
|
|
528
504
|
} = {}) {
|
|
529
505
|
const paginator = new Paginator();
|
|
530
506
|
const callback = async () => {
|
|
531
507
|
const pageId = paginator.nextId;
|
|
532
508
|
const pageNo = paginator.pageNo;
|
|
533
509
|
const pageType = "number";
|
|
534
|
-
const data = await this.
|
|
510
|
+
const data = await this.getAbandonedCart({
|
|
535
511
|
companyId: companyId,
|
|
536
512
|
applicationId: applicationId,
|
|
537
513
|
pageNo: pageNo,
|
|
538
514
|
pageSize: pageSize,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
promotionId: promotionId,
|
|
515
|
+
fromDate: fromDate,
|
|
516
|
+
toDate: toDate,
|
|
517
|
+
anonymousCart: anonymousCart,
|
|
518
|
+
lastId: lastId,
|
|
519
|
+
sortOn: sortOn,
|
|
545
520
|
});
|
|
546
521
|
paginator.setPaginator({
|
|
547
522
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -555,15 +530,19 @@ class Cart {
|
|
|
555
530
|
|
|
556
531
|
/**
|
|
557
532
|
* @param {Object} arg - Arg object.
|
|
558
|
-
* @param {
|
|
559
|
-
* @
|
|
560
|
-
* @
|
|
561
|
-
* @
|
|
533
|
+
* @param {string} [arg.id] -
|
|
534
|
+
* @param {boolean} [arg.i] -
|
|
535
|
+
* @param {boolean} [arg.b] -
|
|
536
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
537
|
+
* @summary: Fetch all items added to the cart
|
|
538
|
+
* @description: Use this API to get details of all the items added to a cart.
|
|
562
539
|
*/
|
|
563
|
-
async
|
|
564
|
-
const { error } = CartValidator.
|
|
540
|
+
async getAbandonedCartDetails({ id, i, b } = {}) {
|
|
541
|
+
const { error } = CartValidator.getAbandonedCartDetails().validate(
|
|
565
542
|
{
|
|
566
|
-
|
|
543
|
+
id,
|
|
544
|
+
i,
|
|
545
|
+
b,
|
|
567
546
|
},
|
|
568
547
|
{ abortEarly: false, allowUnknown: true }
|
|
569
548
|
);
|
|
@@ -572,31 +551,40 @@ class Cart {
|
|
|
572
551
|
}
|
|
573
552
|
|
|
574
553
|
// Showing warrnings if extra unknown parameters are found
|
|
575
|
-
const {
|
|
554
|
+
const {
|
|
555
|
+
error: warrning,
|
|
556
|
+
} = CartValidator.getAbandonedCartDetails().validate(
|
|
576
557
|
{
|
|
577
|
-
|
|
558
|
+
id,
|
|
559
|
+
i,
|
|
560
|
+
b,
|
|
578
561
|
},
|
|
579
562
|
{ abortEarly: false, allowUnknown: false }
|
|
580
563
|
);
|
|
581
564
|
if (warrning) {
|
|
582
565
|
Logger({
|
|
583
566
|
level: "WARN",
|
|
584
|
-
message: "Parameter Validation warrnings for
|
|
567
|
+
message: "Parameter Validation warrnings for getAbandonedCartDetails",
|
|
585
568
|
});
|
|
586
569
|
Logger({ level: "WARN", message: warrning });
|
|
587
570
|
}
|
|
588
571
|
|
|
589
572
|
const query_params = {};
|
|
573
|
+
query_params["id"] = id;
|
|
574
|
+
query_params["i"] = i;
|
|
575
|
+
query_params["b"] = b;
|
|
590
576
|
|
|
591
577
|
const response = await PlatformAPIClient.execute(
|
|
592
578
|
this.config,
|
|
593
|
-
"
|
|
594
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
579
|
+
"get",
|
|
580
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/cart/detail`,
|
|
595
581
|
query_params,
|
|
596
|
-
|
|
582
|
+
undefined
|
|
597
583
|
);
|
|
598
584
|
|
|
599
|
-
const {
|
|
585
|
+
const {
|
|
586
|
+
error: res_error,
|
|
587
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
600
588
|
abortEarly: false,
|
|
601
589
|
allowUnknown: false,
|
|
602
590
|
});
|
|
@@ -604,7 +592,7 @@ class Cart {
|
|
|
604
592
|
if (res_error) {
|
|
605
593
|
Logger({
|
|
606
594
|
level: "WARN",
|
|
607
|
-
message: "Response Validation Warnnings for
|
|
595
|
+
message: "Response Validation Warnnings for getAbandonedCartDetails",
|
|
608
596
|
});
|
|
609
597
|
Logger({ level: "WARN", message: res_error });
|
|
610
598
|
}
|
|
@@ -615,12 +603,12 @@ class Cart {
|
|
|
615
603
|
/**
|
|
616
604
|
* @param {Object} arg - Arg object.
|
|
617
605
|
* @param {string} arg.id -
|
|
618
|
-
* @returns {Promise<
|
|
619
|
-
* @summary: Get with single
|
|
620
|
-
* @description: Get single
|
|
606
|
+
* @returns {Promise<CouponUpdate>} - Success response
|
|
607
|
+
* @summary: Get with single coupon details or coupon list
|
|
608
|
+
* @description: Get single coupon details with `id` in path param
|
|
621
609
|
*/
|
|
622
|
-
async
|
|
623
|
-
const { error } = CartValidator.
|
|
610
|
+
async getCouponById({ id } = {}) {
|
|
611
|
+
const { error } = CartValidator.getCouponById().validate(
|
|
624
612
|
{
|
|
625
613
|
id,
|
|
626
614
|
},
|
|
@@ -631,7 +619,7 @@ class Cart {
|
|
|
631
619
|
}
|
|
632
620
|
|
|
633
621
|
// Showing warrnings if extra unknown parameters are found
|
|
634
|
-
const { error: warrning } = CartValidator.
|
|
622
|
+
const { error: warrning } = CartValidator.getCouponById().validate(
|
|
635
623
|
{
|
|
636
624
|
id,
|
|
637
625
|
},
|
|
@@ -640,7 +628,7 @@ class Cart {
|
|
|
640
628
|
if (warrning) {
|
|
641
629
|
Logger({
|
|
642
630
|
level: "WARN",
|
|
643
|
-
message: "Parameter Validation warrnings for
|
|
631
|
+
message: "Parameter Validation warrnings for getCouponById",
|
|
644
632
|
});
|
|
645
633
|
Logger({ level: "WARN", message: warrning });
|
|
646
634
|
}
|
|
@@ -650,20 +638,20 @@ class Cart {
|
|
|
650
638
|
const response = await PlatformAPIClient.execute(
|
|
651
639
|
this.config,
|
|
652
640
|
"get",
|
|
653
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
641
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
654
642
|
query_params,
|
|
655
643
|
undefined
|
|
656
644
|
);
|
|
657
645
|
|
|
658
|
-
const { error: res_error } = CartModel.
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
);
|
|
646
|
+
const { error: res_error } = CartModel.CouponUpdate().validate(response, {
|
|
647
|
+
abortEarly: false,
|
|
648
|
+
allowUnknown: false,
|
|
649
|
+
});
|
|
662
650
|
|
|
663
651
|
if (res_error) {
|
|
664
652
|
Logger({
|
|
665
653
|
level: "WARN",
|
|
666
|
-
message: "Response Validation Warnnings for
|
|
654
|
+
message: "Response Validation Warnnings for getCouponById",
|
|
667
655
|
});
|
|
668
656
|
Logger({ level: "WARN", message: res_error });
|
|
669
657
|
}
|
|
@@ -673,17 +661,15 @@ class Cart {
|
|
|
673
661
|
|
|
674
662
|
/**
|
|
675
663
|
* @param {Object} arg - Arg object.
|
|
676
|
-
* @param {string} arg.
|
|
677
|
-
* @
|
|
678
|
-
* @
|
|
679
|
-
* @
|
|
680
|
-
* @description: Update promotion with id sent in `id`
|
|
664
|
+
* @param {string} [arg.code] -
|
|
665
|
+
* @returns {Promise<Object>} - Success response
|
|
666
|
+
* @summary: Check if coupon is already created with coupon code
|
|
667
|
+
* @description: Check if sent coupon code is already existing coupon code. As coupon code is to be unique.
|
|
681
668
|
*/
|
|
682
|
-
async
|
|
683
|
-
const { error } = CartValidator.
|
|
669
|
+
async getCouponCodeExists({ code } = {}) {
|
|
670
|
+
const { error } = CartValidator.getCouponCodeExists().validate(
|
|
684
671
|
{
|
|
685
|
-
|
|
686
|
-
body,
|
|
672
|
+
code,
|
|
687
673
|
},
|
|
688
674
|
{ abortEarly: false, allowUnknown: true }
|
|
689
675
|
);
|
|
@@ -692,32 +678,183 @@ class Cart {
|
|
|
692
678
|
}
|
|
693
679
|
|
|
694
680
|
// Showing warrnings if extra unknown parameters are found
|
|
695
|
-
const { error: warrning } = CartValidator.
|
|
681
|
+
const { error: warrning } = CartValidator.getCouponCodeExists().validate(
|
|
696
682
|
{
|
|
697
|
-
|
|
698
|
-
body,
|
|
683
|
+
code,
|
|
699
684
|
},
|
|
700
685
|
{ abortEarly: false, allowUnknown: false }
|
|
701
686
|
);
|
|
702
687
|
if (warrning) {
|
|
703
688
|
Logger({
|
|
704
689
|
level: "WARN",
|
|
705
|
-
message: "Parameter Validation warrnings for
|
|
690
|
+
message: "Parameter Validation warrnings for getCouponCodeExists",
|
|
706
691
|
});
|
|
707
692
|
Logger({ level: "WARN", message: warrning });
|
|
708
693
|
}
|
|
709
694
|
|
|
710
695
|
const query_params = {};
|
|
696
|
+
query_params["code"] = code;
|
|
711
697
|
|
|
712
698
|
const response = await PlatformAPIClient.execute(
|
|
713
699
|
this.config,
|
|
714
|
-
"
|
|
715
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
700
|
+
"get",
|
|
701
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon_code_exists`,
|
|
716
702
|
query_params,
|
|
717
|
-
|
|
703
|
+
undefined
|
|
718
704
|
);
|
|
719
705
|
|
|
720
|
-
const { error: res_error } =
|
|
706
|
+
const { error: res_error } = Joi.any().validate(response, {
|
|
707
|
+
abortEarly: false,
|
|
708
|
+
allowUnknown: false,
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
if (res_error) {
|
|
712
|
+
Logger({
|
|
713
|
+
level: "WARN",
|
|
714
|
+
message: "Response Validation Warnnings for getCouponCodeExists",
|
|
715
|
+
});
|
|
716
|
+
Logger({ level: "WARN", message: res_error });
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return response;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* @param {Object} arg - Arg object.
|
|
724
|
+
* @returns {Promise<Object>} - Success response
|
|
725
|
+
* @summary: Get coupon options enums with display values
|
|
726
|
+
* @description: Get coupon enum values for fields in valid coupon object. Used for front end to create, update and filter coupon lists via fields
|
|
727
|
+
*/
|
|
728
|
+
async getCouponOptionValues({} = {}) {
|
|
729
|
+
const { error } = CartValidator.getCouponOptionValues().validate(
|
|
730
|
+
{},
|
|
731
|
+
{ abortEarly: false, allowUnknown: true }
|
|
732
|
+
);
|
|
733
|
+
if (error) {
|
|
734
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// Showing warrnings if extra unknown parameters are found
|
|
738
|
+
const { error: warrning } = CartValidator.getCouponOptionValues().validate(
|
|
739
|
+
{},
|
|
740
|
+
{ abortEarly: false, allowUnknown: false }
|
|
741
|
+
);
|
|
742
|
+
if (warrning) {
|
|
743
|
+
Logger({
|
|
744
|
+
level: "WARN",
|
|
745
|
+
message: "Parameter Validation warrnings for getCouponOptionValues",
|
|
746
|
+
});
|
|
747
|
+
Logger({ level: "WARN", message: warrning });
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
const query_params = {};
|
|
751
|
+
|
|
752
|
+
const response = await PlatformAPIClient.execute(
|
|
753
|
+
this.config,
|
|
754
|
+
"get",
|
|
755
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon_options`,
|
|
756
|
+
query_params,
|
|
757
|
+
undefined
|
|
758
|
+
);
|
|
759
|
+
|
|
760
|
+
const { error: res_error } = Joi.any().validate(response, {
|
|
761
|
+
abortEarly: false,
|
|
762
|
+
allowUnknown: false,
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
if (res_error) {
|
|
766
|
+
Logger({
|
|
767
|
+
level: "WARN",
|
|
768
|
+
message: "Response Validation Warnnings for getCouponOptionValues",
|
|
769
|
+
});
|
|
770
|
+
Logger({ level: "WARN", message: res_error });
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
return response;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* @param {Object} arg - Arg object.
|
|
778
|
+
* @param {number} [arg.pageNo] -
|
|
779
|
+
* @param {number} [arg.pageSize] -
|
|
780
|
+
* @param {boolean} [arg.isArchived] -
|
|
781
|
+
* @param {string} [arg.title] -
|
|
782
|
+
* @param {boolean} [arg.isPublic] -
|
|
783
|
+
* @param {boolean} [arg.isDisplay] -
|
|
784
|
+
* @param {string} [arg.typeSlug] -
|
|
785
|
+
* @param {string} [arg.code] -
|
|
786
|
+
* @returns {Promise<CouponsResponse>} - Success response
|
|
787
|
+
* @summary: Get with single coupon details or coupon list
|
|
788
|
+
* @description: Get coupon list with pagination
|
|
789
|
+
*/
|
|
790
|
+
async getCoupons({
|
|
791
|
+
pageNo,
|
|
792
|
+
pageSize,
|
|
793
|
+
isArchived,
|
|
794
|
+
title,
|
|
795
|
+
isPublic,
|
|
796
|
+
isDisplay,
|
|
797
|
+
typeSlug,
|
|
798
|
+
code,
|
|
799
|
+
} = {}) {
|
|
800
|
+
const { error } = CartValidator.getCoupons().validate(
|
|
801
|
+
{
|
|
802
|
+
pageNo,
|
|
803
|
+
pageSize,
|
|
804
|
+
isArchived,
|
|
805
|
+
title,
|
|
806
|
+
isPublic,
|
|
807
|
+
isDisplay,
|
|
808
|
+
typeSlug,
|
|
809
|
+
code,
|
|
810
|
+
},
|
|
811
|
+
{ abortEarly: false, allowUnknown: true }
|
|
812
|
+
);
|
|
813
|
+
if (error) {
|
|
814
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// Showing warrnings if extra unknown parameters are found
|
|
818
|
+
const { error: warrning } = CartValidator.getCoupons().validate(
|
|
819
|
+
{
|
|
820
|
+
pageNo,
|
|
821
|
+
pageSize,
|
|
822
|
+
isArchived,
|
|
823
|
+
title,
|
|
824
|
+
isPublic,
|
|
825
|
+
isDisplay,
|
|
826
|
+
typeSlug,
|
|
827
|
+
code,
|
|
828
|
+
},
|
|
829
|
+
{ abortEarly: false, allowUnknown: false }
|
|
830
|
+
);
|
|
831
|
+
if (warrning) {
|
|
832
|
+
Logger({
|
|
833
|
+
level: "WARN",
|
|
834
|
+
message: "Parameter Validation warrnings for getCoupons",
|
|
835
|
+
});
|
|
836
|
+
Logger({ level: "WARN", message: warrning });
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
const query_params = {};
|
|
840
|
+
query_params["page_no"] = pageNo;
|
|
841
|
+
query_params["page_size"] = pageSize;
|
|
842
|
+
query_params["is_archived"] = isArchived;
|
|
843
|
+
query_params["title"] = title;
|
|
844
|
+
query_params["is_public"] = isPublic;
|
|
845
|
+
query_params["is_display"] = isDisplay;
|
|
846
|
+
query_params["type_slug"] = typeSlug;
|
|
847
|
+
query_params["code"] = code;
|
|
848
|
+
|
|
849
|
+
const response = await PlatformAPIClient.execute(
|
|
850
|
+
this.config,
|
|
851
|
+
"get",
|
|
852
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon`,
|
|
853
|
+
query_params,
|
|
854
|
+
undefined
|
|
855
|
+
);
|
|
856
|
+
|
|
857
|
+
const { error: res_error } = CartModel.CouponsResponse().validate(
|
|
721
858
|
response,
|
|
722
859
|
{ abortEarly: false, allowUnknown: false }
|
|
723
860
|
);
|
|
@@ -725,7 +862,7 @@ class Cart {
|
|
|
725
862
|
if (res_error) {
|
|
726
863
|
Logger({
|
|
727
864
|
level: "WARN",
|
|
728
|
-
message: "Response Validation Warnnings for
|
|
865
|
+
message: "Response Validation Warnnings for getCoupons",
|
|
729
866
|
});
|
|
730
867
|
Logger({ level: "WARN", message: res_error });
|
|
731
868
|
}
|
|
@@ -733,19 +870,69 @@ class Cart {
|
|
|
733
870
|
return response;
|
|
734
871
|
}
|
|
735
872
|
|
|
873
|
+
/**
|
|
874
|
+
* @param {Object} arg - Arg object.
|
|
875
|
+
* @param {string} arg.companyId - Current company id
|
|
876
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
877
|
+
* @param {number} [arg.pageSize] -
|
|
878
|
+
* @param {boolean} [arg.isArchived] -
|
|
879
|
+
* @param {string} [arg.title] -
|
|
880
|
+
* @param {boolean} [arg.isPublic] -
|
|
881
|
+
* @param {boolean} [arg.isDisplay] -
|
|
882
|
+
* @param {string} [arg.typeSlug] -
|
|
883
|
+
* @param {string} [arg.code] -
|
|
884
|
+
* @summary: Get with single coupon details or coupon list
|
|
885
|
+
* @description: Get coupon list with pagination
|
|
886
|
+
*/
|
|
887
|
+
getCouponsPaginator({
|
|
888
|
+
companyId,
|
|
889
|
+
applicationId,
|
|
890
|
+
pageSize,
|
|
891
|
+
isArchived,
|
|
892
|
+
title,
|
|
893
|
+
isPublic,
|
|
894
|
+
isDisplay,
|
|
895
|
+
typeSlug,
|
|
896
|
+
code,
|
|
897
|
+
} = {}) {
|
|
898
|
+
const paginator = new Paginator();
|
|
899
|
+
const callback = async () => {
|
|
900
|
+
const pageId = paginator.nextId;
|
|
901
|
+
const pageNo = paginator.pageNo;
|
|
902
|
+
const pageType = "number";
|
|
903
|
+
const data = await this.getCoupons({
|
|
904
|
+
companyId: companyId,
|
|
905
|
+
applicationId: applicationId,
|
|
906
|
+
pageNo: pageNo,
|
|
907
|
+
pageSize: pageSize,
|
|
908
|
+
isArchived: isArchived,
|
|
909
|
+
title: title,
|
|
910
|
+
isPublic: isPublic,
|
|
911
|
+
isDisplay: isDisplay,
|
|
912
|
+
typeSlug: typeSlug,
|
|
913
|
+
code: code,
|
|
914
|
+
});
|
|
915
|
+
paginator.setPaginator({
|
|
916
|
+
hasNext: data.page.has_next ? true : false,
|
|
917
|
+
nextId: data.page.next_id,
|
|
918
|
+
});
|
|
919
|
+
return data;
|
|
920
|
+
};
|
|
921
|
+
paginator.setCallback(callback.bind(this));
|
|
922
|
+
return paginator;
|
|
923
|
+
}
|
|
924
|
+
|
|
736
925
|
/**
|
|
737
926
|
* @param {Object} arg - Arg object.
|
|
738
927
|
* @param {string} arg.id -
|
|
739
|
-
* @
|
|
740
|
-
* @
|
|
741
|
-
* @
|
|
742
|
-
* @description: Update publish/unpublish and change schedule for promotion
|
|
928
|
+
* @returns {Promise<PromotionUpdate>} - Success response
|
|
929
|
+
* @summary: Get with single promotion details or promotion list
|
|
930
|
+
* @description: Get single promotion details with `id` in path param
|
|
743
931
|
*/
|
|
744
|
-
async
|
|
745
|
-
const { error } = CartValidator.
|
|
932
|
+
async getPromotionById({ id } = {}) {
|
|
933
|
+
const { error } = CartValidator.getPromotionById().validate(
|
|
746
934
|
{
|
|
747
935
|
id,
|
|
748
|
-
body,
|
|
749
936
|
},
|
|
750
937
|
{ abortEarly: false, allowUnknown: true }
|
|
751
938
|
);
|
|
@@ -754,19 +941,16 @@ class Cart {
|
|
|
754
941
|
}
|
|
755
942
|
|
|
756
943
|
// Showing warrnings if extra unknown parameters are found
|
|
757
|
-
const {
|
|
758
|
-
error: warrning,
|
|
759
|
-
} = CartValidator.updatePromotionPartially().validate(
|
|
944
|
+
const { error: warrning } = CartValidator.getPromotionById().validate(
|
|
760
945
|
{
|
|
761
946
|
id,
|
|
762
|
-
body,
|
|
763
947
|
},
|
|
764
948
|
{ abortEarly: false, allowUnknown: false }
|
|
765
949
|
);
|
|
766
950
|
if (warrning) {
|
|
767
951
|
Logger({
|
|
768
952
|
level: "WARN",
|
|
769
|
-
message: "Parameter Validation warrnings for
|
|
953
|
+
message: "Parameter Validation warrnings for getPromotionById",
|
|
770
954
|
});
|
|
771
955
|
Logger({ level: "WARN", message: warrning });
|
|
772
956
|
}
|
|
@@ -775,21 +959,21 @@ class Cart {
|
|
|
775
959
|
|
|
776
960
|
const response = await PlatformAPIClient.execute(
|
|
777
961
|
this.config,
|
|
778
|
-
"
|
|
962
|
+
"get",
|
|
779
963
|
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
780
964
|
query_params,
|
|
781
|
-
|
|
965
|
+
undefined
|
|
782
966
|
);
|
|
783
967
|
|
|
784
|
-
const { error: res_error } = CartModel.
|
|
785
|
-
|
|
786
|
-
allowUnknown: false
|
|
787
|
-
|
|
968
|
+
const { error: res_error } = CartModel.PromotionUpdate().validate(
|
|
969
|
+
response,
|
|
970
|
+
{ abortEarly: false, allowUnknown: false }
|
|
971
|
+
);
|
|
788
972
|
|
|
789
973
|
if (res_error) {
|
|
790
974
|
Logger({
|
|
791
975
|
level: "WARN",
|
|
792
|
-
message: "Response Validation Warnnings for
|
|
976
|
+
message: "Response Validation Warnnings for getPromotionById",
|
|
793
977
|
});
|
|
794
978
|
Logger({ level: "WARN", message: res_error });
|
|
795
979
|
}
|
|
@@ -799,15 +983,15 @@ class Cart {
|
|
|
799
983
|
|
|
800
984
|
/**
|
|
801
985
|
* @param {Object} arg - Arg object.
|
|
802
|
-
* @param {
|
|
803
|
-
* @returns {Promise<
|
|
804
|
-
* @summary:
|
|
805
|
-
* @description:
|
|
986
|
+
* @param {string} [arg.code] -
|
|
987
|
+
* @returns {Promise<Object>} - Success response
|
|
988
|
+
* @summary: Check if promotion is already created with promotion code
|
|
989
|
+
* @description: Check if sent promotion code is already existing promotion code. As promotion code is to be unique.
|
|
806
990
|
*/
|
|
807
|
-
async
|
|
808
|
-
const { error } = CartValidator.
|
|
991
|
+
async getPromotionCodeExists({ code } = {}) {
|
|
992
|
+
const { error } = CartValidator.getPromotionCodeExists().validate(
|
|
809
993
|
{
|
|
810
|
-
|
|
994
|
+
code,
|
|
811
995
|
},
|
|
812
996
|
{ abortEarly: false, allowUnknown: true }
|
|
813
997
|
);
|
|
@@ -816,35 +1000,32 @@ class Cart {
|
|
|
816
1000
|
}
|
|
817
1001
|
|
|
818
1002
|
// Showing warrnings if extra unknown parameters are found
|
|
819
|
-
const {
|
|
820
|
-
error: warrning,
|
|
821
|
-
} = CartValidator.fetchAndvalidateCartItems().validate(
|
|
1003
|
+
const { error: warrning } = CartValidator.getPromotionCodeExists().validate(
|
|
822
1004
|
{
|
|
823
|
-
|
|
1005
|
+
code,
|
|
824
1006
|
},
|
|
825
1007
|
{ abortEarly: false, allowUnknown: false }
|
|
826
1008
|
);
|
|
827
1009
|
if (warrning) {
|
|
828
1010
|
Logger({
|
|
829
1011
|
level: "WARN",
|
|
830
|
-
message: "Parameter Validation warrnings for
|
|
1012
|
+
message: "Parameter Validation warrnings for getPromotionCodeExists",
|
|
831
1013
|
});
|
|
832
1014
|
Logger({ level: "WARN", message: warrning });
|
|
833
1015
|
}
|
|
834
1016
|
|
|
835
1017
|
const query_params = {};
|
|
1018
|
+
query_params["code"] = code;
|
|
836
1019
|
|
|
837
1020
|
const response = await PlatformAPIClient.execute(
|
|
838
1021
|
this.config,
|
|
839
|
-
"
|
|
840
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1022
|
+
"get",
|
|
1023
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion_code_exists`,
|
|
841
1024
|
query_params,
|
|
842
|
-
|
|
1025
|
+
undefined
|
|
843
1026
|
);
|
|
844
1027
|
|
|
845
|
-
const {
|
|
846
|
-
error: res_error,
|
|
847
|
-
} = CartModel.OpenapiCartDetailsResponse().validate(response, {
|
|
1028
|
+
const { error: res_error } = Joi.any().validate(response, {
|
|
848
1029
|
abortEarly: false,
|
|
849
1030
|
allowUnknown: false,
|
|
850
1031
|
});
|
|
@@ -852,7 +1033,7 @@ class Cart {
|
|
|
852
1033
|
if (res_error) {
|
|
853
1034
|
Logger({
|
|
854
1035
|
level: "WARN",
|
|
855
|
-
message: "Response Validation Warnnings for
|
|
1036
|
+
message: "Response Validation Warnnings for getPromotionCodeExists",
|
|
856
1037
|
});
|
|
857
1038
|
Logger({ level: "WARN", message: res_error });
|
|
858
1039
|
}
|
|
@@ -862,15 +1043,38 @@ class Cart {
|
|
|
862
1043
|
|
|
863
1044
|
/**
|
|
864
1045
|
* @param {Object} arg - Arg object.
|
|
865
|
-
* @param {
|
|
866
|
-
* @
|
|
867
|
-
* @
|
|
868
|
-
* @
|
|
1046
|
+
* @param {number} [arg.pageNo] -
|
|
1047
|
+
* @param {number} [arg.pageSize] -
|
|
1048
|
+
* @param {string} [arg.q] -
|
|
1049
|
+
* @param {boolean} [arg.isActive] -
|
|
1050
|
+
* @param {string} [arg.promoGroup] -
|
|
1051
|
+
* @param {string} [arg.promotionType] -
|
|
1052
|
+
* @param {string} [arg.fpPanel] -
|
|
1053
|
+
* @param {string} [arg.promotionId] -
|
|
1054
|
+
* @returns {Promise<PromotionsResponse>} - Success response
|
|
1055
|
+
* @summary: Get promotion list
|
|
1056
|
+
* @description: Get promotion list with pagination
|
|
869
1057
|
*/
|
|
870
|
-
async
|
|
871
|
-
|
|
1058
|
+
async getPromotions({
|
|
1059
|
+
pageNo,
|
|
1060
|
+
pageSize,
|
|
1061
|
+
q,
|
|
1062
|
+
isActive,
|
|
1063
|
+
promoGroup,
|
|
1064
|
+
promotionType,
|
|
1065
|
+
fpPanel,
|
|
1066
|
+
promotionId,
|
|
1067
|
+
} = {}) {
|
|
1068
|
+
const { error } = CartValidator.getPromotions().validate(
|
|
872
1069
|
{
|
|
873
|
-
|
|
1070
|
+
pageNo,
|
|
1071
|
+
pageSize,
|
|
1072
|
+
q,
|
|
1073
|
+
isActive,
|
|
1074
|
+
promoGroup,
|
|
1075
|
+
promotionType,
|
|
1076
|
+
fpPanel,
|
|
1077
|
+
promotionId,
|
|
874
1078
|
},
|
|
875
1079
|
{ abortEarly: false, allowUnknown: true }
|
|
876
1080
|
);
|
|
@@ -879,35 +1083,48 @@ class Cart {
|
|
|
879
1083
|
}
|
|
880
1084
|
|
|
881
1085
|
// Showing warrnings if extra unknown parameters are found
|
|
882
|
-
const {
|
|
883
|
-
error: warrning,
|
|
884
|
-
} = CartValidator.checkCartServiceability().validate(
|
|
1086
|
+
const { error: warrning } = CartValidator.getPromotions().validate(
|
|
885
1087
|
{
|
|
886
|
-
|
|
1088
|
+
pageNo,
|
|
1089
|
+
pageSize,
|
|
1090
|
+
q,
|
|
1091
|
+
isActive,
|
|
1092
|
+
promoGroup,
|
|
1093
|
+
promotionType,
|
|
1094
|
+
fpPanel,
|
|
1095
|
+
promotionId,
|
|
887
1096
|
},
|
|
888
1097
|
{ abortEarly: false, allowUnknown: false }
|
|
889
1098
|
);
|
|
890
1099
|
if (warrning) {
|
|
891
1100
|
Logger({
|
|
892
1101
|
level: "WARN",
|
|
893
|
-
message: "Parameter Validation warrnings for
|
|
1102
|
+
message: "Parameter Validation warrnings for getPromotions",
|
|
894
1103
|
});
|
|
895
1104
|
Logger({ level: "WARN", message: warrning });
|
|
896
1105
|
}
|
|
897
1106
|
|
|
898
1107
|
const query_params = {};
|
|
1108
|
+
query_params["page_no"] = pageNo;
|
|
1109
|
+
query_params["page_size"] = pageSize;
|
|
1110
|
+
query_params["q"] = q;
|
|
1111
|
+
query_params["is_active"] = isActive;
|
|
1112
|
+
query_params["promo_group"] = promoGroup;
|
|
1113
|
+
query_params["promotion_type"] = promotionType;
|
|
1114
|
+
query_params["fp_panel"] = fpPanel;
|
|
1115
|
+
query_params["promotion_id"] = promotionId;
|
|
899
1116
|
|
|
900
1117
|
const response = await PlatformAPIClient.execute(
|
|
901
1118
|
this.config,
|
|
902
|
-
"
|
|
903
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1119
|
+
"get",
|
|
1120
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion`,
|
|
904
1121
|
query_params,
|
|
905
|
-
|
|
1122
|
+
undefined
|
|
906
1123
|
);
|
|
907
1124
|
|
|
908
1125
|
const {
|
|
909
1126
|
error: res_error,
|
|
910
|
-
} = CartModel.
|
|
1127
|
+
} = CartModel.PromotionsResponse().validate(response, {
|
|
911
1128
|
abortEarly: false,
|
|
912
1129
|
allowUnknown: false,
|
|
913
1130
|
});
|
|
@@ -915,7 +1132,7 @@ class Cart {
|
|
|
915
1132
|
if (res_error) {
|
|
916
1133
|
Logger({
|
|
917
1134
|
level: "WARN",
|
|
918
|
-
message: "Response Validation Warnnings for
|
|
1135
|
+
message: "Response Validation Warnnings for getPromotions",
|
|
919
1136
|
});
|
|
920
1137
|
Logger({ level: "WARN", message: res_error });
|
|
921
1138
|
}
|
|
@@ -925,15 +1142,71 @@ class Cart {
|
|
|
925
1142
|
|
|
926
1143
|
/**
|
|
927
1144
|
* @param {Object} arg - Arg object.
|
|
928
|
-
* @param {
|
|
929
|
-
* @
|
|
930
|
-
* @
|
|
931
|
-
* @
|
|
1145
|
+
* @param {string} arg.companyId - Current company id
|
|
1146
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
1147
|
+
* @param {number} [arg.pageSize] -
|
|
1148
|
+
* @param {string} [arg.q] -
|
|
1149
|
+
* @param {boolean} [arg.isActive] -
|
|
1150
|
+
* @param {string} [arg.promoGroup] -
|
|
1151
|
+
* @param {string} [arg.promotionType] -
|
|
1152
|
+
* @param {string} [arg.fpPanel] -
|
|
1153
|
+
* @param {string} [arg.promotionId] -
|
|
1154
|
+
* @summary: Get promotion list
|
|
1155
|
+
* @description: Get promotion list with pagination
|
|
932
1156
|
*/
|
|
933
|
-
|
|
934
|
-
|
|
1157
|
+
getPromotionsPaginator({
|
|
1158
|
+
companyId,
|
|
1159
|
+
applicationId,
|
|
1160
|
+
pageSize,
|
|
1161
|
+
q,
|
|
1162
|
+
isActive,
|
|
1163
|
+
promoGroup,
|
|
1164
|
+
promotionType,
|
|
1165
|
+
fpPanel,
|
|
1166
|
+
promotionId,
|
|
1167
|
+
} = {}) {
|
|
1168
|
+
const paginator = new Paginator();
|
|
1169
|
+
const callback = async () => {
|
|
1170
|
+
const pageId = paginator.nextId;
|
|
1171
|
+
const pageNo = paginator.pageNo;
|
|
1172
|
+
const pageType = "number";
|
|
1173
|
+
const data = await this.getPromotions({
|
|
1174
|
+
companyId: companyId,
|
|
1175
|
+
applicationId: applicationId,
|
|
1176
|
+
pageNo: pageNo,
|
|
1177
|
+
pageSize: pageSize,
|
|
1178
|
+
q: q,
|
|
1179
|
+
isActive: isActive,
|
|
1180
|
+
promoGroup: promoGroup,
|
|
1181
|
+
promotionType: promotionType,
|
|
1182
|
+
fpPanel: fpPanel,
|
|
1183
|
+
promotionId: promotionId,
|
|
1184
|
+
});
|
|
1185
|
+
paginator.setPaginator({
|
|
1186
|
+
hasNext: data.page.has_next ? true : false,
|
|
1187
|
+
nextId: data.page.next_id,
|
|
1188
|
+
});
|
|
1189
|
+
return data;
|
|
1190
|
+
};
|
|
1191
|
+
paginator.setCallback(callback.bind(this));
|
|
1192
|
+
return paginator;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* @param {Object} arg - Arg object.
|
|
1197
|
+
* @param {string} arg.cartId - Current Cart _id
|
|
1198
|
+
* @param {boolean} [arg.b] -
|
|
1199
|
+
* @param {UpdateCartRequest} arg.body
|
|
1200
|
+
* @returns {Promise<UpdateCartDetailResponse>} - Success response
|
|
1201
|
+
* @summary: Update items in the abandoned cart
|
|
1202
|
+
* @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>
|
|
1203
|
+
*/
|
|
1204
|
+
async updateCart({ cartId, body, b } = {}) {
|
|
1205
|
+
const { error } = CartValidator.updateCart().validate(
|
|
935
1206
|
{
|
|
1207
|
+
cartId,
|
|
936
1208
|
body,
|
|
1209
|
+
b,
|
|
937
1210
|
},
|
|
938
1211
|
{ abortEarly: false, allowUnknown: true }
|
|
939
1212
|
);
|
|
@@ -942,33 +1215,36 @@ class Cart {
|
|
|
942
1215
|
}
|
|
943
1216
|
|
|
944
1217
|
// Showing warrnings if extra unknown parameters are found
|
|
945
|
-
const { error: warrning } = CartValidator.
|
|
1218
|
+
const { error: warrning } = CartValidator.updateCart().validate(
|
|
946
1219
|
{
|
|
1220
|
+
cartId,
|
|
947
1221
|
body,
|
|
1222
|
+
b,
|
|
948
1223
|
},
|
|
949
1224
|
{ abortEarly: false, allowUnknown: false }
|
|
950
1225
|
);
|
|
951
1226
|
if (warrning) {
|
|
952
1227
|
Logger({
|
|
953
1228
|
level: "WARN",
|
|
954
|
-
message: "Parameter Validation warrnings for
|
|
1229
|
+
message: "Parameter Validation warrnings for updateCart",
|
|
955
1230
|
});
|
|
956
1231
|
Logger({ level: "WARN", message: warrning });
|
|
957
1232
|
}
|
|
958
1233
|
|
|
959
1234
|
const query_params = {};
|
|
1235
|
+
query_params["b"] = b;
|
|
960
1236
|
|
|
961
1237
|
const response = await PlatformAPIClient.execute(
|
|
962
1238
|
this.config,
|
|
963
|
-
"
|
|
964
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1239
|
+
"put",
|
|
1240
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts/${cartId}`,
|
|
965
1241
|
query_params,
|
|
966
1242
|
body
|
|
967
1243
|
);
|
|
968
1244
|
|
|
969
1245
|
const {
|
|
970
1246
|
error: res_error,
|
|
971
|
-
} = CartModel.
|
|
1247
|
+
} = CartModel.UpdateCartDetailResponse().validate(response, {
|
|
972
1248
|
abortEarly: false,
|
|
973
1249
|
allowUnknown: false,
|
|
974
1250
|
});
|
|
@@ -976,7 +1252,7 @@ class Cart {
|
|
|
976
1252
|
if (res_error) {
|
|
977
1253
|
Logger({
|
|
978
1254
|
level: "WARN",
|
|
979
|
-
message: "Response Validation Warnnings for
|
|
1255
|
+
message: "Response Validation Warnnings for updateCart",
|
|
980
1256
|
});
|
|
981
1257
|
Logger({ level: "WARN", message: res_error });
|
|
982
1258
|
}
|
|
@@ -986,35 +1262,17 @@ class Cart {
|
|
|
986
1262
|
|
|
987
1263
|
/**
|
|
988
1264
|
* @param {Object} arg - Arg object.
|
|
989
|
-
* @param {
|
|
990
|
-
* @param {
|
|
991
|
-
* @
|
|
992
|
-
* @
|
|
993
|
-
* @
|
|
994
|
-
* @param {string} [arg.lastId] -
|
|
995
|
-
* @param {string} [arg.sortOn] -
|
|
996
|
-
* @returns {Promise<AbandonedCartResponse>} - Success response
|
|
997
|
-
* @summary: Get with abandoned cart list
|
|
998
|
-
* @description: Get abandoned cart list with pagination
|
|
1265
|
+
* @param {string} arg.id -
|
|
1266
|
+
* @param {CouponUpdate} arg.body
|
|
1267
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
1268
|
+
* @summary: Update existing coupon configuration
|
|
1269
|
+
* @description: Update coupon with id sent in `id`
|
|
999
1270
|
*/
|
|
1000
|
-
async
|
|
1001
|
-
|
|
1002
|
-
pageSize,
|
|
1003
|
-
fromDate,
|
|
1004
|
-
toDate,
|
|
1005
|
-
anonymousCart,
|
|
1006
|
-
lastId,
|
|
1007
|
-
sortOn,
|
|
1008
|
-
} = {}) {
|
|
1009
|
-
const { error } = CartValidator.getAbandonedCart().validate(
|
|
1271
|
+
async updateCoupon({ id, body } = {}) {
|
|
1272
|
+
const { error } = CartValidator.updateCoupon().validate(
|
|
1010
1273
|
{
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
fromDate,
|
|
1014
|
-
toDate,
|
|
1015
|
-
anonymousCart,
|
|
1016
|
-
lastId,
|
|
1017
|
-
sortOn,
|
|
1274
|
+
id,
|
|
1275
|
+
body,
|
|
1018
1276
|
},
|
|
1019
1277
|
{ abortEarly: false, allowUnknown: true }
|
|
1020
1278
|
);
|
|
@@ -1023,46 +1281,32 @@ class Cart {
|
|
|
1023
1281
|
}
|
|
1024
1282
|
|
|
1025
1283
|
// Showing warrnings if extra unknown parameters are found
|
|
1026
|
-
const { error: warrning } = CartValidator.
|
|
1284
|
+
const { error: warrning } = CartValidator.updateCoupon().validate(
|
|
1027
1285
|
{
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
fromDate,
|
|
1031
|
-
toDate,
|
|
1032
|
-
anonymousCart,
|
|
1033
|
-
lastId,
|
|
1034
|
-
sortOn,
|
|
1286
|
+
id,
|
|
1287
|
+
body,
|
|
1035
1288
|
},
|
|
1036
1289
|
{ abortEarly: false, allowUnknown: false }
|
|
1037
1290
|
);
|
|
1038
1291
|
if (warrning) {
|
|
1039
1292
|
Logger({
|
|
1040
1293
|
level: "WARN",
|
|
1041
|
-
message: "Parameter Validation warrnings for
|
|
1294
|
+
message: "Parameter Validation warrnings for updateCoupon",
|
|
1042
1295
|
});
|
|
1043
1296
|
Logger({ level: "WARN", message: warrning });
|
|
1044
1297
|
}
|
|
1045
1298
|
|
|
1046
1299
|
const query_params = {};
|
|
1047
|
-
query_params["page_no"] = pageNo;
|
|
1048
|
-
query_params["page_size"] = pageSize;
|
|
1049
|
-
query_params["from_date"] = fromDate;
|
|
1050
|
-
query_params["to_date"] = toDate;
|
|
1051
|
-
query_params["anonymous_cart"] = anonymousCart;
|
|
1052
|
-
query_params["last_id"] = lastId;
|
|
1053
|
-
query_params["sort_on"] = sortOn;
|
|
1054
1300
|
|
|
1055
1301
|
const response = await PlatformAPIClient.execute(
|
|
1056
1302
|
this.config,
|
|
1057
|
-
"
|
|
1058
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1303
|
+
"put",
|
|
1304
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
1059
1305
|
query_params,
|
|
1060
|
-
|
|
1306
|
+
body
|
|
1061
1307
|
);
|
|
1062
1308
|
|
|
1063
|
-
const {
|
|
1064
|
-
error: res_error,
|
|
1065
|
-
} = CartModel.AbandonedCartResponse().validate(response, {
|
|
1309
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
1066
1310
|
abortEarly: false,
|
|
1067
1311
|
allowUnknown: false,
|
|
1068
1312
|
});
|
|
@@ -1070,7 +1314,7 @@ class Cart {
|
|
|
1070
1314
|
if (res_error) {
|
|
1071
1315
|
Logger({
|
|
1072
1316
|
level: "WARN",
|
|
1073
|
-
message: "Response Validation Warnnings for
|
|
1317
|
+
message: "Response Validation Warnnings for updateCoupon",
|
|
1074
1318
|
});
|
|
1075
1319
|
Logger({ level: "WARN", message: res_error });
|
|
1076
1320
|
}
|
|
@@ -1080,68 +1324,17 @@ class Cart {
|
|
|
1080
1324
|
|
|
1081
1325
|
/**
|
|
1082
1326
|
* @param {Object} arg - Arg object.
|
|
1083
|
-
* @param {string} arg.
|
|
1084
|
-
* @param {
|
|
1085
|
-
* @
|
|
1086
|
-
* @
|
|
1087
|
-
* @
|
|
1088
|
-
* @param {boolean} [arg.anonymousCart] -
|
|
1089
|
-
* @param {string} [arg.lastId] -
|
|
1090
|
-
* @param {string} [arg.sortOn] -
|
|
1091
|
-
* @summary: Get with abandoned cart list
|
|
1092
|
-
* @description: Get abandoned cart list with pagination
|
|
1093
|
-
*/
|
|
1094
|
-
getAbandonedCartPaginator({
|
|
1095
|
-
companyId,
|
|
1096
|
-
applicationId,
|
|
1097
|
-
pageSize,
|
|
1098
|
-
fromDate,
|
|
1099
|
-
toDate,
|
|
1100
|
-
anonymousCart,
|
|
1101
|
-
lastId,
|
|
1102
|
-
sortOn,
|
|
1103
|
-
} = {}) {
|
|
1104
|
-
const paginator = new Paginator();
|
|
1105
|
-
const callback = async () => {
|
|
1106
|
-
const pageId = paginator.nextId;
|
|
1107
|
-
const pageNo = paginator.pageNo;
|
|
1108
|
-
const pageType = "number";
|
|
1109
|
-
const data = await this.getAbandonedCart({
|
|
1110
|
-
companyId: companyId,
|
|
1111
|
-
applicationId: applicationId,
|
|
1112
|
-
pageNo: pageNo,
|
|
1113
|
-
pageSize: pageSize,
|
|
1114
|
-
fromDate: fromDate,
|
|
1115
|
-
toDate: toDate,
|
|
1116
|
-
anonymousCart: anonymousCart,
|
|
1117
|
-
lastId: lastId,
|
|
1118
|
-
sortOn: sortOn,
|
|
1119
|
-
});
|
|
1120
|
-
paginator.setPaginator({
|
|
1121
|
-
hasNext: data.page.has_next ? true : false,
|
|
1122
|
-
nextId: data.page.next_id,
|
|
1123
|
-
});
|
|
1124
|
-
return data;
|
|
1125
|
-
};
|
|
1126
|
-
paginator.setCallback(callback.bind(this));
|
|
1127
|
-
return paginator;
|
|
1128
|
-
}
|
|
1129
|
-
|
|
1130
|
-
/**
|
|
1131
|
-
* @param {Object} arg - Arg object.
|
|
1132
|
-
* @param {string} [arg.id] -
|
|
1133
|
-
* @param {boolean} [arg.i] -
|
|
1134
|
-
* @param {boolean} [arg.b] -
|
|
1135
|
-
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1136
|
-
* @summary: Fetch all items added to the cart
|
|
1137
|
-
* @description: Use this API to get details of all the items added to a cart.
|
|
1327
|
+
* @param {string} arg.id -
|
|
1328
|
+
* @param {CouponPartialUpdate} arg.body
|
|
1329
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
1330
|
+
* @summary: Update coupon archive state and schedule
|
|
1331
|
+
* @description: Update archive/unarchive and change schedule for coupon
|
|
1138
1332
|
*/
|
|
1139
|
-
async
|
|
1140
|
-
const { error } = CartValidator.
|
|
1333
|
+
async updateCouponPartially({ id, body } = {}) {
|
|
1334
|
+
const { error } = CartValidator.updateCouponPartially().validate(
|
|
1141
1335
|
{
|
|
1142
1336
|
id,
|
|
1143
|
-
|
|
1144
|
-
b,
|
|
1337
|
+
body,
|
|
1145
1338
|
},
|
|
1146
1339
|
{ abortEarly: false, allowUnknown: true }
|
|
1147
1340
|
);
|
|
@@ -1150,40 +1343,32 @@ class Cart {
|
|
|
1150
1343
|
}
|
|
1151
1344
|
|
|
1152
1345
|
// Showing warrnings if extra unknown parameters are found
|
|
1153
|
-
const {
|
|
1154
|
-
error: warrning,
|
|
1155
|
-
} = CartValidator.getAbandonedCartDetails().validate(
|
|
1346
|
+
const { error: warrning } = CartValidator.updateCouponPartially().validate(
|
|
1156
1347
|
{
|
|
1157
1348
|
id,
|
|
1158
|
-
|
|
1159
|
-
b,
|
|
1349
|
+
body,
|
|
1160
1350
|
},
|
|
1161
1351
|
{ abortEarly: false, allowUnknown: false }
|
|
1162
1352
|
);
|
|
1163
1353
|
if (warrning) {
|
|
1164
1354
|
Logger({
|
|
1165
1355
|
level: "WARN",
|
|
1166
|
-
message: "Parameter Validation warrnings for
|
|
1356
|
+
message: "Parameter Validation warrnings for updateCouponPartially",
|
|
1167
1357
|
});
|
|
1168
1358
|
Logger({ level: "WARN", message: warrning });
|
|
1169
1359
|
}
|
|
1170
1360
|
|
|
1171
1361
|
const query_params = {};
|
|
1172
|
-
query_params["id"] = id;
|
|
1173
|
-
query_params["i"] = i;
|
|
1174
|
-
query_params["b"] = b;
|
|
1175
1362
|
|
|
1176
1363
|
const response = await PlatformAPIClient.execute(
|
|
1177
1364
|
this.config,
|
|
1178
|
-
"
|
|
1179
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1365
|
+
"patch",
|
|
1366
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
1180
1367
|
query_params,
|
|
1181
|
-
|
|
1368
|
+
body
|
|
1182
1369
|
);
|
|
1183
1370
|
|
|
1184
|
-
const {
|
|
1185
|
-
error: res_error,
|
|
1186
|
-
} = CartModel.CartDetailResponse().validate(response, {
|
|
1371
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
1187
1372
|
abortEarly: false,
|
|
1188
1373
|
allowUnknown: false,
|
|
1189
1374
|
});
|
|
@@ -1191,7 +1376,7 @@ class Cart {
|
|
|
1191
1376
|
if (res_error) {
|
|
1192
1377
|
Logger({
|
|
1193
1378
|
level: "WARN",
|
|
1194
|
-
message: "Response Validation Warnnings for
|
|
1379
|
+
message: "Response Validation Warnnings for updateCouponPartially",
|
|
1195
1380
|
});
|
|
1196
1381
|
Logger({ level: "WARN", message: res_error });
|
|
1197
1382
|
}
|
|
@@ -1201,19 +1386,17 @@ class Cart {
|
|
|
1201
1386
|
|
|
1202
1387
|
/**
|
|
1203
1388
|
* @param {Object} arg - Arg object.
|
|
1204
|
-
* @param {string} arg.
|
|
1205
|
-
* @param {
|
|
1206
|
-
* @
|
|
1207
|
-
* @
|
|
1208
|
-
* @
|
|
1209
|
-
* @description: Use this API to add items to the abandoned cart.
|
|
1389
|
+
* @param {string} arg.id -
|
|
1390
|
+
* @param {PromotionUpdate} arg.body
|
|
1391
|
+
* @returns {Promise<PromotionUpdate>} - Success response
|
|
1392
|
+
* @summary: Update existing promotion configuration
|
|
1393
|
+
* @description: Update promotion with id sent in `id`
|
|
1210
1394
|
*/
|
|
1211
|
-
async
|
|
1212
|
-
const { error } = CartValidator.
|
|
1395
|
+
async updatePromotion({ id, body } = {}) {
|
|
1396
|
+
const { error } = CartValidator.updatePromotion().validate(
|
|
1213
1397
|
{
|
|
1214
|
-
|
|
1398
|
+
id,
|
|
1215
1399
|
body,
|
|
1216
|
-
b,
|
|
1217
1400
|
},
|
|
1218
1401
|
{ abortEarly: false, allowUnknown: true }
|
|
1219
1402
|
);
|
|
@@ -1222,44 +1405,40 @@ class Cart {
|
|
|
1222
1405
|
}
|
|
1223
1406
|
|
|
1224
1407
|
// Showing warrnings if extra unknown parameters are found
|
|
1225
|
-
const { error: warrning } = CartValidator.
|
|
1408
|
+
const { error: warrning } = CartValidator.updatePromotion().validate(
|
|
1226
1409
|
{
|
|
1227
|
-
|
|
1410
|
+
id,
|
|
1228
1411
|
body,
|
|
1229
|
-
b,
|
|
1230
1412
|
},
|
|
1231
1413
|
{ abortEarly: false, allowUnknown: false }
|
|
1232
1414
|
);
|
|
1233
1415
|
if (warrning) {
|
|
1234
1416
|
Logger({
|
|
1235
1417
|
level: "WARN",
|
|
1236
|
-
message: "Parameter Validation warrnings for
|
|
1418
|
+
message: "Parameter Validation warrnings for updatePromotion",
|
|
1237
1419
|
});
|
|
1238
1420
|
Logger({ level: "WARN", message: warrning });
|
|
1239
1421
|
}
|
|
1240
1422
|
|
|
1241
1423
|
const query_params = {};
|
|
1242
|
-
query_params["b"] = b;
|
|
1243
1424
|
|
|
1244
1425
|
const response = await PlatformAPIClient.execute(
|
|
1245
1426
|
this.config,
|
|
1246
|
-
"
|
|
1247
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1427
|
+
"put",
|
|
1428
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
1248
1429
|
query_params,
|
|
1249
1430
|
body
|
|
1250
1431
|
);
|
|
1251
1432
|
|
|
1252
|
-
const {
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
allowUnknown: false,
|
|
1257
|
-
});
|
|
1433
|
+
const { error: res_error } = CartModel.PromotionUpdate().validate(
|
|
1434
|
+
response,
|
|
1435
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1436
|
+
);
|
|
1258
1437
|
|
|
1259
1438
|
if (res_error) {
|
|
1260
1439
|
Logger({
|
|
1261
1440
|
level: "WARN",
|
|
1262
|
-
message: "Response Validation Warnnings for
|
|
1441
|
+
message: "Response Validation Warnnings for updatePromotion",
|
|
1263
1442
|
});
|
|
1264
1443
|
Logger({ level: "WARN", message: res_error });
|
|
1265
1444
|
}
|
|
@@ -1269,19 +1448,17 @@ class Cart {
|
|
|
1269
1448
|
|
|
1270
1449
|
/**
|
|
1271
1450
|
* @param {Object} arg - Arg object.
|
|
1272
|
-
* @param {string} arg.
|
|
1273
|
-
* @param {
|
|
1274
|
-
* @
|
|
1275
|
-
* @
|
|
1276
|
-
* @
|
|
1277
|
-
* @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>
|
|
1451
|
+
* @param {string} arg.id -
|
|
1452
|
+
* @param {PromotionPartialUpdate} arg.body
|
|
1453
|
+
* @returns {Promise<SuccessMessage>} - Success response
|
|
1454
|
+
* @summary: Update promotion publish state and schedule
|
|
1455
|
+
* @description: Update publish/unpublish and change schedule for promotion
|
|
1278
1456
|
*/
|
|
1279
|
-
async
|
|
1280
|
-
const { error } = CartValidator.
|
|
1457
|
+
async updatePromotionPartially({ id, body } = {}) {
|
|
1458
|
+
const { error } = CartValidator.updatePromotionPartially().validate(
|
|
1281
1459
|
{
|
|
1282
|
-
|
|
1460
|
+
id,
|
|
1283
1461
|
body,
|
|
1284
|
-
b,
|
|
1285
1462
|
},
|
|
1286
1463
|
{ abortEarly: false, allowUnknown: true }
|
|
1287
1464
|
);
|
|
@@ -1290,36 +1467,34 @@ class Cart {
|
|
|
1290
1467
|
}
|
|
1291
1468
|
|
|
1292
1469
|
// Showing warrnings if extra unknown parameters are found
|
|
1293
|
-
const {
|
|
1470
|
+
const {
|
|
1471
|
+
error: warrning,
|
|
1472
|
+
} = CartValidator.updatePromotionPartially().validate(
|
|
1294
1473
|
{
|
|
1295
|
-
|
|
1474
|
+
id,
|
|
1296
1475
|
body,
|
|
1297
|
-
b,
|
|
1298
1476
|
},
|
|
1299
1477
|
{ abortEarly: false, allowUnknown: false }
|
|
1300
1478
|
);
|
|
1301
1479
|
if (warrning) {
|
|
1302
1480
|
Logger({
|
|
1303
1481
|
level: "WARN",
|
|
1304
|
-
message: "Parameter Validation warrnings for
|
|
1482
|
+
message: "Parameter Validation warrnings for updatePromotionPartially",
|
|
1305
1483
|
});
|
|
1306
1484
|
Logger({ level: "WARN", message: warrning });
|
|
1307
1485
|
}
|
|
1308
1486
|
|
|
1309
1487
|
const query_params = {};
|
|
1310
|
-
query_params["b"] = b;
|
|
1311
1488
|
|
|
1312
1489
|
const response = await PlatformAPIClient.execute(
|
|
1313
1490
|
this.config,
|
|
1314
|
-
"
|
|
1315
|
-
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1491
|
+
"patch",
|
|
1492
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
1316
1493
|
query_params,
|
|
1317
1494
|
body
|
|
1318
1495
|
);
|
|
1319
1496
|
|
|
1320
|
-
const {
|
|
1321
|
-
error: res_error,
|
|
1322
|
-
} = CartModel.UpdateCartDetailResponse().validate(response, {
|
|
1497
|
+
const { error: res_error } = CartModel.SuccessMessage().validate(response, {
|
|
1323
1498
|
abortEarly: false,
|
|
1324
1499
|
allowUnknown: false,
|
|
1325
1500
|
});
|
|
@@ -1327,7 +1502,7 @@ class Cart {
|
|
|
1327
1502
|
if (res_error) {
|
|
1328
1503
|
Logger({
|
|
1329
1504
|
level: "WARN",
|
|
1330
|
-
message: "Response Validation Warnnings for
|
|
1505
|
+
message: "Response Validation Warnnings for updatePromotionPartially",
|
|
1331
1506
|
});
|
|
1332
1507
|
Logger({ level: "WARN", message: res_error });
|
|
1333
1508
|
}
|
|
@@ -1335,4 +1510,5 @@ class Cart {
|
|
|
1335
1510
|
return response;
|
|
1336
1511
|
}
|
|
1337
1512
|
}
|
|
1513
|
+
|
|
1338
1514
|
module.exports = Cart;
|