@finspringinnovations/fixeddepositsdk 1.0.2 → 1.0.4

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 (50) hide show
  1. package/lib/api/customerApi.js +1 -0
  2. package/lib/api/fdApi.d.ts +401 -1
  3. package/lib/api/fdApi.js +24 -2
  4. package/lib/components/PendingFDBottomSheet.js +27 -18
  5. package/lib/config/appDataConfig.js +3 -2
  6. package/lib/config/workflowConstants.d.ts +40 -30
  7. package/lib/config/workflowConstants.js +35 -24
  8. package/lib/constants/strings/fd.d.ts +2 -2
  9. package/lib/constants/strings/fd.js +2 -2
  10. package/lib/navigation/RootNavigator.js +167 -196
  11. package/lib/navigation/types.d.ts +4 -1
  12. package/lib/navigation/workflowNavigator.d.ts +1 -1
  13. package/lib/navigation/workflowNavigator.js +107 -26
  14. package/lib/screens/AadhaarVerification.js +1 -11
  15. package/lib/screens/AddBankAccount.js +1 -11
  16. package/lib/screens/BankDetail.js +1 -11
  17. package/lib/screens/Employee.js +1 -11
  18. package/lib/screens/FDCalculator.js +2 -12
  19. package/lib/screens/FDList.js +531 -417
  20. package/lib/screens/FindIFSC.js +1 -11
  21. package/lib/screens/NomineeDetail.js +12 -22
  22. package/lib/screens/PayNow.js +1 -11
  23. package/lib/screens/Payment.js +2 -11
  24. package/lib/screens/PaymentStatus.js +24 -21
  25. package/lib/screens/ReviewKYC.js +3 -12
  26. package/lib/types/workflowTypes.d.ts +1 -1
  27. package/package.json +50 -50
  28. package/src/api/customerApi.ts +1 -0
  29. package/src/api/fdApi.ts +28 -1
  30. package/src/components/PendingFDBottomSheet.tsx +151 -123
  31. package/src/config/appDataConfig.ts +245 -242
  32. package/src/config/workflowConstants.ts +51 -39
  33. package/src/constants/strings/bank.ts +80 -80
  34. package/src/constants/strings/fd.ts +2 -2
  35. package/src/navigation/RootNavigator.tsx +667 -651
  36. package/src/navigation/types.ts +4 -1
  37. package/src/navigation/workflowNavigator.ts +170 -107
  38. package/src/screens/AadhaarVerification.tsx +1 -15
  39. package/src/screens/AddBankAccount.tsx +2 -16
  40. package/src/screens/BankDetail.tsx +1 -15
  41. package/src/screens/Employee.tsx +1 -15
  42. package/src/screens/FDCalculator.tsx +4 -18
  43. package/src/screens/FDList.tsx +2311 -2170
  44. package/src/screens/FindIFSC.tsx +2 -16
  45. package/src/screens/NomineeDetail.tsx +762 -775
  46. package/src/screens/PayNow.tsx +2 -16
  47. package/src/screens/Payment.tsx +190 -203
  48. package/src/screens/PaymentStatus.tsx +574 -576
  49. package/src/screens/ReviewKYC.tsx +2 -15
  50. package/src/types/workflowTypes.ts +1 -10
