@gofynd/fdk-client-javascript 1.0.3 → 1.1.0

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 (185) hide show
  1. package/README.md +51 -2
  2. package/index.d.ts +7 -4
  3. package/index.js +22 -7
  4. package/package.json +23 -14
  5. package/partner.d.ts +4 -0
  6. package/partner.js +7 -0
  7. package/sdk/application/ApplicationAPIClient.js +2 -4
  8. package/sdk/application/Cart/CartApplicationClient.js +29 -28
  9. package/sdk/application/Cart/CartApplicationModel.js +3 -1
  10. package/sdk/application/Catalog/CatalogApplicationClient.js +43 -42
  11. package/sdk/application/Catalog/CatalogApplicationModel.js +5 -3
  12. package/sdk/application/Common/CommonApplicationClient.js +5 -4
  13. package/sdk/application/Communication/CommunicationApplicationClient.js +6 -5
  14. package/sdk/application/Configuration/ConfigurationApplicationClient.js +21 -20
  15. package/sdk/application/Content/ContentApplicationClient.js +26 -25
  16. package/sdk/application/FileStorage/FileStorageApplicationClient.js +6 -5
  17. package/sdk/application/Lead/LeadApplicationClient.js +10 -9
  18. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +1 -3
  19. package/sdk/application/Logistic/LogisticApplicationClient.js +11 -12
  20. package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -1
  21. package/sdk/application/Order/OrderApplicationClient.js +15 -14
  22. package/sdk/application/Order/OrderApplicationModel.js +9 -0
  23. package/sdk/application/Payment/PaymentApplicationClient.js +42 -41
  24. package/sdk/application/PosCart/PosCartApplicationClient.js +30 -29
  25. package/sdk/application/PosCart/PosCartApplicationModel.js +3 -1
  26. package/sdk/application/Rewards/RewardsApplicationClient.js +11 -10
  27. package/sdk/application/Share/ShareApplicationClient.js +10 -9
  28. package/sdk/application/Theme/ThemeApplicationClient.js +7 -6
  29. package/sdk/application/User/UserApplicationClient.js +38 -37
  30. package/sdk/common/AxiosHelper.js +17 -6
  31. package/sdk/common/BaseOAuthClient.d.ts +17 -0
  32. package/sdk/common/BaseOAuthClient.js +67 -0
  33. package/sdk/common/RequestSigner.js +0 -5
  34. package/sdk/partner/OAuthClient.d.ts +14 -0
  35. package/sdk/partner/OAuthClient.js +112 -0
  36. package/sdk/partner/PartnerAPIClient.d.ts +12 -0
  37. package/sdk/partner/PartnerAPIClient.js +42 -0
  38. package/sdk/partner/PartnerClient.d.ts +6 -0
  39. package/sdk/partner/PartnerClient.js +17 -0
  40. package/sdk/partner/PartnerConfig.d.ts +30 -0
  41. package/sdk/partner/PartnerConfig.js +39 -0
  42. package/sdk/partner/index.d.ts +3 -0
  43. package/sdk/partner/index.js +5 -0
  44. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +3 -1
  45. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
  46. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
  47. package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
  48. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +3 -2
  49. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +1 -0
  50. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
  51. package/sdk/platform/Billing/BillingPlatformClient.js +137 -2
  52. package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
  53. package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
  54. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
  55. package/sdk/platform/Billing/BillingPlatformValidator.js +15 -0
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +27 -0
  57. package/sdk/platform/Cart/CartPlatformApplicationClient.js +177 -1
  58. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
  59. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -1
  60. package/sdk/platform/Cart/CartPlatformModel.js +7 -3
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +3 -1
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -1
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +2 -2
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +6 -9
  65. package/sdk/platform/Catalog/CatalogPlatformModel.js +9 -9
  66. package/sdk/platform/Catalog/CatalogPlatformValidator.js +2 -1
  67. package/sdk/platform/Common/CommonPlatformClient.js +7 -18
  68. package/sdk/platform/Common/CommonPlatformValidator.js +1 -0
  69. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3 -1
  70. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -1
  71. package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
  72. package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
  73. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +5 -4
  74. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +1 -0
  75. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -1
  76. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +1 -1
  77. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +9 -8
  78. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +1 -0
  79. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3 -1
  80. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +1 -1
  81. package/sdk/platform/Discount/DiscountPlatformClient.js +3 -2
  82. package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -0
  83. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -3
  84. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +27 -5
  85. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
  86. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -3
  87. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +28 -6
  88. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +1 -0
  89. package/sdk/platform/Inventory/InventoryPlatformClient.js +3 -2
  90. package/sdk/platform/Inventory/InventoryPlatformValidator.js +1 -0
  91. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +3 -1
  92. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +1 -1
  93. package/sdk/platform/Lead/LeadPlatformClient.js +4 -3
  94. package/sdk/platform/Lead/LeadPlatformValidator.js +1 -0
  95. package/sdk/platform/OAuthClient.js +3 -9
  96. package/sdk/platform/Order/OrderPlatformApplicationClient.js +3 -1
  97. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -1
  98. package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
  99. package/sdk/platform/Order/OrderPlatformClient.js +16 -3
  100. package/sdk/platform/Order/OrderPlatformModel.js +1 -0
  101. package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
  102. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
  103. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
  104. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +1 -1
  105. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +14 -14
  106. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +1 -1
  107. package/sdk/platform/Payment/PaymentPlatformClient.js +3 -2
  108. package/sdk/platform/Payment/PaymentPlatformValidator.js +1 -0
  109. package/sdk/platform/PlatformApplicationClient.d.ts +5 -1
  110. package/sdk/platform/PlatformApplicationClient.js +4 -0
  111. package/sdk/platform/PlatformClient.d.ts +51 -12
  112. package/sdk/platform/PlatformClient.js +54 -11
  113. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +17 -19
  114. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +88 -83
  115. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
  116. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +8 -9
  117. package/sdk/platform/Share/SharePlatformApplicationClient.js +3 -1
  118. package/sdk/platform/Share/SharePlatformApplicationValidator.js +1 -1
  119. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +3 -1
  120. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +1 -1
  121. package/sdk/platform/User/UserPlatformApplicationClient.js +3 -1
  122. package/sdk/platform/User/UserPlatformApplicationValidator.js +1 -1
  123. package/sdk/platform/Webhook/WebhookPlatformClient.js +3 -2
  124. package/sdk/platform/Webhook/WebhookPlatformValidator.js +1 -0
  125. package/sdk/public/Configuration/ConfigurationPublicClient.js +2 -0
  126. package/sdk/public/Inventory/InventoryPublicClient.js +2 -0
  127. package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
  128. package/.github/workflows/on_create_release.yml +0 -23
  129. package/.github/workflows/on_merge_main.yml +0 -38
  130. package/.github/workflows/on_pull_request.yml +0 -35
  131. package/.prettierrc +0 -5
  132. package/documentation/application/CART.md +0 -8771
  133. package/documentation/application/CATALOG.md +0 -8690
  134. package/documentation/application/COMMON.md +0 -325
  135. package/documentation/application/COMMUNICATION.md +0 -387
  136. package/documentation/application/CONFIGURATION.md +0 -2212
  137. package/documentation/application/CONTENT.md +0 -2629
  138. package/documentation/application/FILESTORAGE.md +0 -442
  139. package/documentation/application/LEAD.md +0 -1549
  140. package/documentation/application/LOGISTIC.md +0 -689
  141. package/documentation/application/ORDER.md +0 -2937
  142. package/documentation/application/PAYMENT.md +0 -4475
  143. package/documentation/application/POSCART.md +0 -9375
  144. package/documentation/application/README.md +0 -21
  145. package/documentation/application/REWARDS.md +0 -554
  146. package/documentation/application/SHARE.md +0 -635
  147. package/documentation/application/THEME.md +0 -5517
  148. package/documentation/application/USER.md +0 -3798
  149. package/documentation/platform/ANALYTICS.md +0 -1012
  150. package/documentation/platform/AUDITTRAIL.md +0 -493
  151. package/documentation/platform/BILLING.md +0 -1889
  152. package/documentation/platform/CART.md +0 -4711
  153. package/documentation/platform/CATALOG.md +0 -20522
  154. package/documentation/platform/COMMON.md +0 -325
  155. package/documentation/platform/COMMUNICATION.md +0 -4970
  156. package/documentation/platform/COMPANYPROFILE.md +0 -1646
  157. package/documentation/platform/CONFIGURATION.md +0 -6316
  158. package/documentation/platform/CONTENT.md +0 -8364
  159. package/documentation/platform/DISCOUNT.md +0 -767
  160. package/documentation/platform/FILESTORAGE.md +0 -945
  161. package/documentation/platform/INVENTORY.md +0 -1136
  162. package/documentation/platform/LEAD.md +0 -4394
  163. package/documentation/platform/ORDER.md +0 -6525
  164. package/documentation/platform/PARTNER.md +0 -193
  165. package/documentation/platform/PAYMENT.md +0 -3138
  166. package/documentation/platform/README.md +0 -27
  167. package/documentation/platform/REWARDS.md +0 -919
  168. package/documentation/platform/SHARE.md +0 -513
  169. package/documentation/platform/THEME.md +0 -35446
  170. package/documentation/platform/USER.md +0 -2174
  171. package/documentation/platform/WEBHOOK.md +0 -485
  172. package/documentation/public/CONFIGURATION.md +0 -325
  173. package/documentation/public/INVENTORY.md +0 -508
  174. package/documentation/public/WEBHOOK.md +0 -246
  175. package/jest.config.d.ts +0 -4
  176. package/jest.config.js +0 -6
  177. package/tests/application/catalog.spec.js +0 -54
  178. package/tests/common/action-url.spec.js +0 -35
  179. package/tests/common/schema/action-url.json +0 -178
  180. package/tests/common/schema/url-action.json +0 -683
  181. package/tests/common/url-action.spec.js +0 -48
  182. package/tests/helpers/cookie.helper.js +0 -31
  183. package/tests/helpers/oauth.helper.js +0 -43
  184. package/tests/platform/catalog.spec.js +0 -49
  185. package/tests/public/location.spec.js +0 -39
