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