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