@gofynd/fdk-client-javascript 1.0.0 → 1.0.2

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 (156) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +393 -393
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +268 -268
  5. package/documentation/application/PAYMENT.md +249 -249
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3497 -3097
  9. package/documentation/platform/COMPANYPROFILE.md +207 -207
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1518 -1324
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +96 -96
  14. package/index.js +7 -1
  15. package/package.json +1 -1
  16. package/sdk/application/ApplicationConfig.js +1 -1
  17. package/sdk/application/Cart/CartApplicationClient.js +865 -52
  18. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  19. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  20. package/sdk/application/Cart/CartApplicationValidator.js +1 -0
  21. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  22. package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
  23. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
  24. package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
  25. package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
  26. package/sdk/application/Common/CommonApplicationClient.js +66 -4
  27. package/sdk/application/Common/CommonApplicationValidator.js +1 -0
  28. package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
  29. package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
  30. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  31. package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
  32. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  33. package/sdk/application/Content/ContentApplicationClient.js +621 -38
  34. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  35. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  36. package/sdk/application/Content/ContentApplicationValidator.js +1 -0
  37. package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
  38. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
  39. package/sdk/application/Lead/LeadApplicationClient.js +229 -14
  40. package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
  41. package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
  42. package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
  43. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  44. package/sdk/application/Order/OrderApplicationClient.js +403 -24
  45. package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
  46. package/sdk/application/Order/OrderApplicationModel.js +334 -334
  47. package/sdk/application/Order/OrderApplicationValidator.js +1 -0
  48. package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
  49. package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
  50. package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
  51. package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
  52. package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
  53. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  54. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  55. package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
  56. package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
  57. package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
  58. package/sdk/application/Share/ShareApplicationClient.js +226 -14
  59. package/sdk/application/Share/ShareApplicationValidator.js +1 -0
  60. package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
  61. package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
  62. package/sdk/application/User/UserApplicationClient.js +1133 -70
  63. package/sdk/application/User/UserApplicationValidator.js +1 -0
  64. package/sdk/common/AxiosHelper.js +1 -1
  65. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  66. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
  67. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  68. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
  69. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  70. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
  71. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  72. package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
  73. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  74. package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
  75. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  76. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  77. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
  78. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
  79. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
  80. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
  81. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
  82. package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
  83. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
  84. package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
  85. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
  86. package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
  87. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  88. package/sdk/platform/Common/CommonPlatformClient.js +73 -4
  89. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  90. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
  91. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  92. package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
  93. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  94. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
  95. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
  96. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
  97. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  98. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
  99. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  100. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
  101. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  102. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
  103. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  104. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  105. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  106. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  107. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  108. package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
  109. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  110. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
  111. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  112. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
  113. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  114. package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
  115. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  116. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
  117. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  118. package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
  119. package/sdk/platform/OAuthClient.js +8 -8
  120. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  121. package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
  122. package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
  123. package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
  124. package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
  125. package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
  126. package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
  127. package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
  128. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  129. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
  130. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  131. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  132. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  133. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
  134. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  135. package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
  136. package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
  137. package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
  138. package/sdk/platform/PlatformApplicationClient.js +3461 -3263
  139. package/sdk/platform/PlatformClient.d.ts +2973 -2827
  140. package/sdk/platform/PlatformClient.js +3461 -3263
  141. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  142. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
  143. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  144. package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
  145. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  146. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
  147. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  148. package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
  149. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  150. package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
  151. package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
  152. package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
  153. package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
  154. package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
  155. package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
  156. package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
2
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
3
  const PlatformAPIClient = require("../PlatformAPIClient");
4
4
  const BillingValidator = require("./BillingPlatformValidator");
