@finspringinnovations/fixeddepositsdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,6 +72,14 @@ function getLogoTypeForFD(fd) {
72
72
  return 'mahindra';
73
73
  return undefined;
74
74
  }
75
+ function getStaticCreditRatingForFD(fd) {
76
+ const logoType = getLogoTypeForFD(fd);
77
+ if (logoType === 'mahindra')
78
+ return 'AAA';
79
+ if (logoType === 'shriram')
80
+ return 'AA+';
81
+ return 'AA+';
82
+ }
75
83
  /** Statuses that count as pending/active (in-progress) workflow. */
76
84
  const PENDING_ACTIVE_STATUSES = ['active', 'pending', 'in_progress', 'in-progress'];
77
85
  function getSdkTypeFromProviderId(providerId, mahindraProviderId, shriramProviderId) {
@@ -832,7 +840,10 @@ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToEx
832
840
  amount: Number(fdDisplay.invested) || 0,
833
841
  maturityDate: fdDisplay.maturityDate || '-',
834
842
  status: 'active',
835
- creditRating: appData.credit_rating || appData.creditRating || (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.creditRating) || 'NA',
843
+ creditRating: getStaticCreditRatingForFD({
844
+ name: fdDisplay.name,
845
+ providerId: providerIdFromApp,
846
+ }),
836
847
  companyName: fdDisplay.name,
837
848
  fdRate: `${fdDisplay.returns}% p.a.`,
838
849
  interestPayout: fdDisplay.interestPayout || '',
@@ -942,7 +953,10 @@ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToEx
942
953
  amount: Number(activeFD.invested) || 0,
943
954
  maturityDate: activeFD.maturityDate || '-',
944
955
  status: 'active',
945
- creditRating: appData.credit_rating || appData.creditRating || 'NA',
956
+ creditRating: getStaticCreditRatingForFD({
957
+ name: activeFD.name,
958
+ providerId: providerIdFromApp,
959
+ }),
946
960
  companyName: activeFD.name,
947
961
  fdRate: `${activeFD.returns}% p.a.`,
948
962
  interestPayout: activeFD.interestPayout || 'Yearly',
@@ -1015,7 +1029,10 @@ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToEx
1015
1029
  amount: Number(activeFD.invested) || 0,
1016
1030
  maturityDate: activeFD.maturityDate || '-',
1017
1031
  status: 'active',
1018
- creditRating: appData.credit_rating || appData.creditRating || 'NA',
1032
+ creditRating: getStaticCreditRatingForFD({
1033
+ name: activeFD.name,
1034
+ providerId: providerIdFromApp,
1035
+ }),
1019
1036
  companyName: activeFD.name,
1020
1037
  fdRate: `${activeFD.returns}% p.a.`,
1021
1038
  interestPayout: activeFD.interestPayout || 'Yearly',
@@ -1146,7 +1163,10 @@ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToEx
1146
1163
  amount: Number(activeFD.invested) || 0,
1147
1164
  maturityDate: activeFD.maturityDate || '-',
1148
1165
  status: 'active',
1149
- creditRating: appData.credit_rating || appData.creditRating || (selectedFD === null || selectedFD === void 0 ? void 0 : selectedFD.creditRating) || 'NA',
1166
+ creditRating: getStaticCreditRatingForFD({
1167
+ name: activeFD.name,
1168
+ providerId: providerIdFromApp,
1169
+ }),
1150
1170
  companyName: activeFD.name,
1151
1171
  fdRate: `${activeFD.returns}% p.a.`,
1152
1172
  interestPayout: activeFD.interestPayout || '',
@@ -1335,7 +1355,10 @@ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToEx
1335
1355
  amount: 5000,
1336
1356
  maturityDate: '2025-12-31',
1337
1357
  status: 'active',
1338
- creditRating: rate.creditRating || 'AA+',
1358
+ creditRating: getStaticCreditRatingForFD({
1359
+ name: rate.providerName || '',
1360
+ providerId: rate.providerId || `provider-${index}`,
1361
+ }),
1339
1362
  interestPayout: rate.interestPayout || rate.interest_payout_term || rate.payout_term || 'Yearly'
1340
1363
  });
1341
1364
  });
