@gofynd/fdk-client-javascript 0.1.37 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/application.d.ts +2 -1
- package/application.js +2 -1
- package/documentation/application/CART.md +315 -289
- package/documentation/application/CATALOG.md +438 -415
- package/documentation/application/FILESTORAGE.md +2 -0
- package/documentation/application/LEAD.md +18 -18
- package/documentation/application/LOGISTIC.md +45 -45
- package/documentation/application/ORDER.md +277 -277
- package/documentation/application/PAYMENT.md +251 -251
- package/documentation/application/POSCART.md +318 -292
- package/documentation/application/REWARDS.md +1 -0
- package/documentation/application/USER.md +19 -14
- package/documentation/platform/CART.md +465 -462
- package/documentation/platform/CATALOG.md +2792 -2711
- package/documentation/platform/COMPANYPROFILE.md +200 -362
- package/documentation/platform/DISCOUNT.md +86 -0
- package/documentation/platform/FILESTORAGE.md +2 -0
- package/documentation/platform/LEAD.md +60 -60
- package/documentation/platform/ORDER.md +1451 -1654
- package/documentation/platform/PAYMENT.md +94 -94
- package/documentation/platform/REWARDS.md +145 -0
- package/documentation/platform/USER.md +24 -14
- package/index.d.ts +4 -1
- package/index.js +13 -4
- package/package.json +9 -9
- package/platform.d.ts +2 -1
- package/platform.js +3 -2
- package/public.d.ts +1 -0
- package/public.js +3 -2
- package/sdk/application/ApplicationAPIClient.js +3 -1
- package/sdk/application/ApplicationClient.d.ts +16 -16
- package/sdk/application/ApplicationClient.js +32 -16
- package/sdk/application/ApplicationConfig.js +3 -2
- package/sdk/application/ApplicationModels.d.ts +0 -832
- package/sdk/application/ApplicationModels.js +3 -10574
- package/sdk/application/{client → Cart}/CartApplicationClient.d.ts +9 -3
- package/sdk/application/{client → Cart}/CartApplicationClient.js +316 -8
- package/sdk/application/Cart/CartApplicationModel.d.ts +81 -0
- package/sdk/application/Cart/CartApplicationModel.js +1136 -0
- package/sdk/application/{models/CartValidator.js → Cart/CartApplicationValidator.js} +17 -12
- package/sdk/application/{client → Catalog}/CatalogApplicationClient.d.ts +8 -5
- package/sdk/application/{client → Catalog}/CatalogApplicationClient.js +389 -8
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +117 -0
- package/sdk/application/Catalog/CatalogApplicationModel.js +1606 -0
- package/sdk/application/{models/CatalogValidator.js → Catalog/CatalogApplicationValidator.js} +4 -1
- package/sdk/application/{client → Common}/CommonApplicationClient.js +24 -2
- package/sdk/application/Common/CommonApplicationModel.d.ts +20 -0
- package/sdk/application/Common/CommonApplicationModel.js +228 -0
- package/sdk/{platform/models/CommonValidator.js → application/Common/CommonApplicationValidator.js} +3 -1
- package/sdk/application/{client → Communication}/CommunicationApplicationClient.js +43 -2
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +15 -0
- package/sdk/application/Communication/CommunicationApplicationModel.js +144 -0
- package/sdk/application/{models/CommunicationValidator.js → Communication/CommunicationApplicationValidator.js} +5 -3
- package/sdk/application/{client → Configuration}/ConfigurationApplicationClient.js +202 -2
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +111 -0
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +1182 -0
- package/sdk/application/{models/ConfigurationValidator.js → Configuration/ConfigurationApplicationValidator.js} +4 -2
- package/sdk/application/{client → Content}/ContentApplicationClient.js +217 -2
- package/sdk/application/Content/ContentApplicationModel.d.ts +105 -0
- package/sdk/application/Content/ContentApplicationModel.js +1349 -0
- package/sdk/application/{models/ContentValidator.js → Content/ContentApplicationValidator.js} +3 -1
- package/sdk/application/{client → FileStorage}/FileStorageApplicationClient.js +35 -2
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +21 -0
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +244 -0
- package/sdk/application/{models/FileStorageValidator.js → FileStorage/FileStorageApplicationValidator.js} +6 -4
- package/sdk/application/{client → Lead}/LeadApplicationClient.js +83 -2
- package/sdk/application/Lead/LeadApplicationModel.d.ts +55 -0
- package/sdk/application/Lead/LeadApplicationModel.js +690 -0
- package/sdk/application/{models/LeadValidator.js → Lead/LeadApplicationValidator.js} +6 -4
- package/sdk/application/{client → Logistic}/LogisticApplicationClient.js +46 -2
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +26 -0
- package/sdk/application/Logistic/LogisticApplicationModel.js +286 -0
- package/sdk/application/{models/LogisticValidator.js → Logistic/LogisticApplicationValidator.js} +5 -3
- package/sdk/application/{client → Order}/OrderApplicationClient.js +148 -2
- package/sdk/application/Order/OrderApplicationModel.d.ts +67 -0
- package/sdk/application/Order/OrderApplicationModel.js +872 -0
- package/sdk/application/{models/OrderValidator.js → Order/OrderApplicationValidator.js} +5 -3
- package/sdk/application/{client → Payment}/PaymentApplicationClient.js +530 -2
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +96 -0
- package/sdk/application/Payment/PaymentApplicationModel.js +1318 -0
- package/sdk/application/{models/PaymentValidator.js → Payment/PaymentApplicationValidator.js} +25 -23
- package/sdk/application/{client → PosCart}/PosCartApplicationClient.d.ts +9 -3
- package/sdk/application/{client → PosCart}/PosCartApplicationClient.js +343 -8
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +79 -0
- package/sdk/application/PosCart/PosCartApplicationModel.js +1132 -0
- package/sdk/application/{models/PosCartValidator.js → PosCart/PosCartApplicationValidator.js} +18 -13
- package/sdk/application/{client → Rewards}/RewardsApplicationClient.js +83 -2
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +23 -0
- package/sdk/application/Rewards/RewardsApplicationModel.js +276 -0
- package/sdk/application/{models/RewardsValidator.js → Rewards/RewardsApplicationValidator.js} +6 -4
- package/sdk/application/{client → Share}/ShareApplicationClient.js +89 -2
- package/sdk/application/Share/ShareApplicationModel.d.ts +16 -0
- package/sdk/application/Share/ShareApplicationModel.js +178 -0
- package/sdk/application/{models/ShareValidator.js → Share/ShareApplicationValidator.js} +4 -2
- package/sdk/application/{client → Theme}/ThemeApplicationClient.js +46 -2
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +49 -0
- package/sdk/application/Theme/ThemeApplicationModel.js +486 -0
- package/sdk/application/{models/ThemeValidator.js → Theme/ThemeApplicationValidator.js} +3 -1
- package/sdk/application/{client → User}/UserApplicationClient.js +407 -2
- package/sdk/application/User/UserApplicationModel.d.ts +95 -0
- package/sdk/application/User/UserApplicationModel.js +998 -0
- package/sdk/application/{models/UserValidator.js → User/UserApplicationValidator.js} +31 -29
- package/sdk/application/index.d.ts +18 -0
- package/sdk/application/index.js +33 -0
- package/sdk/common/AxiosHelper.js +23 -10
- package/sdk/common/Logger.d.ts +2 -0
- package/sdk/common/Logger.js +6 -0
- package/sdk/common/curlHelper.d.ts +2 -0
- package/sdk/common/curlHelper.js +95 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +101 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +399 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +11 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +56 -0
- package/sdk/platform/{client → Analytics}/AnalyticsPlatformClient.js +60 -2
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +23 -0
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +252 -0
- package/sdk/platform/{models/AnalyticsValidator.js → Analytics/AnalyticsPlatformValidator.js} +5 -4
- package/sdk/platform/{client → AuditTrail}/AuditTrailPlatformClient.js +48 -2
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +18 -0
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +144 -0
- package/sdk/platform/{models/AuditTrailValidator.js → AuditTrail/AuditTrailPlatformValidator.js} +3 -2
- package/sdk/platform/{client → Billing}/BillingPlatformClient.js +162 -2
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +65 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +906 -0
- package/sdk/platform/{models/BillingValidator.js → Billing/BillingPlatformValidator.js} +6 -5
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +293 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +1001 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +20 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +138 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +104 -0
- package/sdk/platform/Cart/CartPlatformModel.js +1516 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +856 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2927 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +56 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +389 -0
- package/sdk/platform/{client → Catalog}/CatalogPlatformClient.js +1402 -349
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +317 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.js +4702 -0
- package/sdk/platform/{models/CatalogValidator.js → Catalog/CatalogPlatformValidator.js} +92 -91
- package/sdk/platform/{client → Common}/CommonPlatformClient.js +28 -2
- package/sdk/platform/Common/CommonPlatformModel.d.ts +20 -0
- package/sdk/platform/Common/CommonPlatformModel.js +228 -0
- package/sdk/{application/models/CommonValidator.js → platform/Common/CommonPlatformValidator.js} +2 -1
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +611 -0
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +2243 -0
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +43 -0
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +277 -0
- package/sdk/platform/{client → Communication}/CommunicationPlatformClient.js +17 -2
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +102 -0
- package/sdk/platform/Communication/CommunicationPlatformModel.js +1312 -0
- package/sdk/platform/{models/CommunicationValidator.js → Communication/CommunicationPlatformValidator.js} +2 -1
- package/sdk/platform/{client → CompanyProfile}/CompanyProfilePlatformClient.d.ts +0 -9
- package/sdk/platform/{client → CompanyProfile}/CompanyProfilePlatformClient.js +176 -28
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +44 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +706 -0
- package/sdk/platform/{models/CompanyProfileValidator.d.ts → CompanyProfile/CompanyProfilePlatformValidator.d.ts} +0 -1
- package/sdk/platform/{models/CompanyProfileValidator.js → CompanyProfile/CompanyProfilePlatformValidator.js} +9 -14
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +309 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1322 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +31 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +164 -0
- package/sdk/platform/{client → Configuration}/ConfigurationPlatformClient.js +284 -2
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +185 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +2072 -0
- package/sdk/platform/{models/ConfigurationValidator.js → Configuration/ConfigurationPlatformValidator.js} +9 -8
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +781 -0
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +3074 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +71 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +422 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +105 -0
- package/sdk/platform/Content/ContentPlatformModel.js +1349 -0
- package/sdk/platform/{client → Discount}/DiscountPlatformClient.d.ts +11 -0
- package/sdk/platform/{client → Discount}/DiscountPlatformClient.js +187 -2
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +15 -0
- package/sdk/platform/Discount/DiscountPlatformModel.js +176 -0
- package/sdk/platform/{models/DiscountValidator.d.ts → Discount/DiscountPlatformValidator.d.ts} +1 -0
- package/sdk/platform/{models/DiscountValidator.js → Discount/DiscountPlatformValidator.js} +13 -5
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +114 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +301 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +7 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +38 -0
- package/sdk/platform/{client → FileStorage}/FileStoragePlatformClient.js +78 -2
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +21 -0
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +244 -0
- package/sdk/platform/{models/FileStorageValidator.js → FileStorage/FileStoragePlatformValidator.js} +6 -5
- package/sdk/platform/{client → Inventory}/InventoryPlatformClient.js +163 -2
- package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +62 -0
- package/sdk/platform/Inventory/InventoryPlatformModel.js +1178 -0
- package/sdk/platform/{models/InventoryValidator.js → Inventory/InventoryPlatformValidator.js} +5 -4
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +138 -0
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +559 -0
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +16 -0
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +90 -0
- package/sdk/platform/{client → Lead}/LeadPlatformClient.js +142 -2
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +55 -0
- package/sdk/platform/Lead/LeadPlatformModel.js +690 -0
- package/sdk/platform/{models/LeadValidator.js → Lead/LeadPlatformValidator.js} +7 -6
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +59 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +207 -0
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +6 -0
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +37 -0
- package/sdk/platform/{client → Order}/OrderPlatformClient.d.ts +24 -55
- package/sdk/platform/{client → Order}/OrderPlatformClient.js +693 -146
- package/sdk/platform/Order/OrderPlatformModel.d.ts +222 -0
- package/sdk/platform/Order/OrderPlatformModel.js +3466 -0
- package/sdk/platform/{models/OrderValidator.d.ts → Order/OrderPlatformValidator.d.ts} +2 -3
- package/sdk/platform/{models/OrderValidator.js → Order/OrderPlatformValidator.js} +32 -48
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +30 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +100 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +20 -0
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +7 -0
- package/sdk/platform/Partner/PartnerPlatformModel.js +54 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +108 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +498 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +14 -0
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +73 -0
- package/sdk/platform/{client → Payment}/PaymentPlatformClient.js +141 -2
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +44 -0
- package/sdk/platform/Payment/PaymentPlatformModel.js +552 -0
- package/sdk/platform/{models/PaymentValidator.js → Payment/PaymentPlatformValidator.js} +6 -5
- package/sdk/platform/PlatformAPIClient.js +2 -1
- package/sdk/platform/PlatformApplicationClient.d.ts +2824 -18486
- package/sdk/platform/PlatformApplicationClient.js +3772 -13928
- package/sdk/platform/PlatformClient.d.ts +2824 -2881
- package/sdk/platform/PlatformClient.js +3710 -3145
- package/sdk/platform/PlatformConfig.js +2 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +150 -0
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +597 -0
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +16 -0
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +91 -0
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +24 -0
- package/sdk/platform/Rewards/RewardsPlatformModel.js +294 -0
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +72 -0
- package/sdk/platform/Share/SharePlatformApplicationClient.js +235 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +7 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +35 -0
- package/sdk/platform/Share/SharePlatformModel.d.ts +15 -0
- package/sdk/platform/Share/SharePlatformModel.js +170 -0
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +238 -0
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +997 -0
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +27 -0
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +155 -0
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +49 -0
- package/sdk/platform/Theme/ThemePlatformModel.js +486 -0
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +121 -0
- package/sdk/platform/User/UserPlatformApplicationClient.js +506 -0
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +15 -0
- package/sdk/platform/User/UserPlatformApplicationValidator.js +79 -0
- package/sdk/platform/User/UserPlatformModel.d.ts +95 -0
- package/sdk/platform/User/UserPlatformModel.js +998 -0
- package/sdk/platform/{client → Webhook}/WebhookPlatformClient.js +92 -2
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +17 -0
- package/sdk/platform/Webhook/WebhookPlatformModel.js +208 -0
- package/sdk/platform/{models/WebhookValidator.js → Webhook/WebhookPlatformValidator.js} +4 -3
- package/sdk/platform/index.d.ts +24 -0
- package/sdk/platform/index.js +45 -0
- package/sdk/public/{client → Configuration}/ConfigurationPublicClient.js +26 -1
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +20 -0
- package/sdk/public/Configuration/ConfigurationPublicModel.js +230 -0
- package/sdk/public/{models/ConfigurationValidator.js → Configuration/ConfigurationPublicValidator.js} +3 -1
- package/sdk/public/{client → Inventory}/InventoryPublicClient.js +76 -1
- package/sdk/public/Inventory/InventoryPublicModel.d.ts +22 -0
- package/sdk/public/Inventory/InventoryPublicModel.js +334 -0
- package/sdk/public/{models/InventoryValidator.js → Inventory/InventoryPublicValidator.js} +4 -2
- package/sdk/public/PublicClient.d.ts +3 -3
- package/sdk/public/PublicClient.js +8 -3
- package/sdk/public/{client → Webhook}/WebhookPublicClient.js +30 -1
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +17 -0
- package/sdk/public/Webhook/WebhookPublicModel.js +208 -0
- package/sdk/public/{models/WebhookValidator.js → Webhook/WebhookPublicValidator.js} +4 -2
- package/sdk/public/index.d.ts +5 -0
- package/sdk/public/index.js +7 -0
- package/sdk/platform/PlatformApplicationModels.d.ts +0 -328
- package/sdk/platform/PlatformApplicationModels.js +0 -22658
- package/sdk/platform/PlatformModels.d.ts +0 -1477
- package/sdk/platform/PlatformModels.js +0 -20646
- package/sdk/platform/models/CartValidator.d.ts +0 -0
- package/sdk/platform/models/CartValidator.js +0 -0
- package/sdk/platform/models/ContentValidator.d.ts +0 -0
- package/sdk/platform/models/ContentValidator.js +0 -0
- package/sdk/platform/models/PartnerValidator.d.ts +0 -0
- package/sdk/platform/models/PartnerValidator.js +0 -0
- package/sdk/platform/models/RewardsValidator.d.ts +0 -0
- package/sdk/platform/models/RewardsValidator.js +0 -0
- package/sdk/platform/models/ShareValidator.d.ts +0 -0
- package/sdk/platform/models/ShareValidator.js +0 -0
- package/sdk/platform/models/ThemeValidator.d.ts +0 -0
- package/sdk/platform/models/ThemeValidator.js +0 -0
- package/sdk/platform/models/UserValidator.d.ts +0 -0
- package/sdk/platform/models/UserValidator.js +0 -0
- package/sdk/public/PublicModels.d.ts +0 -50
- package/sdk/public/PublicModels.js +0 -712
- package/sdk/application/{models/CartValidator.d.ts → Cart/CartApplicationValidator.d.ts} +0 -0
- package/sdk/application/{models/CatalogValidator.d.ts → Catalog/CatalogApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Common}/CommonApplicationClient.d.ts +0 -0
- package/sdk/application/{models/CommonValidator.d.ts → Common/CommonApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Communication}/CommunicationApplicationClient.d.ts +0 -0
- package/sdk/application/{models/CommunicationValidator.d.ts → Communication/CommunicationApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Configuration}/ConfigurationApplicationClient.d.ts +0 -0
- package/sdk/application/{models/ConfigurationValidator.d.ts → Configuration/ConfigurationApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Content}/ContentApplicationClient.d.ts +0 -0
- package/sdk/application/{models/ContentValidator.d.ts → Content/ContentApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → FileStorage}/FileStorageApplicationClient.d.ts +0 -0
- package/sdk/application/{models/FileStorageValidator.d.ts → FileStorage/FileStorageApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Lead}/LeadApplicationClient.d.ts +0 -0
- package/sdk/application/{models/LeadValidator.d.ts → Lead/LeadApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Logistic}/LogisticApplicationClient.d.ts +0 -0
- package/sdk/application/{models/LogisticValidator.d.ts → Logistic/LogisticApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Order}/OrderApplicationClient.d.ts +0 -0
- package/sdk/application/{models/OrderValidator.d.ts → Order/OrderApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Payment}/PaymentApplicationClient.d.ts +0 -0
- package/sdk/application/{models/PaymentValidator.d.ts → Payment/PaymentApplicationValidator.d.ts} +0 -0
- package/sdk/application/{models/PosCartValidator.d.ts → PosCart/PosCartApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Rewards}/RewardsApplicationClient.d.ts +0 -0
- package/sdk/application/{models/RewardsValidator.d.ts → Rewards/RewardsApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Share}/ShareApplicationClient.d.ts +0 -0
- package/sdk/application/{models/ShareValidator.d.ts → Share/ShareApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → Theme}/ThemeApplicationClient.d.ts +0 -0
- package/sdk/application/{models/ThemeValidator.d.ts → Theme/ThemeApplicationValidator.d.ts} +0 -0
- package/sdk/application/{client → User}/UserApplicationClient.d.ts +0 -0
- package/sdk/application/{models/UserValidator.d.ts → User/UserApplicationValidator.d.ts} +0 -0
- package/sdk/platform/{client → Analytics}/AnalyticsPlatformClient.d.ts +0 -0
- package/sdk/platform/{models/AnalyticsValidator.d.ts → Analytics/AnalyticsPlatformValidator.d.ts} +0 -0
- package/sdk/platform/{client → AuditTrail}/AuditTrailPlatformClient.d.ts +0 -0
- package/sdk/platform/{models/AuditTrailValidator.d.ts → AuditTrail/AuditTrailPlatformValidator.d.ts} +0 -0
- package/sdk/platform/{client → Billing}/BillingPlatformClient.d.ts +0 -0
- package/sdk/platform/{models/BillingValidator.d.ts → Billing/BillingPlatformValidator.d.ts} +0 -0
- package/sdk/platform/{client → Catalog}/CatalogPlatformClient.d.ts +149 -149
- package/sdk/platform/{models/CatalogValidator.d.ts → Catalog/CatalogPlatformValidator.d.ts} +21 -21
- /package/sdk/platform/{client → Common}/CommonPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/CommonValidator.d.ts → Common/CommonPlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → Communication}/CommunicationPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/CommunicationValidator.d.ts → Communication/CommunicationPlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → Configuration}/ConfigurationPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/ConfigurationValidator.d.ts → Configuration/ConfigurationPlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → FileStorage}/FileStoragePlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/FileStorageValidator.d.ts → FileStorage/FileStoragePlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → Inventory}/InventoryPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/InventoryValidator.d.ts → Inventory/InventoryPlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → Lead}/LeadPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/LeadValidator.d.ts → Lead/LeadPlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → Payment}/PaymentPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/PaymentValidator.d.ts → Payment/PaymentPlatformValidator.d.ts} +0 -0
- /package/sdk/platform/{client → Webhook}/WebhookPlatformClient.d.ts +0 -0
- /package/sdk/platform/{models/WebhookValidator.d.ts → Webhook/WebhookPlatformValidator.d.ts} +0 -0
- /package/sdk/public/{client → Configuration}/ConfigurationPublicClient.d.ts +0 -0
- /package/sdk/public/{models/ConfigurationValidator.d.ts → Configuration/ConfigurationPublicValidator.d.ts} +0 -0
- /package/sdk/public/{client → Inventory}/InventoryPublicClient.d.ts +0 -0
- /package/sdk/public/{models/InventoryValidator.d.ts → Inventory/InventoryPublicValidator.d.ts} +0 -0
- /package/sdk/public/{client → Webhook}/WebhookPublicClient.d.ts +0 -0
- /package/sdk/public/{models/WebhookValidator.d.ts → Webhook/WebhookPublicValidator.d.ts} +0 -0
|
@@ -0,0 +1,1001 @@
|
|
|
1
|
+
const Paginator = require("../../common/Paginator");
|
|
2
|
+
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
|
+
const CartValidator = require("./CartPlatformApplicationValidator");
|
|
5
|
+
|
|
6
|
+
class Cart {
|
|
7
|
+
constructor(config, applicationId) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.applicationId = applicationId;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {Object} arg - Arg object.
|
|
14
|
+
* @param {number} [arg.pageNo] -
|
|
15
|
+
* @param {number} [arg.pageSize] -
|
|
16
|
+
* @param {boolean} [arg.isArchived] -
|
|
17
|
+
* @param {string} [arg.title] -
|
|
18
|
+
* @param {boolean} [arg.isPublic] -
|
|
19
|
+
* @param {boolean} [arg.isDisplay] -
|
|
20
|
+
* @param {string} [arg.typeSlug] -
|
|
21
|
+
* @param {string} [arg.code] -
|
|
22
|
+
* @summary: Get with single coupon details or coupon list
|
|
23
|
+
* @description: Get coupon list with pagination
|
|
24
|
+
*/
|
|
25
|
+
getCoupons({
|
|
26
|
+
pageNo,
|
|
27
|
+
pageSize,
|
|
28
|
+
isArchived,
|
|
29
|
+
title,
|
|
30
|
+
isPublic,
|
|
31
|
+
isDisplay,
|
|
32
|
+
typeSlug,
|
|
33
|
+
code,
|
|
34
|
+
} = {}) {
|
|
35
|
+
const { error } = CartValidator.getCoupons().validate(
|
|
36
|
+
{
|
|
37
|
+
pageNo,
|
|
38
|
+
pageSize,
|
|
39
|
+
isArchived,
|
|
40
|
+
title,
|
|
41
|
+
isPublic,
|
|
42
|
+
isDisplay,
|
|
43
|
+
typeSlug,
|
|
44
|
+
code,
|
|
45
|
+
},
|
|
46
|
+
{ abortEarly: false, allowUnknown: true }
|
|
47
|
+
);
|
|
48
|
+
if (error) {
|
|
49
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Showing warrnings if extra unknown parameters are found
|
|
53
|
+
const { error: warrning } = CartValidator.getCoupons().validate(
|
|
54
|
+
{
|
|
55
|
+
pageNo,
|
|
56
|
+
pageSize,
|
|
57
|
+
isArchived,
|
|
58
|
+
title,
|
|
59
|
+
isPublic,
|
|
60
|
+
isDisplay,
|
|
61
|
+
typeSlug,
|
|
62
|
+
code,
|
|
63
|
+
},
|
|
64
|
+
{ abortEarly: false, allowUnknown: false }
|
|
65
|
+
);
|
|
66
|
+
if (warrning) {
|
|
67
|
+
console.log("Parameter Validation warrnings for getCoupons");
|
|
68
|
+
console.log(warrning);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const query_params = {};
|
|
72
|
+
query_params["page_no"] = pageNo;
|
|
73
|
+
query_params["page_size"] = pageSize;
|
|
74
|
+
query_params["is_archived"] = isArchived;
|
|
75
|
+
query_params["title"] = title;
|
|
76
|
+
query_params["is_public"] = isPublic;
|
|
77
|
+
query_params["is_display"] = isDisplay;
|
|
78
|
+
query_params["type_slug"] = typeSlug;
|
|
79
|
+
query_params["code"] = code;
|
|
80
|
+
|
|
81
|
+
return PlatformAPIClient.execute(
|
|
82
|
+
this.config,
|
|
83
|
+
"get",
|
|
84
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon`,
|
|
85
|
+
query_params,
|
|
86
|
+
undefined
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @param {Object} arg - Arg object.
|
|
92
|
+
* @param {string} arg.companyId - Current company id
|
|
93
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
94
|
+
* @param {number} [arg.pageSize] -
|
|
95
|
+
* @param {boolean} [arg.isArchived] -
|
|
96
|
+
* @param {string} [arg.title] -
|
|
97
|
+
* @param {boolean} [arg.isPublic] -
|
|
98
|
+
* @param {boolean} [arg.isDisplay] -
|
|
99
|
+
* @param {string} [arg.typeSlug] -
|
|
100
|
+
* @param {string} [arg.code] -
|
|
101
|
+
* @summary: Get with single coupon details or coupon list
|
|
102
|
+
* @description: Get coupon list with pagination
|
|
103
|
+
*/
|
|
104
|
+
getCouponsPaginator({
|
|
105
|
+
companyId,
|
|
106
|
+
applicationId,
|
|
107
|
+
pageSize,
|
|
108
|
+
isArchived,
|
|
109
|
+
title,
|
|
110
|
+
isPublic,
|
|
111
|
+
isDisplay,
|
|
112
|
+
typeSlug,
|
|
113
|
+
code,
|
|
114
|
+
} = {}) {
|
|
115
|
+
const paginator = new Paginator();
|
|
116
|
+
const callback = async () => {
|
|
117
|
+
const pageId = paginator.nextId;
|
|
118
|
+
const pageNo = paginator.pageNo;
|
|
119
|
+
const pageType = "number";
|
|
120
|
+
const data = await this.getCoupons({
|
|
121
|
+
companyId: companyId,
|
|
122
|
+
applicationId: applicationId,
|
|
123
|
+
pageNo: pageNo,
|
|
124
|
+
pageSize: pageSize,
|
|
125
|
+
isArchived: isArchived,
|
|
126
|
+
title: title,
|
|
127
|
+
isPublic: isPublic,
|
|
128
|
+
isDisplay: isDisplay,
|
|
129
|
+
typeSlug: typeSlug,
|
|
130
|
+
code: code,
|
|
131
|
+
});
|
|
132
|
+
paginator.setPaginator({
|
|
133
|
+
hasNext: data.page.has_next ? true : false,
|
|
134
|
+
nextId: data.page.next_id,
|
|
135
|
+
});
|
|
136
|
+
return data;
|
|
137
|
+
};
|
|
138
|
+
paginator.setCallback(callback.bind(this));
|
|
139
|
+
return paginator;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {Object} arg - Arg object.
|
|
144
|
+
* @param {CouponAdd} arg.body
|
|
145
|
+
* @summary: Create new coupon
|
|
146
|
+
* @description: Create new coupon
|
|
147
|
+
*/
|
|
148
|
+
createCoupon({ body } = {}) {
|
|
149
|
+
const { error } = CartValidator.createCoupon().validate(
|
|
150
|
+
{
|
|
151
|
+
body,
|
|
152
|
+
},
|
|
153
|
+
{ abortEarly: false, allowUnknown: true }
|
|
154
|
+
);
|
|
155
|
+
if (error) {
|
|
156
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Showing warrnings if extra unknown parameters are found
|
|
160
|
+
const { error: warrning } = CartValidator.createCoupon().validate(
|
|
161
|
+
{
|
|
162
|
+
body,
|
|
163
|
+
},
|
|
164
|
+
{ abortEarly: false, allowUnknown: false }
|
|
165
|
+
);
|
|
166
|
+
if (warrning) {
|
|
167
|
+
console.log("Parameter Validation warrnings for createCoupon");
|
|
168
|
+
console.log(warrning);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const query_params = {};
|
|
172
|
+
|
|
173
|
+
return PlatformAPIClient.execute(
|
|
174
|
+
this.config,
|
|
175
|
+
"post",
|
|
176
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon`,
|
|
177
|
+
query_params,
|
|
178
|
+
body
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @param {Object} arg - Arg object.
|
|
184
|
+
* @param {string} arg.id -
|
|
185
|
+
* @summary: Get with single coupon details or coupon list
|
|
186
|
+
* @description: Get single coupon details with `id` in path param
|
|
187
|
+
*/
|
|
188
|
+
getCouponById({ id } = {}) {
|
|
189
|
+
const { error } = CartValidator.getCouponById().validate(
|
|
190
|
+
{
|
|
191
|
+
id,
|
|
192
|
+
},
|
|
193
|
+
{ abortEarly: false, allowUnknown: true }
|
|
194
|
+
);
|
|
195
|
+
if (error) {
|
|
196
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Showing warrnings if extra unknown parameters are found
|
|
200
|
+
const { error: warrning } = CartValidator.getCouponById().validate(
|
|
201
|
+
{
|
|
202
|
+
id,
|
|
203
|
+
},
|
|
204
|
+
{ abortEarly: false, allowUnknown: false }
|
|
205
|
+
);
|
|
206
|
+
if (warrning) {
|
|
207
|
+
console.log("Parameter Validation warrnings for getCouponById");
|
|
208
|
+
console.log(warrning);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const query_params = {};
|
|
212
|
+
|
|
213
|
+
return PlatformAPIClient.execute(
|
|
214
|
+
this.config,
|
|
215
|
+
"get",
|
|
216
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
217
|
+
query_params,
|
|
218
|
+
undefined
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @param {Object} arg - Arg object.
|
|
224
|
+
* @param {string} arg.id -
|
|
225
|
+
* @param {CouponUpdate} arg.body
|
|
226
|
+
* @summary: Update existing coupon configuration
|
|
227
|
+
* @description: Update coupon with id sent in `id`
|
|
228
|
+
*/
|
|
229
|
+
updateCoupon({ id, body } = {}) {
|
|
230
|
+
const { error } = CartValidator.updateCoupon().validate(
|
|
231
|
+
{
|
|
232
|
+
id,
|
|
233
|
+
body,
|
|
234
|
+
},
|
|
235
|
+
{ abortEarly: false, allowUnknown: true }
|
|
236
|
+
);
|
|
237
|
+
if (error) {
|
|
238
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Showing warrnings if extra unknown parameters are found
|
|
242
|
+
const { error: warrning } = CartValidator.updateCoupon().validate(
|
|
243
|
+
{
|
|
244
|
+
id,
|
|
245
|
+
body,
|
|
246
|
+
},
|
|
247
|
+
{ abortEarly: false, allowUnknown: false }
|
|
248
|
+
);
|
|
249
|
+
if (warrning) {
|
|
250
|
+
console.log("Parameter Validation warrnings for updateCoupon");
|
|
251
|
+
console.log(warrning);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const query_params = {};
|
|
255
|
+
|
|
256
|
+
return PlatformAPIClient.execute(
|
|
257
|
+
this.config,
|
|
258
|
+
"put",
|
|
259
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
260
|
+
query_params,
|
|
261
|
+
body
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @param {Object} arg - Arg object.
|
|
267
|
+
* @param {string} arg.id -
|
|
268
|
+
* @param {CouponPartialUpdate} arg.body
|
|
269
|
+
* @summary: Update coupon archive state and schedule
|
|
270
|
+
* @description: Update archive/unarchive and change schedule for coupon
|
|
271
|
+
*/
|
|
272
|
+
updateCouponPartially({ id, body } = {}) {
|
|
273
|
+
const { error } = CartValidator.updateCouponPartially().validate(
|
|
274
|
+
{
|
|
275
|
+
id,
|
|
276
|
+
body,
|
|
277
|
+
},
|
|
278
|
+
{ abortEarly: false, allowUnknown: true }
|
|
279
|
+
);
|
|
280
|
+
if (error) {
|
|
281
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Showing warrnings if extra unknown parameters are found
|
|
285
|
+
const { error: warrning } = CartValidator.updateCouponPartially().validate(
|
|
286
|
+
{
|
|
287
|
+
id,
|
|
288
|
+
body,
|
|
289
|
+
},
|
|
290
|
+
{ abortEarly: false, allowUnknown: false }
|
|
291
|
+
);
|
|
292
|
+
if (warrning) {
|
|
293
|
+
console.log("Parameter Validation warrnings for updateCouponPartially");
|
|
294
|
+
console.log(warrning);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const query_params = {};
|
|
298
|
+
|
|
299
|
+
return PlatformAPIClient.execute(
|
|
300
|
+
this.config,
|
|
301
|
+
"patch",
|
|
302
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon/${id}`,
|
|
303
|
+
query_params,
|
|
304
|
+
body
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @param {Object} arg - Arg object.
|
|
310
|
+
* @param {number} [arg.pageNo] -
|
|
311
|
+
* @param {number} [arg.pageSize] -
|
|
312
|
+
* @param {string} [arg.q] -
|
|
313
|
+
* @param {boolean} [arg.isActive] -
|
|
314
|
+
* @param {string} [arg.promoGroup] -
|
|
315
|
+
* @param {string} [arg.promotionType] -
|
|
316
|
+
* @param {string} [arg.fpPanel] -
|
|
317
|
+
* @param {string} [arg.promotionId] -
|
|
318
|
+
* @summary: Get promotion list
|
|
319
|
+
* @description: Get promotion list with pagination
|
|
320
|
+
*/
|
|
321
|
+
getPromotions({
|
|
322
|
+
pageNo,
|
|
323
|
+
pageSize,
|
|
324
|
+
q,
|
|
325
|
+
isActive,
|
|
326
|
+
promoGroup,
|
|
327
|
+
promotionType,
|
|
328
|
+
fpPanel,
|
|
329
|
+
promotionId,
|
|
330
|
+
} = {}) {
|
|
331
|
+
const { error } = CartValidator.getPromotions().validate(
|
|
332
|
+
{
|
|
333
|
+
pageNo,
|
|
334
|
+
pageSize,
|
|
335
|
+
q,
|
|
336
|
+
isActive,
|
|
337
|
+
promoGroup,
|
|
338
|
+
promotionType,
|
|
339
|
+
fpPanel,
|
|
340
|
+
promotionId,
|
|
341
|
+
},
|
|
342
|
+
{ abortEarly: false, allowUnknown: true }
|
|
343
|
+
);
|
|
344
|
+
if (error) {
|
|
345
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Showing warrnings if extra unknown parameters are found
|
|
349
|
+
const { error: warrning } = CartValidator.getPromotions().validate(
|
|
350
|
+
{
|
|
351
|
+
pageNo,
|
|
352
|
+
pageSize,
|
|
353
|
+
q,
|
|
354
|
+
isActive,
|
|
355
|
+
promoGroup,
|
|
356
|
+
promotionType,
|
|
357
|
+
fpPanel,
|
|
358
|
+
promotionId,
|
|
359
|
+
},
|
|
360
|
+
{ abortEarly: false, allowUnknown: false }
|
|
361
|
+
);
|
|
362
|
+
if (warrning) {
|
|
363
|
+
console.log("Parameter Validation warrnings for getPromotions");
|
|
364
|
+
console.log(warrning);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const query_params = {};
|
|
368
|
+
query_params["page_no"] = pageNo;
|
|
369
|
+
query_params["page_size"] = pageSize;
|
|
370
|
+
query_params["q"] = q;
|
|
371
|
+
query_params["is_active"] = isActive;
|
|
372
|
+
query_params["promo_group"] = promoGroup;
|
|
373
|
+
query_params["promotion_type"] = promotionType;
|
|
374
|
+
query_params["fp_panel"] = fpPanel;
|
|
375
|
+
query_params["promotion_id"] = promotionId;
|
|
376
|
+
|
|
377
|
+
return PlatformAPIClient.execute(
|
|
378
|
+
this.config,
|
|
379
|
+
"get",
|
|
380
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion`,
|
|
381
|
+
query_params,
|
|
382
|
+
undefined
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @param {Object} arg - Arg object.
|
|
388
|
+
* @param {string} arg.companyId - Current company id
|
|
389
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
390
|
+
* @param {number} [arg.pageSize] -
|
|
391
|
+
* @param {string} [arg.q] -
|
|
392
|
+
* @param {boolean} [arg.isActive] -
|
|
393
|
+
* @param {string} [arg.promoGroup] -
|
|
394
|
+
* @param {string} [arg.promotionType] -
|
|
395
|
+
* @param {string} [arg.fpPanel] -
|
|
396
|
+
* @param {string} [arg.promotionId] -
|
|
397
|
+
* @summary: Get promotion list
|
|
398
|
+
* @description: Get promotion list with pagination
|
|
399
|
+
*/
|
|
400
|
+
getPromotionsPaginator({
|
|
401
|
+
companyId,
|
|
402
|
+
applicationId,
|
|
403
|
+
pageSize,
|
|
404
|
+
q,
|
|
405
|
+
isActive,
|
|
406
|
+
promoGroup,
|
|
407
|
+
promotionType,
|
|
408
|
+
fpPanel,
|
|
409
|
+
promotionId,
|
|
410
|
+
} = {}) {
|
|
411
|
+
const paginator = new Paginator();
|
|
412
|
+
const callback = async () => {
|
|
413
|
+
const pageId = paginator.nextId;
|
|
414
|
+
const pageNo = paginator.pageNo;
|
|
415
|
+
const pageType = "number";
|
|
416
|
+
const data = await this.getPromotions({
|
|
417
|
+
companyId: companyId,
|
|
418
|
+
applicationId: applicationId,
|
|
419
|
+
pageNo: pageNo,
|
|
420
|
+
pageSize: pageSize,
|
|
421
|
+
q: q,
|
|
422
|
+
isActive: isActive,
|
|
423
|
+
promoGroup: promoGroup,
|
|
424
|
+
promotionType: promotionType,
|
|
425
|
+
fpPanel: fpPanel,
|
|
426
|
+
promotionId: promotionId,
|
|
427
|
+
});
|
|
428
|
+
paginator.setPaginator({
|
|
429
|
+
hasNext: data.page.has_next ? true : false,
|
|
430
|
+
nextId: data.page.next_id,
|
|
431
|
+
});
|
|
432
|
+
return data;
|
|
433
|
+
};
|
|
434
|
+
paginator.setCallback(callback.bind(this));
|
|
435
|
+
return paginator;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* @param {Object} arg - Arg object.
|
|
440
|
+
* @param {PromotionAdd} arg.body
|
|
441
|
+
* @summary: Create new promotion
|
|
442
|
+
* @description: Create new promotion
|
|
443
|
+
*/
|
|
444
|
+
createPromotion({ body } = {}) {
|
|
445
|
+
const { error } = CartValidator.createPromotion().validate(
|
|
446
|
+
{
|
|
447
|
+
body,
|
|
448
|
+
},
|
|
449
|
+
{ abortEarly: false, allowUnknown: true }
|
|
450
|
+
);
|
|
451
|
+
if (error) {
|
|
452
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Showing warrnings if extra unknown parameters are found
|
|
456
|
+
const { error: warrning } = CartValidator.createPromotion().validate(
|
|
457
|
+
{
|
|
458
|
+
body,
|
|
459
|
+
},
|
|
460
|
+
{ abortEarly: false, allowUnknown: false }
|
|
461
|
+
);
|
|
462
|
+
if (warrning) {
|
|
463
|
+
console.log("Parameter Validation warrnings for createPromotion");
|
|
464
|
+
console.log(warrning);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const query_params = {};
|
|
468
|
+
|
|
469
|
+
return PlatformAPIClient.execute(
|
|
470
|
+
this.config,
|
|
471
|
+
"post",
|
|
472
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion`,
|
|
473
|
+
query_params,
|
|
474
|
+
body
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* @param {Object} arg - Arg object.
|
|
480
|
+
* @param {string} arg.id -
|
|
481
|
+
* @summary: Get with single promotion details or promotion list
|
|
482
|
+
* @description: Get single promotion details with `id` in path param
|
|
483
|
+
*/
|
|
484
|
+
getPromotionById({ id } = {}) {
|
|
485
|
+
const { error } = CartValidator.getPromotionById().validate(
|
|
486
|
+
{
|
|
487
|
+
id,
|
|
488
|
+
},
|
|
489
|
+
{ abortEarly: false, allowUnknown: true }
|
|
490
|
+
);
|
|
491
|
+
if (error) {
|
|
492
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// Showing warrnings if extra unknown parameters are found
|
|
496
|
+
const { error: warrning } = CartValidator.getPromotionById().validate(
|
|
497
|
+
{
|
|
498
|
+
id,
|
|
499
|
+
},
|
|
500
|
+
{ abortEarly: false, allowUnknown: false }
|
|
501
|
+
);
|
|
502
|
+
if (warrning) {
|
|
503
|
+
console.log("Parameter Validation warrnings for getPromotionById");
|
|
504
|
+
console.log(warrning);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
const query_params = {};
|
|
508
|
+
|
|
509
|
+
return PlatformAPIClient.execute(
|
|
510
|
+
this.config,
|
|
511
|
+
"get",
|
|
512
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
513
|
+
query_params,
|
|
514
|
+
undefined
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* @param {Object} arg - Arg object.
|
|
520
|
+
* @param {string} arg.id -
|
|
521
|
+
* @param {PromotionUpdate} arg.body
|
|
522
|
+
* @summary: Update existing promotion configuration
|
|
523
|
+
* @description: Update promotion with id sent in `id`
|
|
524
|
+
*/
|
|
525
|
+
updatePromotion({ id, body } = {}) {
|
|
526
|
+
const { error } = CartValidator.updatePromotion().validate(
|
|
527
|
+
{
|
|
528
|
+
id,
|
|
529
|
+
body,
|
|
530
|
+
},
|
|
531
|
+
{ abortEarly: false, allowUnknown: true }
|
|
532
|
+
);
|
|
533
|
+
if (error) {
|
|
534
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// Showing warrnings if extra unknown parameters are found
|
|
538
|
+
const { error: warrning } = CartValidator.updatePromotion().validate(
|
|
539
|
+
{
|
|
540
|
+
id,
|
|
541
|
+
body,
|
|
542
|
+
},
|
|
543
|
+
{ abortEarly: false, allowUnknown: false }
|
|
544
|
+
);
|
|
545
|
+
if (warrning) {
|
|
546
|
+
console.log("Parameter Validation warrnings for updatePromotion");
|
|
547
|
+
console.log(warrning);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
const query_params = {};
|
|
551
|
+
|
|
552
|
+
return PlatformAPIClient.execute(
|
|
553
|
+
this.config,
|
|
554
|
+
"put",
|
|
555
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
556
|
+
query_params,
|
|
557
|
+
body
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* @param {Object} arg - Arg object.
|
|
563
|
+
* @param {string} arg.id -
|
|
564
|
+
* @param {PromotionPartialUpdate} arg.body
|
|
565
|
+
* @summary: Update promotion publish state and schedule
|
|
566
|
+
* @description: Update publish/unpublish and change schedule for promotion
|
|
567
|
+
*/
|
|
568
|
+
updatePromotionPartially({ id, body } = {}) {
|
|
569
|
+
const { error } = CartValidator.updatePromotionPartially().validate(
|
|
570
|
+
{
|
|
571
|
+
id,
|
|
572
|
+
body,
|
|
573
|
+
},
|
|
574
|
+
{ abortEarly: false, allowUnknown: true }
|
|
575
|
+
);
|
|
576
|
+
if (error) {
|
|
577
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
// Showing warrnings if extra unknown parameters are found
|
|
581
|
+
const {
|
|
582
|
+
error: warrning,
|
|
583
|
+
} = CartValidator.updatePromotionPartially().validate(
|
|
584
|
+
{
|
|
585
|
+
id,
|
|
586
|
+
body,
|
|
587
|
+
},
|
|
588
|
+
{ abortEarly: false, allowUnknown: false }
|
|
589
|
+
);
|
|
590
|
+
if (warrning) {
|
|
591
|
+
console.log(
|
|
592
|
+
"Parameter Validation warrnings for updatePromotionPartially"
|
|
593
|
+
);
|
|
594
|
+
console.log(warrning);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const query_params = {};
|
|
598
|
+
|
|
599
|
+
return PlatformAPIClient.execute(
|
|
600
|
+
this.config,
|
|
601
|
+
"patch",
|
|
602
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion/${id}`,
|
|
603
|
+
query_params,
|
|
604
|
+
body
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* @param {Object} arg - Arg object.
|
|
610
|
+
* @param {OpenapiCartDetailsRequest} arg.body
|
|
611
|
+
* @summary: Fetch Cart Details
|
|
612
|
+
* @description: Get all the details of cart for a list of provided `cart_items`
|
|
613
|
+
*/
|
|
614
|
+
fetchAndvalidateCartItems({ body } = {}) {
|
|
615
|
+
const { error } = CartValidator.fetchAndvalidateCartItems().validate(
|
|
616
|
+
{
|
|
617
|
+
body,
|
|
618
|
+
},
|
|
619
|
+
{ abortEarly: false, allowUnknown: true }
|
|
620
|
+
);
|
|
621
|
+
if (error) {
|
|
622
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Showing warrnings if extra unknown parameters are found
|
|
626
|
+
const {
|
|
627
|
+
error: warrning,
|
|
628
|
+
} = CartValidator.fetchAndvalidateCartItems().validate(
|
|
629
|
+
{
|
|
630
|
+
body,
|
|
631
|
+
},
|
|
632
|
+
{ abortEarly: false, allowUnknown: false }
|
|
633
|
+
);
|
|
634
|
+
if (warrning) {
|
|
635
|
+
console.log(
|
|
636
|
+
"Parameter Validation warrnings for fetchAndvalidateCartItems"
|
|
637
|
+
);
|
|
638
|
+
console.log(warrning);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
const query_params = {};
|
|
642
|
+
|
|
643
|
+
return PlatformAPIClient.execute(
|
|
644
|
+
this.config,
|
|
645
|
+
"post",
|
|
646
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/validate`,
|
|
647
|
+
query_params,
|
|
648
|
+
body
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* @param {Object} arg - Arg object.
|
|
654
|
+
* @param {OpenApiCartServiceabilityRequest} arg.body
|
|
655
|
+
* @summary: Check Pincode Serviceability
|
|
656
|
+
* @description: Check Pincode serviceability for cart items provided in `cart_items` and address pincode in `shipping_address`
|
|
657
|
+
*/
|
|
658
|
+
checkCartServiceability({ body } = {}) {
|
|
659
|
+
const { error } = CartValidator.checkCartServiceability().validate(
|
|
660
|
+
{
|
|
661
|
+
body,
|
|
662
|
+
},
|
|
663
|
+
{ abortEarly: false, allowUnknown: true }
|
|
664
|
+
);
|
|
665
|
+
if (error) {
|
|
666
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// Showing warrnings if extra unknown parameters are found
|
|
670
|
+
const {
|
|
671
|
+
error: warrning,
|
|
672
|
+
} = CartValidator.checkCartServiceability().validate(
|
|
673
|
+
{
|
|
674
|
+
body,
|
|
675
|
+
},
|
|
676
|
+
{ abortEarly: false, allowUnknown: false }
|
|
677
|
+
);
|
|
678
|
+
if (warrning) {
|
|
679
|
+
console.log("Parameter Validation warrnings for checkCartServiceability");
|
|
680
|
+
console.log(warrning);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const query_params = {};
|
|
684
|
+
|
|
685
|
+
return PlatformAPIClient.execute(
|
|
686
|
+
this.config,
|
|
687
|
+
"post",
|
|
688
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/serviceability`,
|
|
689
|
+
query_params,
|
|
690
|
+
body
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* @param {Object} arg - Arg object.
|
|
696
|
+
* @param {OpenApiPlatformCheckoutReq} arg.body
|
|
697
|
+
* @summary: Create Fynd order with cart details
|
|
698
|
+
* @description: Generate Fynd order for cart details send with provided `cart_items`
|
|
699
|
+
*/
|
|
700
|
+
checkoutCart({ body } = {}) {
|
|
701
|
+
const { error } = CartValidator.checkoutCart().validate(
|
|
702
|
+
{
|
|
703
|
+
body,
|
|
704
|
+
},
|
|
705
|
+
{ abortEarly: false, allowUnknown: true }
|
|
706
|
+
);
|
|
707
|
+
if (error) {
|
|
708
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// Showing warrnings if extra unknown parameters are found
|
|
712
|
+
const { error: warrning } = CartValidator.checkoutCart().validate(
|
|
713
|
+
{
|
|
714
|
+
body,
|
|
715
|
+
},
|
|
716
|
+
{ abortEarly: false, allowUnknown: false }
|
|
717
|
+
);
|
|
718
|
+
if (warrning) {
|
|
719
|
+
console.log("Parameter Validation warrnings for checkoutCart");
|
|
720
|
+
console.log(warrning);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const query_params = {};
|
|
724
|
+
|
|
725
|
+
return PlatformAPIClient.execute(
|
|
726
|
+
this.config,
|
|
727
|
+
"post",
|
|
728
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/checkout`,
|
|
729
|
+
query_params,
|
|
730
|
+
body
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* @param {Object} arg - Arg object.
|
|
736
|
+
* @param {number} [arg.pageNo] -
|
|
737
|
+
* @param {number} [arg.pageSize] -
|
|
738
|
+
* @param {string} [arg.fromDate] -
|
|
739
|
+
* @param {string} [arg.toDate] -
|
|
740
|
+
* @param {boolean} [arg.anonymousCart] -
|
|
741
|
+
* @param {string} [arg.lastId] -
|
|
742
|
+
* @param {string} [arg.sortOn] -
|
|
743
|
+
* @summary: Get with abandoned cart list
|
|
744
|
+
* @description: Get abandoned cart list with pagination
|
|
745
|
+
*/
|
|
746
|
+
getAbandonedCart({
|
|
747
|
+
pageNo,
|
|
748
|
+
pageSize,
|
|
749
|
+
fromDate,
|
|
750
|
+
toDate,
|
|
751
|
+
anonymousCart,
|
|
752
|
+
lastId,
|
|
753
|
+
sortOn,
|
|
754
|
+
} = {}) {
|
|
755
|
+
const { error } = CartValidator.getAbandonedCart().validate(
|
|
756
|
+
{
|
|
757
|
+
pageNo,
|
|
758
|
+
pageSize,
|
|
759
|
+
fromDate,
|
|
760
|
+
toDate,
|
|
761
|
+
anonymousCart,
|
|
762
|
+
lastId,
|
|
763
|
+
sortOn,
|
|
764
|
+
},
|
|
765
|
+
{ abortEarly: false, allowUnknown: true }
|
|
766
|
+
);
|
|
767
|
+
if (error) {
|
|
768
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// Showing warrnings if extra unknown parameters are found
|
|
772
|
+
const { error: warrning } = CartValidator.getAbandonedCart().validate(
|
|
773
|
+
{
|
|
774
|
+
pageNo,
|
|
775
|
+
pageSize,
|
|
776
|
+
fromDate,
|
|
777
|
+
toDate,
|
|
778
|
+
anonymousCart,
|
|
779
|
+
lastId,
|
|
780
|
+
sortOn,
|
|
781
|
+
},
|
|
782
|
+
{ abortEarly: false, allowUnknown: false }
|
|
783
|
+
);
|
|
784
|
+
if (warrning) {
|
|
785
|
+
console.log("Parameter Validation warrnings for getAbandonedCart");
|
|
786
|
+
console.log(warrning);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
const query_params = {};
|
|
790
|
+
query_params["page_no"] = pageNo;
|
|
791
|
+
query_params["page_size"] = pageSize;
|
|
792
|
+
query_params["from_date"] = fromDate;
|
|
793
|
+
query_params["to_date"] = toDate;
|
|
794
|
+
query_params["anonymous_cart"] = anonymousCart;
|
|
795
|
+
query_params["last_id"] = lastId;
|
|
796
|
+
query_params["sort_on"] = sortOn;
|
|
797
|
+
|
|
798
|
+
return PlatformAPIClient.execute(
|
|
799
|
+
this.config,
|
|
800
|
+
"get",
|
|
801
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts`,
|
|
802
|
+
query_params,
|
|
803
|
+
undefined
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* @param {Object} arg - Arg object.
|
|
809
|
+
* @param {string} arg.companyId - Current company id
|
|
810
|
+
* @param {string} arg.applicationId - Current Application _id
|
|
811
|
+
* @param {number} [arg.pageSize] -
|
|
812
|
+
* @param {string} [arg.fromDate] -
|
|
813
|
+
* @param {string} [arg.toDate] -
|
|
814
|
+
* @param {boolean} [arg.anonymousCart] -
|
|
815
|
+
* @param {string} [arg.lastId] -
|
|
816
|
+
* @param {string} [arg.sortOn] -
|
|
817
|
+
* @summary: Get with abandoned cart list
|
|
818
|
+
* @description: Get abandoned cart list with pagination
|
|
819
|
+
*/
|
|
820
|
+
getAbandonedCartPaginator({
|
|
821
|
+
companyId,
|
|
822
|
+
applicationId,
|
|
823
|
+
pageSize,
|
|
824
|
+
fromDate,
|
|
825
|
+
toDate,
|
|
826
|
+
anonymousCart,
|
|
827
|
+
lastId,
|
|
828
|
+
sortOn,
|
|
829
|
+
} = {}) {
|
|
830
|
+
const paginator = new Paginator();
|
|
831
|
+
const callback = async () => {
|
|
832
|
+
const pageId = paginator.nextId;
|
|
833
|
+
const pageNo = paginator.pageNo;
|
|
834
|
+
const pageType = "number";
|
|
835
|
+
const data = await this.getAbandonedCart({
|
|
836
|
+
companyId: companyId,
|
|
837
|
+
applicationId: applicationId,
|
|
838
|
+
pageNo: pageNo,
|
|
839
|
+
pageSize: pageSize,
|
|
840
|
+
fromDate: fromDate,
|
|
841
|
+
toDate: toDate,
|
|
842
|
+
anonymousCart: anonymousCart,
|
|
843
|
+
lastId: lastId,
|
|
844
|
+
sortOn: sortOn,
|
|
845
|
+
});
|
|
846
|
+
paginator.setPaginator({
|
|
847
|
+
hasNext: data.page.has_next ? true : false,
|
|
848
|
+
nextId: data.page.next_id,
|
|
849
|
+
});
|
|
850
|
+
return data;
|
|
851
|
+
};
|
|
852
|
+
paginator.setCallback(callback.bind(this));
|
|
853
|
+
return paginator;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* @param {Object} arg - Arg object.
|
|
858
|
+
* @param {string} [arg.id] -
|
|
859
|
+
* @param {boolean} [arg.i] -
|
|
860
|
+
* @param {boolean} [arg.b] -
|
|
861
|
+
* @summary: Fetch all items added to the cart
|
|
862
|
+
* @description: Use this API to get details of all the items added to a cart.
|
|
863
|
+
*/
|
|
864
|
+
getAbandonedCartDetails({ id, i, b } = {}) {
|
|
865
|
+
const { error } = CartValidator.getAbandonedCartDetails().validate(
|
|
866
|
+
{
|
|
867
|
+
id,
|
|
868
|
+
i,
|
|
869
|
+
b,
|
|
870
|
+
},
|
|
871
|
+
{ abortEarly: false, allowUnknown: true }
|
|
872
|
+
);
|
|
873
|
+
if (error) {
|
|
874
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// Showing warrnings if extra unknown parameters are found
|
|
878
|
+
const {
|
|
879
|
+
error: warrning,
|
|
880
|
+
} = CartValidator.getAbandonedCartDetails().validate(
|
|
881
|
+
{
|
|
882
|
+
id,
|
|
883
|
+
i,
|
|
884
|
+
b,
|
|
885
|
+
},
|
|
886
|
+
{ abortEarly: false, allowUnknown: false }
|
|
887
|
+
);
|
|
888
|
+
if (warrning) {
|
|
889
|
+
console.log("Parameter Validation warrnings for getAbandonedCartDetails");
|
|
890
|
+
console.log(warrning);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
const query_params = {};
|
|
894
|
+
query_params["id"] = id;
|
|
895
|
+
query_params["i"] = i;
|
|
896
|
+
query_params["b"] = b;
|
|
897
|
+
|
|
898
|
+
return PlatformAPIClient.execute(
|
|
899
|
+
this.config,
|
|
900
|
+
"get",
|
|
901
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/cart/detail`,
|
|
902
|
+
query_params,
|
|
903
|
+
undefined
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* @param {Object} arg - Arg object.
|
|
909
|
+
* @param {string} arg.cartId - Current Cart _id
|
|
910
|
+
* @param {boolean} [arg.b] -
|
|
911
|
+
* @param {AddCartRequest} arg.body
|
|
912
|
+
* @summary: Add items to abandoned cart
|
|
913
|
+
* @description: Use this API to add items to the abandoned cart.
|
|
914
|
+
*/
|
|
915
|
+
addItems({ cartId, body, b } = {}) {
|
|
916
|
+
const { error } = CartValidator.addItems().validate(
|
|
917
|
+
{
|
|
918
|
+
cartId,
|
|
919
|
+
body,
|
|
920
|
+
b,
|
|
921
|
+
},
|
|
922
|
+
{ abortEarly: false, allowUnknown: true }
|
|
923
|
+
);
|
|
924
|
+
if (error) {
|
|
925
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
// Showing warrnings if extra unknown parameters are found
|
|
929
|
+
const { error: warrning } = CartValidator.addItems().validate(
|
|
930
|
+
{
|
|
931
|
+
cartId,
|
|
932
|
+
body,
|
|
933
|
+
b,
|
|
934
|
+
},
|
|
935
|
+
{ abortEarly: false, allowUnknown: false }
|
|
936
|
+
);
|
|
937
|
+
if (warrning) {
|
|
938
|
+
console.log("Parameter Validation warrnings for addItems");
|
|
939
|
+
console.log(warrning);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
const query_params = {};
|
|
943
|
+
query_params["b"] = b;
|
|
944
|
+
|
|
945
|
+
return PlatformAPIClient.execute(
|
|
946
|
+
this.config,
|
|
947
|
+
"post",
|
|
948
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts/${cartId}`,
|
|
949
|
+
query_params,
|
|
950
|
+
body
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* @param {Object} arg - Arg object.
|
|
956
|
+
* @param {string} arg.cartId - Current Cart _id
|
|
957
|
+
* @param {boolean} [arg.b] -
|
|
958
|
+
* @param {UpdateCartRequest} arg.body
|
|
959
|
+
* @summary: Update items in the abandoned cart
|
|
960
|
+
* @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>
|
|
961
|
+
*/
|
|
962
|
+
updateCart({ cartId, body, b } = {}) {
|
|
963
|
+
const { error } = CartValidator.updateCart().validate(
|
|
964
|
+
{
|
|
965
|
+
cartId,
|
|
966
|
+
body,
|
|
967
|
+
b,
|
|
968
|
+
},
|
|
969
|
+
{ abortEarly: false, allowUnknown: true }
|
|
970
|
+
);
|
|
971
|
+
if (error) {
|
|
972
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
// Showing warrnings if extra unknown parameters are found
|
|
976
|
+
const { error: warrning } = CartValidator.updateCart().validate(
|
|
977
|
+
{
|
|
978
|
+
cartId,
|
|
979
|
+
body,
|
|
980
|
+
b,
|
|
981
|
+
},
|
|
982
|
+
{ abortEarly: false, allowUnknown: false }
|
|
983
|
+
);
|
|
984
|
+
if (warrning) {
|
|
985
|
+
console.log("Parameter Validation warrnings for updateCart");
|
|
986
|
+
console.log(warrning);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
const query_params = {};
|
|
990
|
+
query_params["b"] = b;
|
|
991
|
+
|
|
992
|
+
return PlatformAPIClient.execute(
|
|
993
|
+
this.config,
|
|
994
|
+
"put",
|
|
995
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/abandoned/carts/${cartId}`,
|
|
996
|
+
query_params,
|
|
997
|
+
body
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
module.exports = Cart;
|