@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,43 +1,44 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
2
3
|
const constructUrl = require("../constructUrl");
|
|
3
4
|
const Paginator = require("../../common/Paginator");
|
|
4
|
-
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
5
|
const CartValidator = require("./CartApplicationValidator");
|
|
6
6
|
const CartModel = require("./CartApplicationModel");
|
|
7
7
|
const { Logger } = require("./../../common/Logger");
|
|
8
|
+
const Joi = require("joi");
|
|
8
9
|
|
|
9
10
|
class Cart {
|
|
10
11
|
constructor(_conf) {
|
|
11
12
|
this._conf = _conf;
|
|
12
13
|
this._relativeUrls = {
|
|
13
|
-
|
|
14
|
-
getCartLastModified: "/service/application/cart/v1.0/detail",
|
|
14
|
+
addAddress: "/service/application/cart/v1.0/address",
|
|
15
15
|
addItems: "/service/application/cart/v1.0/detail",
|
|
16
|
-
updateCart: "/service/application/cart/v1.0/detail",
|
|
17
|
-
getItemCount: "/service/application/cart/v1.0/basic",
|
|
18
|
-
getCoupons: "/service/application/cart/v1.0/coupon",
|
|
19
16
|
applyCoupon: "/service/application/cart/v1.0/coupon",
|
|
20
|
-
removeCoupon: "/service/application/cart/v1.0/coupon",
|
|
21
|
-
getBulkDiscountOffers: "/service/application/cart/v1.0/bulk-price",
|
|
22
17
|
applyRewardPoints: "/service/application/cart/v1.0/redeem/points/",
|
|
23
|
-
|
|
24
|
-
addAddress: "/service/application/cart/v1.0/address",
|
|
18
|
+
checkoutCart: "/service/application/cart/v1.0/checkout",
|
|
25
19
|
getAddressById: "/service/application/cart/v1.0/address/{id}",
|
|
26
|
-
|
|
20
|
+
getAddresses: "/service/application/cart/v1.0/address",
|
|
21
|
+
getBulkDiscountOffers: "/service/application/cart/v1.0/bulk-price",
|
|
22
|
+
getCart: "/service/application/cart/v1.0/detail",
|
|
23
|
+
getCartLastModified: "/service/application/cart/v1.0/detail",
|
|
24
|
+
getCartShareLink: "/service/application/cart/v1.0/share-cart",
|
|
25
|
+
getCartSharedItems: "/service/application/cart/v1.0/share-cart/{token}",
|
|
26
|
+
getCoupons: "/service/application/cart/v1.0/coupon",
|
|
27
|
+
getItemCount: "/service/application/cart/v1.0/basic",
|
|
28
|
+
getLadderOffers: "/service/application/cart/v1.0/available-ladder-prices",
|
|
29
|
+
getPromotionOffers: "/service/application/cart/v1.0/available-promotions",
|
|
30
|
+
getShipments: "/service/application/cart/v1.0/shipment",
|
|
27
31
|
removeAddress: "/service/application/cart/v1.0/address/{id}",
|
|
32
|
+
removeCoupon: "/service/application/cart/v1.0/coupon",
|
|
28
33
|
selectAddress: "/service/application/cart/v1.0/select-address",
|
|
29
34
|
selectPaymentMode: "/service/application/cart/v1.0/payment",
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
getShipments: "/service/application/cart/v1.0/shipment",
|
|
33
|
-
checkoutCart: "/service/application/cart/v1.0/checkout",
|
|
35
|
+
updateAddress: "/service/application/cart/v1.0/address/{id}",
|
|
36
|
+
updateCart: "/service/application/cart/v1.0/detail",
|
|
34
37
|
updateCartMeta: "/service/application/cart/v1.0/meta",
|
|
35
|
-
getCartShareLink: "/service/application/cart/v1.0/share-cart",
|
|
36
|
-
getCartSharedItems: "/service/application/cart/v1.0/share-cart/{token}",
|
|
37
38
|
updateCartWithSharedItems:
|
|
38
39
|
"/service/application/cart/v1.0/share-cart/{token}/{action}",
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
validateCouponForPayment:
|
|
41
|
+
"/service/application/cart/v1.0/payment/validate/",
|
|
41
42
|
};
|
|
42
43
|
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
43
44
|
(urls, [method, relativeUrl]) => {
|
|
@@ -57,19 +58,14 @@ class Cart {
|
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* @param {Object} arg - Arg object.
|
|
60
|
-
* @param {
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
63
|
-
* @
|
|
64
|
-
* @param {string} [arg.areaCode] -
|
|
65
|
-
* @param {boolean} [arg.buyNow] -
|
|
66
|
-
* @returns {Promise<CartDetailResponse>} - Success response
|
|
67
|
-
* @summary: Fetch all items added to the cart
|
|
68
|
-
* @description: Use this API to get details of all the items added to a cart.
|
|
61
|
+
* @param {Address} arg.body
|
|
62
|
+
* @returns {Promise<SaveAddressResponse>} - Success response
|
|
63
|
+
* @summary: Add address to an account
|
|
64
|
+
* @description: Use this API to add an address to an account.
|
|
69
65
|
*/
|
|
70
|
-
async
|
|
71
|
-
const { error } = CartValidator.
|
|
72
|
-
{
|
|
66
|
+
async addAddress({ body } = {}) {
|
|
67
|
+
const { error } = CartValidator.addAddress().validate(
|
|
68
|
+
{ body },
|
|
73
69
|
{ abortEarly: false, allowUnknown: true }
|
|
74
70
|
);
|
|
75
71
|
if (error) {
|
|
@@ -77,43 +73,37 @@ class Cart {
|
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
// Showing warrnings if extra unknown parameters are found
|
|
80
|
-
const { error: warrning } = CartValidator.
|
|
81
|
-
{
|
|
76
|
+
const { error: warrning } = CartValidator.addAddress().validate(
|
|
77
|
+
{ body },
|
|
82
78
|
{ abortEarly: false, allowUnknown: false }
|
|
83
79
|
);
|
|
84
80
|
if (warrning) {
|
|
85
81
|
Logger({
|
|
86
82
|
level: "WARN",
|
|
87
|
-
message: "Parameter Validation warrnings for
|
|
83
|
+
message: "Parameter Validation warrnings for addAddress",
|
|
88
84
|
});
|
|
89
85
|
Logger({ level: "WARN", message: warrning });
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
const query_params = {};
|
|
93
|
-
query_params["id"] = id;
|
|
94
|
-
query_params["i"] = i;
|
|
95
|
-
query_params["b"] = b;
|
|
96
|
-
query_params["assign_card_id"] = assignCardId;
|
|
97
|
-
query_params["area_code"] = areaCode;
|
|
98
|
-
query_params["buy_now"] = buyNow;
|
|
99
89
|
|
|
100
90
|
const xHeaders = {};
|
|
101
91
|
|
|
102
|
-
const response = await
|
|
92
|
+
const response = await ApplicationAPIClient.execute(
|
|
103
93
|
this._conf,
|
|
104
|
-
"
|
|
94
|
+
"post",
|
|
105
95
|
constructUrl({
|
|
106
|
-
url: this._urls["
|
|
96
|
+
url: this._urls["addAddress"],
|
|
107
97
|
params: {},
|
|
108
98
|
}),
|
|
109
99
|
query_params,
|
|
110
|
-
|
|
100
|
+
body,
|
|
111
101
|
xHeaders
|
|
112
102
|
);
|
|
113
103
|
|
|
114
104
|
const {
|
|
115
105
|
error: res_error,
|
|
116
|
-
} = CartModel.
|
|
106
|
+
} = CartModel.SaveAddressResponse().validate(response, {
|
|
117
107
|
abortEarly: false,
|
|
118
108
|
allowUnknown: false,
|
|
119
109
|
});
|
|
@@ -121,68 +111,7 @@ class Cart {
|
|
|
121
111
|
if (res_error) {
|
|
122
112
|
Logger({
|
|
123
113
|
level: "WARN",
|
|
124
|
-
message: "Response Validation Warnnings for
|
|
125
|
-
});
|
|
126
|
-
Logger({ level: "WARN", message: res_error });
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return response;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @param {Object} arg - Arg object.
|
|
134
|
-
* @param {string} [arg.id] -
|
|
135
|
-
* @returns {Promise<any>} - Success response
|
|
136
|
-
* @summary: Fetch last-modified timestamp
|
|
137
|
-
* @description: Use this API to fetch Last-Modified timestamp in header metadata.
|
|
138
|
-
*/
|
|
139
|
-
async getCartLastModified({ id } = {}) {
|
|
140
|
-
const { error } = CartValidator.getCartLastModified().validate(
|
|
141
|
-
{ id },
|
|
142
|
-
{ abortEarly: false, allowUnknown: true }
|
|
143
|
-
);
|
|
144
|
-
if (error) {
|
|
145
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Showing warrnings if extra unknown parameters are found
|
|
149
|
-
const { error: warrning } = CartValidator.getCartLastModified().validate(
|
|
150
|
-
{ id },
|
|
151
|
-
{ abortEarly: false, allowUnknown: false }
|
|
152
|
-
);
|
|
153
|
-
if (warrning) {
|
|
154
|
-
Logger({
|
|
155
|
-
level: "WARN",
|
|
156
|
-
message: "Parameter Validation warrnings for getCartLastModified",
|
|
157
|
-
});
|
|
158
|
-
Logger({ level: "WARN", message: warrning });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const query_params = {};
|
|
162
|
-
query_params["id"] = id;
|
|
163
|
-
|
|
164
|
-
const xHeaders = {};
|
|
165
|
-
|
|
166
|
-
const response = await APIClient.execute(
|
|
167
|
-
this._conf,
|
|
168
|
-
"head",
|
|
169
|
-
constructUrl({
|
|
170
|
-
url: this._urls["getCartLastModified"],
|
|
171
|
-
params: {},
|
|
172
|
-
}),
|
|
173
|
-
query_params,
|
|
174
|
-
undefined,
|
|
175
|
-
xHeaders
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
const { error: res_error } = Joi.string()
|
|
179
|
-
.allow("")
|
|
180
|
-
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
181
|
-
|
|
182
|
-
if (res_error) {
|
|
183
|
-
Logger({
|
|
184
|
-
level: "WARN",
|
|
185
|
-
message: "Response Validation Warnnings for getCartLastModified",
|
|
114
|
+
message: "Response Validation Warnnings for addAddress",
|
|
186
115
|
});
|
|
187
116
|
Logger({ level: "WARN", message: res_error });
|
|
188
117
|
}
|
|
@@ -231,7 +160,7 @@ class Cart {
|
|
|
231
160
|
|
|
232
161
|
const xHeaders = {};
|
|
233
162
|
|
|
234
|
-
const response = await
|
|
163
|
+
const response = await ApplicationAPIClient.execute(
|
|
235
164
|
this._conf,
|
|
236
165
|
"post",
|
|
237
166
|
constructUrl({
|
|
@@ -263,19 +192,19 @@ class Cart {
|
|
|
263
192
|
|
|
264
193
|
/**
|
|
265
194
|
* @param {Object} arg - Arg object.
|
|
266
|
-
* @param {string} [arg.id] -
|
|
267
195
|
* @param {boolean} [arg.i] -
|
|
268
196
|
* @param {boolean} [arg.b] -
|
|
269
|
-
* @param {
|
|
197
|
+
* @param {boolean} [arg.p] -
|
|
198
|
+
* @param {string} [arg.id] -
|
|
270
199
|
* @param {boolean} [arg.buyNow] -
|
|
271
|
-
* @param {
|
|
272
|
-
* @returns {Promise<
|
|
273
|
-
* @summary:
|
|
274
|
-
* @description:
|
|
200
|
+
* @param {ApplyCouponRequest} arg.body
|
|
201
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
202
|
+
* @summary: Apply Coupon
|
|
203
|
+
* @description: Use this API to apply coupons on items in the cart.
|
|
275
204
|
*/
|
|
276
|
-
async
|
|
277
|
-
const { error } = CartValidator.
|
|
278
|
-
{ body,
|
|
205
|
+
async applyCoupon({ body, i, b, p, id, buyNow } = {}) {
|
|
206
|
+
const { error } = CartValidator.applyCoupon().validate(
|
|
207
|
+
{ body, i, b, p, id, buyNow },
|
|
279
208
|
{ abortEarly: false, allowUnknown: true }
|
|
280
209
|
);
|
|
281
210
|
if (error) {
|
|
@@ -283,32 +212,32 @@ class Cart {
|
|
|
283
212
|
}
|
|
284
213
|
|
|
285
214
|
// Showing warrnings if extra unknown parameters are found
|
|
286
|
-
const { error: warrning } = CartValidator.
|
|
287
|
-
{ body,
|
|
215
|
+
const { error: warrning } = CartValidator.applyCoupon().validate(
|
|
216
|
+
{ body, i, b, p, id, buyNow },
|
|
288
217
|
{ abortEarly: false, allowUnknown: false }
|
|
289
218
|
);
|
|
290
219
|
if (warrning) {
|
|
291
220
|
Logger({
|
|
292
221
|
level: "WARN",
|
|
293
|
-
message: "Parameter Validation warrnings for
|
|
222
|
+
message: "Parameter Validation warrnings for applyCoupon",
|
|
294
223
|
});
|
|
295
224
|
Logger({ level: "WARN", message: warrning });
|
|
296
225
|
}
|
|
297
226
|
|
|
298
227
|
const query_params = {};
|
|
299
|
-
query_params["id"] = id;
|
|
300
228
|
query_params["i"] = i;
|
|
301
229
|
query_params["b"] = b;
|
|
302
|
-
query_params["
|
|
230
|
+
query_params["p"] = p;
|
|
231
|
+
query_params["id"] = id;
|
|
303
232
|
query_params["buy_now"] = buyNow;
|
|
304
233
|
|
|
305
234
|
const xHeaders = {};
|
|
306
235
|
|
|
307
|
-
const response = await
|
|
236
|
+
const response = await ApplicationAPIClient.execute(
|
|
308
237
|
this._conf,
|
|
309
|
-
"
|
|
238
|
+
"post",
|
|
310
239
|
constructUrl({
|
|
311
|
-
url: this._urls["
|
|
240
|
+
url: this._urls["applyCoupon"],
|
|
312
241
|
params: {},
|
|
313
242
|
}),
|
|
314
243
|
query_params,
|
|
@@ -318,7 +247,7 @@ class Cart {
|
|
|
318
247
|
|
|
319
248
|
const {
|
|
320
249
|
error: res_error,
|
|
321
|
-
} = CartModel.
|
|
250
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
322
251
|
abortEarly: false,
|
|
323
252
|
allowUnknown: false,
|
|
324
253
|
});
|
|
@@ -326,7 +255,7 @@ class Cart {
|
|
|
326
255
|
if (res_error) {
|
|
327
256
|
Logger({
|
|
328
257
|
level: "WARN",
|
|
329
|
-
message: "Response Validation Warnnings for
|
|
258
|
+
message: "Response Validation Warnnings for applyCoupon",
|
|
330
259
|
});
|
|
331
260
|
Logger({ level: "WARN", message: res_error });
|
|
332
261
|
}
|
|
@@ -336,15 +265,18 @@ class Cart {
|
|
|
336
265
|
|
|
337
266
|
/**
|
|
338
267
|
* @param {Object} arg - Arg object.
|
|
339
|
-
* @param {string} [arg.id] -
|
|
268
|
+
* @param {string} [arg.id] -
|
|
269
|
+
* @param {boolean} [arg.i] -
|
|
270
|
+
* @param {boolean} [arg.b] -
|
|
340
271
|
* @param {boolean} [arg.buyNow] -
|
|
341
|
-
* @
|
|
342
|
-
* @
|
|
343
|
-
* @
|
|
272
|
+
* @param {RewardPointRequest} arg.body
|
|
273
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
274
|
+
* @summary: Apply reward points at cart
|
|
275
|
+
* @description: Use this API to redeem a fixed no. of reward points by applying it to the cart.
|
|
344
276
|
*/
|
|
345
|
-
async
|
|
346
|
-
const { error } = CartValidator.
|
|
347
|
-
{ id, buyNow },
|
|
277
|
+
async applyRewardPoints({ body, id, i, b, buyNow } = {}) {
|
|
278
|
+
const { error } = CartValidator.applyRewardPoints().validate(
|
|
279
|
+
{ body, id, i, b, buyNow },
|
|
348
280
|
{ abortEarly: false, allowUnknown: true }
|
|
349
281
|
);
|
|
350
282
|
if (error) {
|
|
@@ -352,39 +284,41 @@ class Cart {
|
|
|
352
284
|
}
|
|
353
285
|
|
|
354
286
|
// Showing warrnings if extra unknown parameters are found
|
|
355
|
-
const { error: warrning } = CartValidator.
|
|
356
|
-
{ id, buyNow },
|
|
287
|
+
const { error: warrning } = CartValidator.applyRewardPoints().validate(
|
|
288
|
+
{ body, id, i, b, buyNow },
|
|
357
289
|
{ abortEarly: false, allowUnknown: false }
|
|
358
290
|
);
|
|
359
291
|
if (warrning) {
|
|
360
292
|
Logger({
|
|
361
293
|
level: "WARN",
|
|
362
|
-
message: "Parameter Validation warrnings for
|
|
294
|
+
message: "Parameter Validation warrnings for applyRewardPoints",
|
|
363
295
|
});
|
|
364
296
|
Logger({ level: "WARN", message: warrning });
|
|
365
297
|
}
|
|
366
298
|
|
|
367
299
|
const query_params = {};
|
|
368
300
|
query_params["id"] = id;
|
|
301
|
+
query_params["i"] = i;
|
|
302
|
+
query_params["b"] = b;
|
|
369
303
|
query_params["buy_now"] = buyNow;
|
|
370
304
|
|
|
371
305
|
const xHeaders = {};
|
|
372
306
|
|
|
373
|
-
const response = await
|
|
307
|
+
const response = await ApplicationAPIClient.execute(
|
|
374
308
|
this._conf,
|
|
375
|
-
"
|
|
309
|
+
"post",
|
|
376
310
|
constructUrl({
|
|
377
|
-
url: this._urls["
|
|
311
|
+
url: this._urls["applyRewardPoints"],
|
|
378
312
|
params: {},
|
|
379
313
|
}),
|
|
380
314
|
query_params,
|
|
381
|
-
|
|
315
|
+
body,
|
|
382
316
|
xHeaders
|
|
383
317
|
);
|
|
384
318
|
|
|
385
319
|
const {
|
|
386
320
|
error: res_error,
|
|
387
|
-
} = CartModel.
|
|
321
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
388
322
|
abortEarly: false,
|
|
389
323
|
allowUnknown: false,
|
|
390
324
|
});
|
|
@@ -392,7 +326,7 @@ class Cart {
|
|
|
392
326
|
if (res_error) {
|
|
393
327
|
Logger({
|
|
394
328
|
level: "WARN",
|
|
395
|
-
message: "Response Validation Warnnings for
|
|
329
|
+
message: "Response Validation Warnnings for applyRewardPoints",
|
|
396
330
|
});
|
|
397
331
|
Logger({ level: "WARN", message: res_error });
|
|
398
332
|
}
|
|
@@ -402,15 +336,15 @@ class Cart {
|
|
|
402
336
|
|
|
403
337
|
/**
|
|
404
338
|
* @param {Object} arg - Arg object.
|
|
405
|
-
* @param {
|
|
406
|
-
* @param {
|
|
407
|
-
* @returns {Promise<
|
|
408
|
-
* @summary:
|
|
409
|
-
* @description: Use this API to
|
|
339
|
+
* @param {boolean} [arg.buyNow] - This indicates the type of cart to checkout
|
|
340
|
+
* @param {CartCheckoutDetailRequest} arg.body
|
|
341
|
+
* @returns {Promise<CartCheckoutResponse>} - Success response
|
|
342
|
+
* @summary: Checkout all items in the cart
|
|
343
|
+
* @description: Use this API to checkout all items in the cart for payment and order generation. For COD, order will be directly generated, whereas for other checkout modes, user will be redirected to a payment gateway.
|
|
410
344
|
*/
|
|
411
|
-
async
|
|
412
|
-
const { error } = CartValidator.
|
|
413
|
-
{
|
|
345
|
+
async checkoutCart({ body, buyNow } = {}) {
|
|
346
|
+
const { error } = CartValidator.checkoutCart().validate(
|
|
347
|
+
{ body, buyNow },
|
|
414
348
|
{ abortEarly: false, allowUnknown: true }
|
|
415
349
|
);
|
|
416
350
|
if (error) {
|
|
@@ -418,39 +352,38 @@ class Cart {
|
|
|
418
352
|
}
|
|
419
353
|
|
|
420
354
|
// Showing warrnings if extra unknown parameters are found
|
|
421
|
-
const { error: warrning } = CartValidator.
|
|
422
|
-
{
|
|
355
|
+
const { error: warrning } = CartValidator.checkoutCart().validate(
|
|
356
|
+
{ body, buyNow },
|
|
423
357
|
{ abortEarly: false, allowUnknown: false }
|
|
424
358
|
);
|
|
425
359
|
if (warrning) {
|
|
426
360
|
Logger({
|
|
427
361
|
level: "WARN",
|
|
428
|
-
message: "Parameter Validation warrnings for
|
|
362
|
+
message: "Parameter Validation warrnings for checkoutCart",
|
|
429
363
|
});
|
|
430
364
|
Logger({ level: "WARN", message: warrning });
|
|
431
365
|
}
|
|
432
366
|
|
|
433
367
|
const query_params = {};
|
|
434
|
-
query_params["id"] = id;
|
|
435
368
|
query_params["buy_now"] = buyNow;
|
|
436
369
|
|
|
437
370
|
const xHeaders = {};
|
|
438
371
|
|
|
439
|
-
const response = await
|
|
372
|
+
const response = await ApplicationAPIClient.execute(
|
|
440
373
|
this._conf,
|
|
441
|
-
"
|
|
374
|
+
"post",
|
|
442
375
|
constructUrl({
|
|
443
|
-
url: this._urls["
|
|
376
|
+
url: this._urls["checkoutCart"],
|
|
444
377
|
params: {},
|
|
445
378
|
}),
|
|
446
379
|
query_params,
|
|
447
|
-
|
|
380
|
+
body,
|
|
448
381
|
xHeaders
|
|
449
382
|
);
|
|
450
383
|
|
|
451
384
|
const {
|
|
452
385
|
error: res_error,
|
|
453
|
-
} = CartModel.
|
|
386
|
+
} = CartModel.CartCheckoutResponse().validate(response, {
|
|
454
387
|
abortEarly: false,
|
|
455
388
|
allowUnknown: false,
|
|
456
389
|
});
|
|
@@ -458,7 +391,7 @@ class Cart {
|
|
|
458
391
|
if (res_error) {
|
|
459
392
|
Logger({
|
|
460
393
|
level: "WARN",
|
|
461
|
-
message: "Response Validation Warnnings for
|
|
394
|
+
message: "Response Validation Warnnings for checkoutCart",
|
|
462
395
|
});
|
|
463
396
|
Logger({ level: "WARN", message: res_error });
|
|
464
397
|
}
|
|
@@ -468,19 +401,28 @@ class Cart {
|
|
|
468
401
|
|
|
469
402
|
/**
|
|
470
403
|
* @param {Object} arg - Arg object.
|
|
471
|
-
* @param {
|
|
472
|
-
* @param {
|
|
473
|
-
* @param {boolean} [arg.p] -
|
|
474
|
-
* @param {string} [arg.id] -
|
|
404
|
+
* @param {string} arg.id -
|
|
405
|
+
* @param {string} [arg.cartId] -
|
|
475
406
|
* @param {boolean} [arg.buyNow] -
|
|
476
|
-
* @param {
|
|
477
|
-
* @
|
|
478
|
-
* @
|
|
479
|
-
* @
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
407
|
+
* @param {string} [arg.mobileNo] -
|
|
408
|
+
* @param {string} [arg.checkoutMode] -
|
|
409
|
+
* @param {string} [arg.tags] -
|
|
410
|
+
* @param {boolean} [arg.isDefault] -
|
|
411
|
+
* @returns {Promise<Address>} - Success response
|
|
412
|
+
* @summary: Fetch a single address by its ID
|
|
413
|
+
* @description: Use this API to get an addresses using its ID. If successful, returns a Address resource in the response body specified in `Address`. Attibutes listed below are optional <ul> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
|
|
414
|
+
*/
|
|
415
|
+
async getAddressById({
|
|
416
|
+
id,
|
|
417
|
+
cartId,
|
|
418
|
+
buyNow,
|
|
419
|
+
mobileNo,
|
|
420
|
+
checkoutMode,
|
|
421
|
+
tags,
|
|
422
|
+
isDefault,
|
|
423
|
+
} = {}) {
|
|
424
|
+
const { error } = CartValidator.getAddressById().validate(
|
|
425
|
+
{ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
484
426
|
{ abortEarly: false, allowUnknown: true }
|
|
485
427
|
);
|
|
486
428
|
if (error) {
|
|
@@ -488,42 +430,41 @@ class Cart {
|
|
|
488
430
|
}
|
|
489
431
|
|
|
490
432
|
// Showing warrnings if extra unknown parameters are found
|
|
491
|
-
const { error: warrning } = CartValidator.
|
|
492
|
-
{
|
|
433
|
+
const { error: warrning } = CartValidator.getAddressById().validate(
|
|
434
|
+
{ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
493
435
|
{ abortEarly: false, allowUnknown: false }
|
|
494
436
|
);
|
|
495
437
|
if (warrning) {
|
|
496
438
|
Logger({
|
|
497
439
|
level: "WARN",
|
|
498
|
-
message: "Parameter Validation warrnings for
|
|
440
|
+
message: "Parameter Validation warrnings for getAddressById",
|
|
499
441
|
});
|
|
500
442
|
Logger({ level: "WARN", message: warrning });
|
|
501
443
|
}
|
|
502
444
|
|
|
503
445
|
const query_params = {};
|
|
504
|
-
query_params["
|
|
505
|
-
query_params["b"] = b;
|
|
506
|
-
query_params["p"] = p;
|
|
507
|
-
query_params["id"] = id;
|
|
446
|
+
query_params["cart_id"] = cartId;
|
|
508
447
|
query_params["buy_now"] = buyNow;
|
|
448
|
+
query_params["mobile_no"] = mobileNo;
|
|
449
|
+
query_params["checkout_mode"] = checkoutMode;
|
|
450
|
+
query_params["tags"] = tags;
|
|
451
|
+
query_params["is_default"] = isDefault;
|
|
509
452
|
|
|
510
453
|
const xHeaders = {};
|
|
511
454
|
|
|
512
|
-
const response = await
|
|
455
|
+
const response = await ApplicationAPIClient.execute(
|
|
513
456
|
this._conf,
|
|
514
|
-
"
|
|
457
|
+
"get",
|
|
515
458
|
constructUrl({
|
|
516
|
-
url: this._urls["
|
|
517
|
-
params: {},
|
|
459
|
+
url: this._urls["getAddressById"],
|
|
460
|
+
params: { id },
|
|
518
461
|
}),
|
|
519
462
|
query_params,
|
|
520
|
-
|
|
463
|
+
undefined,
|
|
521
464
|
xHeaders
|
|
522
465
|
);
|
|
523
466
|
|
|
524
|
-
const {
|
|
525
|
-
error: res_error,
|
|
526
|
-
} = CartModel.CartDetailResponse().validate(response, {
|
|
467
|
+
const { error: res_error } = CartModel.Address().validate(response, {
|
|
527
468
|
abortEarly: false,
|
|
528
469
|
allowUnknown: false,
|
|
529
470
|
});
|
|
@@ -531,7 +472,7 @@ class Cart {
|
|
|
531
472
|
if (res_error) {
|
|
532
473
|
Logger({
|
|
533
474
|
level: "WARN",
|
|
534
|
-
message: "Response Validation Warnnings for
|
|
475
|
+
message: "Response Validation Warnnings for getAddressById",
|
|
535
476
|
});
|
|
536
477
|
Logger({ level: "WARN", message: res_error });
|
|
537
478
|
}
|
|
@@ -541,15 +482,26 @@ class Cart {
|
|
|
541
482
|
|
|
542
483
|
/**
|
|
543
484
|
* @param {Object} arg - Arg object.
|
|
544
|
-
* @param {string} [arg.
|
|
485
|
+
* @param {string} [arg.cartId] -
|
|
545
486
|
* @param {boolean} [arg.buyNow] -
|
|
546
|
-
* @
|
|
547
|
-
* @
|
|
548
|
-
* @
|
|
487
|
+
* @param {string} [arg.mobileNo] -
|
|
488
|
+
* @param {string} [arg.checkoutMode] -
|
|
489
|
+
* @param {string} [arg.tags] -
|
|
490
|
+
* @param {boolean} [arg.isDefault] -
|
|
491
|
+
* @returns {Promise<GetAddressesResponse>} - Success response
|
|
492
|
+
* @summary: Fetch address
|
|
493
|
+
* @description: Use this API to get all the addresses associated with an account. If successful, returns a Address resource in the response body specified in GetAddressesResponse.attibutes listed below are optional <ul> <li> <font color="monochrome">uid</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
|
|
549
494
|
*/
|
|
550
|
-
async
|
|
551
|
-
|
|
552
|
-
|
|
495
|
+
async getAddresses({
|
|
496
|
+
cartId,
|
|
497
|
+
buyNow,
|
|
498
|
+
mobileNo,
|
|
499
|
+
checkoutMode,
|
|
500
|
+
tags,
|
|
501
|
+
isDefault,
|
|
502
|
+
} = {}) {
|
|
503
|
+
const { error } = CartValidator.getAddresses().validate(
|
|
504
|
+
{ cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
553
505
|
{ abortEarly: false, allowUnknown: true }
|
|
554
506
|
);
|
|
555
507
|
if (error) {
|
|
@@ -557,29 +509,33 @@ class Cart {
|
|
|
557
509
|
}
|
|
558
510
|
|
|
559
511
|
// Showing warrnings if extra unknown parameters are found
|
|
560
|
-
const { error: warrning } = CartValidator.
|
|
561
|
-
{
|
|
512
|
+
const { error: warrning } = CartValidator.getAddresses().validate(
|
|
513
|
+
{ cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
562
514
|
{ abortEarly: false, allowUnknown: false }
|
|
563
515
|
);
|
|
564
516
|
if (warrning) {
|
|
565
517
|
Logger({
|
|
566
518
|
level: "WARN",
|
|
567
|
-
message: "Parameter Validation warrnings for
|
|
519
|
+
message: "Parameter Validation warrnings for getAddresses",
|
|
568
520
|
});
|
|
569
521
|
Logger({ level: "WARN", message: warrning });
|
|
570
522
|
}
|
|
571
523
|
|
|
572
524
|
const query_params = {};
|
|
573
|
-
query_params["
|
|
525
|
+
query_params["cart_id"] = cartId;
|
|
574
526
|
query_params["buy_now"] = buyNow;
|
|
527
|
+
query_params["mobile_no"] = mobileNo;
|
|
528
|
+
query_params["checkout_mode"] = checkoutMode;
|
|
529
|
+
query_params["tags"] = tags;
|
|
530
|
+
query_params["is_default"] = isDefault;
|
|
575
531
|
|
|
576
532
|
const xHeaders = {};
|
|
577
533
|
|
|
578
|
-
const response = await
|
|
534
|
+
const response = await ApplicationAPIClient.execute(
|
|
579
535
|
this._conf,
|
|
580
|
-
"
|
|
536
|
+
"get",
|
|
581
537
|
constructUrl({
|
|
582
|
-
url: this._urls["
|
|
538
|
+
url: this._urls["getAddresses"],
|
|
583
539
|
params: {},
|
|
584
540
|
}),
|
|
585
541
|
query_params,
|
|
@@ -589,7 +545,7 @@ class Cart {
|
|
|
589
545
|
|
|
590
546
|
const {
|
|
591
547
|
error: res_error,
|
|
592
|
-
} = CartModel.
|
|
548
|
+
} = CartModel.GetAddressesResponse().validate(response, {
|
|
593
549
|
abortEarly: false,
|
|
594
550
|
allowUnknown: false,
|
|
595
551
|
});
|
|
@@ -597,7 +553,7 @@ class Cart {
|
|
|
597
553
|
if (res_error) {
|
|
598
554
|
Logger({
|
|
599
555
|
level: "WARN",
|
|
600
|
-
message: "Response Validation Warnnings for
|
|
556
|
+
message: "Response Validation Warnnings for getAddresses",
|
|
601
557
|
});
|
|
602
558
|
Logger({ level: "WARN", message: res_error });
|
|
603
559
|
}
|
|
@@ -647,7 +603,7 @@ class Cart {
|
|
|
647
603
|
|
|
648
604
|
const xHeaders = {};
|
|
649
605
|
|
|
650
|
-
const response = await
|
|
606
|
+
const response = await ApplicationAPIClient.execute(
|
|
651
607
|
this._conf,
|
|
652
608
|
"get",
|
|
653
609
|
constructUrl({
|
|
@@ -682,15 +638,16 @@ class Cart {
|
|
|
682
638
|
* @param {string} [arg.id] -
|
|
683
639
|
* @param {boolean} [arg.i] -
|
|
684
640
|
* @param {boolean} [arg.b] -
|
|
641
|
+
* @param {number} [arg.assignCardId] -
|
|
642
|
+
* @param {string} [arg.areaCode] -
|
|
685
643
|
* @param {boolean} [arg.buyNow] -
|
|
686
|
-
* @param {RewardPointRequest} arg.body
|
|
687
644
|
* @returns {Promise<CartDetailResponse>} - Success response
|
|
688
|
-
* @summary:
|
|
689
|
-
* @description: Use this API to
|
|
645
|
+
* @summary: Fetch all items added to the cart
|
|
646
|
+
* @description: Use this API to get details of all the items added to a cart.
|
|
690
647
|
*/
|
|
691
|
-
async
|
|
692
|
-
const { error } = CartValidator.
|
|
693
|
-
{
|
|
648
|
+
async getCart({ id, i, b, assignCardId, areaCode, buyNow } = {}) {
|
|
649
|
+
const { error } = CartValidator.getCart().validate(
|
|
650
|
+
{ id, i, b, assignCardId, areaCode, buyNow },
|
|
694
651
|
{ abortEarly: false, allowUnknown: true }
|
|
695
652
|
);
|
|
696
653
|
if (error) {
|
|
@@ -698,14 +655,14 @@ class Cart {
|
|
|
698
655
|
}
|
|
699
656
|
|
|
700
657
|
// Showing warrnings if extra unknown parameters are found
|
|
701
|
-
const { error: warrning } = CartValidator.
|
|
702
|
-
{
|
|
658
|
+
const { error: warrning } = CartValidator.getCart().validate(
|
|
659
|
+
{ id, i, b, assignCardId, areaCode, buyNow },
|
|
703
660
|
{ abortEarly: false, allowUnknown: false }
|
|
704
661
|
);
|
|
705
662
|
if (warrning) {
|
|
706
663
|
Logger({
|
|
707
664
|
level: "WARN",
|
|
708
|
-
message: "Parameter Validation warrnings for
|
|
665
|
+
message: "Parameter Validation warrnings for getCart",
|
|
709
666
|
});
|
|
710
667
|
Logger({ level: "WARN", message: warrning });
|
|
711
668
|
}
|
|
@@ -714,19 +671,21 @@ class Cart {
|
|
|
714
671
|
query_params["id"] = id;
|
|
715
672
|
query_params["i"] = i;
|
|
716
673
|
query_params["b"] = b;
|
|
674
|
+
query_params["assign_card_id"] = assignCardId;
|
|
675
|
+
query_params["area_code"] = areaCode;
|
|
717
676
|
query_params["buy_now"] = buyNow;
|
|
718
677
|
|
|
719
678
|
const xHeaders = {};
|
|
720
679
|
|
|
721
|
-
const response = await
|
|
680
|
+
const response = await ApplicationAPIClient.execute(
|
|
722
681
|
this._conf,
|
|
723
|
-
"
|
|
682
|
+
"get",
|
|
724
683
|
constructUrl({
|
|
725
|
-
url: this._urls["
|
|
684
|
+
url: this._urls["getCart"],
|
|
726
685
|
params: {},
|
|
727
686
|
}),
|
|
728
687
|
query_params,
|
|
729
|
-
|
|
688
|
+
undefined,
|
|
730
689
|
xHeaders
|
|
731
690
|
);
|
|
732
691
|
|
|
@@ -740,7 +699,7 @@ class Cart {
|
|
|
740
699
|
if (res_error) {
|
|
741
700
|
Logger({
|
|
742
701
|
level: "WARN",
|
|
743
|
-
message: "Response Validation Warnnings for
|
|
702
|
+
message: "Response Validation Warnnings for getCart",
|
|
744
703
|
});
|
|
745
704
|
Logger({ level: "WARN", message: res_error });
|
|
746
705
|
}
|
|
@@ -750,26 +709,14 @@ class Cart {
|
|
|
750
709
|
|
|
751
710
|
/**
|
|
752
711
|
* @param {Object} arg - Arg object.
|
|
753
|
-
* @param {string} [arg.
|
|
754
|
-
* @
|
|
755
|
-
* @
|
|
756
|
-
* @
|
|
757
|
-
* @param {string} [arg.tags] -
|
|
758
|
-
* @param {boolean} [arg.isDefault] -
|
|
759
|
-
* @returns {Promise<GetAddressesResponse>} - Success response
|
|
760
|
-
* @summary: Fetch address
|
|
761
|
-
* @description: Use this API to get all the addresses associated with an account. If successful, returns a Address resource in the response body specified in GetAddressesResponse.attibutes listed below are optional <ul> <li> <font color="monochrome">uid</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
|
|
712
|
+
* @param {string} [arg.id] -
|
|
713
|
+
* @returns {Promise<any>} - Success response
|
|
714
|
+
* @summary: Fetch last-modified timestamp
|
|
715
|
+
* @description: Use this API to fetch Last-Modified timestamp in header metadata.
|
|
762
716
|
*/
|
|
763
|
-
async
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
mobileNo,
|
|
767
|
-
checkoutMode,
|
|
768
|
-
tags,
|
|
769
|
-
isDefault,
|
|
770
|
-
} = {}) {
|
|
771
|
-
const { error } = CartValidator.getAddresses().validate(
|
|
772
|
-
{ cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
717
|
+
async getCartLastModified({ id } = {}) {
|
|
718
|
+
const { error } = CartValidator.getCartLastModified().validate(
|
|
719
|
+
{ id },
|
|
773
720
|
{ abortEarly: false, allowUnknown: true }
|
|
774
721
|
);
|
|
775
722
|
if (error) {
|
|
@@ -777,33 +724,28 @@ class Cart {
|
|
|
777
724
|
}
|
|
778
725
|
|
|
779
726
|
// Showing warrnings if extra unknown parameters are found
|
|
780
|
-
const { error: warrning } = CartValidator.
|
|
781
|
-
{
|
|
727
|
+
const { error: warrning } = CartValidator.getCartLastModified().validate(
|
|
728
|
+
{ id },
|
|
782
729
|
{ abortEarly: false, allowUnknown: false }
|
|
783
730
|
);
|
|
784
731
|
if (warrning) {
|
|
785
732
|
Logger({
|
|
786
733
|
level: "WARN",
|
|
787
|
-
message: "Parameter Validation warrnings for
|
|
734
|
+
message: "Parameter Validation warrnings for getCartLastModified",
|
|
788
735
|
});
|
|
789
736
|
Logger({ level: "WARN", message: warrning });
|
|
790
737
|
}
|
|
791
738
|
|
|
792
739
|
const query_params = {};
|
|
793
|
-
query_params["
|
|
794
|
-
query_params["buy_now"] = buyNow;
|
|
795
|
-
query_params["mobile_no"] = mobileNo;
|
|
796
|
-
query_params["checkout_mode"] = checkoutMode;
|
|
797
|
-
query_params["tags"] = tags;
|
|
798
|
-
query_params["is_default"] = isDefault;
|
|
740
|
+
query_params["id"] = id;
|
|
799
741
|
|
|
800
742
|
const xHeaders = {};
|
|
801
743
|
|
|
802
|
-
const response = await
|
|
744
|
+
const response = await ApplicationAPIClient.execute(
|
|
803
745
|
this._conf,
|
|
804
|
-
"
|
|
746
|
+
"head",
|
|
805
747
|
constructUrl({
|
|
806
|
-
url: this._urls["
|
|
748
|
+
url: this._urls["getCartLastModified"],
|
|
807
749
|
params: {},
|
|
808
750
|
}),
|
|
809
751
|
query_params,
|
|
@@ -811,17 +753,14 @@ class Cart {
|
|
|
811
753
|
xHeaders
|
|
812
754
|
);
|
|
813
755
|
|
|
814
|
-
const {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
abortEarly: false,
|
|
818
|
-
allowUnknown: false,
|
|
819
|
-
});
|
|
756
|
+
const { error: res_error } = Joi.string()
|
|
757
|
+
.allow("")
|
|
758
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
820
759
|
|
|
821
760
|
if (res_error) {
|
|
822
761
|
Logger({
|
|
823
762
|
level: "WARN",
|
|
824
|
-
message: "Response Validation Warnnings for
|
|
763
|
+
message: "Response Validation Warnnings for getCartLastModified",
|
|
825
764
|
});
|
|
826
765
|
Logger({ level: "WARN", message: res_error });
|
|
827
766
|
}
|
|
@@ -831,13 +770,13 @@ class Cart {
|
|
|
831
770
|
|
|
832
771
|
/**
|
|
833
772
|
* @param {Object} arg - Arg object.
|
|
834
|
-
* @param {
|
|
835
|
-
* @returns {Promise<
|
|
836
|
-
* @summary:
|
|
837
|
-
* @description: Use this API to
|
|
773
|
+
* @param {GetShareCartLinkRequest} arg.body
|
|
774
|
+
* @returns {Promise<GetShareCartLinkResponse>} - Success response
|
|
775
|
+
* @summary: Generate token for sharing the cart
|
|
776
|
+
* @description: Use this API to generate a shared cart snapshot and return a shortlink token. The link can be shared with other users for getting the same items in their cart.
|
|
838
777
|
*/
|
|
839
|
-
async
|
|
840
|
-
const { error } = CartValidator.
|
|
778
|
+
async getCartShareLink({ body } = {}) {
|
|
779
|
+
const { error } = CartValidator.getCartShareLink().validate(
|
|
841
780
|
{ body },
|
|
842
781
|
{ abortEarly: false, allowUnknown: true }
|
|
843
782
|
);
|
|
@@ -846,14 +785,14 @@ class Cart {
|
|
|
846
785
|
}
|
|
847
786
|
|
|
848
787
|
// Showing warrnings if extra unknown parameters are found
|
|
849
|
-
const { error: warrning } = CartValidator.
|
|
788
|
+
const { error: warrning } = CartValidator.getCartShareLink().validate(
|
|
850
789
|
{ body },
|
|
851
790
|
{ abortEarly: false, allowUnknown: false }
|
|
852
791
|
);
|
|
853
792
|
if (warrning) {
|
|
854
793
|
Logger({
|
|
855
794
|
level: "WARN",
|
|
856
|
-
message: "Parameter Validation warrnings for
|
|
795
|
+
message: "Parameter Validation warrnings for getCartShareLink",
|
|
857
796
|
});
|
|
858
797
|
Logger({ level: "WARN", message: warrning });
|
|
859
798
|
}
|
|
@@ -862,11 +801,11 @@ class Cart {
|
|
|
862
801
|
|
|
863
802
|
const xHeaders = {};
|
|
864
803
|
|
|
865
|
-
const response = await
|
|
804
|
+
const response = await ApplicationAPIClient.execute(
|
|
866
805
|
this._conf,
|
|
867
806
|
"post",
|
|
868
807
|
constructUrl({
|
|
869
|
-
url: this._urls["
|
|
808
|
+
url: this._urls["getCartShareLink"],
|
|
870
809
|
params: {},
|
|
871
810
|
}),
|
|
872
811
|
query_params,
|
|
@@ -876,7 +815,7 @@ class Cart {
|
|
|
876
815
|
|
|
877
816
|
const {
|
|
878
817
|
error: res_error,
|
|
879
|
-
} = CartModel.
|
|
818
|
+
} = CartModel.GetShareCartLinkResponse().validate(response, {
|
|
880
819
|
abortEarly: false,
|
|
881
820
|
allowUnknown: false,
|
|
882
821
|
});
|
|
@@ -884,7 +823,7 @@ class Cart {
|
|
|
884
823
|
if (res_error) {
|
|
885
824
|
Logger({
|
|
886
825
|
level: "WARN",
|
|
887
|
-
message: "Response Validation Warnnings for
|
|
826
|
+
message: "Response Validation Warnnings for getCartShareLink",
|
|
888
827
|
});
|
|
889
828
|
Logger({ level: "WARN", message: res_error });
|
|
890
829
|
}
|
|
@@ -894,28 +833,14 @@ class Cart {
|
|
|
894
833
|
|
|
895
834
|
/**
|
|
896
835
|
* @param {Object} arg - Arg object.
|
|
897
|
-
* @param {string} arg.
|
|
898
|
-
* @
|
|
899
|
-
* @
|
|
900
|
-
* @
|
|
901
|
-
* @param {string} [arg.checkoutMode] -
|
|
902
|
-
* @param {string} [arg.tags] -
|
|
903
|
-
* @param {boolean} [arg.isDefault] -
|
|
904
|
-
* @returns {Promise<Address>} - Success response
|
|
905
|
-
* @summary: Fetch a single address by its ID
|
|
906
|
-
* @description: Use this API to get an addresses using its ID. If successful, returns a Address resource in the response body specified in `Address`. Attibutes listed below are optional <ul> <li> <font color="monochrome">mobile_no</font></li> <li> <font color="monochrome">checkout_mode</font></li> <li> <font color="monochrome">tags</font></li> <li> <font color="monochrome">default</font></li> </ul>
|
|
836
|
+
* @param {string} arg.token - Token of the shared short link
|
|
837
|
+
* @returns {Promise<SharedCartResponse>} - Success response
|
|
838
|
+
* @summary: Get details of a shared cart
|
|
839
|
+
* @description: Use this API to get the shared cart details as per the token generated using the share-cart API.
|
|
907
840
|
*/
|
|
908
|
-
async
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
buyNow,
|
|
912
|
-
mobileNo,
|
|
913
|
-
checkoutMode,
|
|
914
|
-
tags,
|
|
915
|
-
isDefault,
|
|
916
|
-
} = {}) {
|
|
917
|
-
const { error } = CartValidator.getAddressById().validate(
|
|
918
|
-
{ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault },
|
|
841
|
+
async getCartSharedItems({ token } = {}) {
|
|
842
|
+
const { error } = CartValidator.getCartSharedItems().validate(
|
|
843
|
+
{ token },
|
|
919
844
|
{ abortEarly: false, allowUnknown: true }
|
|
920
845
|
);
|
|
921
846
|
if (error) {
|
|
@@ -923,41 +848,37 @@ class Cart {
|
|
|
923
848
|
}
|
|
924
849
|
|
|
925
850
|
// Showing warrnings if extra unknown parameters are found
|
|
926
|
-
const { error: warrning } = CartValidator.
|
|
927
|
-
{
|
|
851
|
+
const { error: warrning } = CartValidator.getCartSharedItems().validate(
|
|
852
|
+
{ token },
|
|
928
853
|
{ abortEarly: false, allowUnknown: false }
|
|
929
854
|
);
|
|
930
855
|
if (warrning) {
|
|
931
856
|
Logger({
|
|
932
857
|
level: "WARN",
|
|
933
|
-
message: "Parameter Validation warrnings for
|
|
858
|
+
message: "Parameter Validation warrnings for getCartSharedItems",
|
|
934
859
|
});
|
|
935
860
|
Logger({ level: "WARN", message: warrning });
|
|
936
861
|
}
|
|
937
862
|
|
|
938
863
|
const query_params = {};
|
|
939
|
-
query_params["cart_id"] = cartId;
|
|
940
|
-
query_params["buy_now"] = buyNow;
|
|
941
|
-
query_params["mobile_no"] = mobileNo;
|
|
942
|
-
query_params["checkout_mode"] = checkoutMode;
|
|
943
|
-
query_params["tags"] = tags;
|
|
944
|
-
query_params["is_default"] = isDefault;
|
|
945
864
|
|
|
946
865
|
const xHeaders = {};
|
|
947
866
|
|
|
948
|
-
const response = await
|
|
867
|
+
const response = await ApplicationAPIClient.execute(
|
|
949
868
|
this._conf,
|
|
950
869
|
"get",
|
|
951
870
|
constructUrl({
|
|
952
|
-
url: this._urls["
|
|
953
|
-
params: {
|
|
871
|
+
url: this._urls["getCartSharedItems"],
|
|
872
|
+
params: { token },
|
|
954
873
|
}),
|
|
955
874
|
query_params,
|
|
956
875
|
undefined,
|
|
957
876
|
xHeaders
|
|
958
877
|
);
|
|
959
878
|
|
|
960
|
-
const {
|
|
879
|
+
const {
|
|
880
|
+
error: res_error,
|
|
881
|
+
} = CartModel.SharedCartResponse().validate(response, {
|
|
961
882
|
abortEarly: false,
|
|
962
883
|
allowUnknown: false,
|
|
963
884
|
});
|
|
@@ -965,7 +886,7 @@ class Cart {
|
|
|
965
886
|
if (res_error) {
|
|
966
887
|
Logger({
|
|
967
888
|
level: "WARN",
|
|
968
|
-
message: "Response Validation Warnnings for
|
|
889
|
+
message: "Response Validation Warnnings for getCartSharedItems",
|
|
969
890
|
});
|
|
970
891
|
Logger({ level: "WARN", message: res_error });
|
|
971
892
|
}
|
|
@@ -975,15 +896,15 @@ class Cart {
|
|
|
975
896
|
|
|
976
897
|
/**
|
|
977
898
|
* @param {Object} arg - Arg object.
|
|
978
|
-
* @param {string} arg.id -
|
|
979
|
-
* @param {
|
|
980
|
-
* @returns {Promise<
|
|
981
|
-
* @summary:
|
|
982
|
-
* @description:
|
|
983
|
-
*/
|
|
984
|
-
async
|
|
985
|
-
const { error } = CartValidator.
|
|
986
|
-
{ id,
|
|
899
|
+
* @param {string} [arg.id] -
|
|
900
|
+
* @param {boolean} [arg.buyNow] -
|
|
901
|
+
* @returns {Promise<GetCouponResponse>} - Success response
|
|
902
|
+
* @summary: Fetch Coupon
|
|
903
|
+
* @description: Use this API to get a list of available coupons along with their details.
|
|
904
|
+
*/
|
|
905
|
+
async getCoupons({ id, buyNow } = {}) {
|
|
906
|
+
const { error } = CartValidator.getCoupons().validate(
|
|
907
|
+
{ id, buyNow },
|
|
987
908
|
{ abortEarly: false, allowUnknown: true }
|
|
988
909
|
);
|
|
989
910
|
if (error) {
|
|
@@ -991,37 +912,39 @@ class Cart {
|
|
|
991
912
|
}
|
|
992
913
|
|
|
993
914
|
// Showing warrnings if extra unknown parameters are found
|
|
994
|
-
const { error: warrning } = CartValidator.
|
|
995
|
-
{ id,
|
|
915
|
+
const { error: warrning } = CartValidator.getCoupons().validate(
|
|
916
|
+
{ id, buyNow },
|
|
996
917
|
{ abortEarly: false, allowUnknown: false }
|
|
997
918
|
);
|
|
998
919
|
if (warrning) {
|
|
999
920
|
Logger({
|
|
1000
921
|
level: "WARN",
|
|
1001
|
-
message: "Parameter Validation warrnings for
|
|
922
|
+
message: "Parameter Validation warrnings for getCoupons",
|
|
1002
923
|
});
|
|
1003
924
|
Logger({ level: "WARN", message: warrning });
|
|
1004
925
|
}
|
|
1005
926
|
|
|
1006
927
|
const query_params = {};
|
|
928
|
+
query_params["id"] = id;
|
|
929
|
+
query_params["buy_now"] = buyNow;
|
|
1007
930
|
|
|
1008
931
|
const xHeaders = {};
|
|
1009
932
|
|
|
1010
|
-
const response = await
|
|
933
|
+
const response = await ApplicationAPIClient.execute(
|
|
1011
934
|
this._conf,
|
|
1012
|
-
"
|
|
935
|
+
"get",
|
|
1013
936
|
constructUrl({
|
|
1014
|
-
url: this._urls["
|
|
1015
|
-
params: {
|
|
937
|
+
url: this._urls["getCoupons"],
|
|
938
|
+
params: {},
|
|
1016
939
|
}),
|
|
1017
940
|
query_params,
|
|
1018
|
-
|
|
941
|
+
undefined,
|
|
1019
942
|
xHeaders
|
|
1020
943
|
);
|
|
1021
944
|
|
|
1022
945
|
const {
|
|
1023
946
|
error: res_error,
|
|
1024
|
-
} = CartModel.
|
|
947
|
+
} = CartModel.GetCouponResponse().validate(response, {
|
|
1025
948
|
abortEarly: false,
|
|
1026
949
|
allowUnknown: false,
|
|
1027
950
|
});
|
|
@@ -1029,7 +952,7 @@ class Cart {
|
|
|
1029
952
|
if (res_error) {
|
|
1030
953
|
Logger({
|
|
1031
954
|
level: "WARN",
|
|
1032
|
-
message: "Response Validation Warnnings for
|
|
955
|
+
message: "Response Validation Warnnings for getCoupons",
|
|
1033
956
|
});
|
|
1034
957
|
Logger({ level: "WARN", message: res_error });
|
|
1035
958
|
}
|
|
@@ -1039,14 +962,15 @@ class Cart {
|
|
|
1039
962
|
|
|
1040
963
|
/**
|
|
1041
964
|
* @param {Object} arg - Arg object.
|
|
1042
|
-
* @param {string} arg.id -
|
|
1043
|
-
* @
|
|
1044
|
-
* @
|
|
1045
|
-
* @
|
|
965
|
+
* @param {string} [arg.id] - The unique identifier of the cart.
|
|
966
|
+
* @param {boolean} [arg.buyNow] -
|
|
967
|
+
* @returns {Promise<CartItemCountResponse>} - Success response
|
|
968
|
+
* @summary: Count items in the cart
|
|
969
|
+
* @description: Use this API to get the total number of items present in cart.
|
|
1046
970
|
*/
|
|
1047
|
-
async
|
|
1048
|
-
const { error } = CartValidator.
|
|
1049
|
-
{ id },
|
|
971
|
+
async getItemCount({ id, buyNow } = {}) {
|
|
972
|
+
const { error } = CartValidator.getItemCount().validate(
|
|
973
|
+
{ id, buyNow },
|
|
1050
974
|
{ abortEarly: false, allowUnknown: true }
|
|
1051
975
|
);
|
|
1052
976
|
if (error) {
|
|
@@ -1054,28 +978,30 @@ class Cart {
|
|
|
1054
978
|
}
|
|
1055
979
|
|
|
1056
980
|
// Showing warrnings if extra unknown parameters are found
|
|
1057
|
-
const { error: warrning } = CartValidator.
|
|
1058
|
-
{ id },
|
|
981
|
+
const { error: warrning } = CartValidator.getItemCount().validate(
|
|
982
|
+
{ id, buyNow },
|
|
1059
983
|
{ abortEarly: false, allowUnknown: false }
|
|
1060
984
|
);
|
|
1061
985
|
if (warrning) {
|
|
1062
986
|
Logger({
|
|
1063
987
|
level: "WARN",
|
|
1064
|
-
message: "Parameter Validation warrnings for
|
|
988
|
+
message: "Parameter Validation warrnings for getItemCount",
|
|
1065
989
|
});
|
|
1066
990
|
Logger({ level: "WARN", message: warrning });
|
|
1067
991
|
}
|
|
1068
992
|
|
|
1069
993
|
const query_params = {};
|
|
994
|
+
query_params["id"] = id;
|
|
995
|
+
query_params["buy_now"] = buyNow;
|
|
1070
996
|
|
|
1071
997
|
const xHeaders = {};
|
|
1072
998
|
|
|
1073
|
-
const response = await
|
|
999
|
+
const response = await ApplicationAPIClient.execute(
|
|
1074
1000
|
this._conf,
|
|
1075
|
-
"
|
|
1001
|
+
"get",
|
|
1076
1002
|
constructUrl({
|
|
1077
|
-
url: this._urls["
|
|
1078
|
-
params: {
|
|
1003
|
+
url: this._urls["getItemCount"],
|
|
1004
|
+
params: {},
|
|
1079
1005
|
}),
|
|
1080
1006
|
query_params,
|
|
1081
1007
|
undefined,
|
|
@@ -1084,7 +1010,7 @@ class Cart {
|
|
|
1084
1010
|
|
|
1085
1011
|
const {
|
|
1086
1012
|
error: res_error,
|
|
1087
|
-
} = CartModel.
|
|
1013
|
+
} = CartModel.CartItemCountResponse().validate(response, {
|
|
1088
1014
|
abortEarly: false,
|
|
1089
1015
|
allowUnknown: false,
|
|
1090
1016
|
});
|
|
@@ -1092,7 +1018,7 @@ class Cart {
|
|
|
1092
1018
|
if (res_error) {
|
|
1093
1019
|
Logger({
|
|
1094
1020
|
level: "WARN",
|
|
1095
|
-
message: "Response Validation Warnnings for
|
|
1021
|
+
message: "Response Validation Warnnings for getItemCount",
|
|
1096
1022
|
});
|
|
1097
1023
|
Logger({ level: "WARN", message: res_error });
|
|
1098
1024
|
}
|
|
@@ -1102,18 +1028,21 @@ class Cart {
|
|
|
1102
1028
|
|
|
1103
1029
|
/**
|
|
1104
1030
|
* @param {Object} arg - Arg object.
|
|
1105
|
-
* @param {string}
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
* @param {
|
|
1109
|
-
*
|
|
1110
|
-
* @
|
|
1111
|
-
*
|
|
1112
|
-
* @
|
|
1031
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1032
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1033
|
+
* /service/application/catalog/v1.0/products/
|
|
1034
|
+
* @param {string} [arg.storeId] - Store uid of assigned store on PDP page.
|
|
1035
|
+
* If not passed default first created ladder will be returned
|
|
1036
|
+
* @param {string} [arg.promotionId] - Get ladder information of given
|
|
1037
|
+
* promotion id explicitely
|
|
1038
|
+
* @param {number} [arg.pageSize] - Number of offers to be fetched to show
|
|
1039
|
+
* @returns {Promise<LadderPriceOffers>} - Success response
|
|
1040
|
+
* @summary: Fetch ladder price promotion
|
|
1041
|
+
* @description: Use this API to get applicable ladder price promotion for current product
|
|
1113
1042
|
*/
|
|
1114
|
-
async
|
|
1115
|
-
const { error } = CartValidator.
|
|
1116
|
-
{
|
|
1043
|
+
async getLadderOffers({ slug, storeId, promotionId, pageSize } = {}) {
|
|
1044
|
+
const { error } = CartValidator.getLadderOffers().validate(
|
|
1045
|
+
{ slug, storeId, promotionId, pageSize },
|
|
1117
1046
|
{ abortEarly: false, allowUnknown: true }
|
|
1118
1047
|
);
|
|
1119
1048
|
if (error) {
|
|
@@ -1121,41 +1050,41 @@ class Cart {
|
|
|
1121
1050
|
}
|
|
1122
1051
|
|
|
1123
1052
|
// Showing warrnings if extra unknown parameters are found
|
|
1124
|
-
const { error: warrning } = CartValidator.
|
|
1125
|
-
{
|
|
1053
|
+
const { error: warrning } = CartValidator.getLadderOffers().validate(
|
|
1054
|
+
{ slug, storeId, promotionId, pageSize },
|
|
1126
1055
|
{ abortEarly: false, allowUnknown: false }
|
|
1127
1056
|
);
|
|
1128
1057
|
if (warrning) {
|
|
1129
1058
|
Logger({
|
|
1130
1059
|
level: "WARN",
|
|
1131
|
-
message: "Parameter Validation warrnings for
|
|
1060
|
+
message: "Parameter Validation warrnings for getLadderOffers",
|
|
1132
1061
|
});
|
|
1133
1062
|
Logger({ level: "WARN", message: warrning });
|
|
1134
1063
|
}
|
|
1135
1064
|
|
|
1136
1065
|
const query_params = {};
|
|
1137
|
-
query_params["
|
|
1138
|
-
query_params["
|
|
1139
|
-
query_params["
|
|
1140
|
-
query_params["
|
|
1066
|
+
query_params["slug"] = slug;
|
|
1067
|
+
query_params["store_id"] = storeId;
|
|
1068
|
+
query_params["promotion_id"] = promotionId;
|
|
1069
|
+
query_params["page_size"] = pageSize;
|
|
1141
1070
|
|
|
1142
1071
|
const xHeaders = {};
|
|
1143
1072
|
|
|
1144
|
-
const response = await
|
|
1073
|
+
const response = await ApplicationAPIClient.execute(
|
|
1145
1074
|
this._conf,
|
|
1146
|
-
"
|
|
1075
|
+
"get",
|
|
1147
1076
|
constructUrl({
|
|
1148
|
-
url: this._urls["
|
|
1077
|
+
url: this._urls["getLadderOffers"],
|
|
1149
1078
|
params: {},
|
|
1150
1079
|
}),
|
|
1151
1080
|
query_params,
|
|
1152
|
-
|
|
1081
|
+
undefined,
|
|
1153
1082
|
xHeaders
|
|
1154
1083
|
);
|
|
1155
1084
|
|
|
1156
1085
|
const {
|
|
1157
1086
|
error: res_error,
|
|
1158
|
-
} = CartModel.
|
|
1087
|
+
} = CartModel.LadderPriceOffers().validate(response, {
|
|
1159
1088
|
abortEarly: false,
|
|
1160
1089
|
allowUnknown: false,
|
|
1161
1090
|
});
|
|
@@ -1163,7 +1092,7 @@ class Cart {
|
|
|
1163
1092
|
if (res_error) {
|
|
1164
1093
|
Logger({
|
|
1165
1094
|
level: "WARN",
|
|
1166
|
-
message: "Response Validation Warnnings for
|
|
1095
|
+
message: "Response Validation Warnnings for getLadderOffers",
|
|
1167
1096
|
});
|
|
1168
1097
|
Logger({ level: "WARN", message: res_error });
|
|
1169
1098
|
}
|
|
@@ -1173,16 +1102,18 @@ class Cart {
|
|
|
1173
1102
|
|
|
1174
1103
|
/**
|
|
1175
1104
|
* @param {Object} arg - Arg object.
|
|
1176
|
-
* @param {string} [arg.
|
|
1177
|
-
*
|
|
1178
|
-
*
|
|
1179
|
-
* @
|
|
1180
|
-
* @
|
|
1181
|
-
* @
|
|
1105
|
+
* @param {string} [arg.slug] - A short, human-readable, URL-friendly
|
|
1106
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1107
|
+
* /service/application/catalog/v1.0/products/
|
|
1108
|
+
* @param {number} [arg.pageSize] - Number of offers to be fetched to show
|
|
1109
|
+
* @param {string} [arg.promotionGroup] - Type of promotion groups
|
|
1110
|
+
* @returns {Promise<PromotionOffersResponse>} - Success response
|
|
1111
|
+
* @summary: Fetch available promotions
|
|
1112
|
+
* @description: Use this API to get top 5 offers available for current product
|
|
1182
1113
|
*/
|
|
1183
|
-
async
|
|
1184
|
-
const { error } = CartValidator.
|
|
1185
|
-
{
|
|
1114
|
+
async getPromotionOffers({ slug, pageSize, promotionGroup } = {}) {
|
|
1115
|
+
const { error } = CartValidator.getPromotionOffers().validate(
|
|
1116
|
+
{ slug, pageSize, promotionGroup },
|
|
1186
1117
|
{ abortEarly: false, allowUnknown: true }
|
|
1187
1118
|
);
|
|
1188
1119
|
if (error) {
|
|
@@ -1190,39 +1121,40 @@ class Cart {
|
|
|
1190
1121
|
}
|
|
1191
1122
|
|
|
1192
1123
|
// Showing warrnings if extra unknown parameters are found
|
|
1193
|
-
const { error: warrning } = CartValidator.
|
|
1194
|
-
{
|
|
1124
|
+
const { error: warrning } = CartValidator.getPromotionOffers().validate(
|
|
1125
|
+
{ slug, pageSize, promotionGroup },
|
|
1195
1126
|
{ abortEarly: false, allowUnknown: false }
|
|
1196
1127
|
);
|
|
1197
1128
|
if (warrning) {
|
|
1198
1129
|
Logger({
|
|
1199
1130
|
level: "WARN",
|
|
1200
|
-
message: "Parameter Validation warrnings for
|
|
1131
|
+
message: "Parameter Validation warrnings for getPromotionOffers",
|
|
1201
1132
|
});
|
|
1202
1133
|
Logger({ level: "WARN", message: warrning });
|
|
1203
1134
|
}
|
|
1204
1135
|
|
|
1205
1136
|
const query_params = {};
|
|
1206
|
-
query_params["
|
|
1207
|
-
query_params["
|
|
1137
|
+
query_params["slug"] = slug;
|
|
1138
|
+
query_params["page_size"] = pageSize;
|
|
1139
|
+
query_params["promotion_group"] = promotionGroup;
|
|
1208
1140
|
|
|
1209
1141
|
const xHeaders = {};
|
|
1210
1142
|
|
|
1211
|
-
const response = await
|
|
1143
|
+
const response = await ApplicationAPIClient.execute(
|
|
1212
1144
|
this._conf,
|
|
1213
|
-
"
|
|
1145
|
+
"get",
|
|
1214
1146
|
constructUrl({
|
|
1215
|
-
url: this._urls["
|
|
1147
|
+
url: this._urls["getPromotionOffers"],
|
|
1216
1148
|
params: {},
|
|
1217
1149
|
}),
|
|
1218
1150
|
query_params,
|
|
1219
|
-
|
|
1151
|
+
undefined,
|
|
1220
1152
|
xHeaders
|
|
1221
1153
|
);
|
|
1222
1154
|
|
|
1223
1155
|
const {
|
|
1224
1156
|
error: res_error,
|
|
1225
|
-
} = CartModel.
|
|
1157
|
+
} = CartModel.PromotionOffersResponse().validate(response, {
|
|
1226
1158
|
abortEarly: false,
|
|
1227
1159
|
allowUnknown: false,
|
|
1228
1160
|
});
|
|
@@ -1230,7 +1162,7 @@ class Cart {
|
|
|
1230
1162
|
if (res_error) {
|
|
1231
1163
|
Logger({
|
|
1232
1164
|
level: "WARN",
|
|
1233
|
-
message: "Response Validation Warnnings for
|
|
1165
|
+
message: "Response Validation Warnnings for getPromotionOffers",
|
|
1234
1166
|
});
|
|
1235
1167
|
Logger({ level: "WARN", message: res_error });
|
|
1236
1168
|
}
|
|
@@ -1240,36 +1172,20 @@ class Cart {
|
|
|
1240
1172
|
|
|
1241
1173
|
/**
|
|
1242
1174
|
* @param {Object} arg - Arg object.
|
|
1243
|
-
* @param {
|
|
1175
|
+
* @param {boolean} [arg.p] - This is a boolean value. Select `true` for
|
|
1176
|
+
* getting a payment option in response.
|
|
1177
|
+
* @param {string} [arg.id] - The unique identifier of the cart
|
|
1244
1178
|
* @param {boolean} [arg.buyNow] -
|
|
1245
|
-
* @param {string} [arg.addressId] -
|
|
1246
|
-
* @param {string} [arg.
|
|
1247
|
-
*
|
|
1248
|
-
* @
|
|
1249
|
-
* @
|
|
1250
|
-
* @
|
|
1251
|
-
* @summary: Verify the coupon eligibility against the payment mode
|
|
1252
|
-
* @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
|
|
1179
|
+
* @param {string} [arg.addressId] - ID allotted to the selected address
|
|
1180
|
+
* @param {string} [arg.areaCode] - The PIN Code of the destination address,
|
|
1181
|
+
* e.g. 400059
|
|
1182
|
+
* @returns {Promise<CartShipmentsResponse>} - Success response
|
|
1183
|
+
* @summary: Get delivery date and options before checkout
|
|
1184
|
+
* @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
|
|
1253
1185
|
*/
|
|
1254
|
-
async
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
addressId,
|
|
1258
|
-
paymentMode,
|
|
1259
|
-
paymentIdentifier,
|
|
1260
|
-
aggregatorName,
|
|
1261
|
-
merchantCode,
|
|
1262
|
-
} = {}) {
|
|
1263
|
-
const { error } = CartValidator.validateCouponForPayment().validate(
|
|
1264
|
-
{
|
|
1265
|
-
id,
|
|
1266
|
-
buyNow,
|
|
1267
|
-
addressId,
|
|
1268
|
-
paymentMode,
|
|
1269
|
-
paymentIdentifier,
|
|
1270
|
-
aggregatorName,
|
|
1271
|
-
merchantCode,
|
|
1272
|
-
},
|
|
1186
|
+
async getShipments({ p, id, buyNow, addressId, areaCode } = {}) {
|
|
1187
|
+
const { error } = CartValidator.getShipments().validate(
|
|
1188
|
+
{ p, id, buyNow, addressId, areaCode },
|
|
1273
1189
|
{ abortEarly: false, allowUnknown: true }
|
|
1274
1190
|
);
|
|
1275
1191
|
if (error) {
|
|
@@ -1277,44 +1193,32 @@ class Cart {
|
|
|
1277
1193
|
}
|
|
1278
1194
|
|
|
1279
1195
|
// Showing warrnings if extra unknown parameters are found
|
|
1280
|
-
const {
|
|
1281
|
-
|
|
1282
|
-
} = CartValidator.validateCouponForPayment().validate(
|
|
1283
|
-
{
|
|
1284
|
-
id,
|
|
1285
|
-
buyNow,
|
|
1286
|
-
addressId,
|
|
1287
|
-
paymentMode,
|
|
1288
|
-
paymentIdentifier,
|
|
1289
|
-
aggregatorName,
|
|
1290
|
-
merchantCode,
|
|
1291
|
-
},
|
|
1196
|
+
const { error: warrning } = CartValidator.getShipments().validate(
|
|
1197
|
+
{ p, id, buyNow, addressId, areaCode },
|
|
1292
1198
|
{ abortEarly: false, allowUnknown: false }
|
|
1293
1199
|
);
|
|
1294
1200
|
if (warrning) {
|
|
1295
1201
|
Logger({
|
|
1296
1202
|
level: "WARN",
|
|
1297
|
-
message: "Parameter Validation warrnings for
|
|
1203
|
+
message: "Parameter Validation warrnings for getShipments",
|
|
1298
1204
|
});
|
|
1299
1205
|
Logger({ level: "WARN", message: warrning });
|
|
1300
1206
|
}
|
|
1301
1207
|
|
|
1302
1208
|
const query_params = {};
|
|
1209
|
+
query_params["p"] = p;
|
|
1303
1210
|
query_params["id"] = id;
|
|
1304
1211
|
query_params["buy_now"] = buyNow;
|
|
1305
1212
|
query_params["address_id"] = addressId;
|
|
1306
|
-
query_params["
|
|
1307
|
-
query_params["payment_identifier"] = paymentIdentifier;
|
|
1308
|
-
query_params["aggregator_name"] = aggregatorName;
|
|
1309
|
-
query_params["merchant_code"] = merchantCode;
|
|
1213
|
+
query_params["area_code"] = areaCode;
|
|
1310
1214
|
|
|
1311
1215
|
const xHeaders = {};
|
|
1312
1216
|
|
|
1313
|
-
const response = await
|
|
1217
|
+
const response = await ApplicationAPIClient.execute(
|
|
1314
1218
|
this._conf,
|
|
1315
1219
|
"get",
|
|
1316
1220
|
constructUrl({
|
|
1317
|
-
url: this._urls["
|
|
1221
|
+
url: this._urls["getShipments"],
|
|
1318
1222
|
params: {},
|
|
1319
1223
|
}),
|
|
1320
1224
|
query_params,
|
|
@@ -1324,7 +1228,7 @@ class Cart {
|
|
|
1324
1228
|
|
|
1325
1229
|
const {
|
|
1326
1230
|
error: res_error,
|
|
1327
|
-
} = CartModel.
|
|
1231
|
+
} = CartModel.CartShipmentsResponse().validate(response, {
|
|
1328
1232
|
abortEarly: false,
|
|
1329
1233
|
allowUnknown: false,
|
|
1330
1234
|
});
|
|
@@ -1332,7 +1236,7 @@ class Cart {
|
|
|
1332
1236
|
if (res_error) {
|
|
1333
1237
|
Logger({
|
|
1334
1238
|
level: "WARN",
|
|
1335
|
-
message: "Response Validation Warnnings for
|
|
1239
|
+
message: "Response Validation Warnnings for getShipments",
|
|
1336
1240
|
});
|
|
1337
1241
|
Logger({ level: "WARN", message: res_error });
|
|
1338
1242
|
}
|
|
@@ -1342,20 +1246,78 @@ class Cart {
|
|
|
1342
1246
|
|
|
1343
1247
|
/**
|
|
1344
1248
|
* @param {Object} arg - Arg object.
|
|
1345
|
-
* @param {
|
|
1346
|
-
*
|
|
1347
|
-
* @
|
|
1249
|
+
* @param {string} arg.id - ID allotted to the selected address
|
|
1250
|
+
* @returns {Promise<DeleteAddressResponse>} - Success response
|
|
1251
|
+
* @summary: Remove address associated with an account
|
|
1252
|
+
* @description: Use this API to delete an address by its ID. This will returns an object that will indicate whether the address was deleted successfully or not.
|
|
1253
|
+
*/
|
|
1254
|
+
async removeAddress({ id } = {}) {
|
|
1255
|
+
const { error } = CartValidator.removeAddress().validate(
|
|
1256
|
+
{ id },
|
|
1257
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1258
|
+
);
|
|
1259
|
+
if (error) {
|
|
1260
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1264
|
+
const { error: warrning } = CartValidator.removeAddress().validate(
|
|
1265
|
+
{ id },
|
|
1266
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1267
|
+
);
|
|
1268
|
+
if (warrning) {
|
|
1269
|
+
Logger({
|
|
1270
|
+
level: "WARN",
|
|
1271
|
+
message: "Parameter Validation warrnings for removeAddress",
|
|
1272
|
+
});
|
|
1273
|
+
Logger({ level: "WARN", message: warrning });
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
const query_params = {};
|
|
1277
|
+
|
|
1278
|
+
const xHeaders = {};
|
|
1279
|
+
|
|
1280
|
+
const response = await ApplicationAPIClient.execute(
|
|
1281
|
+
this._conf,
|
|
1282
|
+
"delete",
|
|
1283
|
+
constructUrl({
|
|
1284
|
+
url: this._urls["removeAddress"],
|
|
1285
|
+
params: { id },
|
|
1286
|
+
}),
|
|
1287
|
+
query_params,
|
|
1288
|
+
undefined,
|
|
1289
|
+
xHeaders
|
|
1290
|
+
);
|
|
1291
|
+
|
|
1292
|
+
const {
|
|
1293
|
+
error: res_error,
|
|
1294
|
+
} = CartModel.DeleteAddressResponse().validate(response, {
|
|
1295
|
+
abortEarly: false,
|
|
1296
|
+
allowUnknown: false,
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
if (res_error) {
|
|
1300
|
+
Logger({
|
|
1301
|
+
level: "WARN",
|
|
1302
|
+
message: "Response Validation Warnnings for removeAddress",
|
|
1303
|
+
});
|
|
1304
|
+
Logger({ level: "WARN", message: res_error });
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
return response;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* @param {Object} arg - Arg object.
|
|
1312
|
+
* @param {string} [arg.id] -
|
|
1348
1313
|
* @param {boolean} [arg.buyNow] -
|
|
1349
|
-
* @
|
|
1350
|
-
* @
|
|
1351
|
-
*
|
|
1352
|
-
* @returns {Promise<CartShipmentsResponse>} - Success response
|
|
1353
|
-
* @summary: Get delivery date and options before checkout
|
|
1354
|
-
* @description: Use this API to get shipment details, expected delivery date, items and price breakup of the shipment.
|
|
1314
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1315
|
+
* @summary: Remove Coupon Applied
|
|
1316
|
+
* @description: Remove Coupon applied on the cart by passing uid in request body.
|
|
1355
1317
|
*/
|
|
1356
|
-
async
|
|
1357
|
-
const { error } = CartValidator.
|
|
1358
|
-
{
|
|
1318
|
+
async removeCoupon({ id, buyNow } = {}) {
|
|
1319
|
+
const { error } = CartValidator.removeCoupon().validate(
|
|
1320
|
+
{ id, buyNow },
|
|
1359
1321
|
{ abortEarly: false, allowUnknown: true }
|
|
1360
1322
|
);
|
|
1361
1323
|
if (error) {
|
|
@@ -1363,32 +1325,29 @@ class Cart {
|
|
|
1363
1325
|
}
|
|
1364
1326
|
|
|
1365
1327
|
// Showing warrnings if extra unknown parameters are found
|
|
1366
|
-
const { error: warrning } = CartValidator.
|
|
1367
|
-
{
|
|
1328
|
+
const { error: warrning } = CartValidator.removeCoupon().validate(
|
|
1329
|
+
{ id, buyNow },
|
|
1368
1330
|
{ abortEarly: false, allowUnknown: false }
|
|
1369
1331
|
);
|
|
1370
1332
|
if (warrning) {
|
|
1371
1333
|
Logger({
|
|
1372
1334
|
level: "WARN",
|
|
1373
|
-
message: "Parameter Validation warrnings for
|
|
1335
|
+
message: "Parameter Validation warrnings for removeCoupon",
|
|
1374
1336
|
});
|
|
1375
1337
|
Logger({ level: "WARN", message: warrning });
|
|
1376
1338
|
}
|
|
1377
1339
|
|
|
1378
1340
|
const query_params = {};
|
|
1379
|
-
query_params["p"] = p;
|
|
1380
1341
|
query_params["id"] = id;
|
|
1381
1342
|
query_params["buy_now"] = buyNow;
|
|
1382
|
-
query_params["address_id"] = addressId;
|
|
1383
|
-
query_params["area_code"] = areaCode;
|
|
1384
1343
|
|
|
1385
1344
|
const xHeaders = {};
|
|
1386
1345
|
|
|
1387
|
-
const response = await
|
|
1346
|
+
const response = await ApplicationAPIClient.execute(
|
|
1388
1347
|
this._conf,
|
|
1389
|
-
"
|
|
1348
|
+
"delete",
|
|
1390
1349
|
constructUrl({
|
|
1391
|
-
url: this._urls["
|
|
1350
|
+
url: this._urls["removeCoupon"],
|
|
1392
1351
|
params: {},
|
|
1393
1352
|
}),
|
|
1394
1353
|
query_params,
|
|
@@ -1398,7 +1357,7 @@ class Cart {
|
|
|
1398
1357
|
|
|
1399
1358
|
const {
|
|
1400
1359
|
error: res_error,
|
|
1401
|
-
} = CartModel.
|
|
1360
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
1402
1361
|
abortEarly: false,
|
|
1403
1362
|
allowUnknown: false,
|
|
1404
1363
|
});
|
|
@@ -1406,7 +1365,7 @@ class Cart {
|
|
|
1406
1365
|
if (res_error) {
|
|
1407
1366
|
Logger({
|
|
1408
1367
|
level: "WARN",
|
|
1409
|
-
message: "Response Validation Warnnings for
|
|
1368
|
+
message: "Response Validation Warnnings for removeCoupon",
|
|
1410
1369
|
});
|
|
1411
1370
|
Logger({ level: "WARN", message: res_error });
|
|
1412
1371
|
}
|
|
@@ -1416,15 +1375,18 @@ class Cart {
|
|
|
1416
1375
|
|
|
1417
1376
|
/**
|
|
1418
1377
|
* @param {Object} arg - Arg object.
|
|
1419
|
-
* @param {
|
|
1420
|
-
* @param {
|
|
1421
|
-
* @
|
|
1422
|
-
* @
|
|
1423
|
-
* @
|
|
1378
|
+
* @param {string} [arg.cartId] -
|
|
1379
|
+
* @param {boolean} [arg.buyNow] -
|
|
1380
|
+
* @param {boolean} [arg.i] -
|
|
1381
|
+
* @param {boolean} [arg.b] -
|
|
1382
|
+
* @param {SelectCartAddressRequest} arg.body
|
|
1383
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1384
|
+
* @summary: Select an address from available addresses
|
|
1385
|
+
* @description: <p>Select Address from all addresses associated with the account in order to ship the cart items to that address, otherwise default address will be selected implicitly. See `SelectCartAddressRequest` in schema of request body for the list of attributes needed to select Address from account. On successful request, this API returns a Cart object. Below address attributes are required. <ul> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">billing_address_id</font></li> <li> <font color="monochrome">uid</font></li> </ul></p>
|
|
1424
1386
|
*/
|
|
1425
|
-
async
|
|
1426
|
-
const { error } = CartValidator.
|
|
1427
|
-
{ body, buyNow },
|
|
1387
|
+
async selectAddress({ body, cartId, buyNow, i, b } = {}) {
|
|
1388
|
+
const { error } = CartValidator.selectAddress().validate(
|
|
1389
|
+
{ body, cartId, buyNow, i, b },
|
|
1428
1390
|
{ abortEarly: false, allowUnknown: true }
|
|
1429
1391
|
);
|
|
1430
1392
|
if (error) {
|
|
@@ -1432,28 +1394,31 @@ class Cart {
|
|
|
1432
1394
|
}
|
|
1433
1395
|
|
|
1434
1396
|
// Showing warrnings if extra unknown parameters are found
|
|
1435
|
-
const { error: warrning } = CartValidator.
|
|
1436
|
-
{ body, buyNow },
|
|
1397
|
+
const { error: warrning } = CartValidator.selectAddress().validate(
|
|
1398
|
+
{ body, cartId, buyNow, i, b },
|
|
1437
1399
|
{ abortEarly: false, allowUnknown: false }
|
|
1438
1400
|
);
|
|
1439
1401
|
if (warrning) {
|
|
1440
1402
|
Logger({
|
|
1441
1403
|
level: "WARN",
|
|
1442
|
-
message: "Parameter Validation warrnings for
|
|
1404
|
+
message: "Parameter Validation warrnings for selectAddress",
|
|
1443
1405
|
});
|
|
1444
1406
|
Logger({ level: "WARN", message: warrning });
|
|
1445
1407
|
}
|
|
1446
1408
|
|
|
1447
1409
|
const query_params = {};
|
|
1410
|
+
query_params["cart_id"] = cartId;
|
|
1448
1411
|
query_params["buy_now"] = buyNow;
|
|
1412
|
+
query_params["i"] = i;
|
|
1413
|
+
query_params["b"] = b;
|
|
1449
1414
|
|
|
1450
1415
|
const xHeaders = {};
|
|
1451
1416
|
|
|
1452
|
-
const response = await
|
|
1417
|
+
const response = await ApplicationAPIClient.execute(
|
|
1453
1418
|
this._conf,
|
|
1454
1419
|
"post",
|
|
1455
1420
|
constructUrl({
|
|
1456
|
-
url: this._urls["
|
|
1421
|
+
url: this._urls["selectAddress"],
|
|
1457
1422
|
params: {},
|
|
1458
1423
|
}),
|
|
1459
1424
|
query_params,
|
|
@@ -1463,7 +1428,7 @@ class Cart {
|
|
|
1463
1428
|
|
|
1464
1429
|
const {
|
|
1465
1430
|
error: res_error,
|
|
1466
|
-
} = CartModel.
|
|
1431
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
1467
1432
|
abortEarly: false,
|
|
1468
1433
|
allowUnknown: false,
|
|
1469
1434
|
});
|
|
@@ -1471,7 +1436,7 @@ class Cart {
|
|
|
1471
1436
|
if (res_error) {
|
|
1472
1437
|
Logger({
|
|
1473
1438
|
level: "WARN",
|
|
1474
|
-
message: "Response Validation Warnnings for
|
|
1439
|
+
message: "Response Validation Warnnings for selectAddress",
|
|
1475
1440
|
});
|
|
1476
1441
|
Logger({ level: "WARN", message: res_error });
|
|
1477
1442
|
}
|
|
@@ -1483,13 +1448,13 @@ class Cart {
|
|
|
1483
1448
|
* @param {Object} arg - Arg object.
|
|
1484
1449
|
* @param {string} [arg.id] -
|
|
1485
1450
|
* @param {boolean} [arg.buyNow] -
|
|
1486
|
-
* @param {
|
|
1487
|
-
* @returns {Promise<
|
|
1488
|
-
* @summary: Update
|
|
1489
|
-
* @description: Use this API to update cart
|
|
1451
|
+
* @param {UpdateCartPaymentRequest} arg.body
|
|
1452
|
+
* @returns {Promise<CartDetailResponse>} - Success response
|
|
1453
|
+
* @summary: Update cart payment
|
|
1454
|
+
* @description: Use this API to update cart payment.
|
|
1490
1455
|
*/
|
|
1491
|
-
async
|
|
1492
|
-
const { error } = CartValidator.
|
|
1456
|
+
async selectPaymentMode({ body, id, buyNow } = {}) {
|
|
1457
|
+
const { error } = CartValidator.selectPaymentMode().validate(
|
|
1493
1458
|
{ body, id, buyNow },
|
|
1494
1459
|
{ abortEarly: false, allowUnknown: true }
|
|
1495
1460
|
);
|
|
@@ -1498,14 +1463,14 @@ class Cart {
|
|
|
1498
1463
|
}
|
|
1499
1464
|
|
|
1500
1465
|
// Showing warrnings if extra unknown parameters are found
|
|
1501
|
-
const { error: warrning } = CartValidator.
|
|
1466
|
+
const { error: warrning } = CartValidator.selectPaymentMode().validate(
|
|
1502
1467
|
{ body, id, buyNow },
|
|
1503
1468
|
{ abortEarly: false, allowUnknown: false }
|
|
1504
1469
|
);
|
|
1505
1470
|
if (warrning) {
|
|
1506
1471
|
Logger({
|
|
1507
1472
|
level: "WARN",
|
|
1508
|
-
message: "Parameter Validation warrnings for
|
|
1473
|
+
message: "Parameter Validation warrnings for selectPaymentMode",
|
|
1509
1474
|
});
|
|
1510
1475
|
Logger({ level: "WARN", message: warrning });
|
|
1511
1476
|
}
|
|
@@ -1516,11 +1481,11 @@ class Cart {
|
|
|
1516
1481
|
|
|
1517
1482
|
const xHeaders = {};
|
|
1518
1483
|
|
|
1519
|
-
const response = await
|
|
1484
|
+
const response = await ApplicationAPIClient.execute(
|
|
1520
1485
|
this._conf,
|
|
1521
1486
|
"put",
|
|
1522
1487
|
constructUrl({
|
|
1523
|
-
url: this._urls["
|
|
1488
|
+
url: this._urls["selectPaymentMode"],
|
|
1524
1489
|
params: {},
|
|
1525
1490
|
}),
|
|
1526
1491
|
query_params,
|
|
@@ -1528,15 +1493,17 @@ class Cart {
|
|
|
1528
1493
|
xHeaders
|
|
1529
1494
|
);
|
|
1530
1495
|
|
|
1531
|
-
const {
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1496
|
+
const {
|
|
1497
|
+
error: res_error,
|
|
1498
|
+
} = CartModel.CartDetailResponse().validate(response, {
|
|
1499
|
+
abortEarly: false,
|
|
1500
|
+
allowUnknown: false,
|
|
1501
|
+
});
|
|
1535
1502
|
|
|
1536
1503
|
if (res_error) {
|
|
1537
1504
|
Logger({
|
|
1538
1505
|
level: "WARN",
|
|
1539
|
-
message: "Response Validation Warnnings for
|
|
1506
|
+
message: "Response Validation Warnnings for selectPaymentMode",
|
|
1540
1507
|
});
|
|
1541
1508
|
Logger({ level: "WARN", message: res_error });
|
|
1542
1509
|
}
|
|
@@ -1546,14 +1513,15 @@ class Cart {
|
|
|
1546
1513
|
|
|
1547
1514
|
/**
|
|
1548
1515
|
* @param {Object} arg - Arg object.
|
|
1549
|
-
* @param {
|
|
1550
|
-
* @
|
|
1551
|
-
* @
|
|
1552
|
-
* @
|
|
1516
|
+
* @param {string} arg.id - ID allotted to the selected address
|
|
1517
|
+
* @param {Address} arg.body
|
|
1518
|
+
* @returns {Promise<UpdateAddressResponse>} - Success response
|
|
1519
|
+
* @summary: Update address added to an account
|
|
1520
|
+
* @description: <p>Use this API to update an existing address in the account. Request object should contain attributes mentioned in <font color="blue">Address </font> can be updated. These attributes are:</p> <ul> <li> <font color="monochrome">is_default_address</font></li> <li> <font color="monochrome">landmark</font></li> <li> <font color="monochrome">area</font></li> <li> <font color="monochrome">pincode</font></li> <li> <font color="monochrome">email</font></li> <li> <font color="monochrome">address_type</font></li> <li> <font color="monochrome">name</font></li> <li> <font color="monochrome">address_id</font></li> <li> <font color="monochrome">address</font></li> </ul>
|
|
1553
1521
|
*/
|
|
1554
|
-
async
|
|
1555
|
-
const { error } = CartValidator.
|
|
1556
|
-
{ body },
|
|
1522
|
+
async updateAddress({ id, body } = {}) {
|
|
1523
|
+
const { error } = CartValidator.updateAddress().validate(
|
|
1524
|
+
{ id, body },
|
|
1557
1525
|
{ abortEarly: false, allowUnknown: true }
|
|
1558
1526
|
);
|
|
1559
1527
|
if (error) {
|
|
@@ -1561,14 +1529,14 @@ class Cart {
|
|
|
1561
1529
|
}
|
|
1562
1530
|
|
|
1563
1531
|
// Showing warrnings if extra unknown parameters are found
|
|
1564
|
-
const { error: warrning } = CartValidator.
|
|
1565
|
-
{ body },
|
|
1532
|
+
const { error: warrning } = CartValidator.updateAddress().validate(
|
|
1533
|
+
{ id, body },
|
|
1566
1534
|
{ abortEarly: false, allowUnknown: false }
|
|
1567
1535
|
);
|
|
1568
1536
|
if (warrning) {
|
|
1569
1537
|
Logger({
|
|
1570
1538
|
level: "WARN",
|
|
1571
|
-
message: "Parameter Validation warrnings for
|
|
1539
|
+
message: "Parameter Validation warrnings for updateAddress",
|
|
1572
1540
|
});
|
|
1573
1541
|
Logger({ level: "WARN", message: warrning });
|
|
1574
1542
|
}
|
|
@@ -1577,12 +1545,12 @@ class Cart {
|
|
|
1577
1545
|
|
|
1578
1546
|
const xHeaders = {};
|
|
1579
1547
|
|
|
1580
|
-
const response = await
|
|
1548
|
+
const response = await ApplicationAPIClient.execute(
|
|
1581
1549
|
this._conf,
|
|
1582
|
-
"
|
|
1550
|
+
"put",
|
|
1583
1551
|
constructUrl({
|
|
1584
|
-
url: this._urls["
|
|
1585
|
-
params: {},
|
|
1552
|
+
url: this._urls["updateAddress"],
|
|
1553
|
+
params: { id },
|
|
1586
1554
|
}),
|
|
1587
1555
|
query_params,
|
|
1588
1556
|
body,
|
|
@@ -1591,7 +1559,7 @@ class Cart {
|
|
|
1591
1559
|
|
|
1592
1560
|
const {
|
|
1593
1561
|
error: res_error,
|
|
1594
|
-
} = CartModel.
|
|
1562
|
+
} = CartModel.UpdateAddressResponse().validate(response, {
|
|
1595
1563
|
abortEarly: false,
|
|
1596
1564
|
allowUnknown: false,
|
|
1597
1565
|
});
|
|
@@ -1599,7 +1567,7 @@ class Cart {
|
|
|
1599
1567
|
if (res_error) {
|
|
1600
1568
|
Logger({
|
|
1601
1569
|
level: "WARN",
|
|
1602
|
-
message: "Response Validation Warnnings for
|
|
1570
|
+
message: "Response Validation Warnnings for updateAddress",
|
|
1603
1571
|
});
|
|
1604
1572
|
Logger({ level: "WARN", message: res_error });
|
|
1605
1573
|
}
|
|
@@ -1609,14 +1577,19 @@ class Cart {
|
|
|
1609
1577
|
|
|
1610
1578
|
/**
|
|
1611
1579
|
* @param {Object} arg - Arg object.
|
|
1612
|
-
* @param {string} arg.
|
|
1613
|
-
* @
|
|
1614
|
-
* @
|
|
1615
|
-
* @
|
|
1580
|
+
* @param {string} [arg.id] -
|
|
1581
|
+
* @param {boolean} [arg.i] -
|
|
1582
|
+
* @param {boolean} [arg.b] -
|
|
1583
|
+
* @param {string} [arg.areaCode] -
|
|
1584
|
+
* @param {boolean} [arg.buyNow] -
|
|
1585
|
+
* @param {UpdateCartRequest} arg.body
|
|
1586
|
+
* @returns {Promise<UpdateCartDetailResponse>} - Success response
|
|
1587
|
+
* @summary: Update items in the cart
|
|
1588
|
+
* @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>
|
|
1616
1589
|
*/
|
|
1617
|
-
async
|
|
1618
|
-
const { error } = CartValidator.
|
|
1619
|
-
{
|
|
1590
|
+
async updateCart({ body, id, i, b, areaCode, buyNow } = {}) {
|
|
1591
|
+
const { error } = CartValidator.updateCart().validate(
|
|
1592
|
+
{ body, id, i, b, areaCode, buyNow },
|
|
1620
1593
|
{ abortEarly: false, allowUnknown: true }
|
|
1621
1594
|
);
|
|
1622
1595
|
if (error) {
|
|
@@ -1624,37 +1597,42 @@ class Cart {
|
|
|
1624
1597
|
}
|
|
1625
1598
|
|
|
1626
1599
|
// Showing warrnings if extra unknown parameters are found
|
|
1627
|
-
const { error: warrning } = CartValidator.
|
|
1628
|
-
{
|
|
1600
|
+
const { error: warrning } = CartValidator.updateCart().validate(
|
|
1601
|
+
{ body, id, i, b, areaCode, buyNow },
|
|
1629
1602
|
{ abortEarly: false, allowUnknown: false }
|
|
1630
1603
|
);
|
|
1631
1604
|
if (warrning) {
|
|
1632
1605
|
Logger({
|
|
1633
1606
|
level: "WARN",
|
|
1634
|
-
message: "Parameter Validation warrnings for
|
|
1607
|
+
message: "Parameter Validation warrnings for updateCart",
|
|
1635
1608
|
});
|
|
1636
1609
|
Logger({ level: "WARN", message: warrning });
|
|
1637
1610
|
}
|
|
1638
1611
|
|
|
1639
1612
|
const query_params = {};
|
|
1613
|
+
query_params["id"] = id;
|
|
1614
|
+
query_params["i"] = i;
|
|
1615
|
+
query_params["b"] = b;
|
|
1616
|
+
query_params["area_code"] = areaCode;
|
|
1617
|
+
query_params["buy_now"] = buyNow;
|
|
1640
1618
|
|
|
1641
1619
|
const xHeaders = {};
|
|
1642
1620
|
|
|
1643
|
-
const response = await
|
|
1621
|
+
const response = await ApplicationAPIClient.execute(
|
|
1644
1622
|
this._conf,
|
|
1645
|
-
"
|
|
1623
|
+
"put",
|
|
1646
1624
|
constructUrl({
|
|
1647
|
-
url: this._urls["
|
|
1648
|
-
params: {
|
|
1625
|
+
url: this._urls["updateCart"],
|
|
1626
|
+
params: {},
|
|
1649
1627
|
}),
|
|
1650
1628
|
query_params,
|
|
1651
|
-
|
|
1629
|
+
body,
|
|
1652
1630
|
xHeaders
|
|
1653
1631
|
);
|
|
1654
1632
|
|
|
1655
1633
|
const {
|
|
1656
1634
|
error: res_error,
|
|
1657
|
-
} = CartModel.
|
|
1635
|
+
} = CartModel.UpdateCartDetailResponse().validate(response, {
|
|
1658
1636
|
abortEarly: false,
|
|
1659
1637
|
allowUnknown: false,
|
|
1660
1638
|
});
|
|
@@ -1662,7 +1640,7 @@ class Cart {
|
|
|
1662
1640
|
if (res_error) {
|
|
1663
1641
|
Logger({
|
|
1664
1642
|
level: "WARN",
|
|
1665
|
-
message: "Response Validation Warnnings for
|
|
1643
|
+
message: "Response Validation Warnnings for updateCart",
|
|
1666
1644
|
});
|
|
1667
1645
|
Logger({ level: "WARN", message: res_error });
|
|
1668
1646
|
}
|
|
@@ -1672,16 +1650,16 @@ class Cart {
|
|
|
1672
1650
|
|
|
1673
1651
|
/**
|
|
1674
1652
|
* @param {Object} arg - Arg object.
|
|
1675
|
-
* @param {string} arg.
|
|
1676
|
-
* @param {
|
|
1677
|
-
*
|
|
1678
|
-
* @returns {Promise<
|
|
1679
|
-
* @summary:
|
|
1680
|
-
* @description: Use this API to
|
|
1653
|
+
* @param {string} [arg.id] -
|
|
1654
|
+
* @param {boolean} [arg.buyNow] -
|
|
1655
|
+
* @param {CartMetaRequest} arg.body
|
|
1656
|
+
* @returns {Promise<CartMetaResponse>} - Success response
|
|
1657
|
+
* @summary: Update the cart meta
|
|
1658
|
+
* @description: Use this API to update cart meta like checkout_mode and gstin.
|
|
1681
1659
|
*/
|
|
1682
|
-
async
|
|
1683
|
-
const { error } = CartValidator.
|
|
1684
|
-
{
|
|
1660
|
+
async updateCartMeta({ body, id, buyNow } = {}) {
|
|
1661
|
+
const { error } = CartValidator.updateCartMeta().validate(
|
|
1662
|
+
{ body, id, buyNow },
|
|
1685
1663
|
{ abortEarly: false, allowUnknown: true }
|
|
1686
1664
|
);
|
|
1687
1665
|
if (error) {
|
|
@@ -1689,47 +1667,45 @@ class Cart {
|
|
|
1689
1667
|
}
|
|
1690
1668
|
|
|
1691
1669
|
// Showing warrnings if extra unknown parameters are found
|
|
1692
|
-
const {
|
|
1693
|
-
|
|
1694
|
-
} = CartValidator.updateCartWithSharedItems().validate(
|
|
1695
|
-
{ token, action },
|
|
1670
|
+
const { error: warrning } = CartValidator.updateCartMeta().validate(
|
|
1671
|
+
{ body, id, buyNow },
|
|
1696
1672
|
{ abortEarly: false, allowUnknown: false }
|
|
1697
1673
|
);
|
|
1698
1674
|
if (warrning) {
|
|
1699
1675
|
Logger({
|
|
1700
1676
|
level: "WARN",
|
|
1701
|
-
message: "Parameter Validation warrnings for
|
|
1677
|
+
message: "Parameter Validation warrnings for updateCartMeta",
|
|
1702
1678
|
});
|
|
1703
1679
|
Logger({ level: "WARN", message: warrning });
|
|
1704
1680
|
}
|
|
1705
1681
|
|
|
1706
1682
|
const query_params = {};
|
|
1683
|
+
query_params["id"] = id;
|
|
1684
|
+
query_params["buy_now"] = buyNow;
|
|
1707
1685
|
|
|
1708
1686
|
const xHeaders = {};
|
|
1709
1687
|
|
|
1710
|
-
const response = await
|
|
1688
|
+
const response = await ApplicationAPIClient.execute(
|
|
1711
1689
|
this._conf,
|
|
1712
|
-
"
|
|
1690
|
+
"put",
|
|
1713
1691
|
constructUrl({
|
|
1714
|
-
url: this._urls["
|
|
1715
|
-
params: {
|
|
1692
|
+
url: this._urls["updateCartMeta"],
|
|
1693
|
+
params: {},
|
|
1716
1694
|
}),
|
|
1717
1695
|
query_params,
|
|
1718
|
-
|
|
1696
|
+
body,
|
|
1719
1697
|
xHeaders
|
|
1720
1698
|
);
|
|
1721
1699
|
|
|
1722
|
-
const {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
allowUnknown: false,
|
|
1727
|
-
});
|
|
1700
|
+
const { error: res_error } = CartModel.CartMetaResponse().validate(
|
|
1701
|
+
response,
|
|
1702
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1703
|
+
);
|
|
1728
1704
|
|
|
1729
1705
|
if (res_error) {
|
|
1730
1706
|
Logger({
|
|
1731
1707
|
level: "WARN",
|
|
1732
|
-
message: "Response Validation Warnnings for
|
|
1708
|
+
message: "Response Validation Warnnings for updateCartMeta",
|
|
1733
1709
|
});
|
|
1734
1710
|
Logger({ level: "WARN", message: res_error });
|
|
1735
1711
|
}
|
|
@@ -1739,18 +1715,16 @@ class Cart {
|
|
|
1739
1715
|
|
|
1740
1716
|
/**
|
|
1741
1717
|
* @param {Object} arg - Arg object.
|
|
1742
|
-
* @param {string}
|
|
1743
|
-
*
|
|
1744
|
-
*
|
|
1745
|
-
* @
|
|
1746
|
-
* @
|
|
1747
|
-
* @
|
|
1748
|
-
* @summary: Fetch available promotions
|
|
1749
|
-
* @description: Use this API to get top 5 offers available for current product
|
|
1718
|
+
* @param {string} arg.token - Token of the shared short link
|
|
1719
|
+
* @param {string} arg.action - Operation to perform on the existing cart
|
|
1720
|
+
* merge or replace.
|
|
1721
|
+
* @returns {Promise<SharedCartResponse>} - Success response
|
|
1722
|
+
* @summary: Merge or replace existing cart
|
|
1723
|
+
* @description: Use this API to merge the shared cart with existing cart, or replace the existing cart with the shared cart. The `action` parameter is used to indicate the operation Merge or Replace.
|
|
1750
1724
|
*/
|
|
1751
|
-
async
|
|
1752
|
-
const { error } = CartValidator.
|
|
1753
|
-
{
|
|
1725
|
+
async updateCartWithSharedItems({ token, action } = {}) {
|
|
1726
|
+
const { error } = CartValidator.updateCartWithSharedItems().validate(
|
|
1727
|
+
{ token, action },
|
|
1754
1728
|
{ abortEarly: false, allowUnknown: true }
|
|
1755
1729
|
);
|
|
1756
1730
|
if (error) {
|
|
@@ -1758,31 +1732,30 @@ class Cart {
|
|
|
1758
1732
|
}
|
|
1759
1733
|
|
|
1760
1734
|
// Showing warrnings if extra unknown parameters are found
|
|
1761
|
-
const {
|
|
1762
|
-
|
|
1735
|
+
const {
|
|
1736
|
+
error: warrning,
|
|
1737
|
+
} = CartValidator.updateCartWithSharedItems().validate(
|
|
1738
|
+
{ token, action },
|
|
1763
1739
|
{ abortEarly: false, allowUnknown: false }
|
|
1764
1740
|
);
|
|
1765
1741
|
if (warrning) {
|
|
1766
1742
|
Logger({
|
|
1767
1743
|
level: "WARN",
|
|
1768
|
-
message: "Parameter Validation warrnings for
|
|
1744
|
+
message: "Parameter Validation warrnings for updateCartWithSharedItems",
|
|
1769
1745
|
});
|
|
1770
1746
|
Logger({ level: "WARN", message: warrning });
|
|
1771
1747
|
}
|
|
1772
1748
|
|
|
1773
1749
|
const query_params = {};
|
|
1774
|
-
query_params["slug"] = slug;
|
|
1775
|
-
query_params["page_size"] = pageSize;
|
|
1776
|
-
query_params["promotion_group"] = promotionGroup;
|
|
1777
1750
|
|
|
1778
1751
|
const xHeaders = {};
|
|
1779
1752
|
|
|
1780
|
-
const response = await
|
|
1753
|
+
const response = await ApplicationAPIClient.execute(
|
|
1781
1754
|
this._conf,
|
|
1782
|
-
"
|
|
1755
|
+
"post",
|
|
1783
1756
|
constructUrl({
|
|
1784
|
-
url: this._urls["
|
|
1785
|
-
params: {},
|
|
1757
|
+
url: this._urls["updateCartWithSharedItems"],
|
|
1758
|
+
params: { token, action },
|
|
1786
1759
|
}),
|
|
1787
1760
|
query_params,
|
|
1788
1761
|
undefined,
|
|
@@ -1791,7 +1764,7 @@ class Cart {
|
|
|
1791
1764
|
|
|
1792
1765
|
const {
|
|
1793
1766
|
error: res_error,
|
|
1794
|
-
} = CartModel.
|
|
1767
|
+
} = CartModel.SharedCartResponse().validate(response, {
|
|
1795
1768
|
abortEarly: false,
|
|
1796
1769
|
allowUnknown: false,
|
|
1797
1770
|
});
|
|
@@ -1799,7 +1772,7 @@ class Cart {
|
|
|
1799
1772
|
if (res_error) {
|
|
1800
1773
|
Logger({
|
|
1801
1774
|
level: "WARN",
|
|
1802
|
-
message: "Response Validation Warnnings for
|
|
1775
|
+
message: "Response Validation Warnnings for updateCartWithSharedItems",
|
|
1803
1776
|
});
|
|
1804
1777
|
Logger({ level: "WARN", message: res_error });
|
|
1805
1778
|
}
|
|
@@ -1809,21 +1782,36 @@ class Cart {
|
|
|
1809
1782
|
|
|
1810
1783
|
/**
|
|
1811
1784
|
* @param {Object} arg - Arg object.
|
|
1812
|
-
* @param {string} arg.
|
|
1813
|
-
*
|
|
1814
|
-
*
|
|
1815
|
-
* @param {string} [arg.
|
|
1816
|
-
*
|
|
1817
|
-
* @param {string} [arg.
|
|
1818
|
-
*
|
|
1819
|
-
* @
|
|
1820
|
-
* @
|
|
1821
|
-
* @
|
|
1822
|
-
* @description: Use this API to get applicable ladder price promotion for current product
|
|
1785
|
+
* @param {string} [arg.id] -
|
|
1786
|
+
* @param {boolean} [arg.buyNow] -
|
|
1787
|
+
* @param {string} [arg.addressId] -
|
|
1788
|
+
* @param {string} [arg.paymentMode] -
|
|
1789
|
+
* @param {string} [arg.paymentIdentifier] -
|
|
1790
|
+
* @param {string} [arg.aggregatorName] -
|
|
1791
|
+
* @param {string} [arg.merchantCode] -
|
|
1792
|
+
* @returns {Promise<PaymentCouponValidate>} - Success response
|
|
1793
|
+
* @summary: Verify the coupon eligibility against the payment mode
|
|
1794
|
+
* @description: Use this API to validate a coupon against the payment mode such as NetBanking, Wallet, UPI etc.
|
|
1823
1795
|
*/
|
|
1824
|
-
async
|
|
1825
|
-
|
|
1826
|
-
|
|
1796
|
+
async validateCouponForPayment({
|
|
1797
|
+
id,
|
|
1798
|
+
buyNow,
|
|
1799
|
+
addressId,
|
|
1800
|
+
paymentMode,
|
|
1801
|
+
paymentIdentifier,
|
|
1802
|
+
aggregatorName,
|
|
1803
|
+
merchantCode,
|
|
1804
|
+
} = {}) {
|
|
1805
|
+
const { error } = CartValidator.validateCouponForPayment().validate(
|
|
1806
|
+
{
|
|
1807
|
+
id,
|
|
1808
|
+
buyNow,
|
|
1809
|
+
addressId,
|
|
1810
|
+
paymentMode,
|
|
1811
|
+
paymentIdentifier,
|
|
1812
|
+
aggregatorName,
|
|
1813
|
+
merchantCode,
|
|
1814
|
+
},
|
|
1827
1815
|
{ abortEarly: false, allowUnknown: true }
|
|
1828
1816
|
);
|
|
1829
1817
|
if (error) {
|
|
@@ -1831,31 +1819,44 @@ class Cart {
|
|
|
1831
1819
|
}
|
|
1832
1820
|
|
|
1833
1821
|
// Showing warrnings if extra unknown parameters are found
|
|
1834
|
-
const {
|
|
1835
|
-
|
|
1822
|
+
const {
|
|
1823
|
+
error: warrning,
|
|
1824
|
+
} = CartValidator.validateCouponForPayment().validate(
|
|
1825
|
+
{
|
|
1826
|
+
id,
|
|
1827
|
+
buyNow,
|
|
1828
|
+
addressId,
|
|
1829
|
+
paymentMode,
|
|
1830
|
+
paymentIdentifier,
|
|
1831
|
+
aggregatorName,
|
|
1832
|
+
merchantCode,
|
|
1833
|
+
},
|
|
1836
1834
|
{ abortEarly: false, allowUnknown: false }
|
|
1837
1835
|
);
|
|
1838
1836
|
if (warrning) {
|
|
1839
1837
|
Logger({
|
|
1840
1838
|
level: "WARN",
|
|
1841
|
-
message: "Parameter Validation warrnings for
|
|
1839
|
+
message: "Parameter Validation warrnings for validateCouponForPayment",
|
|
1842
1840
|
});
|
|
1843
1841
|
Logger({ level: "WARN", message: warrning });
|
|
1844
1842
|
}
|
|
1845
1843
|
|
|
1846
1844
|
const query_params = {};
|
|
1847
|
-
query_params["
|
|
1848
|
-
query_params["
|
|
1849
|
-
query_params["
|
|
1850
|
-
query_params["
|
|
1845
|
+
query_params["id"] = id;
|
|
1846
|
+
query_params["buy_now"] = buyNow;
|
|
1847
|
+
query_params["address_id"] = addressId;
|
|
1848
|
+
query_params["payment_mode"] = paymentMode;
|
|
1849
|
+
query_params["payment_identifier"] = paymentIdentifier;
|
|
1850
|
+
query_params["aggregator_name"] = aggregatorName;
|
|
1851
|
+
query_params["merchant_code"] = merchantCode;
|
|
1851
1852
|
|
|
1852
1853
|
const xHeaders = {};
|
|
1853
1854
|
|
|
1854
|
-
const response = await
|
|
1855
|
+
const response = await ApplicationAPIClient.execute(
|
|
1855
1856
|
this._conf,
|
|
1856
1857
|
"get",
|
|
1857
1858
|
constructUrl({
|
|
1858
|
-
url: this._urls["
|
|
1859
|
+
url: this._urls["validateCouponForPayment"],
|
|
1859
1860
|
params: {},
|
|
1860
1861
|
}),
|
|
1861
1862
|
query_params,
|
|
@@ -1865,7 +1866,7 @@ class Cart {
|
|
|
1865
1866
|
|
|
1866
1867
|
const {
|
|
1867
1868
|
error: res_error,
|
|
1868
|
-
} = CartModel.
|
|
1869
|
+
} = CartModel.PaymentCouponValidate().validate(response, {
|
|
1869
1870
|
abortEarly: false,
|
|
1870
1871
|
allowUnknown: false,
|
|
1871
1872
|
});
|
|
@@ -1873,7 +1874,7 @@ class Cart {
|
|
|
1873
1874
|
if (res_error) {
|
|
1874
1875
|
Logger({
|
|
1875
1876
|
level: "WARN",
|
|
1876
|
-
message: "Response Validation Warnnings for
|
|
1877
|
+
message: "Response Validation Warnnings for validateCouponForPayment",
|
|
1877
1878
|
});
|
|
1878
1879
|
Logger({ level: "WARN", message: res_error });
|
|
1879
1880
|
}
|