5
+ const BillingModel = require("./BillingPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+
5
8
  class Billing {
6
9
  constructor(config) {
7
10
  this.config = config;
@@ -11,10 +14,11 @@ class Billing {
11
14
  * @param {Object} arg - Arg object.
12
15
  * @param {string} arg.plan - ID of the plan.
13
16
  * @param {string} arg.couponCode - Coupon code.
17
+ * @returns {Promise<CheckValidityResponse>} - Success response
14
18
  * @summary: Check coupon validity
15
19
  * @description: Check coupon validity.
16
20
  */
17
- checkCouponValidity({ plan, couponCode } = {}) {
21
+ async checkCouponValidity({ plan, couponCode } = {}) {
18
22
  const { error } = BillingValidator.checkCouponValidity().validate(
19
23
  {
20
24
  plan,
@@ -26,13 +30,29 @@ class Billing {
26
30
  return Promise.reject(new FDKClientValidationError(error));
27
31
  }
28
32
 
33
+ // Showing warrnings if extra unknown parameters are found
34
+ const { error: warrning } = BillingValidator.checkCouponValidity().validate(
35
+ {
36
+ plan,
37
+ couponCode,
38
+ },
39
+ { abortEarly: false, allowUnknown: false }
40
+ );
41
+ if (warrning) {
42
+ Logger({
43
+ level: "WARN",
44
+ message: "Parameter Validation warrnings for checkCouponValidity",
45
+ });
46
+ Logger({ level: "WARN", message: warrning });
47
+ }
48
+
29
49
  const query_params = {};
30
50
  query_params["plan"] = plan;
31
51
  query_params["coupon_code"] = couponCode;
32
52
 
33
53
  const xHeaders = {};
34
54
 
35
- return PlatformAPIClient.execute(
55
+ const response = await PlatformAPIClient.execute(
36
56
  this.config,
37
57
  "get",
38
58
  `/service/platform/billing/v1.0/company/${this.config.companyId}/coupon/check-validity`,
@@ -40,16 +60,34 @@ class Billing {
40
60
  undefined,
41
61
  xHeaders
42
62
  );
63
+
64
+ const {
65
+ error: res_error,
66
+ } = BillingModel.CheckValidityResponse().validate(response, {
67
+ abortEarly: false,
68
+ allowUnknown: false,
69
+ });
70
+
71
+ if (res_error) {
72
+ Logger({
73
+ level: "WARN",
74
+ message: "Response Validation Warnnings for checkCouponValidity",
75
+ });
76
+ Logger({ level: "WARN", message: res_error });
77
+ }
78
+
79
+ return response;
43
80
  }
44
81
 
45
82
  /**
46
83
  * @param {Object} arg - Arg object.
47
84
  * @param {string} arg.extensionId - Extension _id
48
85
  * @param {CreateSubscriptionCharge} arg.body
86
+ * @returns {Promise<CreateSubscriptionResponse>} - Success response
49
87
  * @summary: Create subscription charge
50
88
  * @description: Register subscription charge for a seller of your extension.
51
89
  */
52
- createSubscriptionCharge({ extensionId, body } = {}) {
90
+ async createSubscriptionCharge({ extensionId, body } = {}) {
53
91
  const { error } = BillingValidator.createSubscriptionCharge().validate(
54
92
  {
55
93
  extensionId,
@@ -61,11 +99,29 @@ class Billing {
61
99
  return Promise.reject(new FDKClientValidationError(error));
62
100
  }
63
101
 
102
+ // Showing warrnings if extra unknown parameters are found
103
+ const {
104
+ error: warrning,
105
+ } = BillingValidator.createSubscriptionCharge().validate(
106
+ {
107
+ extensionId,
108
+ body,
109
+ },
110
+ { abortEarly: false, allowUnknown: false }
111
+ );
112
+ if (warrning) {
113
+ Logger({
114
+ level: "WARN",
115
+ message: "Parameter Validation warrnings for createSubscriptionCharge",
116
+ });
117
+ Logger({ level: "WARN", message: warrning });
118
+ }
119
+
64
120
  const query_params = {};
65
121
 
66
122
  const xHeaders = {};
67
123
 
68
- return PlatformAPIClient.execute(
124
+ const response = await PlatformAPIClient.execute(
69
125
  this.config,
70
126
  "post",
71
127
  `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription`,
@@ -73,16 +129,34 @@ class Billing {
73
129
  body,
74
130
  xHeaders
75
131
  );
132
+
133
+ const {
134
+ error: res_error,
135
+ } = BillingModel.CreateSubscriptionResponse().validate(response, {
136
+ abortEarly: false,
137
+ allowUnknown: false,
138
+ });
139
+
140
+ if (res_error) {
141
+ Logger({
142
+ level: "WARN",
143
+ message: "Response Validation Warnnings for createSubscriptionCharge",
144
+ });
145
+ Logger({ level: "WARN", message: res_error });
146
+ }
147
+
148
+ return response;
76
149
  }
77
150
 
78
151
  /**
79
152
  * @param {Object} arg - Arg object.
80
153
  * @param {string} arg.extensionId - Extension _id
81
154
  * @param {string} arg.subscriptionId - Subscription charge _id
155
+ * @returns {Promise<EntitySubscription>} - Success response
82
156
  * @summary: Get subscription charge details
83
157
  * @description: Get created subscription charge details
84
158
  */
85
- getSubscriptionCharge({ extensionId, subscriptionId } = {}) {
159
+ async getSubscriptionCharge({ extensionId, subscriptionId } = {}) {
86
160
  const { error } = BillingValidator.getSubscriptionCharge().validate(
87
161
  {
88
162
  extensionId,
@@ -94,11 +168,29 @@ class Billing {
94
168
  return Promise.reject(new FDKClientValidationError(error));
95
169
  }
96
170
 
171
+ // Showing warrnings if extra unknown parameters are found
172
+ const {
173
+ error: warrning,
174
+ } = BillingValidator.getSubscriptionCharge().validate(
175
+ {
176
+ extensionId,
177
+ subscriptionId,
178
+ },
179
+ { abortEarly: false, allowUnknown: false }
180
+ );
181
+ if (warrning) {
182
+ Logger({
183
+ level: "WARN",
184
+ message: "Parameter Validation warrnings for getSubscriptionCharge",
185
+ });
186
+ Logger({ level: "WARN", message: warrning });
187
+ }
188
+
97
189
  const query_params = {};
98
190
 
99
191
  const xHeaders = {};
100
192
 
101
- return PlatformAPIClient.execute(
193
+ const response = await PlatformAPIClient.execute(
102
194
  this.config,
103
195
  "get",
104
196
  `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription/${subscriptionId}`,
@@ -106,16 +198,34 @@ class Billing {
106
198
  undefined,
107
199
  xHeaders
108
200
  );
201
+
202
+ const {
203
+ error: res_error,
204
+ } = BillingModel.EntitySubscription().validate(response, {
205
+ abortEarly: false,
206
+ allowUnknown: false,
207
+ });
208
+
209
+ if (res_error) {
210
+ Logger({
211
+ level: "WARN",
212
+ message: "Response Validation Warnnings for getSubscriptionCharge",
213
+ });
214
+ Logger({ level: "WARN", message: res_error });
215
+ }
216
+
217
+ return response;
109
218
  }
110
219
 
111
220
  /**
112
221
  * @param {Object} arg - Arg object.
113
222
  * @param {string} arg.extensionId - Extension _id
114
223
  * @param {string} arg.subscriptionId - Subscription charge _id
224
+ * @returns {Promise<EntitySubscription>} - Success response
115
225
  * @summary: Cancel subscription charge
116
226
  * @description: Cancel subscription and attached charges.
117
227
  */
118
- cancelSubscriptionCharge({ extensionId, subscriptionId } = {}) {
228
+ async cancelSubscriptionCharge({ extensionId, subscriptionId } = {}) {
119
229
  const { error } = BillingValidator.cancelSubscriptionCharge().validate(
120
230
  {
121
231
  extensionId,
@@ -127,11 +237,29 @@ class Billing {
127
237
  return Promise.reject(new FDKClientValidationError(error));
128
238
  }
129
239
 
240
+ // Showing warrnings if extra unknown parameters are found
241
+ const {
242
+ error: warrning,
243
+ } = BillingValidator.cancelSubscriptionCharge().validate(
244
+ {
245
+ extensionId,
246
+ subscriptionId,
247
+ },
248
+ { abortEarly: false, allowUnknown: false }
249
+ );
250
+ if (warrning) {
251
+ Logger({
252
+ level: "WARN",
253
+ message: "Parameter Validation warrnings for cancelSubscriptionCharge",
254
+ });
255
+ Logger({ level: "WARN", message: warrning });
256
+ }
257
+
130
258
  const query_params = {};
131
259
 
132
260
  const xHeaders = {};
133
261
 
134
- return PlatformAPIClient.execute(
262
+ const response = await PlatformAPIClient.execute(
135
263
  this.config,
136
264
  "post",
137
265
  `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription/${subscriptionId}/cancel`,
@@ -139,14 +267,32 @@ class Billing {
139
267
  undefined,
140
268
  xHeaders
141
269
  );
270
+
271
+ const {
272
+ error: res_error,
273
+ } = BillingModel.EntitySubscription().validate(response, {
274
+ abortEarly: false,
275
+ allowUnknown: false,
276
+ });
277
+
278
+ if (res_error) {
279
+ Logger({
280
+ level: "WARN",
281
+ message: "Response Validation Warnnings for cancelSubscriptionCharge",
282
+ });
283
+ Logger({ level: "WARN", message: res_error });
284
+ }
285
+
286
+ return response;
142
287
  }
143
288
 
144
289
  /**
145
290
  * @param {Object} arg - Arg object.
291
+ * @returns {Promise<Invoices>} - Success response
146
292
  * @summary: Get invoices
147
293
  * @description: Get invoices.
148
294
  */
149
- getInvoices({} = {}) {
295
+ async getInvoices({} = {}) {
150
296
  const { error } = BillingValidator.getInvoices().validate(
151
297
  {},
152
298
  { abortEarly: false, allowUnknown: true }
@@ -155,11 +301,24 @@ class Billing {
155
301
  return Promise.reject(new FDKClientValidationError(error));
156
302
  }
157
303
 
304
+ // Showing warrnings if extra unknown parameters are found
305
+ const { error: warrning } = BillingValidator.getInvoices().validate(
306
+ {},
307
+ { abortEarly: false, allowUnknown: false }
308
+ );
309
+ if (warrning) {
310
+ Logger({
311
+ level: "WARN",
312
+ message: "Parameter Validation warrnings for getInvoices",
313
+ });
314
+ Logger({ level: "WARN", message: warrning });
315
+ }
316
+
158
317
  const query_params = {};
159
318
 
160
319
  const xHeaders = {};
161
320
 
162
- return PlatformAPIClient.execute(
321
+ const response = await PlatformAPIClient.execute(
163
322
  this.config,
164
323
  "get",
165
324
  `/service/platform/billing/v1.0/company/${this.config.companyId}/invoice/list`,
@@ -167,15 +326,31 @@ class Billing {
167
326
  undefined,
168
327
  xHeaders
169
328
  );
329
+
330
+ const { error: res_error } = BillingModel.Invoices().validate(response, {
331
+ abortEarly: false,
332
+ allowUnknown: false,
333
+ });
334
+
335
+ if (res_error) {
336
+ Logger({
337
+ level: "WARN",
338
+ message: "Response Validation Warnnings for getInvoices",
339
+ });
340
+ Logger({ level: "WARN", message: res_error });
341
+ }
342
+
343
+ return response;
170
344
  }
171
345
 
172
346
  /**
173
347
  * @param {Object} arg - Arg object.
174
348
  * @param {string} arg.invoiceId - Invoice id
349
+ * @returns {Promise<Invoice>} - Success response
175
350
  * @summary: Get invoice by id
176
351
  * @description: Get invoice by id.
177
352
  */
178
- getInvoiceById({ invoiceId } = {}) {
353
+ async getInvoiceById({ invoiceId } = {}) {
179
354
  const { error } = BillingValidator.getInvoiceById().validate(
180
355
  {
181
356
  invoiceId,
@@ -186,11 +361,26 @@ class Billing {
186
361
  return Promise.reject(new FDKClientValidationError(error));
187
362
  }
188
363
 
364
+ // Showing warrnings if extra unknown parameters are found
365
+ const { error: warrning } = BillingValidator.getInvoiceById().validate(
366
+ {
367
+ invoiceId,
368
+ },
369
+ { abortEarly: false, allowUnknown: false }
370
+ );
371
+ if (warrning) {
372
+ Logger({
373
+ level: "WARN",
374
+ message: "Parameter Validation warrnings for getInvoiceById",
375
+ });
376
+ Logger({ level: "WARN", message: warrning });
377
+ }
378
+
189
379
  const query_params = {};
190
380
 
191
381
  const xHeaders = {};
192
382
 
193
- return PlatformAPIClient.execute(
383
+ const response = await PlatformAPIClient.execute(
194
384
  this.config,
195
385
  "get",
196
386
  `/service/platform/billing/v1.0/company/${this.config.companyId}/invoice/${invoiceId}`,
@@ -198,14 +388,30 @@ class Billing {
198
388
  undefined,
199
389
  xHeaders
200
390
  );
391
+
392
+ const { error: res_error } = BillingModel.Invoice().validate(response, {
393
+ abortEarly: false,
394
+ allowUnknown: false,
395
+ });
396
+
397
+ if (res_error) {
398
+ Logger({
399
+ level: "WARN",
400
+ message: "Response Validation Warnnings for getInvoiceById",
401
+ });
402
+ Logger({ level: "WARN", message: res_error });
403
+ }
404
+
405
+ return response;
201
406
  }
202
407
 
203
408
  /**
204
409
  * @param {Object} arg - Arg object.
410
+ * @returns {Promise<SubscriptionCustomer>} - Success response
205
411
  * @summary: Get subscription customer detail
206
412
  * @description: Get subscription customer detail.
207
413
  */
208
- getCustomerDetail({} = {}) {
414
+ async getCustomerDetail({} = {}) {
209
415
  const { error } = BillingValidator.getCustomerDetail().validate(
210
416
  {},
211
417
  { abortEarly: false, allowUnknown: true }
@@ -214,11 +420,24 @@ class Billing {
214
420
  return Promise.reject(new FDKClientValidationError(error));
215
421
  }
216
422
 
423
+ // Showing warrnings if extra unknown parameters are found
424
+ const { error: warrning } = BillingValidator.getCustomerDetail().validate(
425
+ {},
426
+ { abortEarly: false, allowUnknown: false }
427
+ );
428
+ if (warrning) {
429
+ Logger({
430
+ level: "WARN",
431
+ message: "Parameter Validation warrnings for getCustomerDetail",
432
+ });
433
+ Logger({ level: "WARN", message: warrning });
434
+ }
435
+
217
436
  const query_params = {};
218
437
 
219
438
  const xHeaders = {};
220
439
 
221
- return PlatformAPIClient.execute(
440
+ const response = await PlatformAPIClient.execute(
222
441
  this.config,
223
442
  "get",
224
443
  `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/customer-detail`,
@@ -226,15 +445,33 @@ class Billing {
226
445
  undefined,
227
446
  xHeaders
228
447
  );
448
+
449
+ const {
450
+ error: res_error,
451
+ } = BillingModel.SubscriptionCustomer().validate(response, {
452
+ abortEarly: false,
453
+ allowUnknown: false,
454
+ });
455
+
456
+ if (res_error) {
457
+ Logger({
458
+ level: "WARN",
459
+ message: "Response Validation Warnnings for getCustomerDetail",
460
+ });
461
+ Logger({ level: "WARN", message: res_error });
462
+ }
463
+
464
+ return response;
229
465
  }
230
466
 
231
467
  /**
232
468
  * @param {Object} arg - Arg object.
233
469
  * @param {SubscriptionCustomerCreate} arg.body
470
+ * @returns {Promise<SubscriptionCustomer>} - Success response
234
471
  * @summary: Upsert subscription customer detail
235
472
  * @description: Upsert subscription customer detail.
236
473
  */
237
- upsertCustomerDetail({ body } = {}) {
474
+ async upsertCustomerDetail({ body } = {}) {
238
475
  const { error } = BillingValidator.upsertCustomerDetail().validate(
239
476
  {
240
477
  body,
@@ -245,11 +482,28 @@ class Billing {
245
482
  return Promise.reject(new FDKClientValidationError(error));
246
483
  }
247
484
 
485
+ // Showing warrnings if extra unknown parameters are found
486
+ const {
487
+ error: warrning,
488
+ } = BillingValidator.upsertCustomerDetail().validate(
489
+ {
490
+ body,
491
+ },
492
+ { abortEarly: false, allowUnknown: false }
493
+ );
494
+ if (warrning) {
495
+ Logger({
496
+ level: "WARN",
497
+ message: "Parameter Validation warrnings for upsertCustomerDetail",
498
+ });
499
+ Logger({ level: "WARN", message: warrning });
500
+ }
501
+
248
502
  const query_params = {};
249
503
 
250
504
  const xHeaders = {};
251
505
 
252
- return PlatformAPIClient.execute(
506
+ const response = await PlatformAPIClient.execute(
253
507
  this.config,
254
508
  "post",
255
509
  `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/customer-detail`,
@@ -257,14 +511,32 @@ class Billing {
257
511
  body,
258
512
  xHeaders
259
513
  );
514
+
515
+ const {
516
+ error: res_error,
517
+ } = BillingModel.SubscriptionCustomer().validate(response, {
518
+ abortEarly: false,
519
+ allowUnknown: false,
520
+ });
521
+
522
+ if (res_error) {
523
+ Logger({
524
+ level: "WARN",
525
+ message: "Response Validation Warnnings for upsertCustomerDetail",
526
+ });
527
+ Logger({ level: "WARN", message: res_error });
528
+ }
529
+
530
+ return response;
260
531
  }
261
532
 
262
533
  /**
263
534
  * @param {Object} arg - Arg object.
535
+ * @returns {Promise<SubscriptionStatus>} - Success response
264
536
  * @summary: Get current subscription detail
265
537
  * @description: If subscription is active then it will return is_enabled true and return subscription object. If subscription is not active then is_enabled false and message.
266
538
  */
267
- getSubscription({} = {}) {
539
+ async getSubscription({} = {}) {
268
540
  const { error } = BillingValidator.getSubscription().validate(
269
541
  {},
270
542
  { abortEarly: false, allowUnknown: true }
@@ -273,11 +545,24 @@ class Billing {
273
545
  return Promise.reject(new FDKClientValidationError(error));
274
546
  }
275
547
 
548
+ // Showing warrnings if extra unknown parameters are found
549
+ const { error: warrning } = BillingValidator.getSubscription().validate(
550
+ {},
551
+ { abortEarly: false, allowUnknown: false }
552
+ );
553
+ if (warrning) {
554
+ Logger({
555
+ level: "WARN",
556
+ message: "Parameter Validation warrnings for getSubscription",
557
+ });
558
+ Logger({ level: "WARN", message: warrning });
559
+ }
560
+
276
561
  const query_params = {};
277
562
 
278
563
  const xHeaders = {};
279
564
 
280
- return PlatformAPIClient.execute(
565
+ const response = await PlatformAPIClient.execute(
281
566
  this.config,
282
567
  "get",
283
568
  `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current`,
@@ -285,14 +570,32 @@ class Billing {
285
570
  undefined,
286
571
  xHeaders
287
572
  );
573
+
574
+ const {
575
+ error: res_error,
576
+ } = BillingModel.SubscriptionStatus().validate(response, {
577
+ abortEarly: false,
578
+ allowUnknown: false,
579
+ });
580
+
581
+ if (res_error) {
582
+ Logger({
583
+ level: "WARN",
584
+ message: "Response Validation Warnnings for getSubscription",
585
+ });
586
+ Logger({ level: "WARN", message: res_error });
587
+ }
588
+
589
+ return response;
288
590
  }
289
591
 
290
592
  /**
291
593
  * @param {Object} arg - Arg object.
594
+ * @returns {Promise<SubscriptionLimit>} - Success response
292
595
  * @summary: Get subscription subscription limits
293
596
  * @description: Get subscription subscription limits.
294
597
  */
295
- getFeatureLimitConfig({} = {}) {
598
+ async getFeatureLimitConfig({} = {}) {
296
599
  const { error } = BillingValidator.getFeatureLimitConfig().validate(
297
600
  {},
298
601
  { abortEarly: false, allowUnknown: true }
@@ -301,11 +604,26 @@ class Billing {
301
604
  return Promise.reject(new FDKClientValidationError(error));
302
605
  }
303
606
 
607
+ // Showing warrnings if extra unknown parameters are found
608
+ const {
609
+ error: warrning,
610
+ } = BillingValidator.getFeatureLimitConfig().validate(
611
+ {},
612
+ { abortEarly: false, allowUnknown: false }
613
+ );
614
+ if (warrning) {
615
+ Logger({
616
+ level: "WARN",
617
+ message: "Parameter Validation warrnings for getFeatureLimitConfig",
618
+ });
619
+ Logger({ level: "WARN", message: warrning });
620
+ }
621
+
304
622
  const query_params = {};
305
623
 
306
624
  const xHeaders = {};
307
625
 
308
- return PlatformAPIClient.execute(
626
+ const response = await PlatformAPIClient.execute(
309
627
  this.config,
310
628
  "get",
311
629
  `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current-limit`,
@@ -313,15 +631,33 @@ class Billing {
313
631
  undefined,
314
632
  xHeaders
315
633
  );
634
+
635
+ const {
636
+ error: res_error,
637
+ } = BillingModel.SubscriptionLimit().validate(response, {
638
+ abortEarly: false,
639
+ allowUnknown: false,
640
+ });
641
+
642
+ if (res_error) {
643
+ Logger({
644
+ level: "WARN",
645
+ message: "Response Validation Warnnings for getFeatureLimitConfig",
646
+ });
647
+ Logger({ level: "WARN", message: res_error });
648
+ }
649
+
650
+ return response;
316
651
  }
317
652
 
318
653
  /**
319
654
  * @param {Object} arg - Arg object.
320
655
  * @param {SubscriptionActivateReq} arg.body
656
+ * @returns {Promise<SubscriptionActivateRes>} - Success response
321
657
  * @summary: Activate subscription
322
658
  * @description: It will activate subscription plan for customer
323
659
  */
324
- activateSubscriptionPlan({ body } = {}) {
660
+ async activateSubscriptionPlan({ body } = {}) {
325
661
  const { error } = BillingValidator.activateSubscriptionPlan().validate(
326
662
  {
327
663
  body,
@@ -332,11 +668,28 @@ class Billing {
332
668
  return Promise.reject(new FDKClientValidationError(error));
333
669
  }
334
670
 
671
+ // Showing warrnings if extra unknown parameters are found
672
+ const {
673
+ error: warrning,
674
+ } = BillingValidator.activateSubscriptionPlan().validate(
675
+ {
676
+ body,
677
+ },
678
+ { abortEarly: false, allowUnknown: false }
679
+ );
680
+ if (warrning) {
681
+ Logger({
682
+ level: "WARN",
683
+ message: "Parameter Validation warrnings for activateSubscriptionPlan",
684
+ });
685
+ Logger({ level: "WARN", message: warrning });
686
+ }
687
+
335
688
  const query_params = {};
336
689
 
337
690
  const xHeaders = {};
338
691
 
339
- return PlatformAPIClient.execute(
692
+ const response = await PlatformAPIClient.execute(
340
693
  this.config,
341
694
  "post",
342
695
  `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/activate`,
@@ -344,15 +697,33 @@ class Billing {
344
697
  body,
345
698
  xHeaders
346
699
  );
700
+
701
+ const {
702
+ error: res_error,
703
+ } = BillingModel.SubscriptionActivateRes().validate(response, {
704
+ abortEarly: false,
705
+ allowUnknown: false,
706
+ });
707
+
708
+ if (res_error) {
709
+ Logger({
710
+ level: "WARN",
711
+ message: "Response Validation Warnnings for activateSubscriptionPlan",
712
+ });
713
+ Logger({ level: "WARN", message: res_error });
714
+ }
715
+
716
+ return response;
347
717
  }
348
718
 
349
719
  /**
350
720
  * @param {Object} arg - Arg object.
351
721
  * @param {CancelSubscriptionReq} arg.body
722
+ * @returns {Promise<CancelSubscriptionRes>} - Success response
352
723
  * @summary: Cancel subscription
353
724
  * @description: It will cancel current active subscription.
354
725
  */
355
- cancelSubscriptionPlan({ body } = {}) {
726
+ async cancelSubscriptionPlan({ body } = {}) {
356
727
  const { error } = BillingValidator.cancelSubscriptionPlan().validate(
357
728
  {
358
729
  body,
@@ -363,11 +734,28 @@ class Billing {
363
734
  return Promise.reject(new FDKClientValidationError(error));
364
735
  }
365
736
 
737
+ // Showing warrnings if extra unknown parameters are found
738
+ const {
739
+ error: warrning,
740
+ } = BillingValidator.cancelSubscriptionPlan().validate(
741
+ {
742
+ body,
743
+ },
744
+ { abortEarly: false, allowUnknown: false }
745
+ );
746
+ if (warrning) {
747
+ Logger({
748
+ level: "WARN",
749
+ message: "Parameter Validation warrnings for cancelSubscriptionPlan",
750
+ });
751
+ Logger({ level: "WARN", message: warrning });
752
+ }
753
+
366
754
  const query_params = {};
367
755
 
368
756
  const xHeaders = {};
369
757
 
370
- return PlatformAPIClient.execute(
758
+ const response = await PlatformAPIClient.execute(
371
759
  this.config,
372
760
  "post",
373
761
  `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/cancel`,
@@ -375,6 +763,23 @@ class Billing {
375
763
  body,
376
764
  xHeaders
377
765
  );
766
+
767
+ const {
768
+ error: res_error,
769
+ } = BillingModel.CancelSubscriptionRes().validate(response, {
770
+ abortEarly: false,
771
+ allowUnknown: false,
772
+ });
773
+
774
+ if (res_error) {
775
+ Logger({
776
+ level: "WARN",
777
+ message: "Response Validation Warnnings for cancelSubscriptionPlan",
778
+ });
779
+ Logger({ level: "WARN", message: res_error });
780
+ }
781
+
782
+ return response;
378
783
  }
379
784
  }
380
785