@gofynd/fdk-client-javascript 1.3.6-beta.1 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/sdk/application/ApplicationConfig.d.ts +11 -3
  4. package/sdk/application/ApplicationConfig.js +21 -3
  5. package/sdk/application/Cart/CartApplicationClient.js +228 -113
  6. package/sdk/application/Catalog/CatalogApplicationClient.js +244 -121
  7. package/sdk/application/Common/CommonApplicationClient.js +20 -9
  8. package/sdk/application/Communication/CommunicationApplicationClient.js +28 -13
  9. package/sdk/application/Configuration/ConfigurationApplicationClient.js +132 -65
  10. package/sdk/application/Content/ContentApplicationClient.js +156 -77
  11. package/sdk/application/FileStorage/FileStorageApplicationClient.js +28 -13
  12. package/sdk/application/Lead/LeadApplicationClient.js +60 -29
  13. package/sdk/application/Logistic/LogisticApplicationClient.js +44 -21
  14. package/sdk/application/Order/OrderApplicationClient.js +100 -49
  15. package/sdk/application/Payment/PaymentApplicationClient.js +340 -169
  16. package/sdk/application/PosCart/PosCartApplicationClient.js +220 -109
  17. package/sdk/application/Rewards/RewardsApplicationClient.js +60 -29
  18. package/sdk/application/Share/ShareApplicationClient.js +60 -29
  19. package/sdk/application/Theme/ThemeApplicationClient.js +36 -17
  20. package/sdk/application/User/UserApplicationClient.js +324 -161
  21. package/sdk/common/AxiosHelper.js +3 -3
  22. package/sdk/common/FDKError.d.ts +4 -0
  23. package/sdk/common/FDKError.js +9 -0
  24. package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +16 -40
  25. package/sdk/partner/FileStorage/FileStoragePartnerClient.js +160 -38
  26. package/sdk/partner/PartnerConfig.d.ts +10 -0
  27. package/sdk/partner/PartnerConfig.js +10 -1
  28. package/sdk/partner/Theme/ThemePartnerClient.d.ts +96 -199
  29. package/sdk/partner/Theme/ThemePartnerClient.js +935 -170
  30. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +36 -17
  31. package/sdk/platform/Billing/BillingPlatformClient.js +140 -69
  32. package/sdk/platform/Cart/CartPlatformApplicationClient.js +456 -228
  33. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +512 -256
  34. package/sdk/platform/Catalog/CatalogPlatformClient.js +620 -309
  35. package/sdk/platform/Common/CommonPlatformClient.js +20 -9
  36. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +472 -236
  37. package/sdk/platform/Communication/CommunicationPlatformClient.js +12 -5
  38. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +14 -1
  39. package/sdk/platform/Communication/CommunicationPlatformModel.js +16 -0
  40. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +116 -57
  41. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +256 -128
  42. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +148 -73
  43. package/sdk/platform/Content/ContentPlatformApplicationClient.js +552 -276
  44. package/sdk/platform/Discount/DiscountPlatformClient.js +92 -45
  45. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +88 -44
  46. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +52 -25
  47. package/sdk/platform/Finance/FinancePlatformClient.js +196 -97
  48. package/sdk/platform/Inventory/InventoryPlatformClient.js +100 -49
  49. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +104 -52
  50. package/sdk/platform/Lead/LeadPlatformClient.js +92 -45
  51. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +26 -0
  52. package/sdk/platform/Order/OrderPlatformApplicationClient.js +239 -5
  53. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +57 -1
  54. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +55 -0
  55. package/sdk/platform/Order/OrderPlatformClient.js +356 -177
  56. package/sdk/platform/Order/OrderPlatformModel.d.ts +44 -5
  57. package/sdk/platform/Order/OrderPlatformModel.js +52 -4
  58. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +16 -8
  59. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +336 -168
  60. package/sdk/platform/Payment/PaymentPlatformClient.js +84 -41
  61. package/sdk/platform/PlatformConfig.d.ts +10 -0
  62. package/sdk/platform/PlatformConfig.js +10 -1
  63. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +96 -48
  64. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +112 -56
  65. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +148 -73
  66. package/sdk/platform/Share/SharePlatformApplicationClient.js +40 -20
  67. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +224 -112
  68. package/sdk/platform/Theme/ThemePlatformClient.js +28 -13
  69. package/sdk/platform/User/UserPlatformApplicationClient.js +144 -72
  70. package/sdk/platform/Webhook/WebhookPlatformClient.js +132 -65
  71. package/sdk/public/Configuration/ConfigurationPublicClient.js +20 -9
  72. package/sdk/public/Inventory/InventoryPublicClient.js +52 -25
  73. package/sdk/public/Partner/PartnerPublicClient.js +12 -5
  74. package/sdk/public/PublicConfig.d.ts +11 -1
  75. package/sdk/public/PublicConfig.js +10 -1
  76. package/sdk/public/Webhook/WebhookPublicClient.js +20 -9
