@finspringinnovations/fdsdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (315) hide show
  1. package/README.md +184 -0
  2. package/lib/api/applicationApi.d.ts +1 -0
  3. package/lib/api/applicationApi.js +11 -0
  4. package/lib/api/bankApi.d.ts +352 -0
  5. package/lib/api/bankApi.js +54 -0
  6. package/lib/api/baseApi.d.ts +8 -0
  7. package/lib/api/baseApi.js +456 -0
  8. package/lib/api/customerApi.d.ts +855 -0
  9. package/lib/api/customerApi.js +213 -0
  10. package/lib/api/fdApi.d.ts +979 -0
  11. package/lib/api/fdApi.js +112 -0
  12. package/lib/api/fdCalculatorApi.d.ts +179 -0
  13. package/lib/api/fdCalculatorApi.js +36 -0
  14. package/lib/api/index.d.ts +14 -0
  15. package/lib/api/index.js +45 -0
  16. package/lib/api/interestRateApi.d.ts +585 -0
  17. package/lib/api/interestRateApi.js +101 -0
  18. package/lib/api/kycApi.d.ts +486 -0
  19. package/lib/api/kycApi.js +71 -0
  20. package/lib/api/masterDataApi.d.ts +158 -0
  21. package/lib/api/masterDataApi.js +32 -0
  22. package/lib/api/nomineeApi.d.ts +325 -0
  23. package/lib/api/nomineeApi.js +46 -0
  24. package/lib/api/onboardingApi.d.ts +192 -0
  25. package/lib/api/onboardingApi.js +41 -0
  26. package/lib/api/panApi.d.ts +0 -0
  27. package/lib/api/panApi.js +23 -0
  28. package/lib/api/paymentApi.d.ts +325 -0
  29. package/lib/api/paymentApi.js +46 -0
  30. package/lib/api/workflowApi.d.ts +654 -0
  31. package/lib/api/workflowApi.js +90 -0
  32. package/lib/assets/images/images.d.ts +4 -0
  33. package/lib/assets/images/images.js +10 -0
  34. package/lib/components/AadhaarInput.d.ts +13 -0
  35. package/lib/components/AadhaarInput.js +47 -0
  36. package/lib/components/ActionButton.d.ts +12 -0
  37. package/lib/components/ActionButton.js +87 -0
  38. package/lib/components/ActiveFDCard.d.ts +16 -0
  39. package/lib/components/ActiveFDCard.js +95 -0
  40. package/lib/components/AmountInput.d.ts +20 -0
  41. package/lib/components/AmountInput.js +144 -0
  42. package/lib/components/CheckboxOption.d.ts +11 -0
  43. package/lib/components/CheckboxOption.js +41 -0
  44. package/lib/components/CompanyHeader.d.ts +7 -0
  45. package/lib/components/CompanyHeader.js +57 -0
  46. package/lib/components/DropdownSelector.d.ts +9 -0
  47. package/lib/components/DropdownSelector.js +49 -0
  48. package/lib/components/EmptyState.d.ts +17 -0
  49. package/lib/components/EmptyState.js +44 -0
  50. package/lib/components/ErrorDisplay.d.ts +17 -0
  51. package/lib/components/ErrorDisplay.js +69 -0
  52. package/lib/components/FAQItem.d.ts +9 -0
  53. package/lib/components/FAQItem.js +52 -0
  54. package/lib/components/FDCard.d.ts +21 -0
  55. package/lib/components/FDCard.js +96 -0
  56. package/lib/components/FormDropdown.d.ts +18 -0
  57. package/lib/components/FormDropdown.js +155 -0
  58. package/lib/components/FormSection.d.ts +14 -0
  59. package/lib/components/FormSection.js +38 -0
  60. package/lib/components/Header.d.ts +14 -0
  61. package/lib/components/Header.js +52 -0
  62. package/lib/components/IFSCSearchResultCard.d.ts +13 -0
  63. package/lib/components/IFSCSearchResultCard.js +70 -0
  64. package/lib/components/InfoBox.d.ts +8 -0
  65. package/lib/components/InfoBox.js +39 -0
  66. package/lib/components/InterestRateCard.d.ts +8 -0
  67. package/lib/components/InterestRateCard.js +46 -0
  68. package/lib/components/LoadingIndicator.d.ts +12 -0
  69. package/lib/components/LoadingIndicator.js +30 -0
  70. package/lib/components/OTPInput.d.ts +17 -0
  71. package/lib/components/OTPInput.js +144 -0
  72. package/lib/components/PaymentDetailsCard.d.ts +20 -0
  73. package/lib/components/PaymentDetailsCard.js +68 -0
  74. package/lib/components/PendingFDBottomSheet.d.ts +18 -0
  75. package/lib/components/PendingFDBottomSheet.js +122 -0
  76. package/lib/components/SafeAreaWrapper.d.ts +13 -0
  77. package/lib/components/SafeAreaWrapper.js +41 -0
  78. package/lib/components/ScreenHeader.d.ts +11 -0
  79. package/lib/components/ScreenHeader.js +46 -0
  80. package/lib/components/StatusDisplay.d.ts +15 -0
  81. package/lib/components/StatusDisplay.js +88 -0
  82. package/lib/components/TextFieldWithLabel.d.ts +46 -0
  83. package/lib/components/TextFieldWithLabel.js +326 -0
  84. package/lib/components/TrustBox.d.ts +8 -0
  85. package/lib/components/TrustBox.js +45 -0
  86. package/lib/components/ValidationErrorAlert.d.ts +23 -0
  87. package/lib/components/ValidationErrorAlert.js +39 -0
  88. package/lib/components/ValidationMessage.d.ts +9 -0
  89. package/lib/components/ValidationMessage.js +98 -0
  90. package/lib/components/index.d.ts +35 -0
  91. package/lib/components/index.js +64 -0
  92. package/lib/config/apiConfig.d.ts +34 -0
  93. package/lib/config/apiConfig.js +158 -0
  94. package/lib/config/appDataConfig.d.ts +114 -0
  95. package/lib/config/appDataConfig.js +264 -0
  96. package/lib/config/encryptionConfig.d.ts +21 -0
  97. package/lib/config/encryptionConfig.js +61 -0
  98. package/lib/config/workflowConstants.d.ts +37 -0
  99. package/lib/config/workflowConstants.js +38 -0
  100. package/lib/constants/strings/bank.d.ts +72 -0
  101. package/lib/constants/strings/bank.js +86 -0
  102. package/lib/constants/strings/base64Images.d.ts +25 -0
  103. package/lib/constants/strings/base64Images.js +28 -0
  104. package/lib/constants/strings/common.d.ts +53 -0
  105. package/lib/constants/strings/common.js +62 -0
  106. package/lib/constants/strings/employee.d.ts +61 -0
  107. package/lib/constants/strings/employee.js +77 -0
  108. package/lib/constants/strings/faq.d.ts +14 -0
  109. package/lib/constants/strings/faq.js +20 -0
  110. package/lib/constants/strings/fd.d.ts +122 -0
  111. package/lib/constants/strings/fd.js +151 -0
  112. package/lib/constants/strings/home.d.ts +49 -0
  113. package/lib/constants/strings/home.js +62 -0
  114. package/lib/constants/strings/index.d.ts +16 -0
  115. package/lib/constants/strings/index.js +44 -0
  116. package/lib/constants/strings/kyc.d.ts +80 -0
  117. package/lib/constants/strings/kyc.js +94 -0
  118. package/lib/constants/strings/nominee.d.ts +64 -0
  119. package/lib/constants/strings/nominee.js +81 -0
  120. package/lib/hooks/useAuth.d.ts +25 -0
  121. package/lib/hooks/useAuth.js +39 -0
  122. package/lib/hooks/useFDData.d.ts +11 -0
  123. package/lib/hooks/useFDData.js +40 -0
  124. package/lib/index.d.ts +69 -0
  125. package/lib/index.js +182 -0
  126. package/lib/navigation/RootNavigator.d.ts +8 -0
  127. package/lib/navigation/RootNavigator.js +205 -0
  128. package/lib/navigation/SimpleNavigator.d.ts +11 -0
  129. package/lib/navigation/SimpleNavigator.js +107 -0
  130. package/lib/navigation/helpers.d.ts +11 -0
  131. package/lib/navigation/helpers.js +83 -0
  132. package/lib/navigation/index.d.ts +15 -0
  133. package/lib/navigation/index.js +42 -0
  134. package/lib/navigation/types.d.ts +113 -0
  135. package/lib/navigation/types.js +2 -0
  136. package/lib/navigation/workflowNavigator.d.ts +22 -0
  137. package/lib/navigation/workflowNavigator.js +104 -0
  138. package/lib/providers/ApiProvider.d.ts +7 -0
  139. package/lib/providers/ApiProvider.js +34 -0
  140. package/lib/providers/MasterDataProvider.d.ts +10 -0
  141. package/lib/providers/MasterDataProvider.js +54 -0
  142. package/lib/screens/AadhaarVerification.d.ts +7 -0
  143. package/lib/screens/AadhaarVerification.js +627 -0
  144. package/lib/screens/AddBankAccount.d.ts +22 -0
  145. package/lib/screens/AddBankAccount.js +381 -0
  146. package/lib/screens/BankDetail.d.ts +16 -0
  147. package/lib/screens/BankDetail.js +596 -0
  148. package/lib/screens/BookFD.d.ts +0 -0
  149. package/lib/screens/BookFD.js +315 -0
  150. package/lib/screens/Employee.d.ts +18 -0
  151. package/lib/screens/Employee.js +594 -0
  152. package/lib/screens/FDCalculator.d.ts +18 -0
  153. package/lib/screens/FDCalculator.js +759 -0
  154. package/lib/screens/FDList.d.ts +27 -0
  155. package/lib/screens/FDList.js +1008 -0
  156. package/lib/screens/FindIFSC.d.ts +16 -0
  157. package/lib/screens/FindIFSC.js +248 -0
  158. package/lib/screens/Home.d.ts +0 -0
  159. package/lib/screens/Home.js +143 -0
  160. package/lib/screens/NomineeDetail.d.ts +17 -0
  161. package/lib/screens/NomineeDetail.js +592 -0
  162. package/lib/screens/PayNow.d.ts +14 -0
  163. package/lib/screens/PayNow.js +230 -0
  164. package/lib/screens/Payment.d.ts +11 -0
  165. package/lib/screens/Payment.js +191 -0
  166. package/lib/screens/PaymentStatus.d.ts +16 -0
  167. package/lib/screens/PaymentStatus.js +397 -0
  168. package/lib/screens/ReviewKYC.d.ts +21 -0
  169. package/lib/screens/ReviewKYC.js +660 -0
  170. package/lib/state/paymentSession.d.ts +8 -0
  171. package/lib/state/paymentSession.js +13 -0
  172. package/lib/store/fdListSelectedSlice.d.ts +21 -0
  173. package/lib/store/fdListSelectedSlice.js +26 -0
  174. package/lib/store/hooks.d.ts +8 -0
  175. package/lib/store/hooks.js +31 -0
  176. package/lib/store/index.d.ts +3 -0
  177. package/lib/store/index.js +8 -0
  178. package/lib/store/onboardingSlice.d.ts +12 -0
  179. package/lib/store/onboardingSlice.js +32 -0
  180. package/lib/store/store.d.ts +13 -0
  181. package/lib/store/store.js +33 -0
  182. package/lib/theme/ThemeContext.d.ts +210 -0
  183. package/lib/theme/ThemeContext.js +90 -0
  184. package/lib/theme/colors.d.ts +80 -0
  185. package/lib/theme/colors.js +85 -0
  186. package/lib/theme/index.d.ts +34 -0
  187. package/lib/theme/index.js +69 -0
  188. package/lib/theme/shadows.d.ts +53 -0
  189. package/lib/theme/shadows.js +58 -0
  190. package/lib/theme/typography.d.ts +134 -0
  191. package/lib/theme/typography.js +143 -0
  192. package/lib/types/dataTypes.d.ts +34 -0
  193. package/lib/types/dataTypes.js +2 -0
  194. package/lib/types/workflowTypes.d.ts +2 -0
  195. package/lib/types/workflowTypes.js +2 -0
  196. package/lib/utils/apiLogger.d.ts +48 -0
  197. package/lib/utils/apiLogger.js +105 -0
  198. package/lib/utils/encryption.d.ts +28 -0
  199. package/lib/utils/encryption.js +113 -0
  200. package/lib/utils/getFDData.d.ts +48 -0
  201. package/lib/utils/getFDData.js +154 -0
  202. package/lib/utils/globalData.d.ts +2 -0
  203. package/lib/utils/globalData.js +10 -0
  204. package/package.json +76 -0
  205. package/src/api/applicationApi.ts +12 -0
  206. package/src/api/bankApi.ts +42 -0
  207. package/src/api/baseApi.ts +513 -0
  208. package/src/api/customerApi.ts +291 -0
  209. package/src/api/fdApi.ts +150 -0
  210. package/src/api/fdCalculatorApi.ts +41 -0
  211. package/src/api/index.ts +29 -0
  212. package/src/api/interestRateApi.ts +143 -0
  213. package/src/api/kycApi.ts +63 -0
  214. package/src/api/masterDataApi.ts +34 -0
  215. package/src/api/nomineeApi.ts +34 -0
  216. package/src/api/onboardingApi.ts +64 -0
  217. package/src/api/panApi.ts +25 -0
  218. package/src/api/paymentApi.ts +34 -0
  219. package/src/api/workflowApi.ts +94 -0
  220. package/src/assets/images/arrow-filled.png +0 -0
  221. package/src/assets/images/arrow-left.png +0 -0
  222. package/src/assets/images/backicon.png +0 -0
  223. package/src/assets/images/calendar.png +0 -0
  224. package/src/assets/images/chevron-down.png +0 -0
  225. package/src/assets/images/chevron-down@2x.png +0 -0
  226. package/src/assets/images/chevron-down@3x.png +0 -0
  227. package/src/assets/images/images.js +8 -0
  228. package/src/components/AadhaarInput.tsx +91 -0
  229. package/src/components/ActionButton.tsx +129 -0
  230. package/src/components/ActiveFDCard.tsx +158 -0
  231. package/src/components/AmountInput.tsx +217 -0
  232. package/src/components/CheckboxOption.tsx +93 -0
  233. package/src/components/CompanyHeader.tsx +78 -0
  234. package/src/components/DropdownSelector.tsx +77 -0
  235. package/src/components/EmptyState.tsx +109 -0
  236. package/src/components/ErrorDisplay.tsx +135 -0
  237. package/src/components/FAQItem.tsx +90 -0
  238. package/src/components/FDCard.tsx +165 -0
  239. package/src/components/FormDropdown.tsx +214 -0
  240. package/src/components/FormSection.tsx +86 -0
  241. package/src/components/Header.tsx +110 -0
  242. package/src/components/IFSCSearchResultCard.tsx +139 -0
  243. package/src/components/InfoBox.tsx +55 -0
  244. package/src/components/InterestRateCard.tsx +77 -0
  245. package/src/components/LoadingIndicator.tsx +63 -0
  246. package/src/components/OTPInput.tsx +213 -0
  247. package/src/components/PaymentDetailsCard.tsx +120 -0
  248. package/src/components/PendingFDBottomSheet.tsx +235 -0
  249. package/src/components/README.md +210 -0
  250. package/src/components/SafeAreaWrapper.tsx +68 -0
  251. package/src/components/ScreenHeader.tsx +83 -0
  252. package/src/components/StatusDisplay.tsx +139 -0
  253. package/src/components/TextFieldWithLabel.tsx +502 -0
  254. package/src/components/TrustBox.tsx +63 -0
  255. package/src/components/ValidationErrorAlert.tsx +57 -0
  256. package/src/components/ValidationMessage.tsx +134 -0
  257. package/src/components/index.tsx +47 -0
  258. package/src/config/apiConfig.ts +217 -0
  259. package/src/config/appDataConfig.ts +279 -0
  260. package/src/config/encryptionConfig.ts +65 -0
  261. package/src/config/workflowConstants.ts +43 -0
  262. package/src/constants/strings/README.md +146 -0
  263. package/src/constants/strings/bank.ts +92 -0
  264. package/src/constants/strings/base64Images.ts +29 -0
  265. package/src/constants/strings/common.ts +63 -0
  266. package/src/constants/strings/employee.ts +85 -0
  267. package/src/constants/strings/faq.ts +23 -0
  268. package/src/constants/strings/fd.ts +172 -0
  269. package/src/constants/strings/home.ts +67 -0
  270. package/src/constants/strings/index.ts +21 -0
  271. package/src/constants/strings/kyc.ts +100 -0
  272. package/src/constants/strings/nominee.ts +90 -0
  273. package/src/hooks/useAuth.ts +42 -0
  274. package/src/hooks/useFDData.ts +48 -0
  275. package/src/index.tsx +173 -0
  276. package/src/navigation/RootNavigator.tsx +352 -0
  277. package/src/navigation/SimpleNavigator.tsx +107 -0
  278. package/src/navigation/helpers.ts +85 -0
  279. package/src/navigation/index.tsx +81 -0
  280. package/src/navigation/types.ts +124 -0
  281. package/src/navigation/workflowNavigator.ts +131 -0
  282. package/src/providers/ApiProvider.tsx +43 -0
  283. package/src/providers/MasterDataProvider.tsx +30 -0
  284. package/src/screens/AadhaarVerification.tsx +809 -0
  285. package/src/screens/AddBankAccount.tsx +541 -0
  286. package/src/screens/BankDetail.tsx +826 -0
  287. package/src/screens/BookFD.tsx +330 -0
  288. package/src/screens/Employee.tsx +822 -0
  289. package/src/screens/FDCalculator.tsx +987 -0
  290. package/src/screens/FDList.tsx +1284 -0
  291. package/src/screens/FindIFSC.tsx +332 -0
  292. package/src/screens/Home.tsx +152 -0
  293. package/src/screens/NomineeDetail.tsx +800 -0
  294. package/src/screens/PayNow.tsx +282 -0
  295. package/src/screens/Payment.tsx +224 -0
  296. package/src/screens/PaymentStatus.tsx +561 -0
  297. package/src/screens/ReviewKYC.tsx +956 -0
  298. package/src/state/paymentSession.ts +13 -0
  299. package/src/store/fdListSelectedSlice.ts +42 -0
  300. package/src/store/hooks.ts +27 -0
  301. package/src/store/index.ts +3 -0
  302. package/src/store/onboardingSlice.ts +37 -0
  303. package/src/store/store.ts +35 -0
  304. package/src/theme/ThemeContext.tsx +82 -0
  305. package/src/theme/colors.ts +90 -0
  306. package/src/theme/index.ts +64 -0
  307. package/src/theme/shadows.ts +61 -0
  308. package/src/theme/typography.ts +151 -0
  309. package/src/types/dataTypes.ts +37 -0
  310. package/src/types/env.d.ts +93 -0
  311. package/src/types/workflowTypes.ts +12 -0
  312. package/src/utils/apiLogger.ts +166 -0
  313. package/src/utils/encryption.ts +159 -0
  314. package/src/utils/getFDData.ts +175 -0
  315. package/src/utils/globalData.ts +7 -0