@@ -108,8 +108,11 @@ export type RootStackParamList = {
108
108
  masterData?: any;
109
109
  onboardingIds?: any;
110
110
  initialRouteName?: string;
111
- /** When opening Shriram with initialRouteName 'PaymentStatus', pass status/transactionId/fdData here */
111
+ /** When opening Shriram/Mahindra with initialRouteName 'PaymentStatus', pass status/transactionId/fdData here */
112
112
  initialPaymentStatusParams?: { status?: 'success' | 'failed' | 'pending'; transactionId?: string; fdData?: any };
113
+ /** When opening Mahindra with initialRouteName 'Payment', pass the resolved payment URL and transactionId here */
114
+ initialPaymentUrl?: string;
115
+ initialPaymentTransactionId?: string;
113
116
  shriramSDKGlobalData?: any;
114
117
  mahindraSDKGlobalData?: any;
115
118
  forceFetchCustomerDetails?: boolean;
@@ -1,98 +1,161 @@
1
- import { navigate } from './helpers';
2
- import type { InvestmentData, CustomerData, AppData, FDData } from '../types/dataTypes';
1
+ import { MAHINDRA_WORKFLOW_STATES, SHRIRAM_WORKFLOW_STATES, WORKFLOW_STATES } from '../config/workflowConstants';
2
+ import type { AppData, CustomerData, FDData, InvestmentData } from '../types/dataTypes';
3
3
  import type { WorkflowStateSriram } from '../types/workflowTypes';
4
- import { WORKFLOW_STATES } from '../config/workflowConstants';
4
+ import { navigate } from './helpers';
5
5
 
6
6
  /**
7
7
  * Centralized navigation for FD workflow based on Flutter implementation
8
8
  */
9
9
  export async function handleWorkflowNavigation({
10
- workflowState,
11
- investmentData,
12
- customerData,
13
- appData,
14
- fdData,
15
- completedApplications = [],
16
- transactionId,
10
+ workflowState,
11
+ investmentData,
12
+ customerData,
13
+ appData,
14
+ fdData,
15
+ completedApplications = [],
16
+ transactionId,
17
17
  }: {
18
- workflowState: WorkflowStateSriram;
19
- investmentData?: InvestmentData;
20
- customerData?: CustomerData;
21
- appData?: AppData;
22
- fdData?: FDData;
23
- completedApplications?: any[];
24
- transactionId?: string;
18
+ workflowState: WorkflowStateSriram;
19
+ investmentData?: InvestmentData;
20
+ customerData?: CustomerData;
21
+ appData?: AppData;
22
+ fdData?: FDData;
23
+ completedApplications?: any[];
24
+ transactionId?: string;
25
25
  }) {
26
26
 
27
- switch (workflowState) {
28
- case WORKFLOW_STATES.START:
29
- case WORKFLOW_STATES.INITIATION:
30
- // No navigation required
31
- break;
32
-
33
- case WORKFLOW_STATES.CREATE_FD:
34
- // Navigate to FD overview first, then to occupation
35
- navigate('PayNow', {
36
- fdData: fdData ? {
37
- companyName: fdData.name,
38
- amount: fdData.amount,
39
- fdRate: fdData.roi,
40
- tenure: fdData.tenure,
41
- interestPayout: 'Yearly' // Default value
42
- } : undefined
43
- } as any);
44
- // The flow will continue to occupation after FD selection
45
- break;
46
-
47
- case WORKFLOW_STATES.OCCUPATION:
48
- navigate('Employee');
49
- break;
50
-
51
- case WORKFLOW_STATES.NOMINEE:
52
- navigate('NomineeDetail');
53
- break;
54
-
55
- case WORKFLOW_STATES.BANK_DETAILS:
56
- navigate('BankDetail');
57
- break;
58
-
59
- case WORKFLOW_STATES.KYC:
60
- navigate('ReviewKYC');
61
- break;
62
-
63
- case WORKFLOW_STATES.PAYMENT:
64
- // Handle payment status check and navigation
65
- if (transactionId) {
66
- // Navigate to payment screen with transaction ID
67
- navigate('Payment');
68
- } else {
69
- navigate('PayNow', {
70
- fdData: fdData ? {
71
- companyName: fdData.name,
72
- amount: fdData.amount,
73
- fdRate: fdData.roi,
74
- tenure: fdData.tenure,
75
- interestPayout: '' // Default value
76
- } : undefined
77
- } as any);
78
- }
79
- break;
80
-
81
- case WORKFLOW_STATES.END:
82
- navigate('PaymentStatus', {
83
- transactionId,
84
- fdData: fdData ? {
85
- companyName: fdData.name,
86
- amount: fdData.amount,
87
- fdRate: fdData.roi,
88
- tenure: fdData.tenure,
89
- interestPayout: '' // Default value
90
- } : undefined
91
- });
92
- break;
93
-
94
- default:
95
- }
27
+ // Normalize workflow state from caption if needed
28
+ let normalizedState = workflowState;
29
+
30
+ // Map Shriram captions to common states if necessary, or handle directly
31
+ const isShriramCaption = Object.values(SHRIRAM_WORKFLOW_STATES).includes(workflowState as any);
32
+ const isMahindraCaption = Object.values(MAHINDRA_WORKFLOW_STATES).includes(workflowState as any);
33
+
34
+ if (isShriramCaption) {
35
+ if (workflowState === SHRIRAM_WORKFLOW_STATES.START || workflowState === SHRIRAM_WORKFLOW_STATES.INITIATION) normalizedState = WORKFLOW_STATES.START;
36
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.KYC) normalizedState = WORKFLOW_STATES.KYC;
37
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.OCCUPATION) normalizedState = WORKFLOW_STATES.OCCUPATION;
38
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.NOMINEE) normalizedState = WORKFLOW_STATES.NOMINEE;
39
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.BANK_DETAILS) normalizedState = WORKFLOW_STATES.BANK_DETAILS;
40
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.CREATE_FD) normalizedState = WORKFLOW_STATES.CREATE_FD;
41
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.PAYMENT) normalizedState = WORKFLOW_STATES.PAYMENT;
42
+ else if (workflowState === SHRIRAM_WORKFLOW_STATES.END) normalizedState = WORKFLOW_STATES.END;
43
+ } else if (isMahindraCaption) {
44
+ if (workflowState === MAHINDRA_WORKFLOW_STATES.START || workflowState === MAHINDRA_WORKFLOW_STATES.INITIATION) normalizedState = WORKFLOW_STATES.START;
45
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.KYC || workflowState === MAHINDRA_WORKFLOW_STATES.AADHAAR_VERIFICATION) {
46
+ navigate('AadhaarVerification');
47
+ return;
48
+ }
49
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.DEMOGRAPHIC_INFO) normalizedState = WORKFLOW_STATES.KYC; // Map demographic to KYC
50
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.OCCUPATION) normalizedState = WORKFLOW_STATES.OCCUPATION;
51
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.NOMINEE) normalizedState = WORKFLOW_STATES.NOMINEE;
52
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.BANK_DETAILS) normalizedState = WORKFLOW_STATES.BANK_DETAILS;
53
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.CREATE_FD) normalizedState = WORKFLOW_STATES.CREATE_FD;
54
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.PAYMENT) normalizedState = WORKFLOW_STATES.PAYMENT;
55
+ else if (workflowState === MAHINDRA_WORKFLOW_STATES.END) normalizedState = WORKFLOW_STATES.END;
56
+ }
57
+
58
+ switch (normalizedState) {
59
+ case WORKFLOW_STATES.START:
60
+ case WORKFLOW_STATES.INITIATION:
61
+ // No navigation required
62
+ break;
63
+
64
+ case WORKFLOW_STATES.CREATE_FD:
65
+ // For Shriram, CREATE_FD means we should show payment if possible
66
+ if (isShriramCaption) {
67
+ navigate('PayNow', {
68
+ fdData: fdData ? {
69
+ companyName: fdData.name,
70
+ amount: fdData.amount,
71
+ fdRate: fdData.roi,
72
+ tenure: fdData.tenure,
73
+ interestPayout: ''
74
+ } : undefined
75
+ } as any);
76
+ } else {
77
+ // Default behavior for other providers
78
+ navigate('PayNow', {
79
+ fdData: fdData ? {
80
+ companyName: fdData.name,
81
+ amount: fdData.amount,
82
+ fdRate: fdData.roi,
83
+ tenure: fdData.tenure,
84
+ interestPayout: 'Yearly'
85
+ } : undefined
86
+ } as any);
87
+ }
88
+ break;
89
+
90
+ case WORKFLOW_STATES.OCCUPATION:
91
+ navigate('Employee');
92
+ break;
93
+
94
+ case WORKFLOW_STATES.NOMINEE:
95
+ navigate('NomineeDetail');
96
+ break;
97
+
98
+ case WORKFLOW_STATES.BANK_DETAILS:
99
+ if (isShriramCaption) {
100
+ navigate('ExternalSDK', { sdkType: 'shriram', initialRouteName: 'BankDetail' } as any);
101
+ } else if (isMahindraCaption) {
102
+ navigate('ExternalSDK', { sdkType: 'mahindra', initialRouteName: 'BankDetail' } as any);
103
+ } else {
104
+ navigate('BankDetail');
105
+ }
106
+ break;
107
+
108
+ case WORKFLOW_STATES.KYC:
109
+ navigate('ReviewKYC');
110
+ break;
111
+
112
+ case WORKFLOW_STATES.PAYMENT:
113
+ // Handle payment status check and navigation
114
+ if (transactionId) {
115
+ navigate('Payment');
116
+ } else {
117
+ navigate('PayNow', {
118
+ fdData: fdData ? {
119
+ companyName: fdData.name,
120
+ amount: fdData.amount,
121
+ fdRate: fdData.roi,
122
+ tenure: fdData.tenure,
123
+ interestPayout: ''
124
+ } : undefined
125
+ } as any);
126
+ }
127
+ break;
128
+
129
+ case WORKFLOW_STATES.END:
130
+ if (isShriramCaption) {
131
+ navigate('ExternalSDK', {
132
+ sdkType: 'shriram',
133
+ initialRouteName: 'PayNow',
134
+ fdData: fdData ? {
135
+ companyName: fdData.name,
136
+ amount: fdData.amount,
137
+ fdRate: fdData.roi,
138
+ tenure: fdData.tenure,
139
+ interestPayout: ''
140
+ } : undefined
141
+ } as any);
142
+ } else {
143
+ navigate('PaymentStatus', {
144
+ transactionId,
145
+ fdData: fdData ? {
146
+ companyName: fdData.name,
147
+ amount: fdData.amount,
148
+ fdRate: fdData.roi,
149
+ tenure: fdData.tenure,
150
+ interestPayout: ''
151
+ } : undefined
152
+ });
153
+ }
154
+ break;
155
+
156
+ default:
157
+ break;
158
+ }
96
159
  }
