@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.
- package/README.md +184 -0
- package/lib/api/applicationApi.d.ts +1 -0
- package/lib/api/applicationApi.js +11 -0
- package/lib/api/bankApi.d.ts +352 -0
- package/lib/api/bankApi.js +54 -0
- package/lib/api/baseApi.d.ts +8 -0
- package/lib/api/baseApi.js +456 -0
- package/lib/api/customerApi.d.ts +855 -0
- package/lib/api/customerApi.js +213 -0
- package/lib/api/fdApi.d.ts +979 -0
- package/lib/api/fdApi.js +112 -0
- package/lib/api/fdCalculatorApi.d.ts +179 -0
- package/lib/api/fdCalculatorApi.js +36 -0
- package/lib/api/index.d.ts +14 -0
- package/lib/api/index.js +45 -0
- package/lib/api/interestRateApi.d.ts +585 -0
- package/lib/api/interestRateApi.js +101 -0
- package/lib/api/kycApi.d.ts +486 -0
- package/lib/api/kycApi.js +71 -0
- package/lib/api/masterDataApi.d.ts +158 -0
- package/lib/api/masterDataApi.js +32 -0
- package/lib/api/nomineeApi.d.ts +325 -0
- package/lib/api/nomineeApi.js +46 -0
- package/lib/api/onboardingApi.d.ts +192 -0
- package/lib/api/onboardingApi.js +41 -0
- package/lib/api/panApi.d.ts +0 -0
- package/lib/api/panApi.js +23 -0
- package/lib/api/paymentApi.d.ts +325 -0
- package/lib/api/paymentApi.js +46 -0
- package/lib/api/workflowApi.d.ts +654 -0
- package/lib/api/workflowApi.js +90 -0
- package/lib/assets/images/images.d.ts +4 -0
- package/lib/assets/images/images.js +10 -0
- package/lib/components/AadhaarInput.d.ts +13 -0
- package/lib/components/AadhaarInput.js +47 -0
- package/lib/components/ActionButton.d.ts +12 -0
- package/lib/components/ActionButton.js +87 -0
- package/lib/components/ActiveFDCard.d.ts +16 -0
- package/lib/components/ActiveFDCard.js +95 -0
- package/lib/components/AmountInput.d.ts +20 -0
- package/lib/components/AmountInput.js +144 -0
- package/lib/components/CheckboxOption.d.ts +11 -0
- package/lib/components/CheckboxOption.js +41 -0
- package/lib/components/CompanyHeader.d.ts +7 -0
- package/lib/components/CompanyHeader.js +57 -0
- package/lib/components/DropdownSelector.d.ts +9 -0
- package/lib/components/DropdownSelector.js +49 -0
- package/lib/components/EmptyState.d.ts +17 -0
- package/lib/components/EmptyState.js +44 -0
- package/lib/components/ErrorDisplay.d.ts +17 -0
- package/lib/components/ErrorDisplay.js +69 -0
- package/lib/components/FAQItem.d.ts +9 -0
- package/lib/components/FAQItem.js +52 -0
- package/lib/components/FDCard.d.ts +21 -0
- package/lib/components/FDCard.js +96 -0
- package/lib/components/FormDropdown.d.ts +18 -0
- package/lib/components/FormDropdown.js +155 -0
- package/lib/components/FormSection.d.ts +14 -0
- package/lib/components/FormSection.js +38 -0
- package/lib/components/Header.d.ts +14 -0
- package/lib/components/Header.js +52 -0
- package/lib/components/IFSCSearchResultCard.d.ts +13 -0
- package/lib/components/IFSCSearchResultCard.js +70 -0
- package/lib/components/InfoBox.d.ts +8 -0
- package/lib/components/InfoBox.js +39 -0
- package/lib/components/InterestRateCard.d.ts +8 -0
- package/lib/components/InterestRateCard.js +46 -0
- package/lib/components/LoadingIndicator.d.ts +12 -0
- package/lib/components/LoadingIndicator.js +30 -0
- package/lib/components/OTPInput.d.ts +17 -0
- package/lib/components/OTPInput.js +144 -0
- package/lib/components/PaymentDetailsCard.d.ts +20 -0
- package/lib/components/PaymentDetailsCard.js +68 -0
- package/lib/components/PendingFDBottomSheet.d.ts +18 -0
- package/lib/components/PendingFDBottomSheet.js +122 -0
- package/lib/components/SafeAreaWrapper.d.ts +13 -0
- package/lib/components/SafeAreaWrapper.js +41 -0
- package/lib/components/ScreenHeader.d.ts +11 -0
- package/lib/components/ScreenHeader.js +46 -0
- package/lib/components/StatusDisplay.d.ts +15 -0
- package/lib/components/StatusDisplay.js +88 -0
- package/lib/components/TextFieldWithLabel.d.ts +46 -0
- package/lib/components/TextFieldWithLabel.js +326 -0
- package/lib/components/TrustBox.d.ts +8 -0
- package/lib/components/TrustBox.js +45 -0
- package/lib/components/ValidationErrorAlert.d.ts +23 -0
- package/lib/components/ValidationErrorAlert.js +39 -0
- package/lib/components/ValidationMessage.d.ts +9 -0
- package/lib/components/ValidationMessage.js +98 -0
- package/lib/components/index.d.ts +35 -0
- package/lib/components/index.js +64 -0
- package/lib/config/apiConfig.d.ts +34 -0
- package/lib/config/apiConfig.js +158 -0
- package/lib/config/appDataConfig.d.ts +114 -0
- package/lib/config/appDataConfig.js +264 -0
- package/lib/config/encryptionConfig.d.ts +21 -0
- package/lib/config/encryptionConfig.js +61 -0
- package/lib/config/workflowConstants.d.ts +37 -0
- package/lib/config/workflowConstants.js +38 -0
- package/lib/constants/strings/bank.d.ts +72 -0
- package/lib/constants/strings/bank.js +86 -0
- package/lib/constants/strings/base64Images.d.ts +25 -0
- package/lib/constants/strings/base64Images.js +28 -0
- package/lib/constants/strings/common.d.ts +53 -0
- package/lib/constants/strings/common.js +62 -0
- package/lib/constants/strings/employee.d.ts +61 -0
- package/lib/constants/strings/employee.js +77 -0
- package/lib/constants/strings/faq.d.ts +14 -0
- package/lib/constants/strings/faq.js +20 -0
- package/lib/constants/strings/fd.d.ts +122 -0
- package/lib/constants/strings/fd.js +151 -0
- package/lib/constants/strings/home.d.ts +49 -0
- package/lib/constants/strings/home.js +62 -0
- package/lib/constants/strings/index.d.ts +16 -0
- package/lib/constants/strings/index.js +44 -0
- package/lib/constants/strings/kyc.d.ts +80 -0
- package/lib/constants/strings/kyc.js +94 -0
- package/lib/constants/strings/nominee.d.ts +64 -0
- package/lib/constants/strings/nominee.js +81 -0
- package/lib/hooks/useAuth.d.ts +25 -0
- package/lib/hooks/useAuth.js +39 -0
- package/lib/hooks/useFDData.d.ts +11 -0
- package/lib/hooks/useFDData.js +40 -0
- package/lib/index.d.ts +69 -0
- package/lib/index.js +182 -0
- package/lib/navigation/RootNavigator.d.ts +8 -0
- package/lib/navigation/RootNavigator.js +205 -0
- package/lib/navigation/SimpleNavigator.d.ts +11 -0
- package/lib/navigation/SimpleNavigator.js +107 -0
- package/lib/navigation/helpers.d.ts +11 -0
- package/lib/navigation/helpers.js +83 -0
- package/lib/navigation/index.d.ts +15 -0
- package/lib/navigation/index.js +42 -0
- package/lib/navigation/types.d.ts +113 -0
- package/lib/navigation/types.js +2 -0
- package/lib/navigation/workflowNavigator.d.ts +22 -0
- package/lib/navigation/workflowNavigator.js +104 -0
- package/lib/providers/ApiProvider.d.ts +7 -0
- package/lib/providers/ApiProvider.js +34 -0
- package/lib/providers/MasterDataProvider.d.ts +10 -0
- package/lib/providers/MasterDataProvider.js +54 -0
- package/lib/screens/AadhaarVerification.d.ts +7 -0
- package/lib/screens/AadhaarVerification.js +627 -0
- package/lib/screens/AddBankAccount.d.ts +22 -0
- package/lib/screens/AddBankAccount.js +381 -0
- package/lib/screens/BankDetail.d.ts +16 -0
- package/lib/screens/BankDetail.js +596 -0
- package/lib/screens/BookFD.d.ts +0 -0
- package/lib/screens/BookFD.js +315 -0
- package/lib/screens/Employee.d.ts +18 -0
- package/lib/screens/Employee.js +594 -0
- package/lib/screens/FDCalculator.d.ts +18 -0
- package/lib/screens/FDCalculator.js +759 -0
- package/lib/screens/FDList.d.ts +27 -0
- package/lib/screens/FDList.js +1008 -0
- package/lib/screens/FindIFSC.d.ts +16 -0
- package/lib/screens/FindIFSC.js +248 -0
- package/lib/screens/Home.d.ts +0 -0
- package/lib/screens/Home.js +143 -0
- package/lib/screens/NomineeDetail.d.ts +17 -0
- package/lib/screens/NomineeDetail.js +592 -0
- package/lib/screens/PayNow.d.ts +14 -0
- package/lib/screens/PayNow.js +230 -0
- package/lib/screens/Payment.d.ts +11 -0
- package/lib/screens/Payment.js +191 -0
- package/lib/screens/PaymentStatus.d.ts +16 -0
- package/lib/screens/PaymentStatus.js +397 -0
- package/lib/screens/ReviewKYC.d.ts +21 -0
- package/lib/screens/ReviewKYC.js +660 -0
- package/lib/state/paymentSession.d.ts +8 -0
- package/lib/state/paymentSession.js +13 -0
- package/lib/store/fdListSelectedSlice.d.ts +21 -0
- package/lib/store/fdListSelectedSlice.js +26 -0
- package/lib/store/hooks.d.ts +8 -0
- package/lib/store/hooks.js +31 -0
- package/lib/store/index.d.ts +3 -0
- package/lib/store/index.js +8 -0
- package/lib/store/onboardingSlice.d.ts +12 -0
- package/lib/store/onboardingSlice.js +32 -0
- package/lib/store/store.d.ts +13 -0
- package/lib/store/store.js +33 -0
- package/lib/theme/ThemeContext.d.ts +210 -0
- package/lib/theme/ThemeContext.js +90 -0
- package/lib/theme/colors.d.ts +80 -0
- package/lib/theme/colors.js +85 -0
- package/lib/theme/index.d.ts +34 -0
- package/lib/theme/index.js +69 -0
- package/lib/theme/shadows.d.ts +53 -0
- package/lib/theme/shadows.js +58 -0
- package/lib/theme/typography.d.ts +134 -0
- package/lib/theme/typography.js +143 -0
- package/lib/types/dataTypes.d.ts +34 -0
- package/lib/types/dataTypes.js +2 -0
- package/lib/types/workflowTypes.d.ts +2 -0
- package/lib/types/workflowTypes.js +2 -0
- package/lib/utils/apiLogger.d.ts +48 -0
- package/lib/utils/apiLogger.js +105 -0
- package/lib/utils/encryption.d.ts +28 -0
- package/lib/utils/encryption.js +113 -0
- package/lib/utils/getFDData.d.ts +48 -0
- package/lib/utils/getFDData.js +154 -0
- package/lib/utils/globalData.d.ts +2 -0
- package/lib/utils/globalData.js +10 -0
- package/package.json +76 -0
- package/src/api/applicationApi.ts +12 -0
- package/src/api/bankApi.ts +42 -0
- package/src/api/baseApi.ts +513 -0
- package/src/api/customerApi.ts +291 -0
- package/src/api/fdApi.ts +150 -0
- package/src/api/fdCalculatorApi.ts +41 -0
- package/src/api/index.ts +29 -0
- package/src/api/interestRateApi.ts +143 -0
- package/src/api/kycApi.ts +63 -0
- package/src/api/masterDataApi.ts +34 -0
- package/src/api/nomineeApi.ts +34 -0
- package/src/api/onboardingApi.ts +64 -0
- package/src/api/panApi.ts +25 -0
- package/src/api/paymentApi.ts +34 -0
- package/src/api/workflowApi.ts +94 -0
- package/src/assets/images/arrow-filled.png +0 -0
- package/src/assets/images/arrow-left.png +0 -0
- package/src/assets/images/backicon.png +0 -0
- package/src/assets/images/calendar.png +0 -0
- package/src/assets/images/chevron-down.png +0 -0
- package/src/assets/images/chevron-down@2x.png +0 -0
- package/src/assets/images/chevron-down@3x.png +0 -0
- package/src/assets/images/images.js +8 -0
- package/src/components/AadhaarInput.tsx +91 -0
- package/src/components/ActionButton.tsx +129 -0
- package/src/components/ActiveFDCard.tsx +158 -0
- package/src/components/AmountInput.tsx +217 -0
- package/src/components/CheckboxOption.tsx +93 -0
- package/src/components/CompanyHeader.tsx +78 -0
- package/src/components/DropdownSelector.tsx +77 -0
- package/src/components/EmptyState.tsx +109 -0
- package/src/components/ErrorDisplay.tsx +135 -0
- package/src/components/FAQItem.tsx +90 -0
- package/src/components/FDCard.tsx +165 -0
- package/src/components/FormDropdown.tsx +214 -0
- package/src/components/FormSection.tsx +86 -0
- package/src/components/Header.tsx +110 -0
- package/src/components/IFSCSearchResultCard.tsx +139 -0
- package/src/components/InfoBox.tsx +55 -0
- package/src/components/InterestRateCard.tsx +77 -0
- package/src/components/LoadingIndicator.tsx +63 -0
- package/src/components/OTPInput.tsx +213 -0
- package/src/components/PaymentDetailsCard.tsx +120 -0
- package/src/components/PendingFDBottomSheet.tsx +235 -0
- package/src/components/README.md +210 -0
- package/src/components/SafeAreaWrapper.tsx +68 -0
- package/src/components/ScreenHeader.tsx +83 -0
- package/src/components/StatusDisplay.tsx +139 -0
- package/src/components/TextFieldWithLabel.tsx +502 -0
- package/src/components/TrustBox.tsx +63 -0
- package/src/components/ValidationErrorAlert.tsx +57 -0
- package/src/components/ValidationMessage.tsx +134 -0
- package/src/components/index.tsx +47 -0
- package/src/config/apiConfig.ts +217 -0
- package/src/config/appDataConfig.ts +279 -0
- package/src/config/encryptionConfig.ts +65 -0
- package/src/config/workflowConstants.ts +43 -0
- package/src/constants/strings/README.md +146 -0
- package/src/constants/strings/bank.ts +92 -0
- package/src/constants/strings/base64Images.ts +29 -0
- package/src/constants/strings/common.ts +63 -0
- package/src/constants/strings/employee.ts +85 -0
- package/src/constants/strings/faq.ts +23 -0
- package/src/constants/strings/fd.ts +172 -0
- package/src/constants/strings/home.ts +67 -0
- package/src/constants/strings/index.ts +21 -0
- package/src/constants/strings/kyc.ts +100 -0
- package/src/constants/strings/nominee.ts +90 -0
- package/src/hooks/useAuth.ts +42 -0
- package/src/hooks/useFDData.ts +48 -0
- package/src/index.tsx +173 -0
- package/src/navigation/RootNavigator.tsx +352 -0
- package/src/navigation/SimpleNavigator.tsx +107 -0
- package/src/navigation/helpers.ts +85 -0
- package/src/navigation/index.tsx +81 -0
- package/src/navigation/types.ts +124 -0
- package/src/navigation/workflowNavigator.ts +131 -0
- package/src/providers/ApiProvider.tsx +43 -0
- package/src/providers/MasterDataProvider.tsx +30 -0
- package/src/screens/AadhaarVerification.tsx +809 -0
- package/src/screens/AddBankAccount.tsx +541 -0
- package/src/screens/BankDetail.tsx +826 -0
- package/src/screens/BookFD.tsx +330 -0
- package/src/screens/Employee.tsx +822 -0
- package/src/screens/FDCalculator.tsx +987 -0
- package/src/screens/FDList.tsx +1284 -0
- package/src/screens/FindIFSC.tsx +332 -0
- package/src/screens/Home.tsx +152 -0
- package/src/screens/NomineeDetail.tsx +800 -0
- package/src/screens/PayNow.tsx +282 -0
- package/src/screens/Payment.tsx +224 -0
- package/src/screens/PaymentStatus.tsx +561 -0
- package/src/screens/ReviewKYC.tsx +956 -0
- package/src/state/paymentSession.ts +13 -0
- package/src/store/fdListSelectedSlice.ts +42 -0
- package/src/store/hooks.ts +27 -0
- package/src/store/index.ts +3 -0
- package/src/store/onboardingSlice.ts +37 -0
- package/src/store/store.ts +35 -0
- package/src/theme/ThemeContext.tsx +82 -0
- package/src/theme/colors.ts +90 -0
- package/src/theme/index.ts +64 -0
- package/src/theme/shadows.ts +61 -0
- package/src/theme/typography.ts +151 -0
- package/src/types/dataTypes.ts +37 -0
- package/src/types/env.d.ts +93 -0
- package/src/types/workflowTypes.ts +12 -0
- package/src/utils/apiLogger.ts +166 -0
- package/src/utils/encryption.ts +159 -0
- package/src/utils/getFDData.ts +175 -0
- package/src/utils/globalData.ts +7 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// API Logging Utility for Shriram SDK
|
|
3
|
+
// Provides comprehensive logging for API requests, responses, and debugging
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ApiLogger = exports.apiLogger = void 0;
|
|
6
|
+
// Default logging configuration
|
|
7
|
+
const DEFAULT_LOG_CONFIG = {
|
|
8
|
+
enableLogging: true,
|
|
9
|
+
logLevel: 'info',
|
|
10
|
+
logRequest: true,
|
|
11
|
+
logResponse: true,
|
|
12
|
+
logHeaders: true,
|
|
13
|
+
logBody: true,
|
|
14
|
+
logTiming: true,
|
|
15
|
+
maxBodyLength: 1000,
|
|
16
|
+
};
|
|
17
|
+
class ApiLogger {
|
|
18
|
+
constructor(config = {}) {
|
|
19
|
+
this.requestStartTimes = new Map();
|
|
20
|
+
this.config = Object.assign(Object.assign({}, DEFAULT_LOG_CONFIG), config);
|
|
21
|
+
}
|
|
22
|
+
// Update logging configuration
|
|
23
|
+
updateConfig(newConfig) {
|
|
24
|
+
this.config = Object.assign(Object.assign({}, this.config), newConfig);
|
|
25
|
+
}
|
|
26
|
+
// Log API request
|
|
27
|
+
logRequest(data) {
|
|
28
|
+
if (!this.config.enableLogging || !this.config.logRequest) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const { method, url, baseUrl, headers, body, timestamp, requestId, isEncrypted } = data;
|
|
32
|
+
// Store start time for duration calculation
|
|
33
|
+
this.requestStartTimes.set(requestId, timestamp);
|
|
34
|
+
// API request logging removed for security
|
|
35
|
+
}
|
|
36
|
+
// Log API response
|
|
37
|
+
logResponse(data) {
|
|
38
|
+
if (!this.config.enableLogging || !this.config.logResponse) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const { status, statusText, headers, data: responseData, timestamp, requestId, duration, isEncrypted, error } = data;
|
|
42
|
+
// Remove start time
|
|
43
|
+
this.requestStartTimes.delete(requestId);
|
|
44
|
+
const isSuccess = status >= 200 && status < 300;
|
|
45
|
+
const logMethod = isSuccess ? 'log' : 'error';
|
|
46
|
+
// API response logging removed for security
|
|
47
|
+
}
|
|
48
|
+
// Log API error
|
|
49
|
+
logError(error, requestId, url) {
|
|
50
|
+
if (!this.config.enableLogging) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const startTime = this.requestStartTimes.get(requestId);
|
|
54
|
+
const duration = startTime ? Date.now() - startTime : 0;
|
|
55
|
+
// Remove start time
|
|
56
|
+
this.requestStartTimes.delete(requestId);
|
|
57
|
+
// API error logging removed for security
|
|
58
|
+
}
|
|
59
|
+
// Calculate request duration
|
|
60
|
+
getRequestDuration(requestId) {
|
|
61
|
+
const startTime = this.requestStartTimes.get(requestId);
|
|
62
|
+
return startTime ? Date.now() - startTime : 0;
|
|
63
|
+
}
|
|
64
|
+
// Sanitize headers for logging (remove sensitive data)
|
|
65
|
+
sanitizeHeaders(headers) {
|
|
66
|
+
const sensitiveHeaders = ['authorization', 'x-api-key', 'x-auth-token', 'cookie'];
|
|
67
|
+
const sanitized = Object.assign({}, headers);
|
|
68
|
+
sensitiveHeaders.forEach(header => {
|
|
69
|
+
if (sanitized[header]) {
|
|
70
|
+
sanitized[header] = '***REDACTED***';
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return sanitized;
|
|
74
|
+
}
|
|
75
|
+
// Sanitize body for logging (truncate if too long)
|
|
76
|
+
sanitizeBody(body) {
|
|
77
|
+
if (!body)
|
|
78
|
+
return body;
|
|
79
|
+
try {
|
|
80
|
+
const bodyStr = typeof body === 'string' ? body : JSON.stringify(body, null, 2);
|
|
81
|
+
if (bodyStr.length > this.config.maxBodyLength) {
|
|
82
|
+
return bodyStr.substring(0, this.config.maxBodyLength) + '... [TRUNCATED]';
|
|
83
|
+
}
|
|
84
|
+
return typeof body === 'string' ? JSON.parse(bodyStr) : body;
|
|
85
|
+
}
|
|
86
|
+
catch (_a) {
|
|
87
|
+
return '[UNPARSEABLE BODY]';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Log configuration summary
|
|
91
|
+
logConfig() {
|
|
92
|
+
if (!this.config.enableLogging) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Configuration logging removed for security
|
|
96
|
+
}
|
|
97
|
+
// Clear all stored request times
|
|
98
|
+
clearRequestTimes() {
|
|
99
|
+
this.requestStartTimes.clear();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.ApiLogger = ApiLogger;
|
|
103
|
+
// Create singleton instance
|
|
104
|
+
exports.apiLogger = new ApiLogger();
|
|
105
|
+
exports.default = exports.apiLogger;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export default class CryptoUtils {
|
|
2
|
+
private static readonly SALT_LEN;
|
|
3
|
+
private static readonly IV_LEN;
|
|
4
|
+
private static readonly AUTH_TAG_LEN;
|
|
5
|
+
private static readonly ITERATIONS;
|
|
6
|
+
private static readonly KEY_LEN;
|
|
7
|
+
private static readonly MAX_CACHE;
|
|
8
|
+
private static keyCache;
|
|
9
|
+
static encryptJSONCompact(json: Record<string, any>, password: string): Promise<string>;
|
|
10
|
+
static decryptJSONCompact(compactBase64: string, password: string): Promise<Record<string, any>>;
|
|
11
|
+
private static deriveKey;
|
|
12
|
+
private static generateSalt;
|
|
13
|
+
private static generateIV;
|
|
14
|
+
static encrypt(data: Record<string, any>, passphrase: string): Promise<string>;
|
|
15
|
+
static decrypt(encryptedBase64: string, passphrase: string): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
export declare const ENCRYPTION_KEY = "60913a3b628a29ac9fdd2147e69d013135ce8be5b26d2ee5ec5e905838fcfa78";
|
|
18
|
+
export interface EncryptionConfig {
|
|
19
|
+
secretKey: string;
|
|
20
|
+
algorithm?: string;
|
|
21
|
+
ivLength?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const encryptJSONCompact: (data: Record<string, any>, password?: string) => Promise<string>;
|
|
24
|
+
export declare const decryptJSONCompact: (compactBase64: string, password?: string) => Promise<Record<string, any>>;
|
|
25
|
+
export declare const encryptRequest: (payload: any, config?: EncryptionConfig) => Promise<{
|
|
26
|
+
encryptedRequest: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const decryptResponse: (response: any, config?: EncryptionConfig) => Promise<any>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decryptResponse = exports.encryptRequest = exports.decryptJSONCompact = exports.encryptJSONCompact = exports.ENCRYPTION_KEY = void 0;
|
|
4
|
+
// encryption.ts
|
|
5
|
+
const buffer_1 = require("buffer");
|
|
6
|
+
// Polyfill for react-native-quick-crypto
|
|
7
|
+
const g = global;
|
|
8
|
+
if (typeof g.Buffer === 'undefined') {
|
|
9
|
+
g.Buffer = buffer_1.Buffer;
|
|
10
|
+
}
|
|
11
|
+
if (typeof g.base64FromArrayBuffer === 'undefined') {
|
|
12
|
+
g.base64FromArrayBuffer = (data) => {
|
|
13
|
+
return buffer_1.Buffer.from(data).toString('base64');
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const crypto = require('react-native-quick-crypto');
|
|
17
|
+
class CryptoUtils {
|
|
18
|
+
static async encryptJSONCompact(json, password) {
|
|
19
|
+
try {
|
|
20
|
+
const jsonString = JSON.stringify(json);
|
|
21
|
+
const plaintext = buffer_1.Buffer.from(jsonString, 'utf8');
|
|
22
|
+
const salt = this.generateSalt();
|
|
23
|
+
const iv = this.generateIV();
|
|
24
|
+
const key = this.deriveKey(password, salt);
|
|
25
|
+
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
|
|
26
|
+
const encrypted = buffer_1.Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
27
|
+
const authTag = cipher.getAuthTag();
|
|
28
|
+
const packed = buffer_1.Buffer.concat([salt, iv, authTag, encrypted]);
|
|
29
|
+
return packed.toString('base64');
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static async decryptJSONCompact(compactBase64, password) {
|
|
36
|
+
try {
|
|
37
|
+
const all = buffer_1.Buffer.from(compactBase64, 'base64');
|
|
38
|
+
if (all.length < this.SALT_LEN + this.IV_LEN + this.AUTH_TAG_LEN) {
|
|
39
|
+
throw new Error('Invalid compact payload');
|
|
40
|
+
}
|
|
41
|
+
const salt = all.slice(0, this.SALT_LEN);
|
|
42
|
+
const iv = all.slice(this.SALT_LEN, this.SALT_LEN + this.IV_LEN);
|
|
43
|
+
const authTag = all.slice(this.SALT_LEN + this.IV_LEN, this.SALT_LEN + this.IV_LEN + this.AUTH_TAG_LEN);
|
|
44
|
+
const cipherBytes = all.slice(this.SALT_LEN + this.IV_LEN + this.AUTH_TAG_LEN);
|
|
45
|
+
const key = this.deriveKey(password, salt);
|
|
46
|
+
const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
|
|
47
|
+
decipher.setAuthTag(authTag);
|
|
48
|
+
const decrypted = buffer_1.Buffer.concat([
|
|
49
|
+
decipher.update(cipherBytes),
|
|
50
|
+
decipher.final(),
|
|
51
|
+
]);
|
|
52
|
+
const jsonString = decrypted.toString('utf8');
|
|
53
|
+
return JSON.parse(jsonString);
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
throw e;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
static deriveKey(password, salt) {
|
|
60
|
+
const cacheKey = `${password}_${salt.toString('base64')}`;
|
|
61
|
+
const cached = this.keyCache.get(cacheKey);
|
|
62
|
+
if (cached)
|
|
63
|
+
return cached;
|
|
64
|
+
const key = crypto.pbkdf2Sync(password, salt, this.ITERATIONS, this.KEY_LEN, 'sha256');
|
|
65
|
+
if (this.keyCache.size >= this.MAX_CACHE)
|
|
66
|
+
this.keyCache.clear();
|
|
67
|
+
this.keyCache.set(cacheKey, key);
|
|
68
|
+
return key;
|
|
69
|
+
}
|
|
70
|
+
static generateSalt() {
|
|
71
|
+
return crypto.randomBytes(this.SALT_LEN);
|
|
72
|
+
}
|
|
73
|
+
static generateIV() {
|
|
74
|
+
return crypto.randomBytes(this.IV_LEN);
|
|
75
|
+
}
|
|
76
|
+
static async encrypt(data, passphrase) {
|
|
77
|
+
return this.encryptJSONCompact(data, passphrase);
|
|
78
|
+
}
|
|
79
|
+
static async decrypt(encryptedBase64, passphrase) {
|
|
80
|
+
const result = await this.decryptJSONCompact(encryptedBase64, passphrase);
|
|
81
|
+
return JSON.stringify(result);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
CryptoUtils.SALT_LEN = 16;
|
|
85
|
+
CryptoUtils.IV_LEN = 12;
|
|
86
|
+
CryptoUtils.AUTH_TAG_LEN = 16;
|
|
87
|
+
CryptoUtils.ITERATIONS = 100000;
|
|
88
|
+
CryptoUtils.KEY_LEN = 32;
|
|
89
|
+
CryptoUtils.MAX_CACHE = 10;
|
|
90
|
+
CryptoUtils.keyCache = new Map();
|
|
91
|
+
exports.default = CryptoUtils;
|
|
92
|
+
// Legacy named exports for backward compatibility
|
|
93
|
+
exports.ENCRYPTION_KEY = '60913a3b628a29ac9fdd2147e69d013135ce8be5b26d2ee5ec5e905838fcfa78';
|
|
94
|
+
const encryptJSONCompact = (data, password = exports.ENCRYPTION_KEY) => CryptoUtils.encryptJSONCompact(data, password);
|
|
95
|
+
exports.encryptJSONCompact = encryptJSONCompact;
|
|
96
|
+
const decryptJSONCompact = (compactBase64, password = exports.ENCRYPTION_KEY) => CryptoUtils.decryptJSONCompact(compactBase64, password);
|
|
97
|
+
exports.decryptJSONCompact = decryptJSONCompact;
|
|
98
|
+
const encryptRequest = async (payload, config) => ({
|
|
99
|
+
encryptedRequest: await CryptoUtils.encryptJSONCompact(payload, (config === null || config === void 0 ? void 0 : config.secretKey) || exports.ENCRYPTION_KEY),
|
|
100
|
+
});
|
|
101
|
+
exports.encryptRequest = encryptRequest;
|
|
102
|
+
const decryptResponse = async (response, config) => {
|
|
103
|
+
if (response === null || response === void 0 ? void 0 : response.encryptedResponse) {
|
|
104
|
+
try {
|
|
105
|
+
return await CryptoUtils.decryptJSONCompact(response.encryptedResponse, (config === null || config === void 0 ? void 0 : config.secretKey) || exports.ENCRYPTION_KEY);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return response;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return response;
|
|
112
|
+
};
|
|
113
|
+
exports.decryptResponse = decryptResponse;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get FD Data Utility
|
|
3
|
+
*
|
|
4
|
+
* This function can be called from the main app to retrieve currently booked FD details
|
|
5
|
+
* by calling the customer webhook applications API with completed status filter.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Response structure returned to main app
|
|
9
|
+
*/
|
|
10
|
+
export interface FDDataResponse {
|
|
11
|
+
allApplications: any[];
|
|
12
|
+
success: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get FD data by calling customer webhook applications API and return response to main app
|
|
17
|
+
* Only returns applications with wfStatus='Completed'
|
|
18
|
+
*
|
|
19
|
+
* @param userReferenceId - User reference ID from main app. If not provided, will try to get from SDK's internal state.
|
|
20
|
+
* @param applicationId - Optional application ID to find specific FD. If not provided, returns most recent FD.
|
|
21
|
+
* @returns Promise that resolves to FDDataResponse containing completed applications only
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { getFDData } from '@finspringinnovations/shriramsdk';
|
|
26
|
+
*
|
|
27
|
+
* // Get FD data with user reference ID from main app
|
|
28
|
+
* const result = await getFDData('USER123');
|
|
29
|
+
* if (result.success) {
|
|
30
|
+
* // Access full API response
|
|
31
|
+
* const apiResponse = result.apiResponse;
|
|
32
|
+
* const allApplications = result.allApplications;
|
|
33
|
+
* const bookedFD = result.bookedFD;
|
|
34
|
+
* const fdAmount = result.bookedFD?.amount;
|
|
35
|
+
* const applicationId = result.bookedFD?.applicationId;
|
|
36
|
+
* } else {
|
|
37
|
+
* // Handle error
|
|
38
|
+
* const errorMessage = result.error;
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // Get specific FD by application ID
|
|
42
|
+
* const specificFD = await getFDData('USER123', 'APP123456');
|
|
43
|
+
*
|
|
44
|
+
* // Without userReferenceId (will use SDK's internal state)
|
|
45
|
+
* const resultWithoutUserRef = await getFDData();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const getFDData: (userReferenceId?: string, applicationId?: string) => Promise<FDDataResponse>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Get FD Data Utility
|
|
4
|
+
*
|
|
5
|
+
* This function can be called from the main app to retrieve currently booked FD details
|
|
6
|
+
* by calling the customer webhook applications API with completed status filter.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getFDData = void 0;
|
|
10
|
+
const appDataConfig_1 = require("../config/appDataConfig");
|
|
11
|
+
const store_1 = require("../store");
|
|
12
|
+
const customerApi_1 = require("../api/customerApi");
|
|
13
|
+
/**
|
|
14
|
+
* Get FD data by calling customer webhook applications API and return response to main app
|
|
15
|
+
* Only returns applications with wfStatus='Completed'
|
|
16
|
+
*
|
|
17
|
+
* @param userReferenceId - User reference ID from main app. If not provided, will try to get from SDK's internal state.
|
|
18
|
+
* @param applicationId - Optional application ID to find specific FD. If not provided, returns most recent FD.
|
|
19
|
+
* @returns Promise that resolves to FDDataResponse containing completed applications only
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { getFDData } from '@finspringinnovations/shriramsdk';
|
|
24
|
+
*
|
|
25
|
+
* // Get FD data with user reference ID from main app
|
|
26
|
+
* const result = await getFDData('USER123');
|
|
27
|
+
* if (result.success) {
|
|
28
|
+
* // Access full API response
|
|
29
|
+
* const apiResponse = result.apiResponse;
|
|
30
|
+
* const allApplications = result.allApplications;
|
|
31
|
+
* const bookedFD = result.bookedFD;
|
|
32
|
+
* const fdAmount = result.bookedFD?.amount;
|
|
33
|
+
* const applicationId = result.bookedFD?.applicationId;
|
|
34
|
+
* } else {
|
|
35
|
+
* // Handle error
|
|
36
|
+
* const errorMessage = result.error;
|
|
37
|
+
* }
|
|
38
|
+
*
|
|
39
|
+
* // Get specific FD by application ID
|
|
40
|
+
* const specificFD = await getFDData('USER123', 'APP123456');
|
|
41
|
+
*
|
|
42
|
+
* // Without userReferenceId (will use SDK's internal state)
|
|
43
|
+
* const resultWithoutUserRef = await getFDData();
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
const getFDData = async (userReferenceId, applicationId) => {
|
|
47
|
+
var _a;
|
|
48
|
+
try {
|
|
49
|
+
// Get user reference ID - use provided parameter or fallback to SDK's internal state
|
|
50
|
+
let finalUserReferenceId;
|
|
51
|
+
if (userReferenceId) {
|
|
52
|
+
// Use userReferenceId provided by main app
|
|
53
|
+
finalUserReferenceId = userReferenceId;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Fallback to getting from SDK's internal state
|
|
57
|
+
try {
|
|
58
|
+
const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
|
|
59
|
+
finalUserReferenceId = userInfo.id;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return {
|
|
63
|
+
allApplications: [],
|
|
64
|
+
success: false,
|
|
65
|
+
error: 'User reference ID is required. Please provide userReferenceId parameter or initialize SDK first.',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// ✅ CRITICAL: Use SDK store directly to ensure we always use SDK's store
|
|
70
|
+
// This prevents conflicts with parent app's store
|
|
71
|
+
if (!store_1.store) {
|
|
72
|
+
return {
|
|
73
|
+
allApplications: [],
|
|
74
|
+
success: false,
|
|
75
|
+
error: 'SDK store is not initialized. Please ensure SDK is properly set up.',
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Call webhook API to get customer applications with completed status
|
|
79
|
+
const apiResponse = await store_1.store.dispatch(customerApi_1.customerApi.endpoints.getCustomerWebhookApplications.initiate({
|
|
80
|
+
userReferenceId: finalUserReferenceId,
|
|
81
|
+
wfStatus: 'Completed'
|
|
82
|
+
})).unwrap();
|
|
83
|
+
// Extract applications from response (handle different response structures)
|
|
84
|
+
// Note: API already filters by wfStatus='Completed'
|
|
85
|
+
let applications = [];
|
|
86
|
+
if (Array.isArray(apiResponse)) {
|
|
87
|
+
applications = apiResponse;
|
|
88
|
+
}
|
|
89
|
+
else if ((apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.data) && Array.isArray(apiResponse.data)) {
|
|
90
|
+
applications = apiResponse.data;
|
|
91
|
+
}
|
|
92
|
+
else if ((apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse.applications) && Array.isArray(apiResponse.applications)) {
|
|
93
|
+
applications = apiResponse.applications;
|
|
94
|
+
}
|
|
95
|
+
// Map to only include specified fields
|
|
96
|
+
applications = applications.map((app) => ({
|
|
97
|
+
application_id: (app === null || app === void 0 ? void 0 : app.application_id) || (app === null || app === void 0 ? void 0 : app.applicationId),
|
|
98
|
+
investment_amount: (app === null || app === void 0 ? void 0 : app.investment_amount) || (app === null || app === void 0 ? void 0 : app.investmentAmount),
|
|
99
|
+
interest_rate: (app === null || app === void 0 ? void 0 : app.interest_rate) || (app === null || app === void 0 ? void 0 : app.interestRate),
|
|
100
|
+
maturity_date: (app === null || app === void 0 ? void 0 : app.maturity_date) || (app === null || app === void 0 ? void 0 : app.maturityDate),
|
|
101
|
+
maturity_amount: (app === null || app === void 0 ? void 0 : app.maturity_amount) || (app === null || app === void 0 ? void 0 : app.maturityAmount),
|
|
102
|
+
interest_payout_term: (app === null || app === void 0 ? void 0 : app.interest_payout_term) || (app === null || app === void 0 ? void 0 : app.interestPayoutTerm),
|
|
103
|
+
tenure_in_months: (app === null || app === void 0 ? void 0 : app.tenure_in_months) || (app === null || app === void 0 ? void 0 : app.tenureInMonths),
|
|
104
|
+
transaction_id: (app === null || app === void 0 ? void 0 : app.transaction_id) || (app === null || app === void 0 ? void 0 : app.transactionId),
|
|
105
|
+
fd_provider_id: (app === null || app === void 0 ? void 0 : app.fd_provider_id) || (app === null || app === void 0 ? void 0 : app.fdProviderId),
|
|
106
|
+
fd_provider_name: (app === null || app === void 0 ? void 0 : app.fd_provider_name) || (app === null || app === void 0 ? void 0 : app.fdProviderName),
|
|
107
|
+
transaction_status: (app === null || app === void 0 ? void 0 : app.transaction_status) || (app === null || app === void 0 ? void 0 : app.transactionStatus),
|
|
108
|
+
transaction_description: (app === null || app === void 0 ? void 0 : app.transaction_description) || (app === null || app === void 0 ? void 0 : app.transactionDescription),
|
|
109
|
+
wf_status: (app === null || app === void 0 ? void 0 : app.wf_status) || (app === null || app === void 0 ? void 0 : app.wfStatus),
|
|
110
|
+
created_date: (app === null || app === void 0 ? void 0 : app.created_date) || (app === null || app === void 0 ? void 0 : app.createdDate),
|
|
111
|
+
certificate_status: (app === null || app === void 0 ? void 0 : app.certificate_status) || (app === null || app === void 0 ? void 0 : app.certificateStatus),
|
|
112
|
+
}));
|
|
113
|
+
// Find the FD - match by applicationId or get the most recent one
|
|
114
|
+
let bookedFD = null;
|
|
115
|
+
if (applicationId) {
|
|
116
|
+
// Try to find FD matching the provided applicationId
|
|
117
|
+
bookedFD = applications.find((app) => (app === null || app === void 0 ? void 0 : app.application_id) === applicationId);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
// Get applicationId from Redux store if available
|
|
121
|
+
const state = store_1.store.getState();
|
|
122
|
+
const storeApplicationId = (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.applicationId;
|
|
123
|
+
if (storeApplicationId) {
|
|
124
|
+
// Try to find FD matching the current applicationId from store
|
|
125
|
+
bookedFD = applications.find((app) => (app === null || app === void 0 ? void 0 : app.application_id) === storeApplicationId);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// If not found by applicationId, get the most recent one (assuming it's the latest booking)
|
|
129
|
+
if (!bookedFD && applications.length > 0) {
|
|
130
|
+
// Sort by date if available, otherwise take the last one
|
|
131
|
+
const sortedApps = [...applications].sort((a, b) => {
|
|
132
|
+
const dateA = (a === null || a === void 0 ? void 0 : a.created_date) || 0;
|
|
133
|
+
const dateB = (b === null || b === void 0 ? void 0 : b.created_date) || 0;
|
|
134
|
+
return new Date(dateB).getTime() - new Date(dateA).getTime();
|
|
135
|
+
});
|
|
136
|
+
bookedFD = sortedApps[0];
|
|
137
|
+
}
|
|
138
|
+
// Return full API response data to main app
|
|
139
|
+
return {
|
|
140
|
+
// Full API response
|
|
141
|
+
allApplications: applications, // All applications array
|
|
142
|
+
success: true,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
// If API call fails, return error information
|
|
147
|
+
return {
|
|
148
|
+
allApplications: [],
|
|
149
|
+
success: false,
|
|
150
|
+
error: (error === null || error === void 0 ? void 0 : error.message) || 'Failed to fetch FD data',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
exports.getFDData = getFDData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGlobalData = exports.setGlobalData = void 0;
|
|
4
|
+
let globalData = {};
|
|
5
|
+
const setGlobalData = (data) => {
|
|
6
|
+
globalData = Object.assign(Object.assign({}, globalData), data);
|
|
7
|
+
};
|
|
8
|
+
exports.setGlobalData = setGlobalData;
|
|
9
|
+
const getGlobalData = () => globalData;
|
|
10
|
+
exports.getGlobalData = getGlobalData;
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@finspringinnovations/fdsdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "FD SDK for React Native applications",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"src",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"clean": "rm -rf lib",
|
|
15
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"lint": "eslint src --ext .ts,.tsx"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"react-native",
|
|
21
|
+
"sdk",
|
|
22
|
+
"typescript",
|
|
23
|
+
"android",
|
|
24
|
+
"ios"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@react-native-community/datetimepicker": "^8.4.5",
|
|
28
|
+
"@react-navigation/native": "^7.1.17",
|
|
29
|
+
"@react-navigation/stack": "^7.4.8",
|
|
30
|
+
"@reduxjs/toolkit": "^2.9.0",
|
|
31
|
+
"@types/react-native-vector-icons": "^6.4.18",
|
|
32
|
+
"asmcrypto.js": "^2.3.2",
|
|
33
|
+
"buffer": "^6.0.3",
|
|
34
|
+
"crypto-js": "^4.2.0",
|
|
35
|
+
"react-native-get-random-values": "^1.11.0",
|
|
36
|
+
"react-native-quick-crypto": "^0.7.17",
|
|
37
|
+
"react-native-safe-area-context": "^5.6.1",
|
|
38
|
+
"react-native-screens": "^4.16.0",
|
|
39
|
+
"react-native-vector-icons": "^10.3.0",
|
|
40
|
+
"react-native-webview": "^13.16.0",
|
|
41
|
+
"react-redux": "^9.2.0",
|
|
42
|
+
"uuid": "^13.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=16.8.0",
|
|
46
|
+
"react-native": ">=0.60.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@babel/cli": "^7.28.3",
|
|
50
|
+
"@types/crypto-js": "^4.2.2",
|
|
51
|
+
"@types/react": "^18.2.0",
|
|
52
|
+
"@types/react-native": "^0.72.0",
|
|
53
|
+
"@types/uuid": "^10.0.0",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
55
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
56
|
+
"cpx": "^1.5.0",
|
|
57
|
+
"cross-env": "^10.1.0",
|
|
58
|
+
"eslint": "^8.0.0",
|
|
59
|
+
"jest": "^29.0.0",
|
|
60
|
+
"typescript": "^5.0.0"
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "git+https://github.com/shriram-finance/shriramsdk.git",
|
|
65
|
+
"directory": "packages/shriramsdk"
|
|
66
|
+
},
|
|
67
|
+
"author": {
|
|
68
|
+
"name": "Shriram Finance",
|
|
69
|
+
"email": "tech@shriramfinance.com"
|
|
70
|
+
},
|
|
71
|
+
"homepage": "https://github.com/shriram-finance/shriramsdk#readme",
|
|
72
|
+
"bugs": {
|
|
73
|
+
"url": "https://github.com/shriram-finance/shriramsdk/issues"
|
|
74
|
+
},
|
|
75
|
+
"license": "MIT"
|
|
76
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { baseApi } from './baseApi';
|
|
2
|
+
|
|
3
|
+
export const bankApi = baseApi.injectEndpoints({
|
|
4
|
+
endpoints: (builder) => ({
|
|
5
|
+
addBank: builder.mutation<any, any>({
|
|
6
|
+
query: (body) => {
|
|
7
|
+
const { providerId, workflowInstanceId, userreferenceid, applicationid, ...requestBody } = body;
|
|
8
|
+
return {
|
|
9
|
+
url: 'bank/add',
|
|
10
|
+
method: 'POST',
|
|
11
|
+
body: requestBody,
|
|
12
|
+
headers: {
|
|
13
|
+
provider: providerId || '{{shriramprovider}}',
|
|
14
|
+
workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
|
|
15
|
+
userreferenceid: userreferenceid || '{{userreferenceid}}',
|
|
16
|
+
applicationid: applicationid || '{{applicationid}}',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
}),
|
|
21
|
+
getBankDetails: builder.query<any, { providerId?: string; workflowInstanceId?: string; userreferenceid?: string; applicationid?: string } | void>({
|
|
22
|
+
query: (args) => {
|
|
23
|
+
const providerId = (args as any)?.providerId;
|
|
24
|
+
const workflowInstanceId = (args as any)?.workflowInstanceId;
|
|
25
|
+
const userreferenceid = (args as any)?.userreferenceid;
|
|
26
|
+
const applicationid = (args as any)?.applicationid;
|
|
27
|
+
return {
|
|
28
|
+
url: 'bank/details',
|
|
29
|
+
method: 'GET',
|
|
30
|
+
headers: {
|
|
31
|
+
provider: providerId || '{{shriramprovider}}',
|
|
32
|
+
workflowInstanceId: workflowInstanceId || '{{workflowInstanceId}}',
|
|
33
|
+
userreferenceid: userreferenceid || '{{userreferenceid}}',
|
|
34
|
+
applicationid: applicationid || '{{applicationid}}',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const { useAddBankMutation, useGetBankDetailsQuery } = bankApi;
|