@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,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const react_native_1 = require("react-native");
|
|
41
|
+
const SafeAreaWrapper_1 = __importDefault(require("../components/SafeAreaWrapper"));
|
|
42
|
+
const components_1 = require("../components");
|
|
43
|
+
const ActionButton_1 = __importDefault(require("../components/ActionButton"));
|
|
44
|
+
const ThemeContext_1 = require("../theme/ThemeContext");
|
|
45
|
+
const fdApi_1 = require("../api/fdApi");
|
|
46
|
+
const store_1 = require("../store");
|
|
47
|
+
const appDataConfig_1 = require("../config/appDataConfig");
|
|
48
|
+
const helpers_1 = require("../navigation/helpers");
|
|
49
|
+
const workflowApi_1 = require("../api/workflowApi");
|
|
50
|
+
const paymentSession_1 = require("../state/paymentSession");
|
|
51
|
+
const bank_1 = require("../constants/strings/bank");
|
|
52
|
+
const common_1 = require("../constants/strings/common");
|
|
53
|
+
const PayNow = ({ onGoBack, onConfirm, fdData }) => {
|
|
54
|
+
const colors = (0, ThemeContext_1.useColors)();
|
|
55
|
+
const typography = (0, ThemeContext_1.useTypography)();
|
|
56
|
+
const { themeName } = (0, ThemeContext_1.useTheme)();
|
|
57
|
+
const styles = createStyles(colors, typography, themeName);
|
|
58
|
+
const workflowInstanceId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.workflowInstanceId; });
|
|
59
|
+
const applicationId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.applicationId; });
|
|
60
|
+
const entityId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.entityid; });
|
|
61
|
+
const fdId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.fdId; });
|
|
62
|
+
// Get providerId from app data or use default
|
|
63
|
+
const defaultProviderId = (0, store_1.useAppSelector)((state) => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.onboarding) === null || _a === void 0 ? void 0 : _a.providerId; }); // Default Shriram provider ID
|
|
64
|
+
// Get FD data from Redux store (using only fdListSelected data)
|
|
65
|
+
const fdListSelectedData = (0, store_1.useAppSelector)((state) => state === null || state === void 0 ? void 0 : state.fdListSelected);
|
|
66
|
+
// const fdCalculationData = useAppSelector((state: any) => state?.fdCalculation);
|
|
67
|
+
// Create FD API
|
|
68
|
+
const [createFD, { data: createFDResponse, error: createFDError, isLoading: isLoadingCreateFD, }] = (0, fdApi_1.useCreateFDMutation)();
|
|
69
|
+
const [previousState] = (0, workflowApi_1.usePreviousStateMutation)();
|
|
70
|
+
// Loading state for back navigation
|
|
71
|
+
const [isGoingBack, setIsGoingBack] = (0, react_1.useState)(false);
|
|
72
|
+
// Create FD API status monitored
|
|
73
|
+
// Use FD data with priority: FDList selected > Props > Empty
|
|
74
|
+
const displayData = fdListSelectedData ? {
|
|
75
|
+
// Data from FDList screen (selected FD)
|
|
76
|
+
companyName: fdListSelectedData.companyName || '',
|
|
77
|
+
amount: fdListSelectedData.amount || 0,
|
|
78
|
+
fdRate: fdListSelectedData.fdRate || '',
|
|
79
|
+
tenure: fdListSelectedData.tenure || '',
|
|
80
|
+
interestPayout: fdListSelectedData.interestPayout || '',
|
|
81
|
+
} : fdData || {
|
|
82
|
+
// Fallback to props or empty
|
|
83
|
+
companyName: '',
|
|
84
|
+
amount: 0,
|
|
85
|
+
fdRate: '',
|
|
86
|
+
tenure: '',
|
|
87
|
+
interestPayout: '',
|
|
88
|
+
};
|
|
89
|
+
// Data source processed
|
|
90
|
+
// Get first letter for avatar
|
|
91
|
+
const getAvatarLetter = (name) => {
|
|
92
|
+
return name.charAt(0).toUpperCase();
|
|
93
|
+
};
|
|
94
|
+
const formatAmount = (amount) => {
|
|
95
|
+
return amount.toLocaleString('en-IN');
|
|
96
|
+
};
|
|
97
|
+
const handleConfirm = async () => {
|
|
98
|
+
var _a;
|
|
99
|
+
try {
|
|
100
|
+
// Get user info from app data
|
|
101
|
+
const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
|
|
102
|
+
// Prepare Create FD request body with ONLY required fields
|
|
103
|
+
const createFDRequest = {
|
|
104
|
+
// Headers (will be extracted by API)
|
|
105
|
+
providerId: defaultProviderId,
|
|
106
|
+
workflowInstanceId: workflowInstanceId,
|
|
107
|
+
userreferenceid: userInfo.userReferenceId,
|
|
108
|
+
// entityid: entityId,
|
|
109
|
+
// Body (applicationId is required in body, entityid should NOT be in body)
|
|
110
|
+
applicationId: applicationId,
|
|
111
|
+
fdId: fdId,
|
|
112
|
+
panNo: userInfo.panNumber,
|
|
113
|
+
};
|
|
114
|
+
const response = await createFD(createFDRequest).unwrap();
|
|
115
|
+
// Extract paymentUrl and transactionId from response
|
|
116
|
+
const payload = Array.isArray(response === null || response === void 0 ? void 0 : response.data)
|
|
117
|
+
? response.data[0]
|
|
118
|
+
: (_a = response === null || response === void 0 ? void 0 : response.data) !== null && _a !== void 0 ? _a : response;
|
|
119
|
+
const paymentUrl = payload === null || payload === void 0 ? void 0 : payload.paymentUrl;
|
|
120
|
+
const transactionId = payload === null || payload === void 0 ? void 0 : payload.transactionId;
|
|
121
|
+
// Save to session and navigate to Payment screen
|
|
122
|
+
(0, paymentSession_1.setPaymentSession)({ paymentUrl, transactionId });
|
|
123
|
+
(0, helpers_1.navigate)('Payment');
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
// Optional fallback: allow external handler
|
|
127
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
// Handler for back button (used by both bottom back button and hardware back button)
|
|
131
|
+
const handleBackPress = async () => {
|
|
132
|
+
setIsGoingBack(true);
|
|
133
|
+
try {
|
|
134
|
+
const userInfo = (0, appDataConfig_1.getUserInfoForAPI)();
|
|
135
|
+
await previousState({
|
|
136
|
+
providerId: defaultProviderId,
|
|
137
|
+
workflowInstanceId,
|
|
138
|
+
userreferenceid: userInfo.userReferenceId,
|
|
139
|
+
applicationid: applicationId,
|
|
140
|
+
entityid: entityId,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
// Handle error silently
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
setIsGoingBack(false);
|
|
148
|
+
(0, helpers_1.navigate)('BankDetail');
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
// Handle Android hardware back button
|
|
152
|
+
(0, react_1.useEffect)(() => {
|
|
153
|
+
if (react_native_1.Platform.OS !== 'android')
|
|
154
|
+
return;
|
|
155
|
+
const onHardwareBackPress = () => {
|
|
156
|
+
handleBackPress();
|
|
157
|
+
return true; // Prevent default behavior
|
|
158
|
+
};
|
|
159
|
+
const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onHardwareBackPress);
|
|
160
|
+
return () => backHandler.remove();
|
|
161
|
+
}, [defaultProviderId, workflowInstanceId, applicationId, entityId]);
|
|
162
|
+
return (react_1.default.createElement(SafeAreaWrapper_1.default, { includeTop: false, bottomPadding: 25, statusBarColor: "#000000", statusBarStyle: "light-content" },
|
|
163
|
+
react_1.default.createElement(react_native_1.View, { style: styles.container },
|
|
164
|
+
react_1.default.createElement(react_native_1.ScrollView, { showsVerticalScrollIndicator: false, contentContainerStyle: styles.scrollContent },
|
|
165
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.title }, bank_1.BANK_STRINGS.PAYMENT_DETAILS_TITLE),
|
|
166
|
+
react_1.default.createElement(components_1.PaymentDetailsCard, { companyName: displayData.companyName, amount: displayData.amount, fdRate: displayData.fdRate, tenure: displayData.tenure, interestPayout: displayData.interestPayout, showCompanyLine: true })),
|
|
167
|
+
react_1.default.createElement(react_native_1.View, { style: styles.footer },
|
|
168
|
+
react_1.default.createElement(ActionButton_1.default, { title: common_1.COMMON_STRINGS.BACK, onPress: handleBackPress, disabled: false, style: styles.backButton, textStyle: styles.backButtonText }),
|
|
169
|
+
react_1.default.createElement(ActionButton_1.default, { title: isLoadingCreateFD ? common_1.COMMON_STRINGS.CREATING : common_1.COMMON_STRINGS.CONFIRM, onPress: handleConfirm, disabled: isLoadingCreateFD, style: styles.confirmButton }))),
|
|
170
|
+
isGoingBack && (react_1.default.createElement(react_native_1.View, { style: styles.loadingOverlay, pointerEvents: "auto" },
|
|
171
|
+
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary })))));
|
|
172
|
+
};
|
|
173
|
+
const createStyles = (colors, typography, themeName) => react_native_1.StyleSheet.create({
|
|
174
|
+
container: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
backgroundColor: colors.background,
|
|
177
|
+
},
|
|
178
|
+
scrollContent: {
|
|
179
|
+
flexGrow: 1,
|
|
180
|
+
paddingHorizontal: 16,
|
|
181
|
+
//paddingTop: 24,
|
|
182
|
+
// paddingBottom: 100,
|
|
183
|
+
// justifyContent: 'center',
|
|
184
|
+
},
|
|
185
|
+
title: Object.assign(Object.assign({}, typography.styles.h1), { color: colors.text, textAlign: 'center', marginTop: 100, marginBottom: 80 }),
|
|
186
|
+
footer: {
|
|
187
|
+
position: 'absolute',
|
|
188
|
+
bottom: 0,
|
|
189
|
+
left: 0,
|
|
190
|
+
right: 0,
|
|
191
|
+
backgroundColor: colors.background,
|
|
192
|
+
paddingHorizontal: 16,
|
|
193
|
+
paddingVertical: 16,
|
|
194
|
+
flexDirection: 'row',
|
|
195
|
+
gap: 8,
|
|
196
|
+
},
|
|
197
|
+
backButton: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
backgroundColor: themeName === 'dark' ? colors.cancelButtonBg : 'transparent',
|
|
200
|
+
borderWidth: themeName === 'dark' ? 1 : 0,
|
|
201
|
+
borderColor: themeName === 'dark' ? '#ffffff' : 'transparent',
|
|
202
|
+
borderRadius: themeName === 'dark' ? 10 : 0,
|
|
203
|
+
},
|
|
204
|
+
backButtonText: {
|
|
205
|
+
color: themeName === 'dark' ? '#ffffff' : colors.primary,
|
|
206
|
+
},
|
|
207
|
+
confirmButton: {
|
|
208
|
+
flex: 1,
|
|
209
|
+
},
|
|
210
|
+
debugButton: {
|
|
211
|
+
paddingHorizontal: 16,
|
|
212
|
+
paddingVertical: 12,
|
|
213
|
+
borderRadius: 8,
|
|
214
|
+
marginTop: 20,
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
},
|
|
217
|
+
debugButtonText: Object.assign(Object.assign({}, typography.styles.bodyMedium), { fontWeight: '600' }),
|
|
218
|
+
loadingOverlay: {
|
|
219
|
+
position: 'absolute',
|
|
220
|
+
top: 0,
|
|
221
|
+
left: 0,
|
|
222
|
+
right: 0,
|
|
223
|
+
bottom: 0,
|
|
224
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
225
|
+
justifyContent: 'center',
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
zIndex: 1000,
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
exports.default = PayNow;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PaymentProps {
|
|
3
|
+
onGoBack?: () => void;
|
|
4
|
+
onPaymentSuccess?: (data?: any) => void;
|
|
5
|
+
onPaymentFailure?: (error?: any) => void;
|
|
6
|
+
paymentUrl: string;
|
|
7
|
+
successUrl?: string;
|
|
8
|
+
failureUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Payment: React.FC<PaymentProps>;
|
|
11
|
+
export default Payment;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const react_native_1 = require("react-native");
|
|
41
|
+
const react_native_webview_1 = require("react-native-webview");
|
|
42
|
+
const SafeAreaWrapper_1 = __importDefault(require("../components/SafeAreaWrapper"));
|
|
43
|
+
const ThemeContext_1 = require("../theme/ThemeContext");
|
|
44
|
+
const encryption_1 = require("../utils/encryption");
|
|
45
|
+
const encryptionConfig_1 = require("../config/encryptionConfig");
|
|
46
|
+
const Payment = ({ onGoBack, onPaymentSuccess, onPaymentFailure, paymentUrl, successUrl = 'payment/success', failureUrl = 'payment/failure', }) => {
|
|
47
|
+
const colors = (0, ThemeContext_1.useColors)();
|
|
48
|
+
const styles = createStyles(colors);
|
|
49
|
+
const webViewRef = (0, react_1.useRef)(null);
|
|
50
|
+
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
51
|
+
const handleNavigationStateChange = async (navState) => {
|
|
52
|
+
const { url } = navState;
|
|
53
|
+
if (url.includes('payment/status')) {
|
|
54
|
+
await handlePaymentStatusPage();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (url.includes(successUrl)) {
|
|
58
|
+
setLoading(false);
|
|
59
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(navState);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (url.includes(failureUrl)) {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(navState);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const handleWebViewError = (syntheticEvent) => {
|
|
69
|
+
const { nativeEvent } = syntheticEvent;
|
|
70
|
+
setLoading(false);
|
|
71
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(nativeEvent);
|
|
72
|
+
};
|
|
73
|
+
const handleLoadStart = () => {
|
|
74
|
+
setLoading(true);
|
|
75
|
+
};
|
|
76
|
+
const handleLoadEnd = () => {
|
|
77
|
+
setLoading(false);
|
|
78
|
+
};
|
|
79
|
+
const handleMessage = async (event) => {
|
|
80
|
+
var _a, _b, _c;
|
|
81
|
+
try {
|
|
82
|
+
const dataString = event.nativeEvent.data;
|
|
83
|
+
// Check if data is empty or null
|
|
84
|
+
if (!dataString || dataString.trim() === '') {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Check if data looks like JSON
|
|
88
|
+
const trimmedData = dataString.trim();
|
|
89
|
+
if (!trimmedData.startsWith('{') && !trimmedData.startsWith('[') && !trimmedData.startsWith('"')) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const cleaned = dataString.startsWith('"') && dataString.endsWith('"')
|
|
93
|
+
? dataString.substring(1, dataString.length - 1).replaceAll('\\"', '"')
|
|
94
|
+
: dataString;
|
|
95
|
+
const parsed = JSON.parse(cleaned);
|
|
96
|
+
let response;
|
|
97
|
+
// Handle both encrypted and non-encrypted responses using the same method as API responses
|
|
98
|
+
if (parsed.encryptedResponse) {
|
|
99
|
+
const encryptionConfig = (0, encryptionConfig_1.getEncryptionConfig)();
|
|
100
|
+
try {
|
|
101
|
+
// Use the same decryptResponse function used for API responses
|
|
102
|
+
const decrypted = await (0, encryption_1.decryptResponse)({ encryptedResponse: parsed.encryptedResponse }, encryptionConfig);
|
|
103
|
+
response = decrypted;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
response = parsed;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
response = parsed;
|
|
111
|
+
}
|
|
112
|
+
// Check for success status
|
|
113
|
+
if (((_a = response.status) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'success') {
|
|
114
|
+
// Check payment status in data
|
|
115
|
+
const paymentStatus = (_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.paymentStatus) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
116
|
+
if (paymentStatus === 'success') {
|
|
117
|
+
onPaymentSuccess === null || onPaymentSuccess === void 0 ? void 0 : onPaymentSuccess(response);
|
|
118
|
+
}
|
|
119
|
+
else if (paymentStatus === 'failed') {
|
|
120
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(response);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(response);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(response);
|
|
128
|
+
}
|
|
129
|
+
setLoading(false);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(error);
|
|
133
|
+
setLoading(false);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const handlePaymentStatusPage = async () => {
|
|
137
|
+
var _a;
|
|
138
|
+
try {
|
|
139
|
+
setLoading(true);
|
|
140
|
+
(_a = webViewRef.current) === null || _a === void 0 ? void 0 : _a.injectJavaScript(`
|
|
141
|
+
(function() {
|
|
142
|
+
window.ReactNativeWebView.postMessage(document.body.innerText);
|
|
143
|
+
})();
|
|
144
|
+
`);
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
setLoading(false);
|
|
148
|
+
onPaymentFailure === null || onPaymentFailure === void 0 ? void 0 : onPaymentFailure(err);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
// Disable hardware back button on Payment screen
|
|
152
|
+
(0, react_1.useEffect)(() => {
|
|
153
|
+
if (react_native_1.Platform.OS !== 'android')
|
|
154
|
+
return;
|
|
155
|
+
const onBackPress = () => {
|
|
156
|
+
// Return true to prevent default behavior (block back button)
|
|
157
|
+
return true;
|
|
158
|
+
};
|
|
159
|
+
const backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', onBackPress);
|
|
160
|
+
return () => backHandler.remove();
|
|
161
|
+
}, []);
|
|
162
|
+
return (react_1.default.createElement(SafeAreaWrapper_1.default, { includeTop: false, bottomPadding: 0, statusBarColor: "#000000", statusBarStyle: "light-content" },
|
|
163
|
+
react_native_1.Platform.OS === 'ios' && react_1.default.createElement(react_native_1.StatusBar, { barStyle: "light-content" }),
|
|
164
|
+
react_1.default.createElement(react_native_1.View, { style: styles.container },
|
|
165
|
+
loading && (react_1.default.createElement(react_native_1.View, { style: styles.loadingContainer },
|
|
166
|
+
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: colors.primary }))),
|
|
167
|
+
react_1.default.createElement(react_native_webview_1.WebView, { ref: webViewRef, source: { uri: paymentUrl }, style: styles.webView, onNavigationStateChange: handleNavigationStateChange, onError: handleWebViewError, onLoadStart: handleLoadStart, onLoadEnd: handleLoadEnd, onMessage: handleMessage, javaScriptEnabled: true, domStorageEnabled: false, startInLoadingState: true, scalesPageToFit: true, mixedContentMode: "never", allowsInlineMediaPlayback: false, mediaPlaybackRequiresUserAction: false, sharedCookiesEnabled: false, thirdPartyCookiesEnabled: false, cacheEnabled: false, originWhitelist: ['*'] }))));
|
|
168
|
+
};
|
|
169
|
+
const createStyles = (colors) => react_native_1.StyleSheet.create({
|
|
170
|
+
container: {
|
|
171
|
+
flex: 1,
|
|
172
|
+
backgroundColor: colors.background,
|
|
173
|
+
},
|
|
174
|
+
webView: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
backgroundColor: colors.background,
|
|
177
|
+
marginTop: react_native_1.Platform.OS === 'ios' ? 15 : 0,
|
|
178
|
+
},
|
|
179
|
+
loadingContainer: {
|
|
180
|
+
position: 'absolute',
|
|
181
|
+
top: 0,
|
|
182
|
+
left: 0,
|
|
183
|
+
right: 0,
|
|
184
|
+
bottom: 0,
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
justifyContent: 'center',
|
|
187
|
+
backgroundColor: colors.background,
|
|
188
|
+
zIndex: 1,
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
exports.default = Payment;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PaymentStatusProps {
|
|
3
|
+
onRetry?: () => void;
|
|
4
|
+
onContinue?: (fdDetails?: any) => void;
|
|
5
|
+
status: 'success' | 'failed' | 'pending';
|
|
6
|
+
transactionId?: string;
|
|
7
|
+
fdData?: {
|
|
8
|
+
companyName: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
fdRate: string;
|
|
11
|
+
tenure: string;
|
|
12
|
+
interestPayout: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const PaymentStatus: React.FC<PaymentStatusProps>;
|
|
16
|
+
export default PaymentStatus;
|