@@ -1,5 +1,8 @@
1
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
3
6
  const Paginator = require("../../common/Paginator");
4
7
  const PaymentPlatformValidator = require("./PaymentPlatformValidator");
5
8
  const PaymentPlatformModel = require("./PaymentPlatformModel");
@@ -81,10 +84,14 @@ class Payment {
81
84
  });
82
85
 
83
86
  if (res_error) {
84
- Logger({
85
- level: "WARN",
86
- message: `Response Validation Warnnings for platform > Payment > activateAndDectivatePayout \n ${res_error}`,
87
- });
87
+ if (this.config.options.strictResponseCheck === true) {
88
+ return Promise.reject(new FDKResponseValidationError(res_error));
89
+ } else {
90
+ Logger({
91
+ level: "WARN",
92
+ message: `Response Validation Warnings for platform > Payment > activateAndDectivatePayout \n ${res_error}`,
93
+ });
94
+ }
88
95
  }
89
96
 
90
97
  return response;
@@ -156,10 +163,14 @@ class Payment {
156
163
  });
157
164
 
158
165
  if (res_error) {
159
- Logger({
160
- level: "WARN",
161
- message: `Response Validation Warnnings for platform > Payment > deletePayout \n ${res_error}`,
162
- });
166
+ if (this.config.options.strictResponseCheck === true) {
167
+ return Promise.reject(new FDKResponseValidationError(res_error));
168
+ } else {
169
+ Logger({
170
+ level: "WARN",
171
+ message: `Response Validation Warnings for platform > Payment > deletePayout \n ${res_error}`,
172
+ });
173
+ }
163
174
  }
164
175
 
165
176
  return response;
@@ -243,10 +254,14 @@ class Payment {
243
254
  );
244
255
 
245
256
  if (res_error) {
246
- Logger({
247
- level: "WARN",
248
- message: `Response Validation Warnnings for platform > Payment > deleteSubscriptionPaymentMethod \n ${res_error}`,
249
- });
257
+ if (this.config.options.strictResponseCheck === true) {
258
+ return Promise.reject(new FDKResponseValidationError(res_error));
259
+ } else {
260
+ Logger({
261
+ level: "WARN",
262
+ message: `Response Validation Warnings for platform > Payment > deleteSubscriptionPaymentMethod \n ${res_error}`,
263
+ });
264
+ }
250
265
  }
251
266
 
252
267
  return response;
@@ -319,10 +334,14 @@ class Payment {
319
334
  });
320
335
 
321
336
  if (res_error) {
322
- Logger({
323
- level: "WARN",
324
- message: `Response Validation Warnnings for platform > Payment > getAllPayouts \n ${res_error}`,
325
- });
337
+ if (this.config.options.strictResponseCheck === true) {
338
+ return Promise.reject(new FDKResponseValidationError(res_error));
339
+ } else {
340
+ Logger({
341
+ level: "WARN",
342
+ message: `Response Validation Warnings for platform > Payment > getAllPayouts \n ${res_error}`,
343
+ });
344
+ }
326
345
  }