@@ -1631,7 +1654,10 @@ const FDList = ({ onGoBack, onSelectFD, onNavigateToFDCalculator, onNavigateToEx
1631
1654
  amount: selectedFD.amount,
1632
1655
  maturityDate: selectedFD.maturityDate,
1633
1656
  status: selectedFD.status,
1634
- creditRating: selectedFD.creditRating,
1657
+ creditRating: getStaticCreditRatingForFD({
1658
+ name: selectedFD.name,
1659
+ providerId: selectedFD.providerId,
1660
+ }),
1635
1661
  companyName: selectedFD.name,
1636
1662
  fdRate: selectedFD.roi,
1637
1663
  interestPayout: selectedFD.interestPayout || 'Yearly',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finspringinnovations/fixeddepositsdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "FD SDK for React Native applications",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -57,6 +57,13 @@ function getLogoTypeForFD(fd: { name?: string; providerId?: string }): 'shriram'
57
57
  return undefined;
58
58
  }
59
59
 
60
+ function getStaticCreditRatingForFD(fd: { name?: string; providerId?: string }): string {
61
+ const logoType = getLogoTypeForFD(fd);
62
+ if (logoType === 'mahindra') return 'AAA';
63
+ if (logoType === 'shriram') return 'AA+';
64
+ return 'AA+';
65
+ }
66
+
60
67
  /** Statuses that count as pending/active (in-progress) workflow. */
61
68
  const PENDING_ACTIVE_STATUSES = ['active', 'pending', 'in_progress', 'in-progress'];
62
69
 
@@ -981,7 +988,10 @@ const FDList: React.FC<FDListProps> = ({
981
988
  amount: Number(fdDisplay.invested) || 0,
982
989
  maturityDate: fdDisplay.maturityDate || '-',
983
990
  status: 'active' as const,
984
- creditRating: appData.credit_rating || appData.creditRating || selectedFD?.creditRating || 'NA',
991
+ creditRating: getStaticCreditRatingForFD({
992
+ name: fdDisplay.name,
993
+ providerId: providerIdFromApp,
994
+ }),
985
995
  companyName: fdDisplay.name,
986
996
  fdRate: `${fdDisplay.returns}% p.a.`,
987
997
  interestPayout: fdDisplay.interestPayout || '',
@@ -1086,7 +1096,10 @@ const FDList: React.FC<FDListProps> = ({
1086
1096
  amount: Number(activeFD.invested) || 0,
1087
1097
  maturityDate: activeFD.maturityDate || '-',
1088
1098
  status: 'active' as const,
1089
- creditRating: appData.credit_rating || appData.creditRating || 'NA',
1099
+ creditRating: getStaticCreditRatingForFD({
1100
+ name: activeFD.name,
1101
+ providerId: providerIdFromApp,
1102
+ }),
1090
1103
  companyName: activeFD.name,
1091
1104
  fdRate: `${activeFD.returns}% p.a.`,
1092
1105
  interestPayout: activeFD.interestPayout || 'Yearly',
@@ -1154,7 +1167,10 @@ const FDList: React.FC<FDListProps> = ({
1154
1167
  amount: Number(activeFD.invested) || 0,
1155
1168
  maturityDate: activeFD.maturityDate || '-',
1156
1169
  status: 'active' as const,
1157
- creditRating: appData.credit_rating || appData.creditRating || 'NA',
1170
+ creditRating: getStaticCreditRatingForFD({
1171
+ name: activeFD.name,
1172
+ providerId: providerIdFromApp,
1173
+ }),
1158
1174
  companyName: activeFD.name,
1159
1175
  fdRate: `${activeFD.returns}% p.a.`,
1160
1176
  interestPayout: activeFD.interestPayout || 'Yearly',
@@ -1273,7 +1289,10 @@ const FDList: React.FC<FDListProps> = ({
1273
1289
  amount: Number(activeFD.invested) || 0,
1274
1290
  maturityDate: activeFD.maturityDate || '-',
1275
1291
  status: 'active' as const,
1276
- creditRating: appData.credit_rating || appData.creditRating || selectedFD?.creditRating || 'NA',
1292
+ creditRating: getStaticCreditRatingForFD({
1293
+ name: activeFD.name,
1294
+ providerId: providerIdFromApp,
1295
+ }),
1277
1296
  companyName: activeFD.name,
1278
1297
  fdRate: `${activeFD.returns}% p.a.`,
1279
1298
  interestPayout: activeFD.interestPayout || '',
@@ -1484,7 +1503,10 @@ const FDList: React.FC<FDListProps> = ({
1484
1503
  amount: 5000,
1485
1504
  maturityDate: '2025-12-31',
1486
1505
  status: 'active' as const,
1487
- creditRating: rate.creditRating || 'AA+',
1506
+ creditRating: getStaticCreditRatingForFD({
1507
+ name: rate.providerName || '',
1508
+ providerId: rate.providerId || `provider-${index}`,
1509
+ }),
1488
1510
  interestPayout: rate.interestPayout || rate.interest_payout_term || rate.payout_term || 'Yearly'
1489
1511
  }));
1490
1512
  }
@@ -1913,7 +1935,10 @@ const FDList: React.FC<FDListProps> = ({
1913
1935
  amount: selectedFD.amount,
1914
1936
  maturityDate: selectedFD.maturityDate,
1915
1937
  status: selectedFD.status as 'active' | 'matured' | 'pending' | undefined,
1916
- creditRating: selectedFD.creditRating,
1938
+ creditRating: getStaticCreditRatingForFD({
1939
+ name: selectedFD.name,
1940
+ providerId: selectedFD.providerId,
1941
+ }),
1917
1942
  companyName: selectedFD.name,
1918
1943
  fdRate: selectedFD.roi,
1919
1944
  interestPayout: selectedFD.interestPayout || 'Yearly',