@gofynd/fdk-client-javascript 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +31 -2
  2. package/index.d.ts +4 -4
  3. package/index.js +9 -10
  4. package/package.json +14 -14
  5. package/sdk/APIClient.d.ts +11 -0
  6. package/sdk/APIClient.js +35 -0
  7. package/sdk/Client.d.ts +6 -0
  8. package/sdk/Client.js +17 -0
  9. package/sdk/Config.d.ts +9 -0
  10. package/sdk/Config.js +17 -0
  11. package/sdk/application/Cart/CartApplicationClient.js +29 -28
  12. package/sdk/application/Cart/CartApplicationModel.js +3 -1
  13. package/sdk/application/Catalog/CatalogApplicationClient.js +43 -42
  14. package/sdk/application/Catalog/CatalogApplicationModel.js +1 -1
  15. package/sdk/application/Common/CommonApplicationClient.js +5 -4
  16. package/sdk/application/Communication/CommunicationApplicationClient.js +6 -5
  17. package/sdk/application/Configuration/ConfigurationApplicationClient.js +21 -20
  18. package/sdk/application/Content/ContentApplicationClient.js +26 -25
  19. package/sdk/application/Content/ContentApplicationModel.js +1 -0
  20. package/sdk/application/FileStorage/FileStorageApplicationClient.js +6 -5
  21. package/sdk/application/Lead/LeadApplicationClient.js +10 -9
  22. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +1 -3
  23. package/sdk/application/Logistic/LogisticApplicationClient.js +11 -12
  24. package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -1
  25. package/sdk/application/Order/OrderApplicationClient.js +15 -14
  26. package/sdk/application/Order/OrderApplicationModel.js +9 -0
  27. package/sdk/application/Payment/PaymentApplicationClient.js +42 -41
  28. package/sdk/application/PosCart/PosCartApplicationClient.js +30 -29
  29. package/sdk/application/PosCart/PosCartApplicationModel.js +3 -1
  30. package/sdk/application/Rewards/RewardsApplicationClient.js +11 -10
  31. package/sdk/application/Share/ShareApplicationClient.js +10 -9
  32. package/sdk/application/Theme/ThemeApplicationClient.js +7 -6
  33. package/sdk/application/User/UserApplicationClient.js +38 -37
  34. package/sdk/common/AxiosHelper.js +17 -6
  35. package/sdk/constructUrl.d.ts +5 -0
  36. package/sdk/constructUrl.js +13 -0
  37. package/sdk/index.d.ts +3 -0
  38. package/sdk/index.js +5 -0
  39. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +3 -1
  40. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
  41. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
  42. package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
  43. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +3 -2
  44. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +1 -0
  45. package/sdk/platform/Billing/BillingPlatformClient.js +3 -2
  46. package/sdk/platform/Billing/BillingPlatformValidator.js +1 -0
  47. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +27 -0
  48. package/sdk/platform/Cart/CartPlatformApplicationClient.js +177 -1
  49. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
  50. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -1
  51. package/sdk/platform/Cart/CartPlatformModel.js +7 -3
  52. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +3 -1
  53. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -1
  54. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +2 -2
  55. package/sdk/platform/Catalog/CatalogPlatformClient.js +6 -9
  56. package/sdk/platform/Catalog/CatalogPlatformModel.js +7 -7
  57. package/sdk/platform/Catalog/CatalogPlatformValidator.js +2 -1
  58. package/sdk/platform/Common/CommonPlatformClient.js +7 -18
  59. package/sdk/platform/Common/CommonPlatformValidator.js +1 -0
  60. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3 -1
  61. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -1
  62. package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
  63. package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
  64. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +5 -4
  65. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +1 -0
  66. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -1
  67. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +1 -1
  68. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +9 -8
  69. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +1 -0
  70. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +0 -10
  71. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3 -62
  72. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +0 -1
  73. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +1 -7
  74. package/sdk/platform/Content/ContentPlatformModel.js +1 -0
  75. package/sdk/platform/Discount/DiscountPlatformClient.js +3 -2
  76. package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -0
  77. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -3
  78. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +27 -5
  79. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
  80. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -3
  81. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +28 -6
  82. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +1 -0
  83. package/sdk/platform/Inventory/InventoryPlatformClient.js +3 -2
  84. package/sdk/platform/Inventory/InventoryPlatformValidator.js +1 -0
  85. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +3 -1
  86. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +1 -1
  87. package/sdk/platform/Lead/LeadPlatformClient.js +4 -3
  88. package/sdk/platform/Lead/LeadPlatformValidator.js +1 -0
  89. package/sdk/platform/Order/OrderPlatformApplicationClient.js +3 -1
  90. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -1
  91. package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
  92. package/sdk/platform/Order/OrderPlatformClient.js +16 -3
  93. package/sdk/platform/Order/OrderPlatformModel.js +1 -0
  94. package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
  95. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
  96. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
  97. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +1 -1
  98. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +14 -14
  99. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +1 -1
  100. package/sdk/platform/Payment/PaymentPlatformClient.js +3 -2
  101. package/sdk/platform/Payment/PaymentPlatformValidator.js +1 -0
  102. package/sdk/platform/PlatformClient.d.ts +13 -9
  103. package/sdk/platform/PlatformClient.js +13 -9
  104. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +4 -4
  105. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +36 -17
  106. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +1 -1
  107. package/sdk/platform/Share/SharePlatformApplicationClient.js +3 -1
  108. package/sdk/platform/Share/SharePlatformApplicationValidator.js +1 -1
  109. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +3 -1
  110. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +1 -1
  111. package/sdk/platform/User/UserPlatformApplicationClient.js +3 -1
  112. package/sdk/platform/User/UserPlatformApplicationValidator.js +1 -1
  113. package/sdk/platform/Webhook/WebhookPlatformClient.js +3 -2
  114. package/sdk/platform/Webhook/WebhookPlatformValidator.js +1 -0
  115. package/sdk/public/Configuration/ConfigurationPublicClient.js +2 -0
  116. package/sdk/public/Inventory/InventoryPublicClient.js +2 -0
  117. package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
  118. package/.github/workflows/on_create_release.yml +0 -23
  119. package/.github/workflows/on_merge_main.yml +0 -38
  120. package/.github/workflows/on_pull_request.yml +0 -35
  121. package/.prettierrc +0 -5
  122. package/documentation/application/CART.md +0 -8771
  123. package/documentation/application/CATALOG.md +0 -8690
  124. package/documentation/application/COMMON.md +0 -325
  125. package/documentation/application/COMMUNICATION.md +0 -387
  126. package/documentation/application/CONFIGURATION.md +0 -2212
  127. package/documentation/application/CONTENT.md +0 -2629
  128. package/documentation/application/FILESTORAGE.md +0 -442
  129. package/documentation/application/LEAD.md +0 -1549
  130. package/documentation/application/LOGISTIC.md +0 -689
  131. package/documentation/application/ORDER.md +0 -2937
  132. package/documentation/application/PAYMENT.md +0 -4475
  133. package/documentation/application/POSCART.md +0 -9375
  134. package/documentation/application/README.md +0 -21
  135. package/documentation/application/REWARDS.md +0 -554
  136. package/documentation/application/SHARE.md +0 -635
  137. package/documentation/application/THEME.md +0 -5517
  138. package/documentation/application/USER.md +0 -3798
  139. package/documentation/platform/ANALYTICS.md +0 -1012
  140. package/documentation/platform/AUDITTRAIL.md +0 -493
  141. package/documentation/platform/BILLING.md +0 -1889
  142. package/documentation/platform/CART.md +0 -4711
  143. package/documentation/platform/CATALOG.md +0 -20522
  144. package/documentation/platform/COMMON.md +0 -325
  145. package/documentation/platform/COMMUNICATION.md +0 -4970
  146. package/documentation/platform/COMPANYPROFILE.md +0 -1646
  147. package/documentation/platform/CONFIGURATION.md +0 -6316
  148. package/documentation/platform/CONTENT.md +0 -8364
  149. package/documentation/platform/DISCOUNT.md +0 -767
  150. package/documentation/platform/FILESTORAGE.md +0 -945
  151. package/documentation/platform/INVENTORY.md +0 -1136
  152. package/documentation/platform/LEAD.md +0 -4394
  153. package/documentation/platform/ORDER.md +0 -6525
  154. package/documentation/platform/PARTNER.md +0 -193
  155. package/documentation/platform/PAYMENT.md +0 -3138
  156. package/documentation/platform/README.md +0 -27
  157. package/documentation/platform/REWARDS.md +0 -919
  158. package/documentation/platform/SHARE.md +0 -513
  159. package/documentation/platform/THEME.md +0 -35446
  160. package/documentation/platform/USER.md +0 -2174
  161. package/documentation/platform/WEBHOOK.md +0 -485
  162. package/documentation/public/CONFIGURATION.md +0 -325
  163. package/documentation/public/INVENTORY.md +0 -508
  164. package/documentation/public/WEBHOOK.md +0 -246
  165. package/jest.config.d.ts +0 -4
  166. package/jest.config.js +0 -6
  167. package/tests/application/catalog.spec.js +0 -54
  168. package/tests/common/action-url.spec.js +0 -35
  169. package/tests/common/schema/action-url.json +0 -178
  170. package/tests/common/schema/url-action.json +0 -683
  171. package/tests/common/url-action.spec.js +0 -48
  172. package/tests/helpers/cookie.helper.js +0 -31
  173. package/tests/helpers/oauth.helper.js +0 -43
  174. package/tests/platform/catalog.spec.js +0 -49
  175. package/tests/public/location.spec.js +0 -39
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CartValidator = require("./CartPlatformApplicationValidator");
5
5
  const CartModel = require("./CartPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Cart {
9
10
  constructor(config, applicationId) {
@@ -658,6 +659,120 @@ class Cart {
658
659
  return response;
659
660
  }
660
661
 
662
+ /**
663
+ * @param {Object} arg - Arg object.
664
+ * @param {string} [arg.code] -
665
+ * @returns {Promise<Object>} - Success response
666
+ * @summary: Check if coupon is already created with coupon code
667
+ * @description: Check if sent coupon code is already existing coupon code. As coupon code is to be unique.
668
+ */
669
+ async getCouponCodeExists({ code } = {}) {
670
+ const { error } = CartValidator.getCouponCodeExists().validate(
671
+ {
672
+ code,
673
+ },
674
+ { abortEarly: false, allowUnknown: true }
675
+ );
676
+ if (error) {
677
+ return Promise.reject(new FDKClientValidationError(error));
678
+ }
679
+
680
+ // Showing warrnings if extra unknown parameters are found
681
+ const { error: warrning } = CartValidator.getCouponCodeExists().validate(
682
+ {
683
+ code,
684
+ },
685
+ { abortEarly: false, allowUnknown: false }
686
+ );
687
+ if (warrning) {
688
+ Logger({
689
+ level: "WARN",
690
+ message: "Parameter Validation warrnings for getCouponCodeExists",
691
+ });
692
+ Logger({ level: "WARN", message: warrning });
693
+ }
694
+
695
+ const query_params = {};
696
+ query_params["code"] = code;
697
+
698
+ const response = await PlatformAPIClient.execute(
699
+ this.config,
700
+ "get",
701
+ `/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon_code_exists`,
702
+ query_params,
703
+ undefined
704
+ );
705
+
706
+ const { error: res_error } = Joi.any().validate(response, {
707
+ abortEarly: false,
708
+ allowUnknown: false,
709
+ });
710
+
711
+ if (res_error) {
712
+ Logger({
713
+ level: "WARN",
714
+ message: "Response Validation Warnnings for getCouponCodeExists",
715
+ });
716
+ Logger({ level: "WARN", message: res_error });
717
+ }
718
+
719
+ return response;
720
+ }
721
+
722
+ /**
723
+ * @param {Object} arg - Arg object.
724
+ * @returns {Promise<Object>} - Success response
725
+ * @summary: Get coupon options enums with display values
726
+ * @description: Get coupon enum values for fields in valid coupon object. Used for front end to create, update and filter coupon lists via fields
727
+ */
728
+ async getCouponOptionValues({} = {}) {
729
+ const { error } = CartValidator.getCouponOptionValues().validate(
730
+ {},
731
+ { abortEarly: false, allowUnknown: true }
732
+ );
733
+ if (error) {
734
+ return Promise.reject(new FDKClientValidationError(error));
735
+ }
736
+
737
+ // Showing warrnings if extra unknown parameters are found
738
+ const { error: warrning } = CartValidator.getCouponOptionValues().validate(
739
+ {},
740
+ { abortEarly: false, allowUnknown: false }
741
+ );
742
+ if (warrning) {
743
+ Logger({
744
+ level: "WARN",
745
+ message: "Parameter Validation warrnings for getCouponOptionValues",
746
+ });
747
+ Logger({ level: "WARN", message: warrning });
748
+ }
749
+
750
+ const query_params = {};
751
+
752
+ const response = await PlatformAPIClient.execute(
753
+ this.config,
754
+ "get",
755
+ `/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/coupon_options`,
756
+ query_params,
757
+ undefined
758
+ );
759
+
760
+ const { error: res_error } = Joi.any().validate(response, {
761
+ abortEarly: false,
762
+ allowUnknown: false,
763
+ });
764
+
765
+ if (res_error) {
766
+ Logger({
767
+ level: "WARN",
768
+ message: "Response Validation Warnnings for getCouponOptionValues",
769
+ });
770
+ Logger({ level: "WARN", message: res_error });
771
+ }
772
+
773
+ return response;
774
+ }
775
+
661
776
  /**
662
777
  * @param {Object} arg - Arg object.
663
778
  * @param {number} [arg.pageNo] -
@@ -866,6 +981,66 @@ class Cart {
866
981
  return response;
867
982
  }
868
983
 
984
+ /**
985
+ * @param {Object} arg - Arg object.
986
+ * @param {string} [arg.code] -
987
+ * @returns {Promise<Object>} - Success response
988
+ * @summary: Check if promotion is already created with promotion code
989
+ * @description: Check if sent promotion code is already existing promotion code. As promotion code is to be unique.
990
+ */
991
+ async getPromotionCodeExists({ code } = {}) {
992
+ const { error } = CartValidator.getPromotionCodeExists().validate(
993
+ {
994
+ code,
995
+ },
996
+ { abortEarly: false, allowUnknown: true }
997
+ );
998
+ if (error) {
999
+ return Promise.reject(new FDKClientValidationError(error));
1000
+ }
1001
+
1002
+ // Showing warrnings if extra unknown parameters are found
1003
+ const { error: warrning } = CartValidator.getPromotionCodeExists().validate(
1004
+ {
1005
+ code,
1006
+ },
1007
+ { abortEarly: false, allowUnknown: false }
1008
+ );
1009
+ if (warrning) {
1010
+ Logger({
1011
+ level: "WARN",
1012
+ message: "Parameter Validation warrnings for getPromotionCodeExists",
1013
+ });
1014
+ Logger({ level: "WARN", message: warrning });
1015
+ }
1016
+
1017
+ const query_params = {};
1018
+ query_params["code"] = code;
1019
+
1020
+ const response = await PlatformAPIClient.execute(
1021
+ this.config,
1022
+ "get",
1023
+ `/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/promotion_code_exists`,
1024
+ query_params,
1025
+ undefined
1026
+ );
1027
+
1028
+ const { error: res_error } = Joi.any().validate(response, {
1029
+ abortEarly: false,
1030
+ allowUnknown: false,
1031
+ });
1032
+
1033
+ if (res_error) {
1034
+ Logger({
1035
+ level: "WARN",
1036
+ message: "Response Validation Warnnings for getPromotionCodeExists",
1037
+ });
1038
+ Logger({ level: "WARN", message: res_error });
1039
+ }
1040
+
1041
+ return response;
1042
+ }
1043
+
869
1044
  /**
870
1045
  * @param {Object} arg - Arg object.
871
1046
  * @param {number} [arg.pageNo] -
@@ -1335,4 +1510,5 @@ class Cart {
1335
1510
  return response;
1336
1511
  }
1337
1512
  }
1513
+
1338
1514
  module.exports = Cart;
@@ -9,8 +9,11 @@ declare class CartValidator {
9
9
  static getAbandonedCart(): any;
10
10
  static getAbandonedCartDetails(): any;
11
11
  static getCouponById(): any;
12
+ static getCouponCodeExists(): any;
13
+ static getCouponOptionValues(): any;
12
14
  static getCoupons(): any;
13
15
  static getPromotionById(): any;
16
+ static getPromotionCodeExists(): any;
14
17
  static getPromotions(): any;
15
18
  static updateCart(): any;
16
19
  static updateCoupon(): any;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const CartModel = require("./CartPlatformModel");
3
2
 
3
+ const CartModel = require("./CartPlatformModel");
4
4
  class CartValidator {
5
5
  static addItems() {
6
6
  return Joi.object({
@@ -66,6 +66,16 @@ class CartValidator {
66
66
  }).required();
67
67
  }
68
68
 
69
+ static getCouponCodeExists() {
70
+ return Joi.object({
71
+ code: Joi.string().allow(""),
72
+ }).required();
73
+ }
74
+
75
+ static getCouponOptionValues() {
76
+ return Joi.object({}).required();
77
+ }
78
+
69
79
  static getCoupons() {
70
80
  return Joi.object({
71
81
  pageNo: Joi.number(),
@@ -85,6 +95,12 @@ class CartValidator {
85
95
  }).required();
86
96
  }
87
97
 
98
+ static getPromotionCodeExists() {
99
+ return Joi.object({
100
+ code: Joi.string().allow(""),
101
+ }).required();
102
+ }
103
+
88
104
  static getPromotions() {
89
105
  return Joi.object({
90
106
  pageNo: Joi.number(),
@@ -74,7 +74,9 @@ class CartModel {
74
74
  extra_meta: Joi.any(),
75
75
  item_id: Joi.number(),
76
76
  item_size: Joi.string().allow(""),
77
- parent_item_identifiers: Joi.any(),
77
+ parent_item_identifiers: Joi.array().items(
78
+ Joi.object().pattern(/\S/, Joi.string().allow(""))
79
+ ),
78
80
  pos: Joi.boolean(),
79
81
  product_group_tags: Joi.array().items(Joi.string().allow("").allow(null)),
80
82
  quantity: Joi.number(),
@@ -421,7 +423,7 @@ class CartModel {
421
423
  }
422
424
  static OpenapiCartDetailsRequest() {
423
425
  return Joi.object({
424
- cart_items: CartModel.CartItem(),
426
+ cart_items: Joi.array().items(CartModel.CartItem()).required(),
425
427
  });
426
428
  }
427
429
  static OpenapiCartDetailsResponse() {
@@ -434,7 +436,7 @@ class CartModel {
434
436
  }
435
437
  static OpenApiCartServiceabilityRequest() {
436
438
  return Joi.object({
437
- cart_items: CartModel.CartItem(),
439
+ cart_items: Joi.array().items(CartModel.CartItem()).required(),
438
440
  shipping_address: CartModel.ShippingAddress().required(),
439
441
  });
440
442
  }
@@ -881,6 +883,8 @@ class CartModel {
881
883
  city: Joi.string().allow("").allow(null),
882
884
  country: Joi.string().allow("").allow(null),
883
885
  country_code: Joi.string().allow(""),
886
+ country_iso_code: Joi.string().allow(""),
887
+ country_phone_code: Joi.string().allow(""),
884
888
  email: Joi.string().allow(""),
885
889
  landmark: Joi.string().allow(""),
886
890
  meta: Joi.any(),
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CatalogValidator = require("./CatalogPlatformApplicationValidator");
5
5
  const CatalogModel = require("./CatalogPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Catalog {
9
10
  constructor(config, applicationId) {
@@ -4033,4 +4034,5 @@ class Catalog {
4033
4034
  return response;
4034
4035
  }
4035
4036
  }
4037
+
4036
4038
  module.exports = Catalog;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const CatalogModel = require("./CatalogPlatformModel");
3
2
 
3
+ const CatalogModel = require("./CatalogPlatformModel");
4
4
  class CatalogValidator {
5
5
  static addCollectionItems() {
6
6
  return Joi.object({
@@ -330,7 +330,7 @@ declare class Catalog {
330
330
  /**
331
331
  * @param {Object} arg - Arg object.
332
332
  * @param {boolean} [arg.isActive] - The is_active status for the optin id.
333
- * @param {boolean} [arg.q] - The search value to filter the list.
333
+ * @param {string} [arg.q] - The search value to filter the list.
334
334
  * @param {number} [arg.pageNo] - The number of page for the company id.
335
335
  * @param {number} [arg.pageSize] - Number of records that can be seen on
336
336
  * the page for the company id.
@@ -342,7 +342,7 @@ declare class Catalog {
342
342
  */
343
343
  getCompanyBrandDetail({ isActive, q, pageNo, pageSize, marketplace, }?: {
344
344
  isActive?: boolean;
345
- q?: boolean;
345
+ q?: string;
346
346
  pageNo?: number;
347
347
  pageSize?: number;
348
348
  marketplace?: string;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CatalogValidator = require("./CatalogPlatformValidator");
5
5
  const CatalogModel = require("./CatalogPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Catalog {
9
10
  constructor(config) {
@@ -1947,7 +1948,7 @@ class Catalog {
1947
1948
  /**
1948
1949
  * @param {Object} arg - Arg object.
1949
1950
  * @param {boolean} [arg.isActive] - The is_active status for the optin id.
1950
- * @param {boolean} [arg.q] - The search value to filter the list.
1951
+ * @param {string} [arg.q] - The search value to filter the list.
1951
1952
  * @param {number} [arg.pageNo] - The number of page for the company id.
1952
1953
  * @param {number} [arg.pageSize] - Number of records that can be seen on
1953
1954
  * the page for the company id.
@@ -3792,9 +3793,7 @@ class Catalog {
3792
3793
  */
3793
3794
  async getSingleProductHSNCode({ reportingHsn } = {}) {
3794
3795
  const { error } = CatalogValidator.getSingleProductHSNCode().validate(
3795
- {
3796
- reportingHsn,
3797
- },
3796
+ { reportingHsn },
3798
3797
  { abortEarly: false, allowUnknown: true }
3799
3798
  );
3800
3799
  if (error) {
@@ -3805,9 +3804,7 @@ class Catalog {
3805
3804
  const {
3806
3805
  error: warrning,
3807
3806
  } = CatalogValidator.getSingleProductHSNCode().validate(
3808
- {
3809
- reportingHsn,
3810
- },
3807
+ { reportingHsn },
3811
3808
  { abortEarly: false, allowUnknown: false }
3812
3809
  );
3813
3810
  if (warrning) {
@@ -1179,15 +1179,15 @@ class CatalogModel {
1179
1179
  addresses: Joi.array().items(CatalogModel.GetAddressSerializer()),
1180
1180
  business_type: Joi.string().allow(""),
1181
1181
  company_type: Joi.string().allow(""),
1182
- created_by: CatalogModel.UserSerializer1(),
1182
+ created_by: CatalogModel.UserSerializer2(),
1183
1183
  created_on: Joi.string().allow(""),
1184
- modified_by: CatalogModel.UserSerializer1(),
1184
+ modified_by: CatalogModel.UserSerializer2(),
1185
1185
  modified_on: Joi.string().allow(""),
1186
1186
  name: Joi.string().allow(""),
1187
1187
  reject_reason: Joi.string().allow(""),
1188
1188
  stage: Joi.string().allow(""),
1189
1189
  uid: Joi.number(),
1190
- verified_by: CatalogModel.UserSerializer1(),
1190
+ verified_by: CatalogModel.UserSerializer2(),
1191
1191
  verified_on: Joi.string().allow(""),
1192
1192
  });
1193
1193
  }
@@ -1270,14 +1270,14 @@ class CatalogModel {
1270
1270
  code: Joi.string().allow("").required(),
1271
1271
  company: CatalogModel.GetCompanySerializer(),
1272
1272
  contact_numbers: Joi.array().items(CatalogModel.SellerPhoneNumber()),
1273
- created_by: CatalogModel.UserSerializer2(),
1273
+ created_by: CatalogModel.UserSerializer1(),
1274
1274
  created_on: Joi.string().allow(""),
1275
1275
  display_name: Joi.string().allow("").required(),
1276
1276
  documents: Joi.array().items(CatalogModel.Document()),
1277
1277
  gst_credentials: CatalogModel.InvoiceDetailsSerializer(),
1278
1278
  integration_type: CatalogModel.LocationIntegrationType(),
1279
1279
  manager: CatalogModel.LocationManagerSerializer(),
1280
- modified_by: CatalogModel.UserSerializer2(),
1280
+ modified_by: CatalogModel.UserSerializer1(),
1281
1281
  modified_on: Joi.string().allow(""),
1282
1282
  name: Joi.string().allow("").required(),
1283
1283
  notification_emails: Joi.array().items(Joi.string().allow("")),
@@ -1287,7 +1287,7 @@ class CatalogModel {
1287
1287
  store_type: Joi.string().allow(""),
1288
1288
  timing: Joi.array().items(CatalogModel.LocationDayWiseSerializer()),
1289
1289
  uid: Joi.number(),
1290
- verified_by: CatalogModel.UserSerializer2(),
1290
+ verified_by: CatalogModel.UserSerializer1(),
1291
1291
  verified_on: Joi.string().allow(""),
1292
1292
  warnings: Joi.any(),
1293
1293
  });
@@ -1622,7 +1622,7 @@ class CatalogModel {
1622
1622
  has_next: Joi.boolean(),
1623
1623
  has_previous: Joi.boolean(),
1624
1624
  item_total: Joi.number().required(),
1625
- next_id: Joi.string().allow(""),
1625
+ next_id: Joi.string().allow("").allow(null),
1626
1626
  type: Joi.string().allow("").required(),
1627
1627
  });
1628
1628
  }
@@ -193,7 +193,7 @@ class CatalogValidator {
193
193
  static getCompanyBrandDetail() {
194
194
  return Joi.object({
195
195
  isActive: Joi.boolean(),
196
- q: Joi.boolean(),
196
+ q: Joi.string().allow(""),
197
197
  pageNo: Joi.number(),
198
198
  pageSize: Joi.number(),
199
199
  marketplace: Joi.string().allow(""),
@@ -538,4 +538,5 @@ class CatalogValidator {
538
538
  }).required();
539
539
  }
540
540
  }
541
+
541
542
  module.exports = CatalogValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CommonValidator = require("./CommonPlatformValidator");
5
5
  const CommonModel = require("./CommonPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Common {
9
10
  constructor(config) {
@@ -23,10 +24,7 @@ class Common {
23
24
  */
24
25
  async getLocations({ locationType, id } = {}) {
25
26
  const { error } = CommonValidator.getLocations().validate(
26
- {
27
- locationType,
28
- id,
29
- },
27
+ { locationType, id },
30
28
  { abortEarly: false, allowUnknown: true }
31
29
  );
32
30
  if (error) {
@@ -35,10 +33,7 @@ class Common {
35
33
 
36
34
  // Showing warrnings if extra unknown parameters are found
37
35
  const { error: warrning } = CommonValidator.getLocations().validate(
38
- {
39
- locationType,
40
- id,
41
- },
36
+ { locationType, id },
42
37
  { abortEarly: false, allowUnknown: false }
43
38
  );
44
39
  if (warrning) {
@@ -90,10 +85,7 @@ class Common {
90
85
  */
91
86
  async searchApplication({ authorization, query } = {}) {
92
87
  const { error } = CommonValidator.searchApplication().validate(
93
- {
94
- authorization,
95
- query,
96
- },
88
+ { authorization, query },
97
89
  { abortEarly: false, allowUnknown: true }
98
90
  );
99
91
  if (error) {
@@ -102,10 +94,7 @@ class Common {
102
94
 
103
95
  // Showing warrnings if extra unknown parameters are found
104
96
  const { error: warrning } = CommonValidator.searchApplication().validate(
105
- {
106
- authorization,
107
- query,
108
- },
97
+ { authorization, query },
109
98
  { abortEarly: false, allowUnknown: false }
110
99
  );
111
100
  if (warrning) {
@@ -16,4 +16,5 @@ class CommonValidator {
16
16
  });
17
17
  }
18
18
  }
19
+
19
20
  module.exports = CommonValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CommunicationValidator = require("./CommunicationPlatformApplicationValidator");
5
5
  const CommunicationModel = require("./CommunicationPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Communication {
9
10
  constructor(config, applicationId) {
@@ -3072,4 +3073,5 @@ class Communication {
3072
3073
  return response;
3073
3074
  }
3074
3075
  }
3076
+
3075
3077
  module.exports = Communication;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const CommunicationModel = require("./CommunicationPlatformModel");
3
2
 
3
+ const CommunicationModel = require("./CommunicationPlatformModel");
4
4
  class CommunicationValidator {
5
5
  static createAudience() {
6
6
  return Joi.object({
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CommunicationValidator = require("./CommunicationPlatformValidator");
5
5
  const CommunicationModel = require("./CommunicationPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Communication {
9
10
  constructor(config) {
@@ -103,7 +104,7 @@ class Communication {
103
104
  });
104
105
  return data;
105
106
  };
106
- paginator.setCallback(callback);
107
+ paginator.setCallback(callback.bind(this));
107
108
  return paginator;
108
109
  }
109
110
  }
@@ -9,4 +9,5 @@ class CommunicationValidator {
9
9
  }).required();
10
10
  }
11
11
  }
12
+
12
13
  module.exports = CommunicationValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const CompanyProfileValidator = require("./CompanyProfilePlatformValidator");
5
5
  const CompanyProfileModel = require("./CompanyProfilePlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class CompanyProfile {
9
10
  constructor(config) {
@@ -566,7 +567,7 @@ class CompanyProfile {
566
567
  });
567
568
  return data;
568
569
  };
569
- paginator.setCallback(callback);
570
+ paginator.setCallback(callback.bind(this));
570
571
  return paginator;
571
572
  }
572
573
 
@@ -826,7 +827,7 @@ class CompanyProfile {
826
827
  });
827
828
  return data;
828
829
  };
829
- paginator.setCallback(callback);
830
+ paginator.setCallback(callback.bind(this));
830
831
  return paginator;
831
832
  }
832
833
 
@@ -85,4 +85,5 @@ class CompanyProfileValidator {
85
85
  }).required();
86
86
  }
87
87
  }
88
+
88
89
  module.exports = CompanyProfileValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const ConfigurationValidator = require("./ConfigurationPlatformApplicationValidator");
5
5
  const ConfigurationModel = require("./ConfigurationPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Configuration {
9
10
  constructor(config, applicationId) {
@@ -1966,4 +1967,5 @@ class Configuration {
1966
1967
  return response;
1967
1968
  }
1968
1969
  }
1970
+
1969
1971
  module.exports = Configuration;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const ConfigurationModel = require("./ConfigurationPlatformModel");
3
2
 
3
+ const ConfigurationModel = require("./ConfigurationPlatformModel");
4
4
  class ConfigurationValidator {
5
5
  static addDomain() {
6
6
  return Joi.object({