97
160
 
98
161
  /**
@@ -100,13 +163,13 @@ export async function handleWorkflowNavigation({
100
163
  */
101
164
  export function handleFDSelection(fdData: FDData, investmentData?: InvestmentData) {
102
165
 
103
- // Store FD data in Redux (this should be done in FDList component)
104
- // Then navigate to occupation screen
105
- handleWorkflowNavigation({
106
- workflowState: WORKFLOW_STATES.OCCUPATION,
107
- investmentData,
108
- fdData,
109
- });
166
+ // Store FD data in Redux (this should be done in FDList component)
167
+ // Then navigate to occupation screen
168
+ handleWorkflowNavigation({
169
+ workflowState: WORKFLOW_STATES.OCCUPATION,
170
+ investmentData,
171
+ fdData,
172
+ });
110
173
  }
111
174
 
112
175
  /**
@@ -114,18 +177,18 @@ export function handleFDSelection(fdData: FDData, investmentData?: InvestmentDat
114
177
  */
115
178
  export function navigateFDCreationFlow(fdData: FDData, investmentData?: InvestmentData) {
116
179
 
117
- // This represents the complete flow from FD selection to payment
118
- const flow = [
119
- WORKFLOW_STATES.OCCUPATION, // Employee screen
120
- WORKFLOW_STATES.NOMINEE, // NomineeDetail screen
121
- WORKFLOW_STATES.BANK_DETAILS, // BankDetail screen
122
- WORKFLOW_STATES.PAYMENT, // PayNow screen
123
- ];
124
-
125
- // Start with occupation
126
- handleWorkflowNavigation({
127
- workflowState: WORKFLOW_STATES.OCCUPATION,
128
- investmentData,
129
- fdData,
130
- });
180
+ // This represents the complete flow from FD selection to payment
181
+ const flow = [
182
+ WORKFLOW_STATES.OCCUPATION, // Employee screen
183
+ WORKFLOW_STATES.NOMINEE, // NomineeDetail screen
184
+ WORKFLOW_STATES.BANK_DETAILS, // BankDetail screen
185
+ WORKFLOW_STATES.PAYMENT, // PayNow screen
186
+ ];
187
+
188
+ // Start with occupation
189
+ handleWorkflowNavigation({
190
+ workflowState: WORKFLOW_STATES.OCCUPATION,
191
+ investmentData,
192
+ fdData,
193
+ });
131
194
  }
