@gofynd/fdk-client-javascript 1.4.8-beta.3 → 1.4.9

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 (189) hide show
  1. package/README.md +26 -1
  2. package/package.json +2 -2
  3. package/sdk/application/ApplicationClient.d.ts +8 -0
  4. package/sdk/application/ApplicationClient.js +14 -0
  5. package/sdk/application/Cart/CartApplicationClient.d.ts +20 -20
  6. package/sdk/application/Cart/CartApplicationClient.js +20 -20
  7. package/sdk/application/Cart/CartApplicationModel.d.ts +2446 -664
  8. package/sdk/application/Cart/CartApplicationModel.js +783 -552
  9. package/sdk/application/Cart/CartApplicationValidator.d.ts +268 -194
  10. package/sdk/application/Cart/CartApplicationValidator.js +100 -114
  11. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +53 -53
  12. package/sdk/application/Catalog/CatalogApplicationClient.js +53 -53
  13. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +2012 -503
  14. package/sdk/application/Catalog/CatalogApplicationModel.js +603 -453
  15. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +64 -64
  16. package/sdk/application/Catalog/CatalogApplicationValidator.js +32 -32
  17. package/sdk/application/Common/CommonApplicationClient.d.ts +2 -2
  18. package/sdk/application/Common/CommonApplicationClient.js +2 -2
  19. package/sdk/application/Common/CommonApplicationModel.d.ts +170 -90
  20. package/sdk/application/Common/CommonApplicationModel.js +59 -58
  21. package/sdk/application/Common/CommonApplicationValidator.d.ts +8 -5
  22. package/sdk/application/Common/CommonApplicationValidator.js +3 -3
  23. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +2 -2
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +2 -2
  25. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +170 -35
  26. package/sdk/application/Communication/CommunicationApplicationModel.js +54 -33
  27. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +15 -15
  28. package/sdk/application/Configuration/ConfigurationApplicationClient.js +15 -15
  29. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +624 -443
  30. package/sdk/application/Configuration/ConfigurationApplicationModel.js +259 -248
  31. package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +32 -24
  32. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +14 -13
  33. package/sdk/application/Content/ContentApplicationClient.d.ts +16 -16
  34. package/sdk/application/Content/ContentApplicationClient.js +16 -16
  35. package/sdk/application/Content/ContentApplicationModel.d.ts +1205 -282
  36. package/sdk/application/Content/ContentApplicationModel.js +341 -277
  37. package/sdk/application/Content/ContentApplicationValidator.d.ts +28 -17
  38. package/sdk/application/Content/ContentApplicationValidator.js +11 -10
  39. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +3 -3
  40. package/sdk/application/FileStorage/FileStorageApplicationClient.js +3 -3
  41. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +146 -37
  42. package/sdk/application/FileStorage/FileStorageApplicationModel.js +38 -36
  43. package/sdk/application/Lead/LeadApplicationClient.d.ts +3 -3
  44. package/sdk/application/Lead/LeadApplicationClient.js +3 -3
  45. package/sdk/application/Lead/LeadApplicationModel.d.ts +195 -134
  46. package/sdk/application/Lead/LeadApplicationModel.js +110 -67
  47. package/sdk/application/Lead/LeadApplicationValidator.d.ts +8 -8
  48. package/sdk/application/Lead/LeadApplicationValidator.js +4 -4
  49. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +10 -10
  50. package/sdk/application/Logistic/LogisticApplicationClient.js +10 -10
  51. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +1039 -221
  52. package/sdk/application/Logistic/LogisticApplicationModel.js +342 -199
  53. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +76 -82
  54. package/sdk/application/Logistic/LogisticApplicationValidator.js +38 -41
  55. package/sdk/application/Order/OrderApplicationClient.d.ts +10 -10
  56. package/sdk/application/Order/OrderApplicationClient.js +10 -10
  57. package/sdk/application/Order/OrderApplicationModel.d.ts +1400 -325
  58. package/sdk/application/Order/OrderApplicationModel.js +391 -317
  59. package/sdk/application/Order/OrderApplicationValidator.d.ts +32 -30
  60. package/sdk/application/Order/OrderApplicationValidator.js +15 -14
  61. package/sdk/application/Payment/PaymentApplicationClient.d.ts +43 -43
  62. package/sdk/application/Payment/PaymentApplicationClient.js +43 -43
  63. package/sdk/application/Payment/PaymentApplicationModel.d.ts +1111 -1022
  64. package/sdk/application/Payment/PaymentApplicationModel.js +537 -521
  65. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +82 -49
  66. package/sdk/application/Payment/PaymentApplicationValidator.js +30 -30
  67. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +28 -7
  68. package/sdk/application/Rewards/RewardsApplicationModel.js +7 -7
  69. package/sdk/application/Share/ShareApplicationModel.d.ts +178 -38
  70. package/sdk/application/Share/ShareApplicationModel.js +53 -37
  71. package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -2
  72. package/sdk/application/Share/ShareApplicationValidator.js +2 -1
  73. package/sdk/application/Theme/ThemeApplicationClient.d.ts +4 -4
  74. package/sdk/application/Theme/ThemeApplicationClient.js +14 -8
  75. package/sdk/application/Theme/ThemeApplicationModel.d.ts +528 -287
  76. package/sdk/application/Theme/ThemeApplicationModel.js +208 -172
  77. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +17 -12
  78. package/sdk/application/Theme/ThemeApplicationValidator.js +8 -6
  79. package/sdk/application/User/UserApplicationClient.d.ts +36 -36
  80. package/sdk/application/User/UserApplicationClient.js +36 -36
  81. package/sdk/application/User/UserApplicationModel.d.ts +1062 -255
  82. package/sdk/application/User/UserApplicationModel.js +298 -244
  83. package/sdk/application/User/UserApplicationValidator.d.ts +80 -80
  84. package/sdk/application/User/UserApplicationValidator.js +40 -40
  85. package/sdk/application/Webhook/WebhookApplicationClient.d.ts +1 -1
  86. package/sdk/application/Webhook/WebhookApplicationClient.js +1 -1
  87. package/sdk/application/Webhook/WebhookApplicationModel.d.ts +20 -5
  88. package/sdk/application/Webhook/WebhookApplicationModel.js +5 -5
  89. package/sdk/common/Clickstream.js +95 -15
  90. package/sdk/common/Constant.d.ts +9 -0
  91. package/sdk/common/Constant.js +11 -0
  92. package/sdk/common/Utility.js +19 -0
  93. package/sdk/common/utils.js +8 -1
  94. package/sdk/partner/Lead/LeadPartnerModel.d.ts +28 -7
  95. package/sdk/partner/Lead/LeadPartnerModel.js +7 -7
  96. package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +28 -7
  97. package/sdk/partner/Logistics/LogisticsPartnerModel.js +7 -7
  98. package/sdk/partner/PartnerClient.d.ts +8 -0
  99. package/sdk/partner/PartnerClient.js +14 -0
  100. package/sdk/partner/Theme/ThemePartnerClient.d.ts +20 -0
  101. package/sdk/partner/Theme/ThemePartnerClient.js +158 -0
  102. package/sdk/partner/Theme/ThemePartnerModel.d.ts +45 -6
  103. package/sdk/partner/Theme/ThemePartnerModel.js +33 -4
  104. package/sdk/partner/Theme/ThemePartnerValidator.d.ts +2 -0
  105. package/sdk/partner/Theme/ThemePartnerValidator.js +14 -0
  106. package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +28 -7
  107. package/sdk/partner/Webhook/WebhookPartnerModel.js +7 -7
  108. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +28 -7
  109. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +7 -7
  110. package/sdk/platform/Billing/BillingPlatformClient.d.ts +6 -397
  111. package/sdk/platform/Billing/BillingPlatformClient.js +77 -3215
  112. package/sdk/platform/Billing/BillingPlatformModel.d.ts +621 -2021
  113. package/sdk/platform/Billing/BillingPlatformModel.js +353 -2405
  114. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +12 -451
  115. package/sdk/platform/Billing/BillingPlatformValidator.js +8 -483
  116. package/sdk/platform/Cart/CartPlatformModel.d.ts +28 -7
  117. package/sdk/platform/Cart/CartPlatformModel.js +8 -8
  118. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +12 -2
  119. package/sdk/platform/Catalog/CatalogPlatformClient.js +41 -1
  120. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +46 -12
  121. package/sdk/platform/Catalog/CatalogPlatformModel.js +14 -11
  122. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +40 -0
  123. package/sdk/platform/Catalog/CatalogPlatformValidator.js +17 -0
  124. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +28 -7
  125. package/sdk/platform/Communication/CommunicationPlatformModel.js +7 -7
  126. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +28 -7
  127. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +7 -7
  128. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +0 -97
  129. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +77 -782
  130. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +24 -701
  131. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +7 -539
  132. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +1 -183
  133. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +0 -134
  134. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +0 -10
  135. package/sdk/platform/Content/ContentPlatformApplicationClient.js +0 -79
  136. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -15
  137. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +0 -13
  138. package/sdk/platform/Content/ContentPlatformModel.d.ts +58 -17
  139. package/sdk/platform/Content/ContentPlatformModel.js +28 -15
  140. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +28 -7
  141. package/sdk/platform/Discount/DiscountPlatformModel.js +7 -7
  142. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +127 -25
  143. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +37 -25
  144. package/sdk/platform/Finance/FinancePlatformClient.d.ts +28 -28
  145. package/sdk/platform/Finance/FinancePlatformClient.js +28 -28
  146. package/sdk/platform/Finance/FinancePlatformModel.d.ts +1583 -347
  147. package/sdk/platform/Finance/FinancePlatformModel.js +463 -351
  148. package/sdk/platform/Lead/LeadPlatformModel.d.ts +28 -7
  149. package/sdk/platform/Lead/LeadPlatformModel.js +7 -7
  150. package/sdk/platform/Order/OrderPlatformClient.d.ts +22 -0
  151. package/sdk/platform/Order/OrderPlatformClient.js +165 -0
  152. package/sdk/platform/Order/OrderPlatformModel.d.ts +613 -39
  153. package/sdk/platform/Order/OrderPlatformModel.js +359 -41
  154. package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -1
  155. package/sdk/platform/Order/OrderPlatformValidator.js +28 -0
  156. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +30 -9
  157. package/sdk/platform/Payment/PaymentPlatformModel.js +9 -9
  158. package/sdk/platform/PlatformClient.d.ts +8 -0
  159. package/sdk/platform/PlatformClient.js +14 -0
  160. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +28 -7
  161. package/sdk/platform/Rewards/RewardsPlatformModel.js +7 -7
  162. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +12 -9
  163. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +12 -9
  164. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +120 -22
  165. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +76 -21
  166. package/sdk/platform/Share/SharePlatformModel.d.ts +28 -7
  167. package/sdk/platform/Share/SharePlatformModel.js +7 -7
  168. package/sdk/platform/Theme/ThemePlatformModel.d.ts +18 -5
  169. package/sdk/platform/Theme/ThemePlatformModel.js +7 -4
  170. package/sdk/platform/User/UserPlatformModel.d.ts +18 -18
  171. package/sdk/platform/User/UserPlatformModel.js +9 -9
  172. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +28 -7
  173. package/sdk/platform/Webhook/WebhookPlatformModel.js +7 -7
  174. package/sdk/public/PublicClient.d.ts +0 -4
  175. package/sdk/public/PublicClient.js +0 -8
  176. package/sdk/public/index.d.ts +0 -2
  177. package/sdk/public/index.js +0 -4
  178. package/sdk/public/Billing/BillingPublicClient.d.ts +0 -45
  179. package/sdk/public/Billing/BillingPublicClient.js +0 -269
  180. package/sdk/public/Billing/BillingPublicModel.d.ts +0 -434
  181. package/sdk/public/Billing/BillingPublicModel.js +0 -395
  182. package/sdk/public/Billing/BillingPublicValidator.d.ts +0 -34
  183. package/sdk/public/Billing/BillingPublicValidator.js +0 -38
  184. package/sdk/public/Inventory/InventoryPublicClient.d.ts +0 -87
  185. package/sdk/public/Inventory/InventoryPublicClient.js +0 -529
  186. package/sdk/public/Inventory/InventoryPublicModel.d.ts +0 -393
  187. package/sdk/public/Inventory/InventoryPublicModel.js +0 -448
  188. package/sdk/public/Inventory/InventoryPublicValidator.d.ts +0 -91
  189. package/sdk/public/Inventory/InventoryPublicValidator.js +0 -85
@@ -14,87 +14,6 @@ class Billing {
14
14
  this.config = config;
15
15
  }
16
16
 