@@ -136,6 +136,23 @@ declare class Cart {
136
136
  getCouponById({ id }?: {
137
137
  id: string;
138
138
  }): Promise<CouponUpdate>;
139
+ /**
140
+ * @param {Object} arg - Arg object.
141
+ * @param {string} [arg.code] -
142
+ * @returns {Promise<Object>} - Success response
143
+ * @summary: Check if coupon is already created with coupon code
144
+ * @description: Check if sent coupon code is already existing coupon code. As coupon code is to be unique.
145
+ */
146
+ getCouponCodeExists({ code }?: {
147
+ code?: string;
148
+ }): Promise<any>;
149
+ /**
150
+ * @param {Object} arg - Arg object.
151
+ * @returns {Promise<Object>} - Success response
152
+ * @summary: Get coupon options enums with display values
153
+ * @description: Get coupon enum values for fields in valid coupon object. Used for front end to create, update and filter coupon lists via fields
154
+ */
155
+ getCouponOptionValues({}?: any): Promise<any>;
139
156
  /**
140
157
  * @param {Object} arg - Arg object.
141
158
  * @param {number} [arg.pageNo] -
@@ -195,6 +212,16 @@ declare class Cart {
195
212
  getPromotionById({ id }?: {
196
213
  id: string;
197
214
  }): Promise<PromotionUpdate>;
215
+ /**
216
+ * @param {Object} arg - Arg object.
217
+ * @param {string} [arg.code] -
218
+ * @returns {Promise<Object>} - Success response
219
+ * @summary: Check if promotion is already created with promotion code
220
+ * @description: Check if sent promotion code is already existing promotion code. As promotion code is to be unique.
221
+ */
222
+ getPromotionCodeExists({ code }?: {
223
+ code?: string;
224
+ }): Promise<any>;
198
225
  /**
199
226
  * @param {Object} arg - Arg object.
200
227
  * @param {number} [arg.pageNo] -
@@ -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
  }
@@ -2288,7 +2288,7 @@ class CatalogModel {
2288
2288
  net_quantity: CatalogModel.NetQuantity(),
2289
2289
  no_of_boxes: Joi.number(),
2290
2290
  product_group_tag: Joi.array().items(Joi.string().allow("")),
2291
- product_publish: CatalogModel.ProductPublish(),
2291
+ product_publish: CatalogModel.ProductPublish1(),
2292
2292
  requester: Joi.string().allow(""),
2293
2293
  return_config: CatalogModel.ReturnConfig().required(),
2294
2294
  short_description: Joi.string().allow(""),
@@ -2504,7 +2504,7 @@ class CatalogModel {
2504
2504
  pending: Joi.string().allow(""),
2505
2505
  primary_color: Joi.string().allow(""),
2506
2506
  product_group_tag: Joi.array().items(Joi.string().allow("")),
2507
- product_publish: CatalogModel.ProductPublish1(),
2507
+ product_publish: CatalogModel.ProductPublish(),
2508
2508
  return_config: CatalogModel.ReturnConfigResponse(),
2509
2509
  short_description: Joi.string().allow(""),
2510
2510
  size_guide: Joi.string().allow(""),
@@ -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;