@@ -692,22 +692,8 @@ const AadhaarVerification: React.FC<AadhaarVerificationProps> = ({
692
692
  }
693
693
  };
694
694
 
695
- // Handle Android hardware back button
696
- useEffect(() => {
697
- if (Platform.OS !== 'android') return;
695
+ // Removed screen-level hardware back handler to allow only header back button navigation
698
696
 
699
- const onHardwareBackPress = () => {
700
- handleBackPress();
701
- return true; // Prevent default behavior
702
- };
703
-
704
- const backHandler = BackHandler.addEventListener(
705
- 'hardwareBackPress',
706
- onHardwareBackPress
707
- );
708
-
709
- return () => backHandler.remove();
710
- }, [defultProviderId, workflowInstanceId, applicationId, entityId]);
711
697
 
712
698
  return (
713
699
  <SafeAreaWrapper
@@ -311,22 +311,8 @@ const AddBankAccount: React.FC<AddBankAccountProps> = ({ onGoBack, onContinue, o
311
311
  navigate('BankDetail');
312
312
  };
313
313
 
314
- // Handle Android hardware back button
315
- useEffect(() => {
316
- if (Platform.OS !== 'android') return;
317
-
318
- const onHardwareBackPress = () => {
319
- handleBackPress();
320
- return true; // Prevent default behavior
321
- };
322
-
323
- const backHandler = BackHandler.addEventListener(
324
- 'hardwareBackPress',
325
- onHardwareBackPress
326
- );
327
-
328
- return () => backHandler.remove();
329
- }, []);
314
+ // Removed screen-level hardware back handler to allow only header back button navigation
315
+
330
316
 
331
317
  return (
332
318
  <SafeAreaWrapper
@@ -613,22 +613,8 @@ const BankDetail: React.FC<BankDetailProps> = ({ onGoBack, onContinue, onAddAcco
613
613
  }
614
614
  };
615
615
 
616
- // Handle Android hardware back button
617
- useEffect(() => {
618
- if (Platform.OS !== 'android') return;
619
-
620
- const onHardwareBackPress = () => {
621
- handleBackPress();
622
- return true; // Prevent default behavior
623
- };
624
-
625
- const backHandler = BackHandler.addEventListener(
626
- 'hardwareBackPress',
627
- onHardwareBackPress
628
- );
616
+ // Removed screen-level hardware back handler to allow only header back button navigation
629
617
 
630
- return () => backHandler.remove();
631
- }, [defaultProviderId, workflowInstanceId, applicationId, entityId, appData?.userReferenceId]);
632
618
 
633
619
  return (
634
620
  <SafeAreaWrapper
@@ -583,22 +583,8 @@ const Employee: React.FC<EmployeeProps> = ({ onGoBack, onContinue, initialData }
583
583
  }
584
584
  };
585
585
 
586
- // Handle Android hardware back button
587
- useEffect(() => {
588
- if (Platform.OS !== 'android') return;
586
+ // Removed screen-level hardware back handler to allow only header back button navigation
589
587
 
590
- const onHardwareBackPress = () => {
591
- handleBackPress();
592
- return true; // Prevent default behavior
593
- };
594
-
595
- const backHandler = BackHandler.addEventListener(
596
- 'hardwareBackPress',
597
- onHardwareBackPress
598
- );
599
-
600
- return () => backHandler.remove();
601
- }, [defaultProviderId, workflowInstanceId, applicationId]);
602
588
 
603
589
  return (
604
590
  <SafeAreaWrapper
@@ -285,7 +285,7 @@ const FDCalculator: React.FC<FDCalculatorProps> = ({ onGoBack, onNavigateToRevie
285
285
  }, [interestRates]);
286
286
 
287
287
  useEffect(() => {
288
- console.log("following are the tenure options at the fd",tenureOptions)
288
+ console.log("following are the tenure options at the fd", tenureOptions)
289
289
  })
290
290
 
291
291
  const [tenureValue, setTenureValue] = useState<string>('');
@@ -584,22 +584,8 @@ const FDCalculator: React.FC<FDCalculatorProps> = ({ onGoBack, onNavigateToRevie
584
584
  return fallback;
585
585
  }, [effectiveMasterData]);
586
586
 
587
- // Handle Android hardware back button - use same navigation as header back button
588
- useEffect(() => {
589
- if (Platform.OS !== 'android') return;
590
-
591
- const onHardwareBackPress = () => {
592
- navigate('FDList'); // Same as header back button
593
- return true; // Prevent default behavior
594
- };
587
+ // Removed screen-level hardware back handler to allow only header back button navigation
595
588
 
596
- const backHandler = BackHandler.addEventListener(
597
- 'hardwareBackPress',
598
- onHardwareBackPress
599
- );
600
-
601
- return () => backHandler.remove();
602
- }, []);
603
589
 
604
590
  return (
605
591
  <SafeAreaWrapper
@@ -636,7 +622,7 @@ const FDCalculator: React.FC<FDCalculatorProps> = ({ onGoBack, onNavigateToRevie
636
622
  {/* Company Header */}
637
623
  <CompanyHeader
638
624
  companyName={effectiveFdData?.name || ''}
639
- rating={effectiveFdData?.creditRating || 'AA+'}
625
+ rating="AAA"
640
626
  />
641
627
 
642
628
  {/* Amount Input */}
@@ -998,5 +984,5 @@ const createStyles = (typography: any, colors: any, themeName: string) => StyleS
998
984
  backgroundColor: 'rgba(0, 0, 0, 0.3)',
999
985
  zIndex: 1000,
1000
986
  },
1001
-
987
+
1002
988
  });