Beneficiary Validation Changes
This commit is contained in:
@@ -87,11 +87,19 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
|
|
||||||
final service = getIt<BeneficiaryService>();
|
final service = getIt<BeneficiaryService>();
|
||||||
try {
|
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,
|
accountNo: accountNo,
|
||||||
ifscCode: ifsc,
|
ifscCode: ifsc,
|
||||||
remitterName: remitter,
|
remitterName: remitter,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
nameController.text = beneficiaryName;
|
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/payment_animation.dart';
|
||||||
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
import 'package:kmobile/features/fund_transfer/screens/transaction_pin_screen.dart';
|
||||||
import '../../../l10n/app_localizations.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 }
|
enum TransactionMode { neft, rtgs, imps }
|
||||||
|
|
||||||
@@ -23,12 +25,14 @@ class FundTransferAmountScreen extends StatefulWidget {
|
|||||||
final String debitAccountNo;
|
final String debitAccountNo;
|
||||||
final Beneficiary creditBeneficiary;
|
final Beneficiary creditBeneficiary;
|
||||||
final String remitterName;
|
final String remitterName;
|
||||||
|
final bool isOwnBank;
|
||||||
|
|
||||||
const FundTransferAmountScreen({
|
const FundTransferAmountScreen({
|
||||||
super.key,
|
super.key,
|
||||||
required this.debitAccountNo,
|
required this.debitAccountNo,
|
||||||
required this.creditBeneficiary,
|
required this.creditBeneficiary,
|
||||||
required this.remitterName,
|
required this.remitterName,
|
||||||
|
this.isOwnBank = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -50,7 +54,35 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
|||||||
void _onProceed() {
|
void _onProceed() {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
final amount = double.tryParse(_amountController.text) ?? 0;
|
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) {
|
if (_selectedMode == TransactionMode.rtgs && amount < 200000) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -278,6 +310,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -329,6 +362,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
if (!widget.isOwnBank) ...[
|
||||||
// Transaction Mode Selection
|
// Transaction Mode Selection
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).selectTransactionType,
|
AppLocalizations.of(context).selectTransactionType,
|
||||||
@@ -381,7 +415,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
],
|
||||||
// Amount
|
// Amount
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _amountController,
|
controller: _amountController,
|
||||||
|
@@ -109,6 +109,7 @@ class _FundTransferBeneficiaryScreenState
|
|||||||
debitAccountNo: widget.creditAccountNo,
|
debitAccountNo: widget.creditAccountNo,
|
||||||
creditBeneficiary: beneficiary,
|
creditBeneficiary: beneficiary,
|
||||||
remitterName: widget.remitterName,
|
remitterName: widget.remitterName,
|
||||||
|
isOwnBank: widget.isOwnBank,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@@ -10,7 +10,7 @@ Widget getBankLogo(String? bankName) {
|
|||||||
}
|
}
|
||||||
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
|
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
|
||||||
return Image.asset(
|
return Image.asset(
|
||||||
'assets/images/icon.png',
|
'assets/images/logo.png',
|
||||||
width: 40,
|
width: 40,
|
||||||
height: 40,
|
height: 40,
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user