327
346
 
328
347
  return response;
@@ -391,10 +410,14 @@ class Payment {
391
410
  );
392
411
 
393
412
  if (res_error) {
394
- Logger({
395
- level: "WARN",
396
- message: `Response Validation Warnnings for platform > Payment > getSubscriptionConfig \n ${res_error}`,
397
- });
413
+ if (this.config.options.strictResponseCheck === true) {
414
+ return Promise.reject(new FDKResponseValidationError(res_error));
415
+ } else {
416
+ Logger({
417
+ level: "WARN",
418
+ message: `Response Validation Warnings for platform > Payment > getSubscriptionConfig \n ${res_error}`,
419
+ });
420
+ }
398
421
  }
399
422
 
400
423
  return response;
@@ -473,10 +496,14 @@ class Payment {
473
496
  );
474
497
 
475
498
  if (res_error) {
476
- Logger({
477
- level: "WARN",
478
- message: `Response Validation Warnnings for platform > Payment > getSubscriptionPaymentMethod \n ${res_error}`,
479
- });
499
+ if (this.config.options.strictResponseCheck === true) {
500
+ return Promise.reject(new FDKResponseValidationError(res_error));
501
+ } else {
502
+ Logger({
503
+ level: "WARN",
504
+ message: `Response Validation Warnings for platform > Payment > getSubscriptionPaymentMethod \n ${res_error}`,
505
+ });
506
+ }
480
507
  }
481
508
 
482
509
  return response;
@@ -546,10 +573,14 @@ class Payment {
546
573
  });
547
574
 
548
575
  if (res_error) {
549
- Logger({
550
- level: "WARN",
551
- message: `Response Validation Warnnings for platform > Payment > savePayout \n ${res_error}`,
552
- });
576
+ if (this.config.options.strictResponseCheck === true) {
577
+ return Promise.reject(new FDKResponseValidationError(res_error));
578
+ } else {
579
+ Logger({
580
+ level: "WARN",
581
+ message: `Response Validation Warnings for platform > Payment > savePayout \n ${res_error}`,
582
+ });
583
+ }
553
584
  }
554
585
 
555
586
  return response;
@@ -625,10 +656,14 @@ class Payment {
625
656
  );
626
657
 
627
658
  if (res_error) {
628
- Logger({
629
- level: "WARN",
630
- message: `Response Validation Warnnings for platform > Payment > saveSubscriptionSetupIntent \n ${res_error}`,
631
- });
659
+ if (this.config.options.strictResponseCheck === true) {
660
+ return Promise.reject(new FDKResponseValidationError(res_error));
661
+ } else {
662
+ Logger({
663
+ level: "WARN",
664
+ message: `Response Validation Warnings for platform > Payment > saveSubscriptionSetupIntent \n ${res_error}`,
665
+ });
666
+ }
632
667
  }
633
668
 
634
669
  return response;
@@ -702,10 +737,14 @@ class Payment {
702
737
  });
703
738
 
704
739
  if (res_error) {
705
- Logger({
706
- level: "WARN",
707
- message: `Response Validation Warnnings for platform > Payment > updatePayout \n ${res_error}`,
708
- });
740
+ if (this.config.options.strictResponseCheck === true) {
741
+ return Promise.reject(new FDKResponseValidationError(res_error));
742
+ } else {
743
+ Logger({
744
+ level: "WARN",
745
+ message: `Response Validation Warnings for platform > Payment > updatePayout \n ${res_error}`,
746
+ });
747
+ }
709
748
  }
710
749
 
711
750
  return response;
@@ -778,10 +817,14 @@ class Payment {
778
817
  });
779
818
 
