@gofynd/fdk-client-javascript 1.4.8 → 1.4.10-beta.1

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