Beneficiary Validation Changes
This commit is contained in:
@@ -87,11 +87,19 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
|
||||
final service = getIt<BeneficiaryService>();
|
||||
try {
|
||||
final String beneficiaryName = await service.validateBeneficiary(
|
||||
|
||||
String beneficiaryName;
|
||||
if(ifsc.toLowerCase().contains('kace')){
|
||||
beneficiaryName = await service.validateBeneficiaryWithinBank(accountNo);
|
||||
}
|
||||
|
||||
else{
|
||||
beneficiaryName = await service.validateBeneficiary(
|
||||
accountNo: accountNo,
|
||||
ifscCode: ifsc,
|
||||
remitterName: remitter,
|
||||
);
|
||||
}
|
||||
|
||||
setState(() {
|
||||
nameController.text = beneficiaryName;
|
||||
|
@@ -16,6 +16,8 @@ import 'package:kmobile/di/injection.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import 'package:kmobile/api/services/payment_service.dart';
|
||||
import 'package:kmobile/data/models/transfer.dart';
|
||||
|
||||
enum TransactionMode { neft, rtgs, imps }
|
||||
|
||||
@@ -23,12 +25,14 @@ class FundTransferAmountScreen extends StatefulWidget {
|
||||
final String debitAccountNo;
|
||||
final Beneficiary creditBeneficiary;
|
||||
final String remitterName;
|
||||
final bool isOwnBank;
|
||||
|
||||
const FundTransferAmountScreen({
|
||||
super.key,
|
||||
required this.debitAccountNo,
|
||||
required this.creditBeneficiary,
|
||||
required this.remitterName,
|
||||
this.isOwnBank = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -50,7 +54,35 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
void _onProceed() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
final amount = double.tryParse(_amountController.text) ?? 0;
|
||||
|
||||
if (widget.isOwnBank) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => TransactionPinScreen(
|
||||
onPinCompleted: (pinScreenContext, tpin) async {
|
||||
final transfer = Transfer(
|
||||
fromAccount: widget.debitAccountNo,
|
||||
toAccount: widget.creditBeneficiary.accountNo,
|
||||
toAccountType: 'Savings', // Assuming 'SB' for savings
|
||||
amount: _amountController.text,
|
||||
tpin: tpin,
|
||||
);
|
||||
|
||||
final paymentService = getIt<PaymentService>();
|
||||
final paymentResponseFuture =
|
||||
paymentService.processQuickPayWithinBank(transfer);
|
||||
|
||||
Navigator.of(pinScreenContext).pushReplacement(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => PaymentAnimationScreen(
|
||||
paymentResponse: paymentResponseFuture),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if (_selectedMode == TransactionMode.rtgs && amount < 200000) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -278,6 +310,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -329,6 +362,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
if (!widget.isOwnBank) ...[
|
||||
// Transaction Mode Selection
|
||||
Text(
|
||||
AppLocalizations.of(context).selectTransactionType,
|
||||
@@ -381,7 +415,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
],
|
||||
// Amount
|
||||
TextFormField(
|
||||
controller: _amountController,
|
||||
|
@@ -109,6 +109,7 @@ class _FundTransferBeneficiaryScreenState
|
||||
debitAccountNo: widget.creditAccountNo,
|
||||
creditBeneficiary: beneficiary,
|
||||
remitterName: widget.remitterName,
|
||||
isOwnBank: widget.isOwnBank,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@@ -10,7 +10,7 @@ Widget getBankLogo(String? bankName) {
|
||||
}
|
||||
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
|
||||
return Image.asset(
|
||||
'assets/images/icon.png',
|
||||
'assets/images/logo.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
);
|
||||
|
Reference in New Issue
Block a user