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