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