780
819
  if (res_error) {
781
- Logger({
782
- level: "WARN",
783
- message: `Response Validation Warnnings for platform > Payment > verifyIfscCode \n ${res_error}`,
784
- });
820
+ if (this.config.options.strictResponseCheck === true) {
821
+ return Promise.reject(new FDKResponseValidationError(res_error));
822
+ } else {
823
+ Logger({
824
+ level: "WARN",
825
+ message: `Response Validation Warnings for platform > Payment > verifyIfscCode \n ${res_error}`,
826
+ });
827
+ }
785
828
  }
786
829
 
787
830
  return response;
@@ -21,6 +21,11 @@ declare class PlatformConfig {
21
21
  * before any api call when it is expired. Default is `true`
22
22
  * @param {logLevelEnum} [config.logLevel='ERROR'] - The log level. Available
23
23
  * options: TRACE, DEBUG, INFO, WARN, ERROR. Default is `'ERROR'`
24
+ * @param {object} [options] - Additional options.
25
+ * @param {boolean} [options.strictResponseCheck=false] - Strict check for
26
+ * response schema validation. Passing this `true` will check response
27
+ * against response schema and throw FDKResponseValidationError if it
28
+ * doesn't match. Default is `false`
24
29
  */
25
30
  constructor(config: {
26
31
  companyId: string;
@@ -29,6 +34,8 @@ declare class PlatformConfig {
29
34
  apiSecret: string;
30
35
  useAutoRenewTimer?: boolean;
31
36
  logLevel?: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
37
+ }, options?: {
38
+ strictResponseCheck?: boolean;
32
39
  });
33
40
  companyId: string;
34
41
  domain: string;
@@ -38,6 +45,9 @@ declare class PlatformConfig {
38
45
  oauthClient: OauthClient;
39
46
  logLevel: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
40
47
  extraHeaders: any[];
48
+ options: {
49
+ strictResponseCheck: boolean;
50
+ };
41
51
  /**
42
52
  * Sets the log level for the platform.
43
53
  *
@@ -24,8 +24,13 @@ class PlatformConfig {
24
24
  * before any api call when it is expired. Default is `true`
25
25
  * @param {logLevelEnum} [config.logLevel='ERROR'] - The log level. Available
26
26
  * options: TRACE, DEBUG, INFO, WARN, ERROR. Default is `'ERROR'`
27
+ * @param {object} [options] - Additional options.
28
+ * @param {boolean} [options.strictResponseCheck=false] - Strict check for
29
+ * response schema validation. Passing this `true` will check response
30
+ * against response schema and throw FDKResponseValidationError if it
31
+ * doesn't match. Default is `false`
27
32
  */
28
- constructor(config) {
33
+ constructor(config, options) {
29
34
  this.companyId = config.companyId;
30
35
  this.domain = config.domain || "https://api.fynd.com";
31
36
  this.apiKey = config.apiKey;
@@ -36,6 +41,10 @@ class PlatformConfig {
36
41
  this.logLevel = config.logLevel || "ERROR";
37
42
  this.setLogLevel(this.logLevel);
38
43
  this.extraHeaders = [];
44
+ this.options = {
45
+ ...{ strictResponseCheck: false },
46
+ ...options,
47
+ };
39
48
  }
40
49
 
41
50
  /**
@@ -78,10 +78,14 @@ class Rewards {
78
78
  });
79
79
 
80
80
  if (res_error) {
81
- Logger({
82
- level: "WARN",
83
- message: `Response Validation Warnnings for platform > Rewards > getGiveawayById \n ${res_error}`,
84
- });
81
+ if (this.config.options.strictResponseCheck === true) {
82
+ return Promise.reject(new FDKResponseValidationError(res_error));
83
+ } else {
84
+ Logger({
85
+ level: "WARN",
86
+ message: `Response Validation Warnings for platform > Rewards > getGiveawayById \n ${res_error}`,
87
+ });
88
+ }
85
89
  }
86
90
 
87
91
  return response;
@@ -149,10 +153,14 @@ class Rewards {
149
153
  });
150
154
 
151
155
  if (res_error) {
152
- Logger({
153
- level: "WARN",
154
- message: `Response Validation Warnnings for platform > Rewards > getOfferByName \n ${res_error}`,
155
- });
156
+ if (this.config.options.strictResponseCheck === true) {
157
+ return Promise.reject(new FDKResponseValidationError(res_error));
158
+ } else {
159
+ Logger({
160
+ level: "WARN",
161
+ message: `Response Validation Warnings for platform > Rewards > getOfferByName \n ${res_error}`,
162
+ });
163
+ }
156
164
  }
157
165
 
158
166
  return response;
@@ -222,10 +230,14 @@ class Rewards {
222
230
  });
223
231
 
224
232
  if (res_error) {
225
- Logger({
226
- level: "WARN",
227
- message: `Response Validation Warnnings for platform > Rewards > getRewardsConfiguration \n ${res_error}`,
228
- });
233
+ if (this.config.options.strictResponseCheck === true) {
234
+ return Promise.reject(new FDKResponseValidationError(res_error));
235
+ } else {
236
+ Logger({
237
+ level: "WARN",
238
+ message: `Response Validation Warnings for platform > Rewards > getRewardsConfiguration \n ${res_error}`,
239
+ });
240
+ }
229
241
  }
230
242
 
231
243
  return response;
@@ -293,10 +305,14 @@ class Rewards {
293
305
  });
294
306
 
295
307
  if (res_error) {
296
- Logger({
297
- level: "WARN",
298
- message: `Response Validation Warnnings for platform > Rewards > getUserDetails \n ${res_error}`,
299
- });
308
+ if (this.config.options.strictResponseCheck === true) {
309
+ return Promise.reject(new FDKResponseValidationError(res_error));
310
+ } else {
311
+ Logger({
312
+ level: "WARN",
313
+ message: `Response Validation Warnings for platform > Rewards > getUserDetails \n ${res_error}`,
314
+ });
315
+ }
300
316
  }
301
317
 
302
318
  return response;
@@ -378,10 +394,14 @@ class Rewards {
378
394
  });
379
395
 
380
396
  if (res_error) {
381
- Logger({
382
- level: "WARN",
383
- message: `Response Validation Warnnings for platform > Rewards > getUserPointsHistory \n ${res_error}`,
384
- });
397
+ if (this.config.options.strictResponseCheck === true) {
398
+ return Promise.reject(new FDKResponseValidationError(res_error));
399
+ } else {
400
+ Logger({
401
+ level: "WARN",
402
+ message: `Response Validation Warnings for platform > Rewards > getUserPointsHistory \n ${res_error}`,
403
+ });
404
+ }
385
405
  }
386
406
 
387
407
  return response;
@@ -491,10 +511,14 @@ class Rewards {
491
511
  });
492
512
 
493
513
  if (res_error) {
494
- Logger({
495
- level: "WARN",
496
- message: `Response Validation Warnnings for platform > Rewards > saveGiveAway \n ${res_error}`,
497
- });
514
+ if (this.config.options.strictResponseCheck === true) {
515
+ return Promise.reject(new FDKResponseValidationError(res_error));
516
+ } else {
517
+ Logger({
518
+ level: "WARN",
519
+ message: `Response Validation Warnings for platform > Rewards > saveGiveAway \n ${res_error}`,
520
+ });
521
+ }
498
522
  }
499
523
 
500
524
  return response;
@@ -568,10 +592,14 @@ class Rewards {
568
592
  });
569
593
 
570
594
  if (res_error) {
571
- Logger({
572
- level: "WARN",
573
- message: `Response Validation Warnnings for platform > Rewards > setRewardsConfiguration \n ${res_error}`,
574
- });
595
+ if (this.config.options.strictResponseCheck === true) {
596
+ return Promise.reject(new FDKResponseValidationError(res_error));
597
+ } else {
598
+ Logger({
599
+ level: "WARN",
600
+ message: `Response Validation Warnings for platform > Rewards > setRewardsConfiguration \n ${res_error}`,
601
+ });
602
+ }
575
603
  }
576
604
 
577
605
  return response;
@@ -647,10 +675,14 @@ class Rewards {
647
675
  });
648
676
 
649
677
  if (res_error) {
650
- Logger({
651
- level: "WARN",
652
- message: `Response Validation Warnnings for platform > Rewards > showGiveaways \n ${res_error}`,
653
- });
678
+ if (this.config.options.strictResponseCheck === true) {
679
+ return Promise.reject(new FDKResponseValidationError(res_error));
680
+ } else {
681
+ Logger({
682
+ level: "WARN",
683
+ message: `Response Validation Warnings for platform > Rewards > showGiveaways \n ${res_error}`,
684
+ });
685
+ }
654
686
  }
655
687
 
656
688
  return response;
@@ -713,10 +745,14 @@ class Rewards {
713
745
  .validate(responseData, { abortEarly: false, allowUnknown: false });
714
746
 
715
747
  if (res_error) {
716
- Logger({
717
- level: "WARN",
718
- message: `Response Validation Warnnings for platform > Rewards > showOffers \n ${res_error}`,
719
- });
748
+ if (this.config.options.strictResponseCheck === true) {
749
+ return Promise.reject(new FDKResponseValidationError(res_error));
750
+ } else {
751
+ Logger({
752
+ level: "WARN",
753
+ message: `Response Validation Warnings for platform > Rewards > showOffers \n ${res_error}`,
754
+ });
755
+ }
720
756
  }
721
757
 
722
758
  return response;
@@ -790,10 +826,14 @@ class Rewards {
790
826
  });
791
827
 
792
828
  if (res_error) {
793
- Logger({
794
- level: "WARN",
795
- message: `Response Validation Warnnings for platform > Rewards > updateGiveAway \n ${res_error}`,
796
- });
829
+ if (this.config.options.strictResponseCheck === true) {
830
+ return Promise.reject(new FDKResponseValidationError(res_error));
831
+ } else {
832
+ Logger({
833
+ level: "WARN",
834
+ message: `Response Validation Warnings for platform > Rewards > updateGiveAway \n ${res_error}`,
835
+ });
836
+ }
797
837
  }
798
838
 
799
839
  return response;
@@ -871,10 +911,14 @@ class Rewards {
871
911
  });
872
912
 
873
913
  if (res_error) {
874
- Logger({
875
- level: "WARN",
876
- message: `Response Validation Warnnings for platform > Rewards > updateOfferByName \n ${res_error}`,
877
- });
914
+ if (this.config.options.strictResponseCheck === true) {
915
+ return Promise.reject(new FDKResponseValidationError(res_error));
916
+ } else {
917
+ Logger({
918
+ level: "WARN",
919
+ message: `Response Validation Warnings for platform > Rewards > updateOfferByName \n ${res_error}`,
920
+ });
921
+ }
878
922
  }
879
923
 
880
924
  return response;
@@ -950,10 +994,14 @@ class Rewards {
950
994
  });
951
995
 
952
996
  if (res_error) {
953
- Logger({
954
- level: "WARN",
955
- message: `Response Validation Warnnings for platform > Rewards > updateUserStatus \n ${res_error}`,
956
- });
997
+ if (this.config.options.strictResponseCheck === true) {
998
+ return Promise.reject(new FDKResponseValidationError(res_error));
999
+ } else {
1000
+ Logger({
1001
+ level: "WARN",
1002
+ message: `Response Validation Warnings for platform > Rewards > updateUserStatus \n ${res_error}`,
1003
+ });
1004
+ }
957
1005
  }
958
1006
 
959
1007
  return response;