@@ -0,0 +1,291 @@
1
+ import { baseApi } from './baseApi';
2
+ import { getUserInfoForAPI } from '../config/appDataConfig';
3
+
4
+ // Request/response types
5
+ export interface GetCustomerApplicationsRequest {
6
+ userReferenceId: string;
7
+ }
8
+
9
+ export interface GetCustomerApplicationDetailsRequest {
10
+ applicationId: string;
11
+ customerId: string;
12
+ providerId?: string;
13
+ workflowInstanceId?: string;
14
+ userreferenceid?: string;
15
+ applicationid?: string;
16
+ entityid?: string;
17
+ }
18
+
19
+ export interface CustomerNomineeRequest {
20
+ customerId: string;
21
+ intentToNominate: boolean;
22
+ fullName: string;
23
+ nomineePrefix: string;
24
+ relation: string;
25
+ customRelation?: string;
26
+ dob: string;
27
+ nomineeNameOnCertificate: boolean;
28
+ providerId?: string;
29
+ workflowInstanceId?: string;
30
+ userreferenceid?: string;
31
+ applicationid?: string;
32
+ }
33
+
34
+ export interface CustomerOccupationRequest {
35
+ occupation: string;
36
+ natureOfBusiness: string;
37
+ customOccupation: string;
38
+ annualIncome: string;
39
+ sourceOfFund: string;
40
+ politicallyExposedPerson: boolean;
41
+ providerId?: string;
42
+ workflowInstanceId?: string;
43
+ userreferenceid?: string;
44
+ applicationid?: string;
45
+ }
46
+
47
+ export interface GetCustomerWebhookApplicationsRequest {
48
+ userReferenceId: string;
49
+ wfStatus?: string;
50
+ }
51
+
52
+ // If actual response models are known, replace 'any' with proper interfaces
53
+ export type GetCustomerApplicationsResponse = any;
54
+ export type GetCustomerApplicationDetailsResponse = any;
55
+ export type GetCustomerWebhookApplicationsResponse = any;
56
+ export type CustomerNomineeResponse = any;
57
+ export type CustomerOccupationResponse = any;
58
+
59
+ export const customerApi = baseApi.injectEndpoints({
60
+ endpoints: (builder) => ({
61
+ // --- Replace the existing getCustomerApplications block with the following ---
62
+
63
+ getCustomerApplications: builder.mutation<
64
+ GetCustomerApplicationsResponse,
65
+ GetCustomerApplicationsRequest
66
+ >({
67
+ query: (body) => {
68
+ const raw = (body as any) || {};
69
+ const userReferenceId =
70
+ raw.userReferenceId ??
71
+ raw.id ??
72
+ (() => {
73
+ try {
74
+ return getUserInfoForAPI().userReferenceId;
75
+ } catch {
76
+ return undefined;
77
+ }
78
+ })();
79
+
80
+ const { userReferenceId: _omit, id: _omitId, ...requestBody } = raw;
81
+
82
+ if (userReferenceId) {
83
+ (requestBody as any).userReferenceId = userReferenceId;
84
+ }
85
+
86
+ return {
87
+ url: 'customer/applications',
88
+ method: 'GET',
89
+ params: requestBody,
90
+ headers: {
91
+ userreferenceid: userReferenceId || '{{userreferenceid}}',
92
+ },
93
+ };
94
+ },
95
+
96
+ /**
97
+ * transformResponse:
98
+ * - Accepts backend response in multiple shapes (array, { data: [] }, { applications: [] })
99
+ * - Cleans each application to contain ONLY allowedKeys
100
+ * - Returns the response in the same outer shape it was received in,
101
+ * but with the inner list replaced by the cleaned list.
102
+ */
103
+ transformResponse: (response: any) => {
104
+ const allowedKeys = [
105
+ "application_id",
106
+ "investment_amount",
107
+ "interest_rate",
108
+ "maturity_date",
109
+ "maturity_amount",
110
+ "interest_payout_term",
111
+ "tenure_in_months",
112
+ "transaction_id",
113
+ "fd_provider_id",
114
+ "fd_provider_name",
115
+ "transaction_status",
116
+ "transaction_description",
117
+ "wf_status",
118
+ "created_date",
119
+ "certificate_status",
120
+ "application_id",
121
+ "workflow_instance_id", // ← ADD THIS
122
+ "entity_id", // ← ADD THIS
123
+ "customer_id", // ← ADD THIS
124
+ "current_task",
125
+ "current_state",
126
+ "fd_id",
127
+ ];
128
+
129
+ const cleanItem = (item: any) => {
130
+ const cleaned: any = {};
131
+ // copy only allowed keys
132
+ allowedKeys.forEach((k) => {
133
+ // keep original value (may be undefined) to keep consistent shape
134
+ if (item && Object.prototype.hasOwnProperty.call(item, k)) {
135
+ cleaned[k] = item[k];
136
+ } else {
137
+ // if backend sometimes returns camelCase (just in case), map common variants
138
+ // try camelCase fallback
139
+ const camel = k.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
140
+ if (item && Object.prototype.hasOwnProperty.call(item, camel)) {
141
+ cleaned[k] = item[camel];
142
+ } else {
143
+ // leave undefined (not adding extra fields)
144
+ }
145
+ }
146
+ });
147
+ return cleaned;
148
+ };
149
+
150
+ // Helper to extract array from several possible shapes
151
+ const extractArray = (resp: any): any[] => {
152
+ if (Array.isArray(resp)) return resp;
153
+ if (resp?.data && Array.isArray(resp.data)) return resp.data;
154
+ if (resp?.applications && Array.isArray(resp.applications)) return resp.applications;
155
+ // If response is an object but not containing arrays, return empty array
156
+ return [];
157
+ };
158
+
159
+ const cleanedList = extractArray(response).map((it: any) => cleanItem(it));
160
+
161
+ // Return shape preservation:
162
+ if (Array.isArray(response)) {
163
+ // backend returned an array -> return cleaned array
164
+ return cleanedList;
165
+ }
166
+
167
+ if (response && response.data && Array.isArray(response.data)) {
168
+ // preserve other top-level props but replace data
169
+ return { ...response, data: cleanedList };
170
+ }
171
+
172
+ if (response && response.applications && Array.isArray(response.applications)) {
173
+ return { ...response, applications: cleanedList };
174
+ }
175
+
176
+ // Fallback: return object with data = cleanedList (safe shape)
177
+ return { ...(response || {}), data: cleanedList };
178
+ },
179
+ }),
180
+
181
+
182
+ getCustomerApplicationDetails: builder.mutation<
183
+ GetCustomerApplicationDetailsResponse,
184
+ GetCustomerApplicationDetailsRequest
185
+ >({
186
+ query: (body) => {
187
+ const { providerId, workflowInstanceId, userreferenceid, applicationid, entityid, ...requestBody } = (body as any) || {};
188
+ const headers: Record<string, string> = {};
189
+ if (providerId) headers.provider = providerId;
190
+ if (workflowInstanceId) headers.workflowInstanceId = workflowInstanceId;
191
+ if (userreferenceid) headers.userreferenceid = userreferenceid;
192
+ if (applicationid) headers.applicationid = applicationid;
193
+ if (entityid) headers.entityid = entityid;
194
+
195
+ // Ensure entityid is present in request body as well (as requested)
196
+ const finalParams: any = { ...requestBody };
197
+ if (entityid) finalParams.entityid = entityid;
198
+
199
+ return {
200
+ url: 'customer/application/details',
201
+ method: 'GET',
202
+ params: finalParams,
203
+ headers,
204
+ };
205
+ },
206
+ }),
207
+
208
+ customerNominee: builder.mutation<
209
+ CustomerNomineeResponse,
210
+ CustomerNomineeRequest
211
+ >({
212
+ query: (body) => {
213
+ const { providerId, workflowInstanceId, userreferenceid, applicationid, ...requestBody } = body;
214
+ return {
215
+ url: 'customer/nominee',
216
+ method: 'POST',
217
+ body: requestBody,
218
+ headers: {
219
+ provider: providerId || '{{shriramprovider}}',
220
+ workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
221
+ userreferenceid: userreferenceid || '{{userreferenceid}}',
222
+ applicationid: applicationid || '{{applicationid}}',
223
+ },
224
+ };
225
+ },
226
+ }),
227
+
228
+ customerOccupation: builder.mutation<
229
+ CustomerOccupationResponse,
230
+ CustomerOccupationRequest
231
+ >({
232
+ query: (body) => {
233
+ const { providerId, workflowInstanceId, userreferenceid, applicationid, ...requestBody } = body;
234
+ return {
235
+ url: 'customer/occupation',
236
+ method: 'POST',
237
+ body: requestBody,
238
+ headers: {
239
+ provider: providerId || '{{shriramprovider}}',
240
+ workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
241
+ userreferenceid: userreferenceid || '{{userreferenceid}}',
242
+ applicationid: applicationid || '{{applicationid}}',
243
+ },
244
+ };
245
+ },
246
+ }),
247
+
248
+ getCustomerWebhookApplications: builder.mutation<
249
+ GetCustomerWebhookApplicationsResponse,
250
+ GetCustomerWebhookApplicationsRequest
251
+ >({
252
+ query: (body) => {
253
+ const raw = (body as any) || {};
254
+ const userReferenceId =
255
+ raw.userReferenceId ??
256
+ raw.id ??
257
+ (() => {
258
+ try {
259
+ return getUserInfoForAPI().userReferenceId;
260
+ } catch {
261
+ return undefined;
262
+ }
263
+ })();
264
+
265
+ const wfStatus = raw.wfStatus || 'Completed';
266
+
267
+ return {
268
+ url: 'customer/webhook/applications',
269
+ method: 'GET',
270
+ params: {
271
+ userReferenceId,
272
+ wfStatus,
273
+ },
274
+ headers: {
275
+ userreferenceid: userReferenceId || '{{userreferenceid}}',
276
+ },
277
+ };
278
+ },
279
+ }),
280
+ }),
281
+ });
282
+
283
+ export const {
284
+ useGetCustomerApplicationsMutation,
285
+ useGetCustomerApplicationDetailsMutation,
286
+ useGetCustomerWebhookApplicationsMutation,
287
+ useCustomerNomineeMutation,
288
+ useCustomerOccupationMutation,
289
+ } = customerApi;
290
+
291
+
@@ -0,0 +1,150 @@
1
+ import { baseApi } from './baseApi';
2
+
3
+ export interface FDBankAccountRequest {
4
+ accountType: string;
5
+ accountNumber: string;
6
+ ifscCode: string;
7
+ bankName: string;
8
+ branchName: string;
9
+ customerId: string;
10
+ providerId?: string;
11
+ workflowInstanceId?: string;
12
+ userreferenceid?: string;
13
+ applicationid?: string;
14
+ entityid?: string;
15
+ }
16
+
17
+ export type FDBankAccountResponse = any;
18
+
19
+ export interface FDBankDetailsRequest {
20
+ ifscCode: string;
21
+ providerId?: string;
22
+ }
23
+
24
+ export interface FDBankDetailsResponse {
25
+ status: string;
26
+ statusCode: number;
27
+ message: string;
28
+ data: Array<{
29
+ BankBranch: string;
30
+ BnkDescr: string;
31
+ BnkShrtDescr: string;
32
+ Code: string;
33
+ IfscCode: string;
34
+ intCustbnk_pk: string;
35
+ }>;
36
+ // Legacy fields for backward compatibility
37
+ bankName?: string;
38
+ branchName?: string;
39
+ ifscCode?: string;
40
+ address?: string;
41
+ city?: string;
42
+ state?: string;
43
+ pincode?: string;
44
+ }
45
+
46
+ export const fdApi = baseApi.injectEndpoints({
47
+ endpoints: (builder) => ({
48
+ createFD: builder.mutation<any, any>({
49
+ query: (body) => {
50
+ const { providerId, workflowInstanceId, userreferenceid, entityid, ...requestBody } = body;
51
+ return {
52
+ url: 'fd/create',
53
+ method: 'POST',
54
+ body: requestBody, // applicationId stays in body, entityid is removed
55
+ headers: {
56
+ provider: providerId || '{{shriramprovider}}',
57
+ workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
58
+ userreferenceid: userreferenceid || '{{userreferenceid}}',
59
+ // entityid removed from headers as it's not allowed
60
+ },
61
+ };
62
+ },
63
+ }),
64
+
65
+ fdBankAccount: builder.mutation<FDBankAccountResponse, FDBankAccountRequest>({
66
+ query: (body) => {
67
+ const { providerId, workflowInstanceId, userreferenceid, applicationid, entityid, ...requestBody } = body;
68
+ return {
69
+ url: 'fd/bank/account',
70
+ method: 'POST',
71
+ body: requestBody,
72
+ headers: {
73
+ provider: providerId || '{{shriramprovider}}',
74
+ workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
75
+ userreferenceid: userreferenceid || '{{userreferenceid}}',
76
+ applicationid: applicationid || '{{applicationid}}',
77
+ entityid: entityid || '{{entityid}}',
78
+ },
79
+ };
80
+ },
81
+ }),
82
+
83
+ fdBankDetails: builder.query<FDBankDetailsResponse, FDBankDetailsRequest>({
84
+ query: (params) => {
85
+ const { providerId, ifscCode } = params;
86
+ return {
87
+ url: `fd/masterdata/bank-details?ifscCode=${ifscCode}`,
88
+ method: 'GET',
89
+ headers: {
90
+ provider: providerId || '{{shriramprovider}}',
91
+ },
92
+ };
93
+ },
94
+ }),
95
+
96
+ paymentReverseFeed: builder.mutation<any, any>({
97
+ query: (body) => {
98
+ const { providerId, workflowInstanceId, userreferenceid, applicationid, entityid, ...requestBody } = body;
99
+ return {
100
+ url: 'fd/payment/reversefeed',
101
+ method: 'POST',
102
+ body: requestBody,
103
+ headers: {
104
+ provider: providerId || '{{shriramprovider}}',
105
+ workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
106
+ userreferenceid: userreferenceid || '{{userreferenceid}}',
107
+ applicationid: applicationid || '{{applicationid}}',
108
+ entityid: entityid || '{{entityid}}',
109
+ },
110
+ };
111
+ },
112
+ }),
113
+
114
+ // Retry payment - same header params, transactionId in body
115
+ paymentRetry: builder.mutation<any, any>({
116
+ query: (body) => {
117
+ const { providerId, workflowInstanceId, userreferenceid, applicationid, entityid, ...requestBody } = body;
118
+ return {
119
+ url: 'fd/payment/retry',
120
+ method: 'POST',
121
+ body: requestBody, // expects { transactionId }
122
+ headers: {
123
+ provider: providerId || '{{shriramprovider}}',
124
+ workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
125
+ userreferenceid: userreferenceid || '{{userreferenceid}}',
126
+ applicationid: applicationid || '{{applicationid}}',
127
+ entityid: entityid || '{{entityid}}',
128
+ },
129
+ };
130
+ },
131
+ }),
132
+
133
+ fdBankDetailsSearch: builder.mutation<FDBankDetailsResponse, FDBankDetailsRequest>({
134
+ query: (params) => {
135
+ const { providerId, ifscCode } = params;
136
+ return {
137
+ url: `fd/masterdata/bank-details?ifscCode=${ifscCode}`,
138
+ method: 'GET',
139
+ headers: {
140
+ provider: providerId || '{{shriramprovider}}',
141
+ },
142
+ };
143
+ },
144
+ }),
145
+ }),
146
+ });
147
+
148
+ export const { useCreateFDMutation, useFdBankAccountMutation,
149
+ useFdBankDetailsQuery, useFdBankDetailsSearchMutation,
150
+ usePaymentReverseFeedMutation, usePaymentRetryMutation } = fdApi;
@@ -0,0 +1,41 @@
1
+ // FD Calculator API
2
+ import { baseApi } from './baseApi';
3
+
4
+ export interface FdCalculatorRequest {
5
+ principalAmount: number;
6
+ tenureInMonths: number;
7
+ dob: string;
8
+ isWomenDepositor?: boolean;
9
+ investmentType: string;
10
+ providerId?: string;
11
+ interestPayout?: string;
12
+ }
13
+
14
+ export interface FdCalculatorResponse {
15
+ status: string;
16
+ statusCode: number;
17
+ message: string;
18
+ data: any;
19
+ }
20
+
21
+ export const fdCalculatorApi = baseApi.injectEndpoints({
22
+ endpoints: (builder) => ({
23
+ calculateFD: builder.mutation<FdCalculatorResponse, FdCalculatorRequest>({
24
+ query: (body) => {
25
+ const { providerId, ...requestParams } = body;
26
+ const headers: Record<string, string> = {};
27
+ if (providerId) headers.provider = providerId;
28
+
29
+ const request = {
30
+ url: 'interest-rates/calculate',
31
+ method: 'GET' as const,
32
+ params: requestParams,
33
+ headers,
34
+ } as const;
35
+ return request;
36
+ },
37
+ }),
38
+ }),
39
+ });
40
+
41
+ export const { useCalculateFDMutation } = fdCalculatorApi;
@@ -0,0 +1,29 @@
1
+ // Main API exports
2
+ export { baseApi } from './baseApi';
3
+ export * from './interestRateApi';
4
+ export * from './customerApi';
5
+ export * from './workflowApi';
6
+ export * from './fdCalculatorApi';
7
+ export * from './kycApi';
8
+ export * from './masterDataApi';
9
+ export * from './onboardingApi';
10
+
11
+ // Re-export all hooks for convenience
12
+ export {
13
+ useGetInterestRatesMutation,
14
+ } from './interestRateApi';
15
+
16
+ export {
17
+ useGetCustomerApplicationsMutation,
18
+ useGetCustomerApplicationDetailsMutation,
19
+ } from './customerApi';
20
+
21
+ export {
22
+ useTerminateWorkflowMutation,
23
+ useUpdateTaskMutation,
24
+ useUpdateStateMutation,
25
+ } from './workflowApi';
26
+
27
+ export { useCalculateFDMutation } from './fdCalculatorApi';
28
+ export { usePanRapidNoMutation, useEkycSendOtpMutation, useAadhaarVerifyOtpMutation } from './kycApi';
29
+ export { useStartOnboardingMutation } from './onboardingApi';
@@ -0,0 +1,143 @@
1
+ import { baseApi, toggleEncryption, isEncryptionEnabled, getCurrentApiConfig } from './baseApi';
2
+ import { getUserDemographics, isSDKInitialized } from '../config/appDataConfig';
3
+
4
+ // Interest Rate related interfaces
5
+ export interface InterestRate {
6
+ effectiveYield: number;
7
+ maturityValue: number;
8
+ perdMonth: number; // tenure in months
9
+ rate: number;
10
+ providerId: string;
11
+ providerName: string;
12
+ }
13
+
14
+ export interface InterestRateRequest {
15
+ // New parameters for depositor information
16
+ isWomenDepositor?: boolean;
17
+ investmentType?: string;
18
+ dob?: string; // Date of birth
19
+ }
20
+
21
+ export interface InterestRateApiResponse {
22
+ status: string;
23
+ statusCode: number;
24
+ message: string;
25
+ data: {
26
+ fdrScheme: InterestRate[];
27
+ sdrScheme: InterestRate[];
28
+ };
29
+ }
30
+
31
+ export interface InterestCalculation {
32
+ principal: number;
33
+ rate: number;
34
+ tenure: number;
35
+ interest: number;
36
+ maturityAmount: number;
37
+ effectiveDate: string;
38
+ maturityDate: string;
39
+ }
40
+
41
+ // Interest Rate API endpoints
42
+ export const interestRateApi = baseApi.injectEndpoints({
43
+ endpoints: (builder) => ({
44
+ // Get all available interest rates
45
+ getInterestRates: builder.mutation<InterestRateApiResponse, Partial<InterestRateRequest>>({
46
+ query: (params = {}) => {
47
+ // Get user demographics from app data if SDK is initialized
48
+ let requestBody: any = {
49
+ investmentType: params.investmentType || 'SDR',
50
+ };
51
+
52
+ if (isSDKInitialized()) {
53
+ try {
54
+ const userDemographics = getUserDemographics();
55
+ requestBody = {
56
+ isWomenDepositor: userDemographics.isWomenDepositor,
57
+ investmentType: params.investmentType || 'SDR',
58
+ dob: userDemographics.dob,
59
+ };
60
+
61
+ } catch (error) {
62
+ requestBody = {
63
+ isWomenDepositor: params.isWomenDepositor || false,
64
+ investmentType: params.investmentType || 'SDR',
65
+ dob: params.dob || '1990-01-01',
66
+ };
67
+ }
68
+ } else {
69
+ // Fallback to provided params or defaults
70
+ requestBody = {
71
+ isWomenDepositor: params.isWomenDepositor || false,
72
+ investmentType: params.investmentType || 'SDR',
73
+ dob: params.dob || '1990-01-01',
74
+ };
75
+ }
76
+
77
+ return {
78
+ url: 'interest-rates',
79
+ method: 'GET',
80
+ params: requestBody,
81
+ };
82
+ },
83
+ invalidatesTags: ['InterestRate'],
84
+ }),
85
+
86
+
87
+ // Toggle encryption for API requests
88
+ toggleEncryption: builder.mutation<{ enabled: boolean; message: string }, boolean | undefined>({
89
+ queryFn: async (enable) => {
90
+ try {
91
+ const result = toggleEncryption(enable);
92
+ return {
93
+ data: {
94
+ enabled: result,
95
+ message: `Encryption ${result ? 'enabled' : 'disabled'} successfully`
96
+ }
97
+ };
98
+ } catch (error) {
99
+ return {
100
+ error: {
101
+ status: 400,
102
+ data: { message: 'Failed to toggle encryption' }
103
+ }
104
+ };
105
+ }
106
+ },
107
+ }),
108
+
109
+ // Get current encryption status
110
+ getEncryptionStatus: builder.query<{ enabled: boolean; config: any }, void>({
111
+ queryFn: async () => {
112
+ try {
113
+ const enabled = isEncryptionEnabled();
114
+ const config = getCurrentApiConfig();
115
+ return {
116
+ data: {
117
+ enabled,
118
+ config: {
119
+ allowEncryptionToggle: config.allowEncryptionToggle,
120
+ baseUrl: config.baseUrl,
121
+ environment: config.headers['X-Environment']
122
+ }
123
+ }
124
+ };
125
+ } catch (error) {
126
+ return {
127
+ error: {
128
+ status: 500,
129
+ data: { message: 'Failed to get encryption status' }
130
+ }
131
+ };
132
+ }
133
+ },
134
+ }),
135
+ }),
136
+ });
137
+
138
+ // Export hooks for use in components
139
+ export const {
140
+ useGetInterestRatesMutation,
141
+ useToggleEncryptionMutation,
142
+ useGetEncryptionStatusQuery,
143
+ } = interestRateApi;