17
- /**
18
- * @param {BillingPlatformValidator.ActivateSubscriptionPlanParam} arg - Arg object
19
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
20
- * @param {import("../PlatformAPIClient").Options} - Options
21
- * @returns {Promise<BillingPlatformModel.SubscriptionActivateRes>} - Success response
22
- * @name activateSubscriptionPlan
23
- * @summary: Activate a subscription plan.
24
- * @description: Activate a specific subscription plan for a customer. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/activateSubscriptionPlan/).
25
- */
26
- async activateSubscriptionPlan(
27
- { body, requestHeaders } = { requestHeaders: {} },
28
- { responseHeaders } = { responseHeaders: false }
29
- ) {
30
- const {
31
- error,
32
- } = BillingPlatformValidator.activateSubscriptionPlan().validate(
33
- {
34
- body,
35
- },
36
- { abortEarly: false, allowUnknown: true }
37
- );
38
- if (error) {
39
- return Promise.reject(new FDKClientValidationError(error));
40
- }
41
-
42
- // Showing warrnings if extra unknown parameters are found
43
- const {
44
- error: warrning,
45
- } = BillingPlatformValidator.activateSubscriptionPlan().validate(
46
- {
47
- body,
48
- },
49
- { abortEarly: false, allowUnknown: false }
50
- );
51
- if (warrning) {
52
- Logger({
53
- level: "WARN",
54
- message: `Parameter Validation warrnings for platform > Billing > activateSubscriptionPlan \n ${warrning}`,
55
- });
56
- }
57
-
58
- const query_params = {};
59
-
60
- const xHeaders = {};
61
-
62
- const response = await PlatformAPIClient.execute(
63
- this.config,
64
- "post",
65
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/activate`,
66
- query_params,
67
- body,
68
- { ...xHeaders, ...requestHeaders },
69
- { responseHeaders }
70
- );
71
-
72
- let responseData = response;
73
- if (responseHeaders) {
74
- responseData = response[0];
75
- }
76
-
77
- const {
78
- error: res_error,
79
- } = BillingPlatformModel.SubscriptionActivateRes().validate(responseData, {
80
- abortEarly: false,
81
- allowUnknown: true,
82
- });
83
-
84
- if (res_error) {
85
- if (this.config.options.strictResponseCheck === true) {
86
- return Promise.reject(new FDKResponseValidationError(res_error));
87
- } else {
88
- Logger({
89
- level: "WARN",
90
- message: `Response Validation Warnings for platform > Billing > activateSubscriptionPlan \n ${res_error}`,
91
- });
92
- }
93
- }
94
-
95
- return response;
96
- }
97
-
98
17
  /**
99
18
  * @param {BillingPlatformValidator.CancelSubscriptionChargeParam} arg - Arg object
100
19
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
@@ -179,22 +98,22 @@ class Billing {
179
98
  }
180
99
 
181
100
  /**
182
- * @param {BillingPlatformValidator.CancelSubscriptionPlanParam} arg - Arg object
101
+ * @param {BillingPlatformValidator.CreateOneTimeChargeParam} arg - Arg object
183
102
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
184
103
  * @param {import("../PlatformAPIClient").Options} - Options
185
- * @returns {Promise<BillingPlatformModel.CancelSubscriptionRes>} - Success response
186
- * @name cancelSubscriptionPlan
187
- * @summary: Cancel a subscription plan.
188
- * @description: Cancel an active subscription plan for a customer - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/cancelSubscriptionPlan/).
104
+ * @returns {Promise<BillingPlatformModel.CreateOneTimeChargeResponse>} -
105
+ * Success response
106
+ * @name createOneTimeCharge
107
+ * @summary: Generate a one-time charge.
108
+ * @description: Generate a one-time charge for specific services or products. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/createOneTimeCharge/).
189
109
  */
190
- async cancelSubscriptionPlan(
191
- { body, requestHeaders } = { requestHeaders: {} },
110
+ async createOneTimeCharge(
111
+ { extensionId, body, requestHeaders } = { requestHeaders: {} },
192
112
  { responseHeaders } = { responseHeaders: false }
193
113
  ) {
194
- const {
195
- error,
196
- } = BillingPlatformValidator.cancelSubscriptionPlan().validate(
114
+ const { error } = BillingPlatformValidator.createOneTimeCharge().validate(
197
115
  {
116
+ extensionId,
198
117
  body,
199
118
  },
200
119
  { abortEarly: false, allowUnknown: true }
@@ -206,8 +125,9 @@ class Billing {
206
125
  // Showing warrnings if extra unknown parameters are found
207
126
  const {
208
127
  error: warrning,
209
- } = BillingPlatformValidator.cancelSubscriptionPlan().validate(
128
+ } = BillingPlatformValidator.createOneTimeCharge().validate(
210
129
  {
130
+ extensionId,
211
131
  body,
212
132
  },
213
133
  { abortEarly: false, allowUnknown: false }
@@ -215,7 +135,7 @@ class Billing {
215
135
  if (warrning) {
216
136
  Logger({
217
137
  level: "WARN",
218
- message: `Parameter Validation warrnings for platform > Billing > cancelSubscriptionPlan \n ${warrning}`,
138
+ message: `Parameter Validation warrnings for platform > Billing > createOneTimeCharge \n ${warrning}`,
219
139
  });
220
140
  }
221
141
 
@@ -226,7 +146,7 @@ class Billing {
226
146
  const response = await PlatformAPIClient.execute(
227
147
  this.config,
228
148
  "post",
229
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/cancel`,
149
+ `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/one_time_charge`,
230
150
  query_params,
231
151
  body,
232
152
  { ...xHeaders, ...requestHeaders },
@@ -240,10 +160,10 @@ class Billing {
240
160
 
241
161
  const {
242
162
  error: res_error,
243
- } = BillingPlatformModel.CancelSubscriptionRes().validate(responseData, {
244
- abortEarly: false,
245
- allowUnknown: true,
246
- });
163
+ } = BillingPlatformModel.CreateOneTimeChargeResponse().validate(
164
+ responseData,
165
+ { abortEarly: false, allowUnknown: true }
166
+ );
247
167
 
248
168
  if (res_error) {
249
169
  if (this.config.options.strictResponseCheck === true) {
@@ -251,7 +171,7 @@ class Billing {
251
171
  } else {
252
172
  Logger({
253
173
  level: "WARN",
254
- message: `Response Validation Warnings for platform > Billing > cancelSubscriptionPlan \n ${res_error}`,
174
+ message: `Response Validation Warnings for platform > Billing > createOneTimeCharge \n ${res_error}`,
255
175
  });
256
176
  }
257
177
  }
@@ -260,20 +180,24 @@ class Billing {
260
180
  }
261
181
 
262
182
  /**
263
- * @param {BillingPlatformValidator.ChangePlanParam} arg - Arg object
183
+ * @param {BillingPlatformValidator.CreateSubscriptionChargeParam} arg - Arg object
264
184
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
265
185
  * @param {import("../PlatformAPIClient").Options} - Options
266
- * @returns {Promise<BillingPlatformModel.SubscriptionActivateRes>} - Success response
267
- * @name changePlan
268
- * @summary: Upgrade plan.
269
- * @description: Admin user can modify the subscription plan for an seller account. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/changePlan/).
186
+ * @returns {Promise<BillingPlatformModel.CreateSubscriptionResponse>} -
187
+ * Success response
188
+ * @name createSubscriptionCharge
189
+ * @summary: Initiate subscription billing
190
+ * @description: Register a subscription charge for a seller using your extension. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/createSubscriptionCharge/).
270
191
  */
271
- async changePlan(
272
- { body, requestHeaders } = { requestHeaders: {} },
192
+ async createSubscriptionCharge(
193
+ { extensionId, body, requestHeaders } = { requestHeaders: {} },
273
194
  { responseHeaders } = { responseHeaders: false }
274
195
  ) {
275
- const { error } = BillingPlatformValidator.changePlan().validate(
196
+ const {
197
+ error,
198
+ } = BillingPlatformValidator.createSubscriptionCharge().validate(
276
199
  {
200
+ extensionId,
277
201
  body,
278
202
  },
279
203
  { abortEarly: false, allowUnknown: true }
@@ -283,8 +207,11 @@ class Billing {
283
207
  }
284
208
 
285
209
  // Showing warrnings if extra unknown parameters are found
286
- const { error: warrning } = BillingPlatformValidator.changePlan().validate(
210
+ const {
211
+ error: warrning,
212
+ } = BillingPlatformValidator.createSubscriptionCharge().validate(
287
213
  {
214
+ extensionId,
288
215
  body,
289
216
  },
290
217
  { abortEarly: false, allowUnknown: false }
@@ -292,7 +219,7 @@ class Billing {
292
219
  if (warrning) {
293
220
  Logger({
294
221
  level: "WARN",
295
- message: `Parameter Validation warrnings for platform > Billing > changePlan \n ${warrning}`,
222
+ message: `Parameter Validation warrnings for platform > Billing > createSubscriptionCharge \n ${warrning}`,
296
223
  });
297
224
  }
298
225
 
@@ -303,7 +230,7 @@ class Billing {
303
230
  const response = await PlatformAPIClient.execute(
304
231
  this.config,
305
232
  "post",
306
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/plan-change`,
233
+ `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription`,
307
234
  query_params,
308
235
  body,
309
236
  { ...xHeaders, ...requestHeaders },
@@ -317,10 +244,10 @@ class Billing {
317
244
 
318
245
  const {
319
246
  error: res_error,
320
- } = BillingPlatformModel.SubscriptionActivateRes().validate(responseData, {
321
- abortEarly: false,
322
- allowUnknown: true,
323
- });
247
+ } = BillingPlatformModel.CreateSubscriptionResponse().validate(
248
+ responseData,
249
+ { abortEarly: false, allowUnknown: true }
250
+ );
324
251
 
325
252
  if (res_error) {
326
253
  if (this.config.options.strictResponseCheck === true) {
@@ -328,7 +255,7 @@ class Billing {
328
255
  } else {
329
256
  Logger({
330
257
  level: "WARN",
331
- message: `Response Validation Warnings for platform > Billing > changePlan \n ${res_error}`,
258
+ message: `Response Validation Warnings for platform > Billing > createSubscriptionCharge \n ${res_error}`,
332
259
  });
333
260
  }
334
261
  }
@@ -337,22 +264,22 @@ class Billing {
337
264
  }
338
265
 
339
266
  /**
340
- * @param {BillingPlatformValidator.CheckCouponValidityParam} arg - Arg object
267
+ * @param {BillingPlatformValidator.GetChargeDetailsParam} arg - Arg object
341
268
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
342
269
  * @param {import("../PlatformAPIClient").Options} - Options
343
- * @returns {Promise<BillingPlatformModel.CheckValidityResponse>} - Success response
344
- * @name checkCouponValidity
345
- * @summary: Verify coupon validity.
346
- * @description: Checks whether a coupon code is valid for discounts while billing. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/checkCouponValidity/).
270
+ * @returns {Promise<BillingPlatformModel.ChargeDetails>} - Success response
271
+ * @name getChargeDetails
272
+ * @summary: Obtain charge details.
273
+ * @description: Retrieve comprehensive details about a specific billing charge. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getChargeDetails/).
347
274
  */
348
- async checkCouponValidity(
349
- { plan, couponCode, requestHeaders } = { requestHeaders: {} },
275
+ async getChargeDetails(
276
+ { extensionId, chargeId, requestHeaders } = { requestHeaders: {} },
350
277
  { responseHeaders } = { responseHeaders: false }
351
278
  ) {
352
- const { error } = BillingPlatformValidator.checkCouponValidity().validate(
279
+ const { error } = BillingPlatformValidator.getChargeDetails().validate(
353
280
  {
354
- plan,
355
- couponCode,
281
+ extensionId,
282
+ chargeId,
356
283
  },
357
284
  { abortEarly: false, allowUnknown: true }
358
285
  );
@@ -363,30 +290,28 @@ class Billing {
363
290
  // Showing warrnings if extra unknown parameters are found
364
291
  const {
365
292
  error: warrning,
366
- } = BillingPlatformValidator.checkCouponValidity().validate(
293
+ } = BillingPlatformValidator.getChargeDetails().validate(
367
294
  {
368
- plan,
369
- couponCode,
295
+ extensionId,
296
+ chargeId,
370
297
  },
371
298
  { abortEarly: false, allowUnknown: false }
372
299
  );
373
300
  if (warrning) {
374
301
  Logger({
375
302
  level: "WARN",
376
- message: `Parameter Validation warrnings for platform > Billing > checkCouponValidity \n ${warrning}`,
303
+ message: `Parameter Validation warrnings for platform > Billing > getChargeDetails \n ${warrning}`,
377
304
  });
378
305
  }
379
306
 
380
307
  const query_params = {};
381
- query_params["plan"] = plan;
382
- query_params["coupon_code"] = couponCode;
383
308
 
384
309
  const xHeaders = {};
385
310
 
386
311
  const response = await PlatformAPIClient.execute(
387
312
  this.config,
388
313
  "get",
389
- `/service/platform/billing/v1.0/company/${this.config.companyId}/coupon/check-validity`,
314
+ `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/charge/${chargeId}`,
390
315
  query_params,
391
316
  undefined,
392
317
  { ...xHeaders, ...requestHeaders },
@@ -400,7 +325,7 @@ class Billing {
400
325
 
401
326
  const {
402
327
  error: res_error,
403
- } = BillingPlatformModel.CheckValidityResponse().validate(responseData, {
328
+ } = BillingPlatformModel.ChargeDetails().validate(responseData, {
404
329
  abortEarly: false,
405
330
  allowUnknown: true,
406
331
  });
@@ -411,7 +336,7 @@ class Billing {
411
336
  } else {
412
337
  Logger({
413
338
  level: "WARN",
414
- message: `Response Validation Warnings for platform > Billing > checkCouponValidity \n ${res_error}`,
339
+ message: `Response Validation Warnings for platform > Billing > getChargeDetails \n ${res_error}`,
415
340
  });
416
341
  }
417
342
  }
@@ -420,23 +345,22 @@ class Billing {
420
345
  }
421
346
 
422
347
  /**
423
- * @param {BillingPlatformValidator.CreateOneTimeChargeParam} arg - Arg object
348
+ * @param {BillingPlatformValidator.GetSubscriptionChargeParam} arg - Arg object
424
349
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
425
350
  * @param {import("../PlatformAPIClient").Options} - Options
426
- * @returns {Promise<BillingPlatformModel.CreateOneTimeChargeResponse>} -
427
- * Success response
428
- * @name createOneTimeCharge
429
- * @summary: Generate a one-time charge.
430
- * @description: Generate a one-time charge for specific services or products. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/createOneTimeCharge/).
351
+ * @returns {Promise<BillingPlatformModel.SubscriptionChargeRes>} - Success response
352
+ * @name getSubscriptionCharge
353
+ * @summary: Retrieve subscription charge details.
354
+ * @description: Retrieve detailed information about subscription charges using this API. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getSubscriptionCharge/).
431
355
  */
432
- async createOneTimeCharge(
433
- { extensionId, body, requestHeaders } = { requestHeaders: {} },
356
+ async getSubscriptionCharge(
357
+ { extensionId, subscriptionId, requestHeaders } = { requestHeaders: {} },
434
358
  { responseHeaders } = { responseHeaders: false }
435
359
  ) {
436
- const { error } = BillingPlatformValidator.createOneTimeCharge().validate(
360
+ const { error } = BillingPlatformValidator.getSubscriptionCharge().validate(
437
361
  {
438
362
  extensionId,
439
- body,
363
+ subscriptionId,
440
364
  },
441
365
  { abortEarly: false, allowUnknown: true }
442
366
  );
@@ -447,144 +371,28 @@ class Billing {
447
371
  // Showing warrnings if extra unknown parameters are found
448
372
  const {
449
373
  error: warrning,
450
- } = BillingPlatformValidator.createOneTimeCharge().validate(
374
+ } = BillingPlatformValidator.getSubscriptionCharge().validate(
451
375
  {
452
376
  extensionId,
453
- body,
454
- },
455
- { abortEarly: false, allowUnknown: false }
456
- );
457
- if (warrning) {
458
- Logger({
459
- level: "WARN",
460
- message: `Parameter Validation warrnings for platform > Billing > createOneTimeCharge \n ${warrning}`,
461
- });
462
- }
463
-
464
- const query_params = {};
465
-
466
- const xHeaders = {};
467
-
468
- const response = await PlatformAPIClient.execute(
469
- this.config,
470
- "post",
471
- `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/one_time_charge`,
472
- query_params,
473
- body,
474
- { ...xHeaders, ...requestHeaders },
475
- { responseHeaders }
476
- );
477
-
478
- let responseData = response;
479
- if (responseHeaders) {
480
- responseData = response[0];
481
- }
482
-
483
- const {
484
- error: res_error,
485
- } = BillingPlatformModel.CreateOneTimeChargeResponse().validate(
486
- responseData,
487
- { abortEarly: false, allowUnknown: true }
488
- );
489
-
490
- if (res_error) {
491
- if (this.config.options.strictResponseCheck === true) {
492
- return Promise.reject(new FDKResponseValidationError(res_error));
493
- } else {
494
- Logger({
495
- level: "WARN",
496
- message: `Response Validation Warnings for platform > Billing > createOneTimeCharge \n ${res_error}`,
497
- });
498
- }
499
- }
500
-
501
- return response;
502
- }
503
-
504
- /**
505
- * @param {BillingPlatformValidator.CreditTransactionParam} arg - Arg object
506
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
507
- * @param {import("../PlatformAPIClient").Options} - Options
508
- * @returns {Promise<BillingPlatformModel.CreditTransactionResponse>} -
509
- * Success response
510
- * @name creditTransaction
511
- * @summary: Credit Transaction
512
- * @description: Credit Transaction - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/creditTransaction/).
513
- */
514
- async creditTransaction(
515
- {
516
- uniqueId,
517
- productSuite,
518
- type,
519
- pageSize,
520
- pageNo,
521
- startDate,
522
- endDate,
523
- searchType,
524
- searchValue,
525
- requestHeaders,
526
- } = { requestHeaders: {} },
527
- { responseHeaders } = { responseHeaders: false }
528
- ) {
529
- const { error } = BillingPlatformValidator.creditTransaction().validate(
530
- {
531
- uniqueId,
532
- productSuite,
533
- type,
534
- pageSize,
535
- pageNo,
536
- startDate,
537
- endDate,
538
- searchType,
539
- searchValue,
540
- },
541
- { abortEarly: false, allowUnknown: true }
542
- );
543
- if (error) {
544
- return Promise.reject(new FDKClientValidationError(error));
545
- }
546
-
547
- // Showing warrnings if extra unknown parameters are found
548
- const {
549
- error: warrning,
550
- } = BillingPlatformValidator.creditTransaction().validate(
551
- {
552
- uniqueId,
553
- productSuite,
554
- type,
555
- pageSize,
556
- pageNo,
557
- startDate,
558
- endDate,
559
- searchType,
560
- searchValue,
377
+ subscriptionId,
561
378
  },
562
379
  { abortEarly: false, allowUnknown: false }
563
380
  );
564
381
  if (warrning) {
565
382
  Logger({
566
383
  level: "WARN",
567
- message: `Parameter Validation warrnings for platform > Billing > creditTransaction \n ${warrning}`,
384
+ message: `Parameter Validation warrnings for platform > Billing > getSubscriptionCharge \n ${warrning}`,
568
385
  });
569
386
  }
570
387
 
571
388
  const query_params = {};
572
- query_params["unique_id"] = uniqueId;
573
- query_params["product_suite"] = productSuite;
574
- query_params["type"] = type;
575
- query_params["page_size"] = pageSize;
576
- query_params["page_no"] = pageNo;
577
- query_params["start_date"] = startDate;
578
- query_params["end_date"] = endDate;
579
- query_params["search_type"] = searchType;
580
- query_params["search_value"] = searchValue;
581
389
 
582
390
  const xHeaders = {};
583
391
 
584
392
  const response = await PlatformAPIClient.execute(
585
393
  this.config,
586
394
  "get",
587
- `/service/platform/billing/v1.0/company/${this.config.companyId}/credit-transaction`,
395
+ `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription/${subscriptionId}`,
588
396
  query_params,
589
397
  undefined,
590
398
  { ...xHeaders, ...requestHeaders },
@@ -598,10 +406,10 @@ class Billing {
598
406
 
599
407
  const {
600
408
  error: res_error,
601
- } = BillingPlatformModel.CreditTransactionResponse().validate(
602
- responseData,
603
- { abortEarly: false, allowUnknown: true }
604
- );
409
+ } = BillingPlatformModel.SubscriptionChargeRes().validate(responseData, {
410
+ abortEarly: false,
411
+ allowUnknown: true,
412
+ });
605
413
 
606
414
  if (res_error) {
607
415
  if (this.config.options.strictResponseCheck === true) {
@@ -609,2953 +417,7 @@ class Billing {
609
417
  } else {
610
418
  Logger({
611
419
  level: "WARN",
612
- message: `Response Validation Warnings for platform > Billing > creditTransaction \n ${res_error}`,
613
- });
614
- }
615
- }
616
-
617
- return response;
618
- }
619
-
620
- /**
621
- * @param {BillingPlatformValidator.CurrentAppLimitParam} arg - Arg object
622
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
623
- * @param {import("../PlatformAPIClient").Options} - Options
624
- * @returns {Promise<BillingPlatformModel.SubscriptionLimit>} - Success response
625
- * @name currentAppLimit
626
- * @summary: Obtain feature limit configurations.
627
- * @description: Retrieve configuration settings for feature limits in subscription plans. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/currentAppLimit/).
628
- */
629
- async currentAppLimit(
630
- { productSuite, type, requestHeaders } = { requestHeaders: {} },
631
- { responseHeaders } = { responseHeaders: false }
632
- ) {
633
- const { error } = BillingPlatformValidator.currentAppLimit().validate(
634
- {
635
- productSuite,
636
- type,
637
- },
638
- { abortEarly: false, allowUnknown: true }
639
- );
640
- if (error) {
641
- return Promise.reject(new FDKClientValidationError(error));
642
- }
643
-
644
- // Showing warrnings if extra unknown parameters are found
645
- const {
646
- error: warrning,
647
- } = BillingPlatformValidator.currentAppLimit().validate(
648
- {
649
- productSuite,
650
- type,
651
- },
652
- { abortEarly: false, allowUnknown: false }
653
- );
654
- if (warrning) {
655
- Logger({
656
- level: "WARN",
657
- message: `Parameter Validation warrnings for platform > Billing > currentAppLimit \n ${warrning}`,
658
- });
659
- }
660
-
661
- const query_params = {};
662
- query_params["product_suite"] = productSuite;
663
- query_params["type"] = type;
664
-
665
- const xHeaders = {};
666
-
667
- const response = await PlatformAPIClient.execute(
668
- this.config,
669
- "get",
670
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current-app-limit`,
671
- query_params,
672
- undefined,
673
- { ...xHeaders, ...requestHeaders },
674
- { responseHeaders }
675
- );
676
-
677
- let responseData = response;
678
- if (responseHeaders) {
679
- responseData = response[0];
680
- }
681
-
682
- const {
683
- error: res_error,
684
- } = BillingPlatformModel.SubscriptionLimit().validate(responseData, {
685
- abortEarly: false,
686
- allowUnknown: true,
687
- });
688
-
689
- if (res_error) {
690
- if (this.config.options.strictResponseCheck === true) {
691
- return Promise.reject(new FDKResponseValidationError(res_error));
692
- } else {
693
- Logger({
694
- level: "WARN",
695
- message: `Response Validation Warnings for platform > Billing > currentAppLimit \n ${res_error}`,
696
- });
697
- }
698
- }
699
-
700
- return response;
701
- }
702
-
703
- /**
704
- * @param {BillingPlatformValidator.GetBankListParam} arg - Arg object
705
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
706
- * @param {import("../PlatformAPIClient").Options} - Options
707
- * @returns {Promise<string>} - Success response
708
- * @name getBankList
709
- * @summary: Get Bank List
710
- * @description: Get Bank List - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getBankList/).
711
- */
712
- async getBankList(
713
- { requestHeaders } = { requestHeaders: {} },
714
- { responseHeaders } = { responseHeaders: false }
715
- ) {
716
- const { error } = BillingPlatformValidator.getBankList().validate(
717
- {},
718
- { abortEarly: false, allowUnknown: true }
719
- );
720
- if (error) {
721
- return Promise.reject(new FDKClientValidationError(error));
722
- }
723
-
724
- // Showing warrnings if extra unknown parameters are found
725
- const { error: warrning } = BillingPlatformValidator.getBankList().validate(
726
- {},
727
- { abortEarly: false, allowUnknown: false }
728
- );
729
- if (warrning) {
730
- Logger({
731
- level: "WARN",
732
- message: `Parameter Validation warrnings for platform > Billing > getBankList \n ${warrning}`,
733
- });
734
- }
735
-
736
- const query_params = {};
737
-
738
- const xHeaders = {};
739
-
740
- const response = await PlatformAPIClient.execute(
741
- this.config,
742
- "get",
743
- `/service/platform/billing/v1.0/company/${this.config.companyId}/payment/bank/list`,
744
- query_params,
745
- undefined,
746
- { ...xHeaders, ...requestHeaders },
747
- { responseHeaders }
748
- );
749
-
750
- let responseData = response;
751
- if (responseHeaders) {
752
- responseData = response[0];
753
- }
754
-
755
- const { error: res_error } = Joi.string()
756
- .allow("")
757
- .validate(responseData, { abortEarly: false, allowUnknown: true });
758
-
759
- if (res_error) {
760
- if (this.config.options.strictResponseCheck === true) {
761
- return Promise.reject(new FDKResponseValidationError(res_error));
762
- } else {
763
- Logger({
764
- level: "WARN",
765
- message: `Response Validation Warnings for platform > Billing > getBankList \n ${res_error}`,
766
- });
767
- }
768
- }
769
-
770
- return response;
771
- }
772
-
773
- /**
774
- * @param {BillingPlatformValidator.GetChargeDetailsParam} arg - Arg object
775
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
776
- * @param {import("../PlatformAPIClient").Options} - Options
777
- * @returns {Promise<BillingPlatformModel.ChargeDetails>} - Success response
778
- * @name getChargeDetails
779
- * @summary: Obtain charge details.
780
- * @description: Retrieve comprehensive details about a specific billing charge. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getChargeDetails/).
781
- */
782
- async getChargeDetails(
783
- { extensionId, chargeId, requestHeaders } = { requestHeaders: {} },
784
- { responseHeaders } = { responseHeaders: false }
785
- ) {
786
- const { error } = BillingPlatformValidator.getChargeDetails().validate(
787
- {
788
- extensionId,
789
- chargeId,
790
- },
791
- { abortEarly: false, allowUnknown: true }
792
- );
793
- if (error) {
794
- return Promise.reject(new FDKClientValidationError(error));
795
- }
796
-
797
- // Showing warrnings if extra unknown parameters are found
798
- const {
799
- error: warrning,
800
- } = BillingPlatformValidator.getChargeDetails().validate(
801
- {
802
- extensionId,
803
- chargeId,
804
- },
805
- { abortEarly: false, allowUnknown: false }
806
- );
807
- if (warrning) {
808
- Logger({
809
- level: "WARN",
810
- message: `Parameter Validation warrnings for platform > Billing > getChargeDetails \n ${warrning}`,
811
- });
812
- }
813
-
814
- const query_params = {};
815
-
816
- const xHeaders = {};
817
-
818
- const response = await PlatformAPIClient.execute(
819
- this.config,
820
- "get",
821
- `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/charge/${chargeId}`,
822
- query_params,
823
- undefined,
824
- { ...xHeaders, ...requestHeaders },
825
- { responseHeaders }
826
- );
827
-
828
- let responseData = response;
829
- if (responseHeaders) {
830
- responseData = response[0];
831
- }
832
-
833
- const {
834
- error: res_error,
835
- } = BillingPlatformModel.ChargeDetails().validate(responseData, {
836
- abortEarly: false,
837
- allowUnknown: true,
838
- });
839
-
840
- if (res_error) {
841
- if (this.config.options.strictResponseCheck === true) {
842
- return Promise.reject(new FDKResponseValidationError(res_error));
843
- } else {
844
- Logger({
845
- level: "WARN",
846
- message: `Response Validation Warnings for platform > Billing > getChargeDetails \n ${res_error}`,
847
- });
848
- }
849
- }
850
-
851
- return response;
852
- }
853
-
854
- /**
855
- * @param {BillingPlatformValidator.GetCustomerDetailParam} arg - Arg object
856
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
857
- * @param {import("../PlatformAPIClient").Options} - Options
858
- * @returns {Promise<BillingPlatformModel.SubscriptionCustomer>} - Success response
859
- * @name getCustomerDetail
860
- * @summary: Fetch customer details.
861
- * @description: Obtain customer-related billing information. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getCustomerDetail/).
862
- */
863
- async getCustomerDetail(
864
- { requestHeaders } = { requestHeaders: {} },
865
- { responseHeaders } = { responseHeaders: false }
866
- ) {
867
- const { error } = BillingPlatformValidator.getCustomerDetail().validate(
868
- {},
869
- { abortEarly: false, allowUnknown: true }
870
- );
871
- if (error) {
872
- return Promise.reject(new FDKClientValidationError(error));
873
- }
874
-
875
- // Showing warrnings if extra unknown parameters are found
876
- const {
877
- error: warrning,
878
- } = BillingPlatformValidator.getCustomerDetail().validate(
879
- {},
880
- { abortEarly: false, allowUnknown: false }
881
- );
882
- if (warrning) {
883
- Logger({
884
- level: "WARN",
885
- message: `Parameter Validation warrnings for platform > Billing > getCustomerDetail \n ${warrning}`,
886
- });
887
- }
888
-
889
- const query_params = {};
890
-
891
- const xHeaders = {};
892
-
893
- const response = await PlatformAPIClient.execute(
894
- this.config,
895
- "get",
896
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/customer-detail`,
897
- query_params,
898
- undefined,
899
- { ...xHeaders, ...requestHeaders },
900
- { responseHeaders }
901
- );
902
-
903
- let responseData = response;
904
- if (responseHeaders) {
905
- responseData = response[0];
906
- }
907
-
908
- const {
909
- error: res_error,
910
- } = BillingPlatformModel.SubscriptionCustomer().validate(responseData, {
911
- abortEarly: false,
912
- allowUnknown: true,
913
- });
914
-
915
- if (res_error) {
916
- if (this.config.options.strictResponseCheck === true) {
917
- return Promise.reject(new FDKResponseValidationError(res_error));
918
- } else {
919
- Logger({
920
- level: "WARN",
921
- message: `Response Validation Warnings for platform > Billing > getCustomerDetail \n ${res_error}`,
922
- });
923
- }
924
- }
925
-
926
- return response;
927
- }
928
-
929
- /**
930
- * @param {BillingPlatformValidator.GetEnterprisePlansParam} arg - Arg object
931
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
932
- * @param {import("../PlatformAPIClient").Options} - Options
933
- * @returns {Promise<BillingPlatformModel.Plan[]>} - Success response
934
- * @name getEnterprisePlans
935
- * @summary: Retrieve enterprise-level plans.
936
- * @description: Retrieve available enterprise-level subscription plans. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getEnterprisePlans/).
937
- */
938
- async getEnterprisePlans(
939
- { requestHeaders } = { requestHeaders: {} },
940
- { responseHeaders } = { responseHeaders: false }
941
- ) {
942
- const { error } = BillingPlatformValidator.getEnterprisePlans().validate(
943
- {},
944
- { abortEarly: false, allowUnknown: true }
945
- );
946
- if (error) {
947
- return Promise.reject(new FDKClientValidationError(error));
948
- }
949
-
950
- // Showing warrnings if extra unknown parameters are found
951
- const {
952
- error: warrning,
953
- } = BillingPlatformValidator.getEnterprisePlans().validate(
954
- {},
955
- { abortEarly: false, allowUnknown: false }
956
- );
957
- if (warrning) {
958
- Logger({
959
- level: "WARN",
960
- message: `Parameter Validation warrnings for platform > Billing > getEnterprisePlans \n ${warrning}`,
961
- });
962
- }
963
-
964
- const query_params = {};
965
-
966
- const xHeaders = {};
967
-
968
- const response = await PlatformAPIClient.execute(
969
- this.config,
970
- "get",
971
- `/service/platform/billing/v1.0/company/${this.config.companyId}/plans`,
972
- query_params,
973
- undefined,
974
- { ...xHeaders, ...requestHeaders },
975
- { responseHeaders }
976
- );
977
-
978
- let responseData = response;
979
- if (responseHeaders) {
980
- responseData = response[0];
981
- }
982
-
983
- const { error: res_error } = Joi.array()
984
- .items(BillingPlatformModel.Plan())
985
- .validate(responseData, { abortEarly: false, allowUnknown: true });
986
-
987
- if (res_error) {
988
- if (this.config.options.strictResponseCheck === true) {
989
- return Promise.reject(new FDKResponseValidationError(res_error));
990
- } else {
991
- Logger({
992
- level: "WARN",
993
- message: `Response Validation Warnings for platform > Billing > getEnterprisePlans \n ${res_error}`,
994
- });
995
- }
996
- }
997
-
998
- return response;
999
- }
1000
-
1001
- /**
1002
- * @param {BillingPlatformValidator.GetFeatureLimitConfigParam} arg - Arg object
1003
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1004
- * @param {import("../PlatformAPIClient").Options} - Options
1005
- * @returns {Promise<BillingPlatformModel.SubscriptionLimit>} - Success response
1006
- * @name getFeatureLimitConfig
1007
- * @summary: Obtain feature limit configurations.
1008
- * @description: Retrieve configuration settings for feature limits in subscription plans. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getFeatureLimitConfig/).
1009
- */
1010
- async getFeatureLimitConfig(
1011
- { productSuite, type, requestHeaders } = { requestHeaders: {} },
1012
- { responseHeaders } = { responseHeaders: false }
1013
- ) {
1014
- const { error } = BillingPlatformValidator.getFeatureLimitConfig().validate(
1015
- {
1016
- productSuite,
1017
- type,
1018
- },
1019
- { abortEarly: false, allowUnknown: true }
1020
- );
1021
- if (error) {
1022
- return Promise.reject(new FDKClientValidationError(error));
1023
- }
1024
-
1025
- // Showing warrnings if extra unknown parameters are found
1026
- const {
1027
- error: warrning,
1028
- } = BillingPlatformValidator.getFeatureLimitConfig().validate(
1029
- {
1030
- productSuite,
1031
- type,
1032
- },
1033
- { abortEarly: false, allowUnknown: false }
1034
- );
1035
- if (warrning) {
1036
- Logger({
1037
- level: "WARN",
1038
- message: `Parameter Validation warrnings for platform > Billing > getFeatureLimitConfig \n ${warrning}`,
1039
- });
1040
- }
1041
-
1042
- const query_params = {};
1043
- query_params["product_suite"] = productSuite;
1044
- query_params["type"] = type;
1045
-
1046
- const xHeaders = {};
1047
-
1048
- const response = await PlatformAPIClient.execute(
1049
- this.config,
1050
- "get",
1051
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current-limit`,
1052
- query_params,
1053
- undefined,
1054
- { ...xHeaders, ...requestHeaders },
1055
- { responseHeaders }
1056
- );
1057
-
1058
- let responseData = response;
1059
- if (responseHeaders) {
1060
- responseData = response[0];
1061
- }
1062
-
1063
- const {
1064
- error: res_error,
1065
- } = BillingPlatformModel.SubscriptionLimit().validate(responseData, {
1066
- abortEarly: false,
1067
- allowUnknown: true,
1068
- });
1069
-
1070
- if (res_error) {
1071
- if (this.config.options.strictResponseCheck === true) {
1072
- return Promise.reject(new FDKResponseValidationError(res_error));
1073
- } else {
1074
- Logger({
1075
- level: "WARN",
1076
- message: `Response Validation Warnings for platform > Billing > getFeatureLimitConfig \n ${res_error}`,
1077
- });
1078
- }
1079
- }
1080
-
1081
- return response;
1082
- }
1083
-
1084
- /**
1085
- * @param {BillingPlatformValidator.GetInvoiceByIdParam} arg - Arg object
1086
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1087
- * @param {import("../PlatformAPIClient").Options} - Options
1088
- * @returns {Promise<BillingPlatformModel.InvoiceData>} - Success response
1089
- * @name getInvoiceById
1090
- * @summary: Get a specific invoice.
1091
- * @description: Retrieve a particular invoice's details by providing its unique ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getInvoiceById/).
1092
- */
1093
- async getInvoiceById(
1094
- { invoiceId, requestHeaders } = { requestHeaders: {} },
1095
- { responseHeaders } = { responseHeaders: false }
1096
- ) {
1097
- const { error } = BillingPlatformValidator.getInvoiceById().validate(
1098
- {
1099
- invoiceId,
1100
- },
1101
- { abortEarly: false, allowUnknown: true }
1102
- );
1103
- if (error) {
1104
- return Promise.reject(new FDKClientValidationError(error));
1105
- }
1106
-
1107
- // Showing warrnings if extra unknown parameters are found
1108
- const {
1109
- error: warrning,
1110
- } = BillingPlatformValidator.getInvoiceById().validate(
1111
- {
1112
- invoiceId,
1113
- },
1114
- { abortEarly: false, allowUnknown: false }
1115
- );
1116
- if (warrning) {
1117
- Logger({
1118
- level: "WARN",
1119
- message: `Parameter Validation warrnings for platform > Billing > getInvoiceById \n ${warrning}`,
1120
- });
1121
- }
1122
-
1123
- const query_params = {};
1124
-
1125
- const xHeaders = {};
1126
-
1127
- const response = await PlatformAPIClient.execute(
1128
- this.config,
1129
- "get",
1130
- `/service/platform/billing/v1.0/company/${this.config.companyId}/invoice/${invoiceId}`,
1131
- query_params,
1132
- undefined,
1133
- { ...xHeaders, ...requestHeaders },
1134
- { responseHeaders }
1135
- );
1136
-
1137
- let responseData = response;
1138
- if (responseHeaders) {
1139
- responseData = response[0];
1140
- }
1141
-
1142
- const {
1143
- error: res_error,
1144
- } = BillingPlatformModel.InvoiceData().validate(responseData, {
1145
- abortEarly: false,
1146
- allowUnknown: true,
1147
- });
1148
-
1149
- if (res_error) {
1150
- if (this.config.options.strictResponseCheck === true) {
1151
- return Promise.reject(new FDKResponseValidationError(res_error));
1152
- } else {
1153
- Logger({
1154
- level: "WARN",
1155
- message: `Response Validation Warnings for platform > Billing > getInvoiceById \n ${res_error}`,
1156
- });
1157
- }
1158
- }
1159
-
1160
- return response;
1161
- }
1162
-
1163
- /**
1164
- * @param {BillingPlatformValidator.GetInvoicesParam} arg - Arg object
1165
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1166
- * @param {import("../PlatformAPIClient").Options} - Options
1167
- * @returns {Promise<BillingPlatformModel.Invoices>} - Success response
1168
- * @name getInvoices
1169
- * @summary: Retrieve invoices.
1170
- * @description: Retrieve invoices for billing and payment tracking. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getInvoices/).
1171
- */
1172
- async getInvoices(
1173
- { requestHeaders } = { requestHeaders: {} },
1174
- { responseHeaders } = { responseHeaders: false }
1175
- ) {
1176
- const { error } = BillingPlatformValidator.getInvoices().validate(
1177
- {},
1178
- { abortEarly: false, allowUnknown: true }
1179
- );
1180
- if (error) {
1181
- return Promise.reject(new FDKClientValidationError(error));
1182
- }
1183
-
1184
- // Showing warrnings if extra unknown parameters are found
1185
- const { error: warrning } = BillingPlatformValidator.getInvoices().validate(
1186
- {},
1187
- { abortEarly: false, allowUnknown: false }
1188
- );
1189
- if (warrning) {
1190
- Logger({
1191
- level: "WARN",
1192
- message: `Parameter Validation warrnings for platform > Billing > getInvoices \n ${warrning}`,
1193
- });
1194
- }
1195
-
1196
- const query_params = {};
1197
-
1198
- const xHeaders = {};
1199
-
1200
- const response = await PlatformAPIClient.execute(
1201
- this.config,
1202
- "get",
1203
- `/service/platform/billing/v1.0/company/${this.config.companyId}/invoice/list`,
1204
- query_params,
1205
- undefined,
1206
- { ...xHeaders, ...requestHeaders },
1207
- { responseHeaders }
1208
- );
1209
-
1210
- let responseData = response;
1211
- if (responseHeaders) {
1212
- responseData = response[0];
1213
- }
1214
-
1215
- const {
1216
- error: res_error,
1217
- } = BillingPlatformModel.Invoices().validate(responseData, {
1218
- abortEarly: false,
1219
- allowUnknown: true,
1220
- });
1221
-
1222
- if (res_error) {
1223
- if (this.config.options.strictResponseCheck === true) {
1224
- return Promise.reject(new FDKResponseValidationError(res_error));
1225
- } else {
1226
- Logger({
1227
- level: "WARN",
1228
- message: `Response Validation Warnings for platform > Billing > getInvoices \n ${res_error}`,
1229
- });
1230
- }
1231
- }
1232
-
1233
- return response;
1234
- }
1235
-
1236
- /**
1237
- * @param {BillingPlatformValidator.GetPaymentOptionsParam} arg - Arg object
1238
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1239
- * @param {import("../PlatformAPIClient").Options} - Options
1240
- * @returns {Promise<BillingPlatformModel.GetPaymentOptions>} - Success response
1241
- * @name getPaymentOptions
1242
- * @summary: API to get payment options
1243
- * @description: API to get payment options. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getPaymentOptions/).
1244
- */
1245
- async getPaymentOptions(
1246
- { transactionId, requestHeaders } = { requestHeaders: {} },
1247
- { responseHeaders } = { responseHeaders: false }
1248
- ) {
1249
- const { error } = BillingPlatformValidator.getPaymentOptions().validate(
1250
- {
1251
- transactionId,
1252
- },
1253
- { abortEarly: false, allowUnknown: true }
1254
- );
1255
- if (error) {
1256
- return Promise.reject(new FDKClientValidationError(error));
1257
- }
1258
-
1259
- // Showing warrnings if extra unknown parameters are found
1260
- const {
1261
- error: warrning,
1262
- } = BillingPlatformValidator.getPaymentOptions().validate(
1263
- {
1264
- transactionId,
1265
- },
1266
- { abortEarly: false, allowUnknown: false }
1267
- );
1268
- if (warrning) {
1269
- Logger({
1270
- level: "WARN",
1271
- message: `Parameter Validation warrnings for platform > Billing > getPaymentOptions \n ${warrning}`,
1272
- });
1273
- }
1274
-
1275
- const query_params = {};
1276
- query_params["transaction_id"] = transactionId;
1277
-
1278
- const xHeaders = {};
1279
-
1280
- const response = await PlatformAPIClient.execute(
1281
- this.config,
1282
- "get",
1283
- `/service/platform/billing/v1.0/company/${this.config.companyId}/payment/options`,
1284
- query_params,
1285
- undefined,
1286
- { ...xHeaders, ...requestHeaders },
1287
- { responseHeaders }
1288
- );
1289
-
1290
- let responseData = response;
1291
- if (responseHeaders) {
1292
- responseData = response[0];
1293
- }
1294
-
1295
- const {
1296
- error: res_error,
1297
- } = BillingPlatformModel.GetPaymentOptions().validate(responseData, {
1298
- abortEarly: false,
1299
- allowUnknown: true,
1300
- });
1301
-
1302
- if (res_error) {
1303
- if (this.config.options.strictResponseCheck === true) {
1304
- return Promise.reject(new FDKResponseValidationError(res_error));
1305
- } else {
1306
- Logger({
1307
- level: "WARN",
1308
- message: `Response Validation Warnings for platform > Billing > getPaymentOptions \n ${res_error}`,
1309
- });
1310
- }
1311
- }
1312
-
1313
- return response;
1314
- }
1315
-
1316
- /**
1317
- * @param {BillingPlatformValidator.GetPaymentTransactionParam} arg - Arg object
1318
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1319
- * @param {import("../PlatformAPIClient").Options} - Options
1320
- * @returns {Promise<BillingPlatformModel.PaymentTransactionDetails>} -
1321
- * Success response
1322
- * @name getPaymentTransaction
1323
- * @summary: API to get payment transaction details
1324
- * @description: API to get payment transaction details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getPaymentTransaction/).
1325
- */
1326
- async getPaymentTransaction(
1327
- { transactionId, requestHeaders } = { requestHeaders: {} },
1328
- { responseHeaders } = { responseHeaders: false }
1329
- ) {
1330
- const { error } = BillingPlatformValidator.getPaymentTransaction().validate(
1331
- {
1332
- transactionId,
1333
- },
1334
- { abortEarly: false, allowUnknown: true }
1335
- );
1336
- if (error) {
1337
- return Promise.reject(new FDKClientValidationError(error));
1338
- }
1339
-
1340
- // Showing warrnings if extra unknown parameters are found
1341
- const {
1342
- error: warrning,
1343
- } = BillingPlatformValidator.getPaymentTransaction().validate(
1344
- {
1345
- transactionId,
1346
- },
1347
- { abortEarly: false, allowUnknown: false }
1348
- );
1349
- if (warrning) {
1350
- Logger({
1351
- level: "WARN",
1352
- message: `Parameter Validation warrnings for platform > Billing > getPaymentTransaction \n ${warrning}`,
1353
- });
1354
- }
1355
-
1356
- const query_params = {};
1357
-
1358
- const xHeaders = {};
1359
-
1360
- const response = await PlatformAPIClient.execute(
1361
- this.config,
1362
- "get",
1363
- `/service/platform/billing/v1.0/company/${this.config.companyId}/payment/transaction/${transactionId}`,
1364
- query_params,
1365
- undefined,
1366
- { ...xHeaders, ...requestHeaders },
1367
- { responseHeaders }
1368
- );
1369
-
1370
- let responseData = response;
1371
- if (responseHeaders) {
1372
- responseData = response[0];
1373
- }
1374
-
1375
- const {
1376
- error: res_error,
1377
- } = BillingPlatformModel.PaymentTransactionDetails().validate(
1378
- responseData,
1379
- { abortEarly: false, allowUnknown: true }
1380
- );
1381
-
1382
- if (res_error) {
1383
- if (this.config.options.strictResponseCheck === true) {
1384
- return Promise.reject(new FDKResponseValidationError(res_error));
1385
- } else {
1386
- Logger({
1387
- level: "WARN",
1388
- message: `Response Validation Warnings for platform > Billing > getPaymentTransaction \n ${res_error}`,
1389
- });
1390
- }
1391
- }
1392
-
1393
- return response;
1394
- }
1395
-
1396
- /**
1397
- * @param {BillingPlatformValidator.GetSubscriptionParam} arg - Arg object
1398
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1399
- * @param {import("../PlatformAPIClient").Options} - Options
1400
- * @returns {Promise<BillingPlatformModel.SubscriptionStatus>} - Success response
1401
- * @name getSubscription
1402
- * @summary: Retrieve subscription details.
1403
- * @description: Retrieve details of a customer's subscription information. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getSubscription/).
1404
- */
1405
- async getSubscription(
1406
- { requestHeaders } = { requestHeaders: {} },
1407
- { responseHeaders } = { responseHeaders: false }
1408
- ) {
1409
- const { error } = BillingPlatformValidator.getSubscription().validate(
1410
- {},
1411
- { abortEarly: false, allowUnknown: true }
1412
- );
1413
- if (error) {
1414
- return Promise.reject(new FDKClientValidationError(error));
1415
- }
1416
-
1417
- // Showing warrnings if extra unknown parameters are found
1418
- const {
1419
- error: warrning,
1420
- } = BillingPlatformValidator.getSubscription().validate(
1421
- {},
1422
- { abortEarly: false, allowUnknown: false }
1423
- );
1424
- if (warrning) {
1425
- Logger({
1426
- level: "WARN",
1427
- message: `Parameter Validation warrnings for platform > Billing > getSubscription \n ${warrning}`,
1428
- });
1429
- }
1430
-
1431
- const query_params = {};
1432
-
1433
- const xHeaders = {};
1434
-
1435
- const response = await PlatformAPIClient.execute(
1436
- this.config,
1437
- "get",
1438
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/current`,
1439
- query_params,
1440
- undefined,
1441
- { ...xHeaders, ...requestHeaders },
1442
- { responseHeaders }
1443
- );
1444
-
1445
- let responseData = response;
1446
- if (responseHeaders) {
1447
- responseData = response[0];
1448
- }
1449
-
1450
- const {
1451
- error: res_error,
1452
- } = BillingPlatformModel.SubscriptionStatus().validate(responseData, {
1453
- abortEarly: false,
1454
- allowUnknown: true,
1455
- });
1456
-
1457
- if (res_error) {
1458
- if (this.config.options.strictResponseCheck === true) {
1459
- return Promise.reject(new FDKResponseValidationError(res_error));
1460
- } else {
1461
- Logger({
1462
- level: "WARN",
1463
- message: `Response Validation Warnings for platform > Billing > getSubscription \n ${res_error}`,
1464
- });
1465
- }
1466
- }
1467
-
1468
- return response;
1469
- }
1470
-
1471
- /**
1472
- * @param {BillingPlatformValidator.GetSubscriptionChargeParam} arg - Arg object
1473
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1474
- * @param {import("../PlatformAPIClient").Options} - Options
1475
- * @returns {Promise<BillingPlatformModel.SubscriptionChargeRes>} - Success response
1476
- * @name getSubscriptionCharge
1477
- * @summary: Retrieve subscription charge details.
1478
- * @description: Retrieve detailed information about subscription charges using this API. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getSubscriptionCharge/).
1479
- */
1480
- async getSubscriptionCharge(
1481
- { extensionId, subscriptionId, requestHeaders } = { requestHeaders: {} },
1482
- { responseHeaders } = { responseHeaders: false }
1483
- ) {
1484
- const { error } = BillingPlatformValidator.getSubscriptionCharge().validate(
1485
- {
1486
- extensionId,
1487
- subscriptionId,
1488
- },
1489
- { abortEarly: false, allowUnknown: true }
1490
- );
1491
- if (error) {
1492
- return Promise.reject(new FDKClientValidationError(error));
1493
- }
1494
-
1495
- // Showing warrnings if extra unknown parameters are found
1496
- const {
1497
- error: warrning,
1498
- } = BillingPlatformValidator.getSubscriptionCharge().validate(
1499
- {
1500
- extensionId,
1501
- subscriptionId,
1502
- },
1503
- { abortEarly: false, allowUnknown: false }
1504
- );
1505
- if (warrning) {
1506
- Logger({
1507
- level: "WARN",
1508
- message: `Parameter Validation warrnings for platform > Billing > getSubscriptionCharge \n ${warrning}`,
1509
- });
1510
- }
1511
-
1512
- const query_params = {};
1513
-
1514
- const xHeaders = {};
1515
-
1516
- const response = await PlatformAPIClient.execute(
1517
- this.config,
1518
- "get",
1519
- `/service/platform/billing/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscription/${subscriptionId}`,
1520
- query_params,
1521
- undefined,
1522
- { ...xHeaders, ...requestHeaders },
1523
- { responseHeaders }
1524
- );
1525
-
1526
- let responseData = response;
1527
- if (responseHeaders) {
1528
- responseData = response[0];
1529
- }
1530
-
1531
- const {
1532
- error: res_error,
1533
- } = BillingPlatformModel.SubscriptionChargeRes().validate(responseData, {
1534
- abortEarly: false,
1535
- allowUnknown: true,
1536
- });
1537
-
1538
- if (res_error) {
1539
- if (this.config.options.strictResponseCheck === true) {
1540
- return Promise.reject(new FDKResponseValidationError(res_error));
1541
- } else {
1542
- Logger({
1543
- level: "WARN",
1544
- message: `Response Validation Warnings for platform > Billing > getSubscriptionCharge \n ${res_error}`,
1545
- });
1546
- }
1547
- }
1548
-
1549
- return response;
1550
- }
1551
-
1552
- /**
1553
- * @param {BillingPlatformValidator.GetentityDetailParam} arg - Arg object
1554
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1555
- * @param {import("../PlatformAPIClient").Options} - Options
1556
- * @returns {Promise<BillingPlatformModel.EntityDetail[]>} - Success response
1557
- * @name getentityDetail
1558
- * @summary: Generic api to get the entity detail
1559
- * @description: Generic api to get the entity detail - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/getentityDetail/).
1560
- */
1561
- async getentityDetail(
1562
- {
1563
- entityName,
1564
- channel,
1565
- entityId,
1566
- component,
1567
- componentName,
1568
- requestHeaders,
1569
- } = { requestHeaders: {} },
1570
- { responseHeaders } = { responseHeaders: false }
1571
- ) {
1572
- const { error } = BillingPlatformValidator.getentityDetail().validate(
1573
- {
1574
- entityName,
1575
- channel,
1576
- entityId,
1577
- component,
1578
- componentName,
1579
- },
1580
- { abortEarly: false, allowUnknown: true }
1581
- );
1582
- if (error) {
1583
- return Promise.reject(new FDKClientValidationError(error));
1584
- }
1585
-
1586
- // Showing warrnings if extra unknown parameters are found
1587
- const {
1588
- error: warrning,
1589
- } = BillingPlatformValidator.getentityDetail().validate(
1590
- {
1591
- entityName,
1592
- channel,
1593
- entityId,
1594
- component,
1595
- componentName,
1596
- },
1597
- { abortEarly: false, allowUnknown: false }
1598
- );
1599
- if (warrning) {
1600
- Logger({
1601
- level: "WARN",
1602
- message: `Parameter Validation warrnings for platform > Billing > getentityDetail \n ${warrning}`,
1603
- });
1604
- }
1605
-
1606
- const query_params = {};
1607
- query_params["entity_name"] = entityName;
1608
- query_params["entity_id"] = entityId;
1609
- query_params["channel"] = channel;
1610
- query_params["component"] = component;
1611
- query_params["component_name"] = componentName;
1612
-
1613
- const xHeaders = {};
1614
-
1615
- const response = await PlatformAPIClient.execute(
1616
- this.config,
1617
- "get",
1618
- `/service/platform/billing/v1.0/company/${this.config.companyId}/entity/detail`,
1619
- query_params,
1620
- undefined,
1621
- { ...xHeaders, ...requestHeaders },
1622
- { responseHeaders }
1623
- );
1624
-
1625
- let responseData = response;
1626
- if (responseHeaders) {
1627
- responseData = response[0];
1628
- }
1629
-
1630
- const { error: res_error } = Joi.array()
1631
- .items(BillingPlatformModel.EntityDetail())
1632
- .validate(responseData, { abortEarly: false, allowUnknown: true });
1633
-
1634
- if (res_error) {
1635
- if (this.config.options.strictResponseCheck === true) {
1636
- return Promise.reject(new FDKResponseValidationError(res_error));
1637
- } else {
1638
- Logger({
1639
- level: "WARN",
1640
- message: `Response Validation Warnings for platform > Billing > getentityDetail \n ${res_error}`,
1641
- });
1642
- }
1643
- }
1644
-
1645
- return response;
1646
- }
1647
-
1648
- /**
1649
- * @param {BillingPlatformValidator.GlobalSettingsParam} arg - Arg object
1650
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1651
- * @param {import("../PlatformAPIClient").Options} - Options
1652
- * @returns {Promise<BillingPlatformModel.GlobalSettings>} - Success response
1653
- * @name globalSettings
1654
- * @summary: API to get global settings details
1655
- * @description: API to get global settings details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/globalSettings/).
1656
- */
1657
- async globalSettings(
1658
- { pageNo, pageSize, query, requestHeaders } = { requestHeaders: {} },
1659
- { responseHeaders } = { responseHeaders: false }
1660
- ) {
1661
- const { error } = BillingPlatformValidator.globalSettings().validate(
1662
- {
1663
- pageNo,
1664
- pageSize,
1665
- query,
1666
- },
1667
- { abortEarly: false, allowUnknown: true }
1668
- );
1669
- if (error) {
1670
- return Promise.reject(new FDKClientValidationError(error));
1671
- }
1672
-
1673
- // Showing warrnings if extra unknown parameters are found
1674
- const {
1675
- error: warrning,
1676
- } = BillingPlatformValidator.globalSettings().validate(
1677
- {
1678
- pageNo,
1679
- pageSize,
1680
- query,
1681
- },
1682
- { abortEarly: false, allowUnknown: false }
1683
- );
1684
- if (warrning) {
1685
- Logger({
1686
- level: "WARN",
1687
- message: `Parameter Validation warrnings for platform > Billing > globalSettings \n ${warrning}`,
1688
- });
1689
- }
1690
-
1691
- const query_params = {};
1692
- query_params["page_no"] = pageNo;
1693
- query_params["page_size"] = pageSize;
1694
- query_params["query"] = query;
1695
-
1696
- const xHeaders = {};
1697
-
1698
- const response = await PlatformAPIClient.execute(
1699
- this.config,
1700
- "get",
1701
- `/service/platform/billing/v1.0/company/${this.config.companyId}/global-settings`,
1702
- query_params,
1703
- undefined,
1704
- { ...xHeaders, ...requestHeaders },
1705
- { responseHeaders }
1706
- );
1707
-
1708
- let responseData = response;
1709
- if (responseHeaders) {
1710
- responseData = response[0];
1711
- }
1712
-
1713
- const {
1714
- error: res_error,
1715
- } = BillingPlatformModel.GlobalSettings().validate(responseData, {
1716
- abortEarly: false,
1717
- allowUnknown: true,
1718
- });
1719
-
1720
- if (res_error) {
1721
- if (this.config.options.strictResponseCheck === true) {
1722
- return Promise.reject(new FDKResponseValidationError(res_error));
1723
- } else {
1724
- Logger({
1725
- level: "WARN",
1726
- message: `Response Validation Warnings for platform > Billing > globalSettings \n ${res_error}`,
1727
- });
1728
- }
1729
- }
1730
-
1731
- return response;
1732
- }
1733
-
1734
- /**
1735
- * @param {BillingPlatformValidator.MethodDefaultParam} arg - Arg object
1736
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1737
- * @param {import("../PlatformAPIClient").Options} - Options
1738
- * @returns {Promise<BillingPlatformModel.Message>} - Success response
1739
- * @name methodDefault
1740
- * @summary: Method Default
1741
- * @description: Method Default - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/methodDefault/).
1742
- */
1743
- async methodDefault(
1744
- { body, requestHeaders } = { requestHeaders: {} },
1745
- { responseHeaders } = { responseHeaders: false }
1746
- ) {
1747
- const { error } = BillingPlatformValidator.methodDefault().validate(
1748
- {
1749
- body,
1750
- },
1751
- { abortEarly: false, allowUnknown: true }
1752
- );
1753
- if (error) {
1754
- return Promise.reject(new FDKClientValidationError(error));
1755
- }
1756
-
1757
- // Showing warrnings if extra unknown parameters are found
1758
- const {
1759
- error: warrning,
1760
- } = BillingPlatformValidator.methodDefault().validate(
1761
- {
1762
- body,
1763
- },
1764
- { abortEarly: false, allowUnknown: false }
1765
- );
1766
- if (warrning) {
1767
- Logger({
1768
- level: "WARN",
1769
- message: `Parameter Validation warrnings for platform > Billing > methodDefault \n ${warrning}`,
1770
- });
1771
- }
1772
-
1773
- const query_params = {};
1774
-
1775
- const xHeaders = {};
1776
-
1777
- const response = await PlatformAPIClient.execute(
1778
- this.config,
1779
- "put",
1780
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/method/default`,
1781
- query_params,
1782
- body,
1783
- { ...xHeaders, ...requestHeaders },
1784
- { responseHeaders }
1785
- );
1786
-
1787
- let responseData = response;
1788
- if (responseHeaders) {
1789
- responseData = response[0];
1790
- }
1791
-
1792
- const {
1793
- error: res_error,
1794
- } = BillingPlatformModel.Message().validate(responseData, {
1795
- abortEarly: false,
1796
- allowUnknown: true,
1797
- });
1798
-
1799
- if (res_error) {
1800
- if (this.config.options.strictResponseCheck === true) {
1801
- return Promise.reject(new FDKResponseValidationError(res_error));
1802
- } else {
1803
- Logger({
1804
- level: "WARN",
1805
- message: `Response Validation Warnings for platform > Billing > methodDefault \n ${res_error}`,
1806
- });
1807
- }
1808
- }
1809
-
1810
- return response;
1811
- }
1812
-
1813
- /**
1814
- * @param {BillingPlatformValidator.PaymentCollectParam} arg - Arg object
1815
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1816
- * @param {import("../PlatformAPIClient").Options} - Options
1817
- * @returns {Promise<BillingPlatformModel.PaymentCollectRes>} - Success response
1818
- * @name paymentCollect
1819
- * @summary: Payment Collect
1820
- * @description: Payment Collect - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/paymentCollect/).
1821
- */
1822
- async paymentCollect(
1823
- { body, requestHeaders } = { requestHeaders: {} },
1824
- { responseHeaders } = { responseHeaders: false }
1825
- ) {
1826
- const { error } = BillingPlatformValidator.paymentCollect().validate(
1827
- {
1828
- body,
1829
- },
1830
- { abortEarly: false, allowUnknown: true }
1831
- );
1832
- if (error) {
1833
- return Promise.reject(new FDKClientValidationError(error));
1834
- }
1835
-
1836
- // Showing warrnings if extra unknown parameters are found
1837
- const {
1838
- error: warrning,
1839
- } = BillingPlatformValidator.paymentCollect().validate(
1840
- {
1841
- body,
1842
- },
1843
- { abortEarly: false, allowUnknown: false }
1844
- );
1845
- if (warrning) {
1846
- Logger({
1847
- level: "WARN",
1848
- message: `Parameter Validation warrnings for platform > Billing > paymentCollect \n ${warrning}`,
1849
- });
1850
- }
1851
-
1852
- const query_params = {};
1853
-
1854
- const xHeaders = {};
1855
-
1856
- const response = await PlatformAPIClient.execute(
1857
- this.config,
1858
- "post",
1859
- `/service/platform/billing/v1.0/company/${this.config.companyId}/payment/collect`,
1860
- query_params,
1861
- body,
1862
- { ...xHeaders, ...requestHeaders },
1863
- { responseHeaders }
1864
- );
1865
-
1866
- let responseData = response;
1867
- if (responseHeaders) {
1868
- responseData = response[0];
1869
- }
1870
-
1871
- const {
1872
- error: res_error,
1873
- } = BillingPlatformModel.PaymentCollectRes().validate(responseData, {
1874
- abortEarly: false,
1875
- allowUnknown: true,
1876
- });
1877
-
1878
- if (res_error) {
1879
- if (this.config.options.strictResponseCheck === true) {
1880
- return Promise.reject(new FDKResponseValidationError(res_error));
1881
- } else {
1882
- Logger({
1883
- level: "WARN",
1884
- message: `Response Validation Warnings for platform > Billing > paymentCollect \n ${res_error}`,
1885
- });
1886
- }
1887
- }
1888
-
1889
- return response;
1890
- }
1891
-
1892
- /**
1893
- * @param {BillingPlatformValidator.PaymentInitiateParam} arg - Arg object
1894
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1895
- * @param {import("../PlatformAPIClient").Options} - Options
1896
- * @returns {Promise<BillingPlatformModel.SubscribePlanRes>} - Success response
1897
- * @name paymentInitiate
1898
- * @summary: Initiate Payment
1899
- * @description: Initiate Payment. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/paymentInitiate/).
1900
- */
1901
- async paymentInitiate(
1902
- { body, requestHeaders } = { requestHeaders: {} },
1903
- { responseHeaders } = { responseHeaders: false }
1904
- ) {
1905
- const { error } = BillingPlatformValidator.paymentInitiate().validate(
1906
- {
1907
- body,
1908
- },
1909
- { abortEarly: false, allowUnknown: true }
1910
- );
1911
- if (error) {
1912
- return Promise.reject(new FDKClientValidationError(error));
1913
- }
1914
-
1915
- // Showing warrnings if extra unknown parameters are found
1916
- const {
1917
- error: warrning,
1918
- } = BillingPlatformValidator.paymentInitiate().validate(
1919
- {
1920
- body,
1921
- },
1922
- { abortEarly: false, allowUnknown: false }
1923
- );
1924
- if (warrning) {
1925
- Logger({
1926
- level: "WARN",
1927
- message: `Parameter Validation warrnings for platform > Billing > paymentInitiate \n ${warrning}`,
1928
- });
1929
- }
1930
-
1931
- const query_params = {};
1932
-
1933
- const xHeaders = {};
1934
-
1935
- const response = await PlatformAPIClient.execute(
1936
- this.config,
1937
- "post",
1938
- `/service/platform/billing/v1.0/company/${this.config.companyId}/payment/initiate`,
1939
- query_params,
1940
- body,
1941
- { ...xHeaders, ...requestHeaders },
1942
- { responseHeaders }
1943
- );
1944
-
1945
- let responseData = response;
1946
- if (responseHeaders) {
1947
- responseData = response[0];
1948
- }
1949
-
1950
- const {
1951
- error: res_error,
1952
- } = BillingPlatformModel.SubscribePlanRes().validate(responseData, {
1953
- abortEarly: false,
1954
- allowUnknown: true,
1955
- });
1956
-
1957
- if (res_error) {
1958
- if (this.config.options.strictResponseCheck === true) {
1959
- return Promise.reject(new FDKResponseValidationError(res_error));
1960
- } else {
1961
- Logger({
1962
- level: "WARN",
1963
- message: `Response Validation Warnings for platform > Billing > paymentInitiate \n ${res_error}`,
1964
- });
1965
- }
1966
- }
1967
-
1968
- return response;
1969
- }
1970
-
1971
- /**
1972
- * @param {BillingPlatformValidator.PaymentOptionsParam} arg - Arg object
1973
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1974
- * @param {import("../PlatformAPIClient").Options} - Options
1975
- * @returns {Promise<BillingPlatformModel.PaymentOptions>} - Success response
1976
- * @name paymentOptions
1977
- * @summary: API to get payment details of requested payment options
1978
- * @description: API to get payment details of requested payment options. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/paymentOptions/).
1979
- */
1980
- async paymentOptions(
1981
- { code, requestHeaders } = { requestHeaders: {} },
1982
- { responseHeaders } = { responseHeaders: false }
1983
- ) {
1984
- const { error } = BillingPlatformValidator.paymentOptions().validate(
1985
- {
1986
- code,
1987
- },
1988
- { abortEarly: false, allowUnknown: true }
1989
- );
1990
- if (error) {
1991
- return Promise.reject(new FDKClientValidationError(error));
1992
- }
1993
-
1994
- // Showing warrnings if extra unknown parameters are found
1995
- const {
1996
- error: warrning,
1997
- } = BillingPlatformValidator.paymentOptions().validate(
1998
- {
1999
- code,
2000
- },
2001
- { abortEarly: false, allowUnknown: false }
2002
- );
2003
- if (warrning) {
2004
- Logger({
2005
- level: "WARN",
2006
- message: `Parameter Validation warrnings for platform > Billing > paymentOptions \n ${warrning}`,
2007
- });
2008
- }
2009
-
2010
- const query_params = {};
2011
- query_params["code"] = code;
2012
-
2013
- const xHeaders = {};
2014
-
2015
- const response = await PlatformAPIClient.execute(
2016
- this.config,
2017
- "get",
2018
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/payment-options`,
2019
- query_params,
2020
- undefined,
2021
- { ...xHeaders, ...requestHeaders },
2022
- { responseHeaders }
2023
- );
2024
-
2025
- let responseData = response;
2026
- if (responseHeaders) {
2027
- responseData = response[0];
2028
- }
2029
-
2030
- const {
2031
- error: res_error,
2032
- } = BillingPlatformModel.PaymentOptions().validate(responseData, {
2033
- abortEarly: false,
2034
- allowUnknown: true,
2035
- });
2036
-
2037
- if (res_error) {
2038
- if (this.config.options.strictResponseCheck === true) {
2039
- return Promise.reject(new FDKResponseValidationError(res_error));
2040
- } else {
2041
- Logger({
2042
- level: "WARN",
2043
- message: `Response Validation Warnings for platform > Billing > paymentOptions \n ${res_error}`,
2044
- });
2045
- }
2046
- }
2047
-
2048
- return response;
2049
- }
2050
-
2051
- /**
2052
- * @param {BillingPlatformValidator.PaymentStatusParam} arg - Arg object
2053
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2054
- * @param {import("../PlatformAPIClient").Options} - Options
2055
- * @returns {Promise<BillingPlatformModel.PaymentStatusResponse>} - Success response
2056
- * @name paymentStatus
2057
- * @summary: Credit Transaction
2058
- * @description: Credit Transaction - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/paymentStatus/).
2059
- */
2060
- async paymentStatus(
2061
- { orderId, requestHeaders } = { requestHeaders: {} },
2062
- { responseHeaders } = { responseHeaders: false }
2063
- ) {
2064
- const { error } = BillingPlatformValidator.paymentStatus().validate(
2065
- {
2066
- orderId,
2067
- },
2068
- { abortEarly: false, allowUnknown: true }
2069
- );
2070
- if (error) {
2071
- return Promise.reject(new FDKClientValidationError(error));
2072
- }
2073
-
2074
- // Showing warrnings if extra unknown parameters are found
2075
- const {
2076
- error: warrning,
2077
- } = BillingPlatformValidator.paymentStatus().validate(
2078
- {
2079
- orderId,
2080
- },
2081
- { abortEarly: false, allowUnknown: false }
2082
- );
2083
- if (warrning) {
2084
- Logger({
2085
- level: "WARN",
2086
- message: `Parameter Validation warrnings for platform > Billing > paymentStatus \n ${warrning}`,
2087
- });
2088
- }
2089
-
2090
- const query_params = {};
2091
- query_params["order_id"] = orderId;
2092
-
2093
- const xHeaders = {};
2094
-
2095
- const response = await PlatformAPIClient.execute(
2096
- this.config,
2097
- "get",
2098
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/payment-status`,
2099
- query_params,
2100
- undefined,
2101
- { ...xHeaders, ...requestHeaders },
2102
- { responseHeaders }
2103
- );
2104
-
2105
- let responseData = response;
2106
- if (responseHeaders) {
2107
- responseData = response[0];
2108
- }
2109
-
2110
- const {
2111
- error: res_error,
2112
- } = BillingPlatformModel.PaymentStatusResponse().validate(responseData, {
2113
- abortEarly: false,
2114
- allowUnknown: true,
2115
- });
2116
-
2117
- if (res_error) {
2118
- if (this.config.options.strictResponseCheck === true) {
2119
- return Promise.reject(new FDKResponseValidationError(res_error));
2120
- } else {
2121
- Logger({
2122
- level: "WARN",
2123
- message: `Response Validation Warnings for platform > Billing > paymentStatus \n ${res_error}`,
2124
- });
2125
- }
2126
- }
2127
-
2128
- return response;
2129
- }
2130
-
2131
- /**
2132
- * @param {BillingPlatformValidator.PlanDowngradeParam} arg - Arg object
2133
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2134
- * @param {import("../PlatformAPIClient").Options} - Options
2135
- * @returns {Promise<BillingPlatformModel.PostDowngradeRes>} - Success response
2136
- * @name planDowngrade
2137
- * @summary: Plan change downgrade
2138
- * @description: Plan change downgrade - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/planDowngrade/).
2139
- */
2140
- async planDowngrade(
2141
- { body, requestHeaders } = { requestHeaders: {} },
2142
- { responseHeaders } = { responseHeaders: false }
2143
- ) {
2144
- const { error } = BillingPlatformValidator.planDowngrade().validate(
2145
- {
2146
- body,
2147
- },
2148
- { abortEarly: false, allowUnknown: true }
2149
- );
2150
- if (error) {
2151
- return Promise.reject(new FDKClientValidationError(error));
2152
- }
2153
-
2154
- // Showing warrnings if extra unknown parameters are found
2155
- const {
2156
- error: warrning,
2157
- } = BillingPlatformValidator.planDowngrade().validate(
2158
- {
2159
- body,
2160
- },
2161
- { abortEarly: false, allowUnknown: false }
2162
- );
2163
- if (warrning) {
2164
- Logger({
2165
- level: "WARN",
2166
- message: `Parameter Validation warrnings for platform > Billing > planDowngrade \n ${warrning}`,
2167
- });
2168
- }
2169
-
2170
- const query_params = {};
2171
-
2172
- const xHeaders = {};
2173
-
2174
- const response = await PlatformAPIClient.execute(
2175
- this.config,
2176
- "post",
2177
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/plan-change/downgrade`,
2178
- query_params,
2179
- body,
2180
- { ...xHeaders, ...requestHeaders },
2181
- { responseHeaders }
2182
- );
2183
-
2184
- let responseData = response;
2185
- if (responseHeaders) {
2186
- responseData = response[0];
2187
- }
2188
-
2189
- const {
2190
- error: res_error,
2191
- } = BillingPlatformModel.PostDowngradeRes().validate(responseData, {
2192
- abortEarly: false,
2193
- allowUnknown: true,
2194
- });
2195
-
2196
- if (res_error) {
2197
- if (this.config.options.strictResponseCheck === true) {
2198
- return Promise.reject(new FDKResponseValidationError(res_error));
2199
- } else {
2200
- Logger({
2201
- level: "WARN",
2202
- message: `Response Validation Warnings for platform > Billing > planDowngrade \n ${res_error}`,
2203
- });
2204
- }
2205
- }
2206
-
2207
- return response;
2208
- }
2209
-
2210
- /**
2211
- * @param {BillingPlatformValidator.PlanDowngradeGetParam} arg - Arg object
2212
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2213
- * @param {import("../PlatformAPIClient").Options} - Options
2214
- * @returns {Promise<BillingPlatformModel.DowngradeRes>} - Success response
2215
- * @name planDowngradeGet
2216
- * @summary: Get plan change downgrade
2217
- * @description: Get plan change downgrade - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/planDowngradeGet/).
2218
- */
2219
- async planDowngradeGet(
2220
- { requestHeaders } = { requestHeaders: {} },
2221
- { responseHeaders } = { responseHeaders: false }
2222
- ) {
2223
- const { error } = BillingPlatformValidator.planDowngradeGet().validate(
2224
- {},
2225
- { abortEarly: false, allowUnknown: true }
2226
- );
2227
- if (error) {
2228
- return Promise.reject(new FDKClientValidationError(error));
2229
- }
2230
-
2231
- // Showing warrnings if extra unknown parameters are found
2232
- const {
2233
- error: warrning,
2234
- } = BillingPlatformValidator.planDowngradeGet().validate(
2235
- {},
2236
- { abortEarly: false, allowUnknown: false }
2237
- );
2238
- if (warrning) {
2239
- Logger({
2240
- level: "WARN",
2241
- message: `Parameter Validation warrnings for platform > Billing > planDowngradeGet \n ${warrning}`,
2242
- });
2243
- }
2244
-
2245
- const query_params = {};
2246
-
2247
- const xHeaders = {};
2248
-
2249
- const response = await PlatformAPIClient.execute(
2250
- this.config,
2251
- "get",
2252
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/plan-change/downgrade`,
2253
- query_params,
2254
- undefined,
2255
- { ...xHeaders, ...requestHeaders },
2256
- { responseHeaders }
2257
- );
2258
-
2259
- let responseData = response;
2260
- if (responseHeaders) {
2261
- responseData = response[0];
2262
- }
2263
-
2264
- const {
2265
- error: res_error,
2266
- } = BillingPlatformModel.DowngradeRes().validate(responseData, {
2267
- abortEarly: false,
2268
- allowUnknown: true,
2269
- });
2270
-
2271
- if (res_error) {
2272
- if (this.config.options.strictResponseCheck === true) {
2273
- return Promise.reject(new FDKResponseValidationError(res_error));
2274
- } else {
2275
- Logger({
2276
- level: "WARN",
2277
- message: `Response Validation Warnings for platform > Billing > planDowngradeGet \n ${res_error}`,
2278
- });
2279
- }
2280
- }
2281
-
2282
- return response;
2283
- }
2284
-
2285
- /**
2286
- * @param {BillingPlatformValidator.PlanStatusUpdateParam} arg - Arg object
2287
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2288
- * @param {import("../PlatformAPIClient").Options} - Options
2289
- * @returns {Promise<BillingPlatformModel.Plan>} - Success response
2290
- * @name planStatusUpdate
2291
- * @summary: Update subscription plan status.
2292
- * @description: Modify the status of a subscription plan. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/planStatusUpdate/).
2293
- */
2294
- async planStatusUpdate(
2295
- { body, requestHeaders } = { requestHeaders: {} },
2296
- { responseHeaders } = { responseHeaders: false }
2297
- ) {
2298
- const { error } = BillingPlatformValidator.planStatusUpdate().validate(
2299
- {
2300
- body,
2301
- },
2302
- { abortEarly: false, allowUnknown: true }
2303
- );
2304
- if (error) {
2305
- return Promise.reject(new FDKClientValidationError(error));
2306
- }
2307
-
2308
- // Showing warrnings if extra unknown parameters are found
2309
- const {
2310
- error: warrning,
2311
- } = BillingPlatformValidator.planStatusUpdate().validate(
2312
- {
2313
- body,
2314
- },
2315
- { abortEarly: false, allowUnknown: false }
2316
- );
2317
- if (warrning) {
2318
- Logger({
2319
- level: "WARN",
2320
- message: `Parameter Validation warrnings for platform > Billing > planStatusUpdate \n ${warrning}`,
2321
- });
2322
- }
2323
-
2324
- const query_params = {};
2325
-
2326
- const xHeaders = {};
2327
-
2328
- const response = await PlatformAPIClient.execute(
2329
- this.config,
2330
- "patch",
2331
- `/service/platform/billing/v1.0/company/${this.config.companyId}/plan/status`,
2332
- query_params,
2333
- body,
2334
- { ...xHeaders, ...requestHeaders },
2335
- { responseHeaders }
2336
- );
2337
-
2338
- let responseData = response;
2339
- if (responseHeaders) {
2340
- responseData = response[0];
2341
- }
2342
-
2343
- const {
2344
- error: res_error,
2345
- } = BillingPlatformModel.Plan().validate(responseData, {
2346
- abortEarly: false,
2347
- allowUnknown: true,
2348
- });
2349
-
2350
- if (res_error) {
2351
- if (this.config.options.strictResponseCheck === true) {
2352
- return Promise.reject(new FDKResponseValidationError(res_error));
2353
- } else {
2354
- Logger({
2355
- level: "WARN",
2356
- message: `Response Validation Warnings for platform > Billing > planStatusUpdate \n ${res_error}`,
2357
- });
2358
- }
2359
- }
2360
-
2361
- return response;
2362
- }
2363
-
2364
- /**
2365
- * @param {BillingPlatformValidator.SetupIntentParam} arg - Arg object
2366
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2367
- * @param {import("../PlatformAPIClient").Options} - Options
2368
- * @returns {Promise<BillingPlatformModel.SetupIntentRes>} - Success response
2369
- * @name setupIntent
2370
- * @summary: Setup Intent
2371
- * @description: Setup Intent - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/setupIntent/).
2372
- */
2373
- async setupIntent(
2374
- { body, requestHeaders } = { requestHeaders: {} },
2375
- { responseHeaders } = { responseHeaders: false }
2376
- ) {
2377
- const { error } = BillingPlatformValidator.setupIntent().validate(
2378
- {
2379
- body,
2380
- },
2381
- { abortEarly: false, allowUnknown: true }
2382
- );
2383
- if (error) {
2384
- return Promise.reject(new FDKClientValidationError(error));
2385
- }
2386
-
2387
- // Showing warrnings if extra unknown parameters are found
2388
- const { error: warrning } = BillingPlatformValidator.setupIntent().validate(
2389
- {
2390
- body,
2391
- },
2392
- { abortEarly: false, allowUnknown: false }
2393
- );
2394
- if (warrning) {
2395
- Logger({
2396
- level: "WARN",
2397
- message: `Parameter Validation warrnings for platform > Billing > setupIntent \n ${warrning}`,
2398
- });
2399
- }
2400
-
2401
- const query_params = {};
2402
-
2403
- const xHeaders = {};
2404
-
2405
- const response = await PlatformAPIClient.execute(
2406
- this.config,
2407
- "post",
2408
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/setup/intent`,
2409
- query_params,
2410
- body,
2411
- { ...xHeaders, ...requestHeaders },
2412
- { responseHeaders }
2413
- );
2414
-
2415
- let responseData = response;
2416
- if (responseHeaders) {
2417
- responseData = response[0];
2418
- }
2419
-
2420
- const {
2421
- error: res_error,
2422
- } = BillingPlatformModel.SetupIntentRes().validate(responseData, {
2423
- abortEarly: false,
2424
- allowUnknown: true,
2425
- });
2426
-
2427
- if (res_error) {
2428
- if (this.config.options.strictResponseCheck === true) {
2429
- return Promise.reject(new FDKResponseValidationError(res_error));
2430
- } else {
2431
- Logger({
2432
- level: "WARN",
2433
- message: `Response Validation Warnings for platform > Billing > setupIntent \n ${res_error}`,
2434
- });
2435
- }
2436
- }
2437
-
2438
- return response;
2439
- }
2440
-
2441
- /**
2442
- * @param {BillingPlatformValidator.SetupMandateParam} arg - Arg object
2443
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2444
- * @param {import("../PlatformAPIClient").Options} - Options
2445
- * @returns {Promise<BillingPlatformModel.Message>} - Success response
2446
- * @name setupMandate
2447
- * @summary: Setup Mandate
2448
- * @description: Setup Mandate - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/setupMandate/).
2449
- */
2450
- async setupMandate(
2451
- { body, requestHeaders } = { requestHeaders: {} },
2452
- { responseHeaders } = { responseHeaders: false }
2453
- ) {
2454
- const { error } = BillingPlatformValidator.setupMandate().validate(
2455
- {
2456
- body,
2457
- },
2458
- { abortEarly: false, allowUnknown: true }
2459
- );
2460
- if (error) {
2461
- return Promise.reject(new FDKClientValidationError(error));
2462
- }
2463
-
2464
- // Showing warrnings if extra unknown parameters are found
2465
- const {
2466
- error: warrning,
2467
- } = BillingPlatformValidator.setupMandate().validate(
2468
- {
2469
- body,
2470
- },
2471
- { abortEarly: false, allowUnknown: false }
2472
- );
2473
- if (warrning) {
2474
- Logger({
2475
- level: "WARN",
2476
- message: `Parameter Validation warrnings for platform > Billing > setupMandate \n ${warrning}`,
2477
- });
2478
- }
2479
-
2480
- const query_params = {};
2481
-
2482
- const xHeaders = {};
2483
-
2484
- const response = await PlatformAPIClient.execute(
2485
- this.config,
2486
- "patch",
2487
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/setup/mandate`,
2488
- query_params,
2489
- body,
2490
- { ...xHeaders, ...requestHeaders },
2491
- { responseHeaders }
2492
- );
2493
-
2494
- let responseData = response;
2495
- if (responseHeaders) {
2496
- responseData = response[0];
2497
- }
2498
-
2499
- const {
2500
- error: res_error,
2501
- } = BillingPlatformModel.Message().validate(responseData, {
2502
- abortEarly: false,
2503
- allowUnknown: true,
2504
- });
2505
-
2506
- if (res_error) {
2507
- if (this.config.options.strictResponseCheck === true) {
2508
- return Promise.reject(new FDKResponseValidationError(res_error));
2509
- } else {
2510
- Logger({
2511
- level: "WARN",
2512
- message: `Response Validation Warnings for platform > Billing > setupMandate \n ${res_error}`,
2513
- });
2514
- }
2515
- }
2516
-
2517
- return response;
2518
- }
2519
-
2520
- /**
2521
- * @param {BillingPlatformValidator.SetupPaymentParam} arg - Arg object
2522
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2523
- * @param {import("../PlatformAPIClient").Options} - Options
2524
- * @returns {Promise<BillingPlatformModel.SetupPayment>} - Success response
2525
- * @name setupPayment
2526
- * @summary: Setup Payment
2527
- * @description: Setup Payment - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/setupPayment/).
2528
- */
2529
- async setupPayment(
2530
- { body, requestHeaders } = { requestHeaders: {} },
2531
- { responseHeaders } = { responseHeaders: false }
2532
- ) {
2533
- const { error } = BillingPlatformValidator.setupPayment().validate(
2534
- {
2535
- body,
2536
- },
2537
- { abortEarly: false, allowUnknown: true }
2538
- );
2539
- if (error) {
2540
- return Promise.reject(new FDKClientValidationError(error));
2541
- }
2542
-
2543
- // Showing warrnings if extra unknown parameters are found
2544
- const {
2545
- error: warrning,
2546
- } = BillingPlatformValidator.setupPayment().validate(
2547
- {
2548
- body,
2549
- },
2550
- { abortEarly: false, allowUnknown: false }
2551
- );
2552
- if (warrning) {
2553
- Logger({
2554
- level: "WARN",
2555
- message: `Parameter Validation warrnings for platform > Billing > setupPayment \n ${warrning}`,
2556
- });
2557
- }
2558
-
2559
- const query_params = {};
2560
-
2561
- const xHeaders = {};
2562
-
2563
- const response = await PlatformAPIClient.execute(
2564
- this.config,
2565
- "post",
2566
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/setup/payment`,
2567
- query_params,
2568
- body,
2569
- { ...xHeaders, ...requestHeaders },
2570
- { responseHeaders }
2571
- );
2572
-
2573
- let responseData = response;
2574
- if (responseHeaders) {
2575
- responseData = response[0];
2576
- }
2577
-
2578
- const {
2579
- error: res_error,
2580
- } = BillingPlatformModel.SetupPayment().validate(responseData, {
2581
- abortEarly: false,
2582
- allowUnknown: true,
2583
- });
2584
-
2585
- if (res_error) {
2586
- if (this.config.options.strictResponseCheck === true) {
2587
- return Promise.reject(new FDKResponseValidationError(res_error));
2588
- } else {
2589
- Logger({
2590
- level: "WARN",
2591
- message: `Response Validation Warnings for platform > Billing > setupPayment \n ${res_error}`,
2592
- });
2593
- }
2594
- }
2595
-
2596
- return response;
2597
- }
2598
-
2599
- /**
2600
- * @param {BillingPlatformValidator.SubscriptionConfigsParam} arg - Arg object
2601
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2602
- * @param {import("../PlatformAPIClient").Options} - Options
2603
- * @returns {Promise<BillingPlatformModel.ConfigRes>} - Success response
2604
- * @name subscriptionConfigs
2605
- * @summary: API to get subscription config details
2606
- * @description: API to get subscription config details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/subscriptionConfigs/).
2607
- */
2608
- async subscriptionConfigs(
2609
- { requestHeaders } = { requestHeaders: {} },
2610
- { responseHeaders } = { responseHeaders: false }
2611
- ) {
2612
- const { error } = BillingPlatformValidator.subscriptionConfigs().validate(
2613
- {},
2614
- { abortEarly: false, allowUnknown: true }
2615
- );
2616
- if (error) {
2617
- return Promise.reject(new FDKClientValidationError(error));
2618
- }
2619
-
2620
- // Showing warrnings if extra unknown parameters are found
2621
- const {
2622
- error: warrning,
2623
- } = BillingPlatformValidator.subscriptionConfigs().validate(
2624
- {},
2625
- { abortEarly: false, allowUnknown: false }
2626
- );
2627
- if (warrning) {
2628
- Logger({
2629
- level: "WARN",
2630
- message: `Parameter Validation warrnings for platform > Billing > subscriptionConfigs \n ${warrning}`,
2631
- });
2632
- }
2633
-
2634
- const query_params = {};
2635
-
2636
- const xHeaders = {};
2637
-
2638
- const response = await PlatformAPIClient.execute(
2639
- this.config,
2640
- "get",
2641
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/configs`,
2642
- query_params,
2643
- undefined,
2644
- { ...xHeaders, ...requestHeaders },
2645
- { responseHeaders }
2646
- );
2647
-
2648
- let responseData = response;
2649
- if (responseHeaders) {
2650
- responseData = response[0];
2651
- }
2652
-
2653
- const {
2654
- error: res_error,
2655
- } = BillingPlatformModel.ConfigRes().validate(responseData, {
2656
- abortEarly: false,
2657
- allowUnknown: true,
2658
- });
2659
-
2660
- if (res_error) {
2661
- if (this.config.options.strictResponseCheck === true) {
2662
- return Promise.reject(new FDKResponseValidationError(res_error));
2663
- } else {
2664
- Logger({
2665
- level: "WARN",
2666
- message: `Response Validation Warnings for platform > Billing > subscriptionConfigs \n ${res_error}`,
2667
- });
2668
- }
2669
- }
2670
-
2671
- return response;
2672
- }
2673
-
2674
- /**
2675
- * @param {BillingPlatformValidator.SubscriptionMethodsParam} arg - Arg object
2676
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2677
- * @param {import("../PlatformAPIClient").Options} - Options
2678
- * @returns {Promise<BillingPlatformModel.SubscriptionMethods>} - Success response
2679
- * @name subscriptionMethods
2680
- * @summary: API to get subscription methods
2681
- * @description: API to get subscription methods. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/subscriptionMethods/).
2682
- */
2683
- async subscriptionMethods(
2684
- { uniqueExternalId, requestHeaders } = { requestHeaders: {} },
2685
- { responseHeaders } = { responseHeaders: false }
2686
- ) {
2687
- const { error } = BillingPlatformValidator.subscriptionMethods().validate(
2688
- {
2689
- uniqueExternalId,
2690
- },
2691
- { abortEarly: false, allowUnknown: true }
2692
- );
2693
- if (error) {
2694
- return Promise.reject(new FDKClientValidationError(error));
2695
- }
2696
-
2697
- // Showing warrnings if extra unknown parameters are found
2698
- const {
2699
- error: warrning,
2700
- } = BillingPlatformValidator.subscriptionMethods().validate(
2701
- {
2702
- uniqueExternalId,
2703
- },
2704
- { abortEarly: false, allowUnknown: false }
2705
- );
2706
- if (warrning) {
2707
- Logger({
2708
- level: "WARN",
2709
- message: `Parameter Validation warrnings for platform > Billing > subscriptionMethods \n ${warrning}`,
2710
- });
2711
- }
2712
-
2713
- const query_params = {};
2714
- query_params["unique_external_id"] = uniqueExternalId;
2715
-
2716
- const xHeaders = {};
2717
-
2718
- const response = await PlatformAPIClient.execute(
2719
- this.config,
2720
- "get",
2721
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/methods`,
2722
- query_params,
2723
- undefined,
2724
- { ...xHeaders, ...requestHeaders },
2725
- { responseHeaders }
2726
- );
2727
-
2728
- let responseData = response;
2729
- if (responseHeaders) {
2730
- responseData = response[0];
2731
- }
2732
-
2733
- const {
2734
- error: res_error,
2735
- } = BillingPlatformModel.SubscriptionMethods().validate(responseData, {
2736
- abortEarly: false,
2737
- allowUnknown: true,
2738
- });
2739
-
2740
- if (res_error) {
2741
- if (this.config.options.strictResponseCheck === true) {
2742
- return Promise.reject(new FDKResponseValidationError(res_error));
2743
- } else {
2744
- Logger({
2745
- level: "WARN",
2746
- message: `Response Validation Warnings for platform > Billing > subscriptionMethods \n ${res_error}`,
2747
- });
2748
- }
2749
- }
2750
-
2751
- return response;
2752
- }
2753
-
2754
- /**
2755
- * @param {BillingPlatformValidator.SubscriptionMethodsDeleteParam} arg - Arg object
2756
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2757
- * @param {import("../PlatformAPIClient").Options} - Options
2758
- * @returns {Promise<BillingPlatformModel.ResourceNotFound>} - Success response
2759
- * @name subscriptionMethodsDelete
2760
- * @summary: API to get subscription methods
2761
- * @description: API to get subscription methods. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/subscriptionMethodsDelete/).
2762
- */
2763
- async subscriptionMethodsDelete(
2764
- { uniqueExternalId, paymentMethodId, requestHeaders } = {
2765
- requestHeaders: {},
2766
- },
2767
- { responseHeaders } = { responseHeaders: false }
2768
- ) {
2769
- const {
2770
- error,
2771
- } = BillingPlatformValidator.subscriptionMethodsDelete().validate(
2772
- {
2773
- uniqueExternalId,
2774
- paymentMethodId,
2775
- },
2776
- { abortEarly: false, allowUnknown: true }
2777
- );
2778
- if (error) {
2779
- return Promise.reject(new FDKClientValidationError(error));
2780
- }
2781
-
2782
- // Showing warrnings if extra unknown parameters are found
2783
- const {
2784
- error: warrning,
2785
- } = BillingPlatformValidator.subscriptionMethodsDelete().validate(
2786
- {
2787
- uniqueExternalId,
2788
- paymentMethodId,
2789
- },
2790
- { abortEarly: false, allowUnknown: false }
2791
- );
2792
- if (warrning) {
2793
- Logger({
2794
- level: "WARN",
2795
- message: `Parameter Validation warrnings for platform > Billing > subscriptionMethodsDelete \n ${warrning}`,
2796
- });
2797
- }
2798
-
2799
- const query_params = {};
2800
- query_params["unique_external_id"] = uniqueExternalId;
2801
- query_params["payment_method_id"] = paymentMethodId;
2802
-
2803
- const xHeaders = {};
2804
-
2805
- const response = await PlatformAPIClient.execute(
2806
- this.config,
2807
- "delete",
2808
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/methods`,
2809
- query_params,
2810
- undefined,
2811
- { ...xHeaders, ...requestHeaders },
2812
- { responseHeaders }
2813
- );
2814
-
2815
- let responseData = response;
2816
- if (responseHeaders) {
2817
- responseData = response[0];
2818
- }
2819
-
2820
- const {
2821
- error: res_error,
2822
- } = BillingPlatformModel.ResourceNotFound().validate(responseData, {
2823
- abortEarly: false,
2824
- allowUnknown: true,
2825
- });
2826
-
2827
- if (res_error) {
2828
- if (this.config.options.strictResponseCheck === true) {
2829
- return Promise.reject(new FDKResponseValidationError(res_error));
2830
- } else {
2831
- Logger({
2832
- level: "WARN",
2833
- message: `Response Validation Warnings for platform > Billing > subscriptionMethodsDelete \n ${res_error}`,
2834
- });
2835
- }
2836
- }
2837
-
2838
- return response;
2839
- }
2840
-
2841
- /**
2842
- * @param {BillingPlatformValidator.SubscriptionPlanChangeParam} arg - Arg object
2843
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2844
- * @param {import("../PlatformAPIClient").Options} - Options
2845
- * @returns {Promise<BillingPlatformModel.PlanChangeDetails>} - Success response
2846
- * @name subscriptionPlanChange
2847
- * @summary: API to get plan change details of subscription
2848
- * @description: API to get plan change details of subscription. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/subscriptionPlanChange/).
2849
- */
2850
- async subscriptionPlanChange(
2851
- { productSuite, coupon, uniqueId, platform, planId, requestHeaders } = {
2852
- requestHeaders: {},
2853
- },
2854
- { responseHeaders } = { responseHeaders: false }
2855
- ) {
2856
- const {
2857
- error,
2858
- } = BillingPlatformValidator.subscriptionPlanChange().validate(
2859
- {
2860
- productSuite,
2861
- coupon,
2862
- uniqueId,
2863
- platform,
2864
- planId,
2865
- },
2866
- { abortEarly: false, allowUnknown: true }
2867
- );
2868
- if (error) {
2869
- return Promise.reject(new FDKClientValidationError(error));
2870
- }
2871
-
2872
- // Showing warrnings if extra unknown parameters are found
2873
- const {
2874
- error: warrning,
2875
- } = BillingPlatformValidator.subscriptionPlanChange().validate(
2876
- {
2877
- productSuite,
2878
- coupon,
2879
- uniqueId,
2880
- platform,
2881
- planId,
2882
- },
2883
- { abortEarly: false, allowUnknown: false }
2884
- );
2885
- if (warrning) {
2886
- Logger({
2887
- level: "WARN",
2888
- message: `Parameter Validation warrnings for platform > Billing > subscriptionPlanChange \n ${warrning}`,
2889
- });
2890
- }
2891
-
2892
- const query_params = {};
2893
- query_params["product_suite"] = productSuite;
2894
- query_params["coupon"] = coupon;
2895
- query_params["unique_id"] = uniqueId;
2896
- query_params["platform"] = platform;
2897
- query_params["plan_id"] = planId;
2898
-
2899
- const xHeaders = {};
2900
-
2901
- const response = await PlatformAPIClient.execute(
2902
- this.config,
2903
- "get",
2904
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/plan-change`,
2905
- query_params,
2906
- undefined,
2907
- { ...xHeaders, ...requestHeaders },
2908
- { responseHeaders }
2909
- );
2910
-
2911
- let responseData = response;
2912
- if (responseHeaders) {
2913
- responseData = response[0];
2914
- }
2915
-
2916
- const {
2917
- error: res_error,
2918
- } = BillingPlatformModel.PlanChangeDetails().validate(responseData, {
2919
- abortEarly: false,
2920
- allowUnknown: true,
2921
- });
2922
-
2923
- if (res_error) {
2924
- if (this.config.options.strictResponseCheck === true) {
2925
- return Promise.reject(new FDKResponseValidationError(res_error));
2926
- } else {
2927
- Logger({
2928
- level: "WARN",
2929
- message: `Response Validation Warnings for platform > Billing > subscriptionPlanChange \n ${res_error}`,
2930
- });
2931
- }
2932
- }
2933
-
2934
- return response;
2935
- }
2936
-
2937
- /**
2938
- * @param {BillingPlatformValidator.SubscriptionRenewParam} arg - Arg object
2939
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
2940
- * @param {import("../PlatformAPIClient").Options} - Options
2941
- * @returns {Promise<BillingPlatformModel.SubscriptionRenewRes>} - Success response
2942
- * @name subscriptionRenew
2943
- * @summary: Subscription Renew
2944
- * @description: Subscription Renew - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/subscriptionRenew/).
2945
- */
2946
- async subscriptionRenew(
2947
- { body, requestHeaders } = { requestHeaders: {} },
2948
- { responseHeaders } = { responseHeaders: false }
2949
- ) {
2950
- const { error } = BillingPlatformValidator.subscriptionRenew().validate(
2951
- {
2952
- body,
2953
- },
2954
- { abortEarly: false, allowUnknown: true }
2955
- );
2956
- if (error) {
2957
- return Promise.reject(new FDKClientValidationError(error));
2958
- }
2959
-
2960
- // Showing warrnings if extra unknown parameters are found
2961
- const {
2962
- error: warrning,
2963
- } = BillingPlatformValidator.subscriptionRenew().validate(
2964
- {
2965
- body,
2966
- },
2967
- { abortEarly: false, allowUnknown: false }
2968
- );
2969
- if (warrning) {
2970
- Logger({
2971
- level: "WARN",
2972
- message: `Parameter Validation warrnings for platform > Billing > subscriptionRenew \n ${warrning}`,
2973
- });
2974
- }
2975
-
2976
- const query_params = {};
2977
-
2978
- const xHeaders = {};
2979
-
2980
- const response = await PlatformAPIClient.execute(
2981
- this.config,
2982
- "post",
2983
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/renew`,
2984
- query_params,
2985
- body,
2986
- { ...xHeaders, ...requestHeaders },
2987
- { responseHeaders }
2988
- );
2989
-
2990
- let responseData = response;
2991
- if (responseHeaders) {
2992
- responseData = response[0];
2993
- }
2994
-
2995
- const {
2996
- error: res_error,
2997
- } = BillingPlatformModel.SubscriptionRenewRes().validate(responseData, {
2998
- abortEarly: false,
2999
- allowUnknown: true,
3000
- });
3001
-
3002
- if (res_error) {
3003
- if (this.config.options.strictResponseCheck === true) {
3004
- return Promise.reject(new FDKResponseValidationError(res_error));
3005
- } else {
3006
- Logger({
3007
- level: "WARN",
3008
- message: `Response Validation Warnings for platform > Billing > subscriptionRenew \n ${res_error}`,
3009
- });
3010
- }
3011
- }
3012
-
3013
- return response;
3014
- }
3015
-
3016
- /**
3017
- * @param {BillingPlatformValidator.TopupCancelCreditParam} arg - Arg object
3018
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3019
- * @param {import("../PlatformAPIClient").Options} - Options
3020
- * @returns {Promise<BillingPlatformModel.CancelTopupRes>} - Success response
3021
- * @name topupCancelCredit
3022
- * @summary: Cancel Topup
3023
- * @description: Cancel Topup - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/topupCancelCredit/).
3024
- */
3025
- async topupCancelCredit(
3026
- { body, requestHeaders } = { requestHeaders: {} },
3027
- { responseHeaders } = { responseHeaders: false }
3028
- ) {
3029
- const { error } = BillingPlatformValidator.topupCancelCredit().validate(
3030
- {
3031
- body,
3032
- },
3033
- { abortEarly: false, allowUnknown: true }
3034
- );
3035
- if (error) {
3036
- return Promise.reject(new FDKClientValidationError(error));
3037
- }
3038
-
3039
- // Showing warrnings if extra unknown parameters are found
3040
- const {
3041
- error: warrning,
3042
- } = BillingPlatformValidator.topupCancelCredit().validate(
3043
- {
3044
- body,
3045
- },
3046
- { abortEarly: false, allowUnknown: false }
3047
- );
3048
- if (warrning) {
3049
- Logger({
3050
- level: "WARN",
3051
- message: `Parameter Validation warrnings for platform > Billing > topupCancelCredit \n ${warrning}`,
3052
- });
3053
- }
3054
-
3055
- const query_params = {};
3056
-
3057
- const xHeaders = {};
3058
-
3059
- const response = await PlatformAPIClient.execute(
3060
- this.config,
3061
- "post",
3062
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/topup/cancel`,
3063
- query_params,
3064
- body,
3065
- { ...xHeaders, ...requestHeaders },
3066
- { responseHeaders }
3067
- );
3068
-
3069
- let responseData = response;
3070
- if (responseHeaders) {
3071
- responseData = response[0];
3072
- }
3073
-
3074
- const {
3075
- error: res_error,
3076
- } = BillingPlatformModel.CancelTopupRes().validate(responseData, {
3077
- abortEarly: false,
3078
- allowUnknown: true,
3079
- });
3080
-
3081
- if (res_error) {
3082
- if (this.config.options.strictResponseCheck === true) {
3083
- return Promise.reject(new FDKResponseValidationError(res_error));
3084
- } else {
3085
- Logger({
3086
- level: "WARN",
3087
- message: `Response Validation Warnings for platform > Billing > topupCancelCredit \n ${res_error}`,
3088
- });
3089
- }
3090
- }
3091
-
3092
- return response;
3093
- }
3094
-
3095
- /**
3096
- * @param {BillingPlatformValidator.TopupCreditParam} arg - Arg object
3097
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3098
- * @param {import("../PlatformAPIClient").Options} - Options
3099
- * @returns {Promise<BillingPlatformModel.TopupRes>} - Success response
3100
- * @name topupCredit
3101
- * @summary: Topup
3102
- * @description: Topup - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/topupCredit/).
3103
- */
3104
- async topupCredit(
3105
- { body, requestHeaders } = { requestHeaders: {} },
3106
- { responseHeaders } = { responseHeaders: false }
3107
- ) {
3108
- const { error } = BillingPlatformValidator.topupCredit().validate(
3109
- {
3110
- body,
3111
- },
3112
- { abortEarly: false, allowUnknown: true }
3113
- );
3114
- if (error) {
3115
- return Promise.reject(new FDKClientValidationError(error));
3116
- }
3117
-
3118
- // Showing warrnings if extra unknown parameters are found
3119
- const { error: warrning } = BillingPlatformValidator.topupCredit().validate(
3120
- {
3121
- body,
3122
- },
3123
- { abortEarly: false, allowUnknown: false }
3124
- );
3125
- if (warrning) {
3126
- Logger({
3127
- level: "WARN",
3128
- message: `Parameter Validation warrnings for platform > Billing > topupCredit \n ${warrning}`,
3129
- });
3130
- }
3131
-
3132
- const query_params = {};
3133
-
3134
- const xHeaders = {};
3135
-
3136
- const response = await PlatformAPIClient.execute(
3137
- this.config,
3138
- "post",
3139
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/topup`,
3140
- query_params,
3141
- body,
3142
- { ...xHeaders, ...requestHeaders },
3143
- { responseHeaders }
3144
- );
3145
-
3146
- let responseData = response;
3147
- if (responseHeaders) {
3148
- responseData = response[0];
3149
- }
3150
-
3151
- const {
3152
- error: res_error,
3153
- } = BillingPlatformModel.TopupRes().validate(responseData, {
3154
- abortEarly: false,
3155
- allowUnknown: true,
3156
- });
3157
-
3158
- if (res_error) {
3159
- if (this.config.options.strictResponseCheck === true) {
3160
- return Promise.reject(new FDKResponseValidationError(res_error));
3161
- } else {
3162
- Logger({
3163
- level: "WARN",
3164
- message: `Response Validation Warnings for platform > Billing > topupCredit \n ${res_error}`,
3165
- });
3166
- }
3167
- }
3168
-
3169
- return response;
3170
- }
3171
-
3172
- /**
3173
- * @param {BillingPlatformValidator.UpdateConsentParam} arg - Arg object
3174
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3175
- * @param {import("../PlatformAPIClient").Options} - Options
3176
- * @returns {Promise<BillingPlatformModel.StatusMessage>} - Success response
3177
- * @name updateConsent
3178
- * @summary: Update Consent
3179
- * @description: Update Consent - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/updateConsent/).
3180
- */
3181
- async updateConsent(
3182
- { subscriberId, requestHeaders } = { requestHeaders: {} },
3183
- { responseHeaders } = { responseHeaders: false }
3184
- ) {
3185
- const { error } = BillingPlatformValidator.updateConsent().validate(
3186
- {
3187
- subscriberId,
3188
- },
3189
- { abortEarly: false, allowUnknown: true }
3190
- );
3191
- if (error) {
3192
- return Promise.reject(new FDKClientValidationError(error));
3193
- }
3194
-
3195
- // Showing warrnings if extra unknown parameters are found
3196
- const {
3197
- error: warrning,
3198
- } = BillingPlatformValidator.updateConsent().validate(
3199
- {
3200
- subscriberId,
3201
- },
3202
- { abortEarly: false, allowUnknown: false }
3203
- );
3204
- if (warrning) {
3205
- Logger({
3206
- level: "WARN",
3207
- message: `Parameter Validation warrnings for platform > Billing > updateConsent \n ${warrning}`,
3208
- });
3209
- }
3210
-
3211
- const query_params = {};
3212
- query_params["subscriber_id"] = subscriberId;
3213
-
3214
- const xHeaders = {};
3215
-
3216
- const response = await PlatformAPIClient.execute(
3217
- this.config,
3218
- "put",
3219
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/consent`,
3220
- query_params,
3221
- undefined,
3222
- { ...xHeaders, ...requestHeaders },
3223
- { responseHeaders }
3224
- );
3225
-
3226
- let responseData = response;
3227
- if (responseHeaders) {
3228
- responseData = response[0];
3229
- }
3230
-
3231
- const {
3232
- error: res_error,
3233
- } = BillingPlatformModel.StatusMessage().validate(responseData, {
3234
- abortEarly: false,
3235
- allowUnknown: true,
3236
- });
3237
-
3238
- if (res_error) {
3239
- if (this.config.options.strictResponseCheck === true) {
3240
- return Promise.reject(new FDKResponseValidationError(res_error));
3241
- } else {
3242
- Logger({
3243
- level: "WARN",
3244
- message: `Response Validation Warnings for platform > Billing > updateConsent \n ${res_error}`,
3245
- });
3246
- }
3247
- }
3248
-
3249
- return response;
3250
- }
3251
-
3252
- /**
3253
- * @param {BillingPlatformValidator.UpdateSetupIntentParam} arg - Arg object
3254
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3255
- * @param {import("../PlatformAPIClient").Options} - Options
3256
- * @returns {Promise<BillingPlatformModel.StatusMessage>} - Success response
3257
- * @name updateSetupIntent
3258
- * @summary: Setup Intent
3259
- * @description: Setup Intent - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/updateSetupIntent/).
3260
- */
3261
- async updateSetupIntent(
3262
- { body, requestHeaders } = { requestHeaders: {} },
3263
- { responseHeaders } = { responseHeaders: false }
3264
- ) {
3265
- const { error } = BillingPlatformValidator.updateSetupIntent().validate(
3266
- {
3267
- body,
3268
- },
3269
- { abortEarly: false, allowUnknown: true }
3270
- );
3271
- if (error) {
3272
- return Promise.reject(new FDKClientValidationError(error));
3273
- }
3274
-
3275
- // Showing warrnings if extra unknown parameters are found
3276
- const {
3277
- error: warrning,
3278
- } = BillingPlatformValidator.updateSetupIntent().validate(
3279
- {
3280
- body,
3281
- },
3282
- { abortEarly: false, allowUnknown: false }
3283
- );
3284
- if (warrning) {
3285
- Logger({
3286
- level: "WARN",
3287
- message: `Parameter Validation warrnings for platform > Billing > updateSetupIntent \n ${warrning}`,
3288
- });
3289
- }
3290
-
3291
- const query_params = {};
3292
-
3293
- const xHeaders = {};
3294
-
3295
- const response = await PlatformAPIClient.execute(
3296
- this.config,
3297
- "put",
3298
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/setup/intent`,
3299
- query_params,
3300
- body,
3301
- { ...xHeaders, ...requestHeaders },
3302
- { responseHeaders }
3303
- );
3304
-
3305
- let responseData = response;
3306
- if (responseHeaders) {
3307
- responseData = response[0];
3308
- }
3309
-
3310
- const {
3311
- error: res_error,
3312
- } = BillingPlatformModel.StatusMessage().validate(responseData, {
3313
- abortEarly: false,
3314
- allowUnknown: true,
3315
- });
3316
-
3317
- if (res_error) {
3318
- if (this.config.options.strictResponseCheck === true) {
3319
- return Promise.reject(new FDKResponseValidationError(res_error));
3320
- } else {
3321
- Logger({
3322
- level: "WARN",
3323
- message: `Response Validation Warnings for platform > Billing > updateSetupIntent \n ${res_error}`,
3324
- });
3325
- }
3326
- }
3327
-
3328
- return response;
3329
- }
3330
-
3331
- /**
3332
- * @param {BillingPlatformValidator.UpgradePlanParam} arg - Arg object
3333
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3334
- * @param {import("../PlatformAPIClient").Options} - Options
3335
- * @returns {Promise<BillingPlatformModel.ResourceNotFound>} - Success response
3336
- * @name upgradePlan
3337
- * @summary: Post Methods
3338
- * @description: Admin user can modify the subscription plan for an seller account. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/upgradePlan/).
3339
- */
3340
- async upgradePlan(
3341
- { body, requestHeaders } = { requestHeaders: {} },
3342
- { responseHeaders } = { responseHeaders: false }
3343
- ) {
3344
- const { error } = BillingPlatformValidator.upgradePlan().validate(
3345
- {
3346
- body,
3347
- },
3348
- { abortEarly: false, allowUnknown: true }
3349
- );
3350
- if (error) {
3351
- return Promise.reject(new FDKClientValidationError(error));
3352
- }
3353
-
3354
- // Showing warrnings if extra unknown parameters are found
3355
- const { error: warrning } = BillingPlatformValidator.upgradePlan().validate(
3356
- {
3357
- body,
3358
- },
3359
- { abortEarly: false, allowUnknown: false }
3360
- );
3361
- if (warrning) {
3362
- Logger({
3363
- level: "WARN",
3364
- message: `Parameter Validation warrnings for platform > Billing > upgradePlan \n ${warrning}`,
3365
- });
3366
- }
3367
-
3368
- const query_params = {};
3369
-
3370
- const xHeaders = {};
3371
-
3372
- const response = await PlatformAPIClient.execute(
3373
- this.config,
3374
- "post",
3375
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/methods`,
3376
- query_params,
3377
- body,
3378
- { ...xHeaders, ...requestHeaders },
3379
- { responseHeaders }
3380
- );
3381
-
3382
- let responseData = response;
3383
- if (responseHeaders) {
3384
- responseData = response[0];
3385
- }
3386
-
3387
- const {
3388
- error: res_error,
3389
- } = BillingPlatformModel.ResourceNotFound().validate(responseData, {
3390
- abortEarly: false,
3391
- allowUnknown: true,
3392
- });
3393
-
3394
- if (res_error) {
3395
- if (this.config.options.strictResponseCheck === true) {
3396
- return Promise.reject(new FDKResponseValidationError(res_error));
3397
- } else {
3398
- Logger({
3399
- level: "WARN",
3400
- message: `Response Validation Warnings for platform > Billing > upgradePlan \n ${res_error}`,
3401
- });
3402
- }
3403
- }
3404
-
3405
- return response;
3406
- }
3407
-
3408
- /**
3409
- * @param {BillingPlatformValidator.UpsertCustomerDetailParam} arg - Arg object
3410
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3411
- * @param {import("../PlatformAPIClient").Options} - Options
3412
- * @returns {Promise<BillingPlatformModel.SubscriptionCustomer>} - Success response
3413
- * @name upsertCustomerDetail
3414
- * @summary: Update or insert customer details.
3415
- * @description: Allows you to modify or insert customer information in the billing system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/upsertCustomerDetail/).
3416
- */
3417
- async upsertCustomerDetail(
3418
- { body, requestHeaders } = { requestHeaders: {} },
3419
- { responseHeaders } = { responseHeaders: false }
3420
- ) {
3421
- const { error } = BillingPlatformValidator.upsertCustomerDetail().validate(
3422
- {
3423
- body,
3424
- },
3425
- { abortEarly: false, allowUnknown: true }
3426
- );
3427
- if (error) {
3428
- return Promise.reject(new FDKClientValidationError(error));
3429
- }
3430
-
3431
- // Showing warrnings if extra unknown parameters are found
3432
- const {
3433
- error: warrning,
3434
- } = BillingPlatformValidator.upsertCustomerDetail().validate(
3435
- {
3436
- body,
3437
- },
3438
- { abortEarly: false, allowUnknown: false }
3439
- );
3440
- if (warrning) {
3441
- Logger({
3442
- level: "WARN",
3443
- message: `Parameter Validation warrnings for platform > Billing > upsertCustomerDetail \n ${warrning}`,
3444
- });
3445
- }
3446
-
3447
- const query_params = {};
3448
-
3449
- const xHeaders = {};
3450
-
3451
- const response = await PlatformAPIClient.execute(
3452
- this.config,
3453
- "post",
3454
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/customer-detail`,
3455
- query_params,
3456
- body,
3457
- { ...xHeaders, ...requestHeaders },
3458
- { responseHeaders }
3459
- );
3460
-
3461
- let responseData = response;
3462
- if (responseHeaders) {
3463
- responseData = response[0];
3464
- }
3465
-
3466
- const {
3467
- error: res_error,
3468
- } = BillingPlatformModel.SubscriptionCustomer().validate(responseData, {
3469
- abortEarly: false,
3470
- allowUnknown: true,
3471
- });
3472
-
3473
- if (res_error) {
3474
- if (this.config.options.strictResponseCheck === true) {
3475
- return Promise.reject(new FDKResponseValidationError(res_error));
3476
- } else {
3477
- Logger({
3478
- level: "WARN",
3479
- message: `Response Validation Warnings for platform > Billing > upsertCustomerDetail \n ${res_error}`,
3480
- });
3481
- }
3482
- }
3483
-
3484
- return response;
3485
- }
3486
-
3487
- /**
3488
- * @param {BillingPlatformValidator.VerifyPaymentParam} arg - Arg object
3489
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
3490
- * @param {import("../PlatformAPIClient").Options} - Options
3491
- * @returns {Promise<BillingPlatformModel.VerifyPaymentRes>} - Success response
3492
- * @name verifyPayment
3493
- * @summary: API to verify subscription payment
3494
- * @description: API to verify subscription payment. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/billing/verifyPayment/).
3495
- */
3496
- async verifyPayment(
3497
- { body, requestHeaders } = { requestHeaders: {} },
3498
- { responseHeaders } = { responseHeaders: false }
3499
- ) {
3500
- const { error } = BillingPlatformValidator.verifyPayment().validate(
3501
- {
3502
- body,
3503
- },
3504
- { abortEarly: false, allowUnknown: true }
3505
- );
3506
- if (error) {
3507
- return Promise.reject(new FDKClientValidationError(error));
3508
- }
3509
-
3510
- // Showing warrnings if extra unknown parameters are found
3511
- const {
3512
- error: warrning,
3513
- } = BillingPlatformValidator.verifyPayment().validate(
3514
- {
3515
- body,
3516
- },
3517
- { abortEarly: false, allowUnknown: false }
3518
- );
3519
- if (warrning) {
3520
- Logger({
3521
- level: "WARN",
3522
- message: `Parameter Validation warrnings for platform > Billing > verifyPayment \n ${warrning}`,
3523
- });
3524
- }
3525
-
3526
- const query_params = {};
3527
-
3528
- const xHeaders = {};
3529
-
3530
- const response = await PlatformAPIClient.execute(
3531
- this.config,
3532
- "post",
3533
- `/service/platform/billing/v1.0/company/${this.config.companyId}/subscription/verify-payment`,
3534
- query_params,
3535
- body,
3536
- { ...xHeaders, ...requestHeaders },
3537
- { responseHeaders }
3538
- );
3539
-
3540
- let responseData = response;
3541
- if (responseHeaders) {
3542
- responseData = response[0];
3543
- }
3544
-
3545
- const {
3546
- error: res_error,
3547
- } = BillingPlatformModel.VerifyPaymentRes().validate(responseData, {
3548
- abortEarly: false,
3549
- allowUnknown: true,
3550
- });
3551
-
3552
- if (res_error) {
3553
- if (this.config.options.strictResponseCheck === true) {
3554
- return Promise.reject(new FDKResponseValidationError(res_error));
3555
- } else {
3556
- Logger({
3557
- level: "WARN",
3558
- message: `Response Validation Warnings for platform > Billing > verifyPayment \n ${res_error}`,
420
+ message: `Response Validation Warnings for platform > Billing > getSubscriptionCharge \n ${res_error}`,
3559
421
  });
3560
422
  }
3561
423
  }