Localization changes #4
This commit is contained in:
@@ -106,16 +106,16 @@ class BeneficiaryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteBeneficiary(String accountNo) async {
|
Future<void> deleteBeneficiary(String accountNo) async {
|
||||||
try {
|
try {
|
||||||
final response = await _dio.delete('/api/beneficiary/$accountNo');
|
final response = await _dio.delete('/api/beneficiary/$accountNo');
|
||||||
|
|
||||||
if (response.statusCode != 204) {
|
if (response.statusCode != 204) {
|
||||||
throw Exception('Failed to delete beneficiary');
|
throw Exception('Failed to delete beneficiary');
|
||||||
|
}
|
||||||
|
} on DioException catch (e) {
|
||||||
|
throw Exception('Network error: ${e.message}');
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('Unexpected error: ${e.toString()}');
|
||||||
}
|
}
|
||||||
} on DioException catch (e) {
|
|
||||||
throw Exception('Network error: ${e.message}');
|
|
||||||
} catch (e) {
|
|
||||||
throw Exception('Unexpected error: ${e.toString()}');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@@ -11,7 +11,11 @@ import 'transaction_details_screen.dart';
|
|||||||
class AccountStatementScreen extends StatefulWidget {
|
class AccountStatementScreen extends StatefulWidget {
|
||||||
final String accountNo;
|
final String accountNo;
|
||||||
final String balance;
|
final String balance;
|
||||||
const AccountStatementScreen({super.key, required this.accountNo, required this.balance,});
|
const AccountStatementScreen({
|
||||||
|
super.key,
|
||||||
|
required this.accountNo,
|
||||||
|
required this.balance,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AccountStatementScreen> createState() => _AccountStatementScreen();
|
State<AccountStatementScreen> createState() => _AccountStatementScreen();
|
||||||
@@ -161,13 +165,14 @@ class _AccountStatementScreen extends State<AccountStatementScreen> {
|
|||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"${AppLocalizations.of(context).availableBalance}: ",
|
"${AppLocalizations.of(context).availableBalance}: ",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 17,
|
fontSize: 17,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(' ₹ ${widget.balance}', style: const TextStyle(fontSize: 17)),
|
Text(' ₹ ${widget.balance}',
|
||||||
|
style: const TextStyle(fontSize: 17)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
|
@@ -46,7 +46,7 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accountType = AppLocalizations.of(context).savings;
|
accountType = 'Savings';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -87,18 +87,16 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
|
|
||||||
final service = getIt<BeneficiaryService>();
|
final service = getIt<BeneficiaryService>();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String beneficiaryName;
|
String beneficiaryName;
|
||||||
if(ifsc.toLowerCase().contains('kace')){
|
if (ifsc.toLowerCase().contains('kace')) {
|
||||||
beneficiaryName = await service.validateBeneficiaryWithinBank(accountNo);
|
beneficiaryName =
|
||||||
}
|
await service.validateBeneficiaryWithinBank(accountNo);
|
||||||
|
} else {
|
||||||
else{
|
beneficiaryName = await service.validateBeneficiary(
|
||||||
beneficiaryName = await service.validateBeneficiary(
|
accountNo: accountNo,
|
||||||
accountNo: accountNo,
|
ifscCode: ifsc,
|
||||||
ifscCode: ifsc,
|
remitterName: remitter,
|
||||||
remitterName: remitter,
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -129,8 +127,9 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
// Ensure beneficiary is validated before proceeding to TPIN
|
// Ensure beneficiary is validated before proceeding to TPIN
|
||||||
if (!_isBeneficiaryValidated) {
|
if (!_isBeneficiaryValidated) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(
|
SnackBar(
|
||||||
content: Text('Please validate beneficiary details first.')),
|
content: Text(AppLocalizations.of(context)
|
||||||
|
.pleaseValidateBeneficiaryDetailsFirst)),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -517,8 +516,8 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
items: [
|
items: [
|
||||||
AppLocalizations.of(context).savings,
|
'Savings',
|
||||||
AppLocalizations.of(context).current,
|
'Current',
|
||||||
]
|
]
|
||||||
.map(
|
.map(
|
||||||
(type) => DropdownMenuItem(
|
(type) => DropdownMenuItem(
|
||||||
|
@@ -4,6 +4,8 @@ import 'package:kmobile/di/injection.dart';
|
|||||||
import 'package:kmobile/widgets/bank_logos.dart';
|
import 'package:kmobile/widgets/bank_logos.dart';
|
||||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||||
|
|
||||||
|
import '../../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
class BeneficiaryDetailsScreen extends StatelessWidget {
|
class BeneficiaryDetailsScreen extends StatelessWidget {
|
||||||
final Beneficiary beneficiary;
|
final Beneficiary beneficiary;
|
||||||
|
|
||||||
@@ -12,67 +14,72 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
|
|||||||
final service = getIt<BeneficiaryService>();
|
final service = getIt<BeneficiaryService>();
|
||||||
|
|
||||||
void _deleteBeneficiary(BuildContext context) async {
|
void _deleteBeneficiary(BuildContext context) async {
|
||||||
try {
|
try {
|
||||||
await service.deleteBeneficiary(beneficiary.accountNo);
|
await service.deleteBeneficiary(beneficiary.accountNo);
|
||||||
_showSuccessDialog(context);
|
_showSuccessDialog(context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text('Failed to delete beneficiary: $e')),
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
'${AppLocalizations.of(context).failedToDeleteBeneficiary}: $e')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showSuccessDialog(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context).success),
|
||||||
|
content:
|
||||||
|
Text(AppLocalizations.of(context).beneficiaryDeletedSuccessfully),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text(AppLocalizations.of(context).ok),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void _showSuccessDialog(BuildContext context) {
|
void _showDeleteConfirmationDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Success'),
|
title: Text(AppLocalizations.of(context).deleteBeneficiary),
|
||||||
content: const Text('Beneficiary deleted successfully.'),
|
content: Text(AppLocalizations.of(context)
|
||||||
actions: <Widget>[
|
.areYouSureYouWantToDeleteThisBeneficiary),
|
||||||
TextButton(
|
actions: <Widget>[
|
||||||
child: const Text('OK'),
|
TextButton(
|
||||||
onPressed: () {
|
child: Text(AppLocalizations.of(context).cancel),
|
||||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
onPressed: () {
|
||||||
},
|
Navigator.of(context).pop();
|
||||||
),
|
},
|
||||||
],
|
),
|
||||||
);
|
TextButton(
|
||||||
},
|
child: Text(AppLocalizations.of(context).delete),
|
||||||
);
|
onPressed: () {
|
||||||
}
|
//Navigator.of(context).pop();
|
||||||
|
_deleteBeneficiary(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void _showDeleteConfirmationDialog(BuildContext context) {
|
@override
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('Delete Beneficiary'),
|
|
||||||
content:
|
|
||||||
const Text('Are you sure you want to delete this beneficiary?'),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Cancel'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Delete'),
|
|
||||||
onPressed: () {
|
|
||||||
//Navigator.of(context).pop();
|
|
||||||
_deleteBeneficiary(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} @override
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Beneficiary Details'),
|
title: Text(AppLocalizations.of(context).beneficiarydetails),
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
@@ -95,11 +102,16 @@ void _showDeleteConfirmationDialog(BuildContext context) {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
_buildDetailRow('Beneficiary Name', beneficiary.bankName ?? 'N/A'),
|
_buildDetailRow('${AppLocalizations.of(context).bankName} ',
|
||||||
_buildDetailRow('Account No.', beneficiary.accountNo),
|
beneficiary.bankName ?? 'N/A'),
|
||||||
_buildDetailRow('Account Type', beneficiary.accountType),
|
_buildDetailRow('${AppLocalizations.of(context).accountNumber} ',
|
||||||
_buildDetailRow('IFSC Code', beneficiary.ifscCode),
|
beneficiary.accountNo),
|
||||||
_buildDetailRow('Branch Name', beneficiary.branchName ?? 'N/A'),
|
_buildDetailRow('${AppLocalizations.of(context).accountType} ',
|
||||||
|
beneficiary.accountType),
|
||||||
|
_buildDetailRow('${AppLocalizations.of(context).ifscCode} ',
|
||||||
|
beneficiary.ifscCode),
|
||||||
|
_buildDetailRow('${AppLocalizations.of(context).branchName} ',
|
||||||
|
beneficiary.branchName ?? 'N/A'),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
@@ -114,10 +126,10 @@ void _showDeleteConfirmationDialog(BuildContext context) {
|
|||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Delete beneficiary option
|
// Delete beneficiary option
|
||||||
_showDeleteConfirmationDialog(context);
|
_showDeleteConfirmationDialog(context);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
label: const Text('Delete'),
|
label: Text(AppLocalizations.of(context).delete),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@@ -523,8 +523,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
AccountStatementScreen(
|
AccountStatementScreen(
|
||||||
accountNo: users[selectedAccountIndex].accountNo!,
|
accountNo: users[selectedAccountIndex]
|
||||||
balance: users[selectedAccountIndex].availableBalance!,
|
.accountNo!,
|
||||||
|
balance: users[selectedAccountIndex]
|
||||||
|
.availableBalance!,
|
||||||
)));
|
)));
|
||||||
}),
|
}),
|
||||||
_buildQuickLink(Symbols.checkbook,
|
_buildQuickLink(Symbols.checkbook,
|
||||||
|
@@ -25,7 +25,7 @@ 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;
|
final bool isOwnBank;
|
||||||
|
|
||||||
const FundTransferAmountScreen({
|
const FundTransferAmountScreen({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -54,263 +54,266 @@ 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) {
|
if (widget.isOwnBank) {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => TransactionPinScreen(
|
builder: (context) => TransactionPinScreen(
|
||||||
onPinCompleted: (pinScreenContext, tpin) async {
|
onPinCompleted: (pinScreenContext, tpin) async {
|
||||||
final transfer = Transfer(
|
final transfer = Transfer(
|
||||||
fromAccount: widget.debitAccountNo,
|
fromAccount: widget.debitAccountNo,
|
||||||
toAccount: widget.creditBeneficiary.accountNo,
|
toAccount: widget.creditBeneficiary.accountNo,
|
||||||
toAccountType: 'Savings', // Assuming 'SB' for savings
|
toAccountType: 'Savings', // Assuming 'SB' for savings
|
||||||
amount: _amountController.text,
|
amount: _amountController.text,
|
||||||
tpin: tpin,
|
tpin: tpin,
|
||||||
);
|
);
|
||||||
|
|
||||||
final paymentService = getIt<PaymentService>();
|
final paymentService = getIt<PaymentService>();
|
||||||
final paymentResponseFuture =
|
final paymentResponseFuture =
|
||||||
paymentService.processQuickPayWithinBank(transfer);
|
paymentService.processQuickPayWithinBank(transfer);
|
||||||
|
|
||||||
Navigator.of(pinScreenContext).pushReplacement(
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) => PaymentAnimationScreen(
|
builder: (_) => PaymentAnimationScreen(
|
||||||
paymentResponse: paymentResponseFuture),
|
paymentResponse: paymentResponseFuture),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
if (_selectedMode == TransactionMode.rtgs && amount < 200000) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (ctx) => AlertDialog(
|
|
||||||
title: Text(AppLocalizations.of(context).invalidRtgs),
|
|
||||||
content: Text(AppLocalizations.of(context).invalidRtgsPopUp),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(ctx).pop(),
|
|
||||||
child: Text(AppLocalizations.of(context).ok),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return; // Stop further execution
|
} else {
|
||||||
}
|
if (_selectedMode == TransactionMode.rtgs && amount < 200000) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (ctx) => AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context).invalidRtgs),
|
||||||
|
content: Text(AppLocalizations.of(context).invalidRtgsPopUp),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(ctx).pop(),
|
||||||
|
child: Text(AppLocalizations.of(context).ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return; // Stop further execution
|
||||||
|
}
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => TransactionPinScreen(
|
builder: (context) => TransactionPinScreen(
|
||||||
onPinCompleted: (pinScreenContext, tpin) async {
|
onPinCompleted: (pinScreenContext, tpin) async {
|
||||||
if (_selectedMode == TransactionMode.neft) {
|
if (_selectedMode == TransactionMode.neft) {
|
||||||
final neftTx = NeftTransaction(
|
final neftTx = NeftTransaction(
|
||||||
fromAccount: widget.debitAccountNo,
|
fromAccount: widget.debitAccountNo,
|
||||||
toAccount: widget.creditBeneficiary.accountNo,
|
toAccount: widget.creditBeneficiary.accountNo,
|
||||||
amount: _amountController.text,
|
amount: _amountController.text,
|
||||||
ifscCode: widget.creditBeneficiary.ifscCode,
|
ifscCode: widget.creditBeneficiary.ifscCode,
|
||||||
remitterName: widget.remitterName,
|
remitterName: widget.remitterName,
|
||||||
beneficiaryName: widget.creditBeneficiary.name,
|
beneficiaryName: widget.creditBeneficiary.name,
|
||||||
tpin: tpin,
|
tpin: tpin,
|
||||||
);
|
|
||||||
final neftService = getIt<NeftService>();
|
|
||||||
|
|
||||||
final completer = Completer<PaymentResponse>();
|
|
||||||
|
|
||||||
Navigator.of(pinScreenContext).pushReplacement(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) => PaymentAnimationScreen(
|
|
||||||
paymentResponse: completer.future),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final neftResponse =
|
|
||||||
await neftService.processNeftTransaction(neftTx);
|
|
||||||
final paymentResponse = PaymentResponse(
|
|
||||||
isSuccess: neftResponse.message.toUpperCase() == 'SUCCESS',
|
|
||||||
date: DateTime.now(),
|
|
||||||
creditedAccount: neftTx.toAccount,
|
|
||||||
amount: neftTx.amount,
|
|
||||||
currency: 'INR',
|
|
||||||
utr: neftResponse.utr,
|
|
||||||
);
|
);
|
||||||
completer.complete(paymentResponse);
|
final neftService = getIt<NeftService>();
|
||||||
} on DioException catch (e) {
|
|
||||||
print(e);
|
final completer = Completer<PaymentResponse>();
|
||||||
String errorMessage;
|
|
||||||
if (e.response != null && e.response!.data != null) {
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
print('error has data');
|
MaterialPageRoute(
|
||||||
try {
|
builder: (_) => PaymentAnimationScreen(
|
||||||
// final error = jsonDecode(e.response!.toString())['error'];
|
paymentResponse: completer.future),
|
||||||
final error = e.response?.data['error'];
|
),
|
||||||
print('actual error message $error');
|
);
|
||||||
errorMessage = {
|
|
||||||
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
try {
|
||||||
"INSUFFICIENT_FUNDS":
|
final neftResponse =
|
||||||
"Your account does not have sufficient balance"
|
await neftService.processNeftTransaction(neftTx);
|
||||||
}[error] ??
|
final paymentResponse = PaymentResponse(
|
||||||
"Something Went Wrong";
|
isSuccess:
|
||||||
} catch (_) {
|
neftResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
print('error extracting errorMessage');
|
date: DateTime.now(),
|
||||||
|
creditedAccount: neftTx.toAccount,
|
||||||
|
amount: neftTx.amount,
|
||||||
|
currency: 'INR',
|
||||||
|
utr: neftResponse.utr,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} on DioException catch (e) {
|
||||||
|
print(e);
|
||||||
|
String errorMessage;
|
||||||
|
if (e.response != null && e.response!.data != null) {
|
||||||
|
print('error has data');
|
||||||
|
try {
|
||||||
|
// final error = jsonDecode(e.response!.toString())['error'];
|
||||||
|
final error = e.response?.data['error'];
|
||||||
|
print('actual error message $error');
|
||||||
|
errorMessage = {
|
||||||
|
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
||||||
|
"INSUFFICIENT_FUNDS":
|
||||||
|
"Your account does not have sufficient balance"
|
||||||
|
}[error] ??
|
||||||
|
"Something Went Wrong";
|
||||||
|
} catch (_) {
|
||||||
|
print('error extracting errorMessage');
|
||||||
|
errorMessage = "Something Went Wrong";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print('has has no data');
|
||||||
errorMessage = "Something Went Wrong";
|
errorMessage = "Something Went Wrong";
|
||||||
}
|
}
|
||||||
} else {
|
print('PaymentResponse generating');
|
||||||
print('has has no data');
|
final paymentResponse = PaymentResponse(
|
||||||
errorMessage = "Something Went Wrong";
|
isSuccess: false,
|
||||||
|
errorMessage: errorMessage,
|
||||||
|
);
|
||||||
|
print('PaymentResponse generated');
|
||||||
|
print(paymentResponse);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
print("NEFT transaction failed with DioException."); // Add
|
||||||
|
} catch (e) {
|
||||||
|
print('generic exception');
|
||||||
|
print(e.toString());
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: AppLocalizations.of(pinScreenContext)
|
||||||
|
.somethingWentWrong,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
print(
|
||||||
|
"NEFT transaction failed with generic exception."); // Add
|
||||||
}
|
}
|
||||||
print('PaymentResponse generating');
|
|
||||||
final paymentResponse = PaymentResponse(
|
|
||||||
isSuccess: false,
|
|
||||||
errorMessage: errorMessage,
|
|
||||||
);
|
|
||||||
print('PaymentResponse generated');
|
|
||||||
print(paymentResponse);
|
|
||||||
completer.complete(paymentResponse);
|
|
||||||
print("NEFT transaction failed with DioException."); // Add
|
|
||||||
} catch (e) {
|
|
||||||
print('generic exception');
|
|
||||||
print(e.toString());
|
|
||||||
final paymentResponse = PaymentResponse(
|
|
||||||
isSuccess: false,
|
|
||||||
errorMessage: AppLocalizations.of(pinScreenContext)
|
|
||||||
.somethingWentWrong,
|
|
||||||
);
|
|
||||||
completer.complete(paymentResponse);
|
|
||||||
print(
|
|
||||||
"NEFT transaction failed with generic exception."); // Add
|
|
||||||
}
|
}
|
||||||
}
|
//IMPS transaction
|
||||||
//IMPS transaction
|
else if (_selectedMode == TransactionMode.imps) {
|
||||||
else if (_selectedMode == TransactionMode.imps) {
|
final impsTx = ImpsTransaction(
|
||||||
final impsTx = ImpsTransaction(
|
fromAccount: widget.debitAccountNo,
|
||||||
fromAccount: widget.debitAccountNo,
|
toAccount: widget.creditBeneficiary.accountNo,
|
||||||
toAccount: widget.creditBeneficiary.accountNo,
|
amount: _amountController.text,
|
||||||
amount: _amountController.text,
|
ifscCode: widget.creditBeneficiary.ifscCode,
|
||||||
ifscCode: widget.creditBeneficiary.ifscCode,
|
remitterName: widget.remitterName,
|
||||||
remitterName: widget.remitterName,
|
beneficiaryName: widget.creditBeneficiary.name,
|
||||||
beneficiaryName: widget.creditBeneficiary.name,
|
tpin: tpin,
|
||||||
tpin: tpin,
|
|
||||||
);
|
|
||||||
final impsService = getIt<ImpsService>();
|
|
||||||
final completer = Completer<PaymentResponse>();
|
|
||||||
|
|
||||||
Navigator.of(pinScreenContext).pushReplacement(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) => PaymentAnimationScreen(
|
|
||||||
paymentResponse: completer.future),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final impsResponse =
|
|
||||||
await impsService.processImpsTransaction(impsTx);
|
|
||||||
final paymentResponse = PaymentResponse(
|
|
||||||
isSuccess: impsResponse.message.toUpperCase() == 'SUCCESS',
|
|
||||||
date: DateTime.now(),
|
|
||||||
creditedAccount: impsTx.toAccount,
|
|
||||||
amount: impsTx.amount,
|
|
||||||
currency: 'INR',
|
|
||||||
utr: impsResponse.utr,
|
|
||||||
);
|
);
|
||||||
completer.complete(paymentResponse);
|
final impsService = getIt<ImpsService>();
|
||||||
} on DioException catch (e) {
|
final completer = Completer<PaymentResponse>();
|
||||||
print('dio exception');
|
|
||||||
print(e.toString());
|
|
||||||
|
|
||||||
final error = jsonDecode(e.response.toString())['error'];
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
var errorMessage = {
|
MaterialPageRoute(
|
||||||
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
builder: (_) => PaymentAnimationScreen(
|
||||||
"INSUFFICIENT_FUNDS":
|
paymentResponse: completer.future),
|
||||||
"Your account does not have sufficient balance"
|
),
|
||||||
}[error] ??
|
);
|
||||||
"Something Went Wrong";
|
|
||||||
|
|
||||||
final paymentResponse = PaymentResponse(
|
try {
|
||||||
isSuccess: false,
|
final impsResponse =
|
||||||
errorMessage: errorMessage,
|
await impsService.processImpsTransaction(impsTx);
|
||||||
);
|
final paymentResponse = PaymentResponse(
|
||||||
completer.complete(paymentResponse);
|
isSuccess:
|
||||||
} catch (e) {
|
impsResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
print('generic exception');
|
date: DateTime.now(),
|
||||||
print(e.toString());
|
creditedAccount: impsTx.toAccount,
|
||||||
final paymentResponse = PaymentResponse(
|
amount: impsTx.amount,
|
||||||
isSuccess: false,
|
currency: 'INR',
|
||||||
errorMessage: "Something went Wrong",
|
utr: impsResponse.utr,
|
||||||
);
|
);
|
||||||
completer.complete(paymentResponse);
|
completer.complete(paymentResponse);
|
||||||
|
} on DioException catch (e) {
|
||||||
|
print('dio exception');
|
||||||
|
print(e.toString());
|
||||||
|
|
||||||
|
final error = jsonDecode(e.response.toString())['error'];
|
||||||
|
var errorMessage = {
|
||||||
|
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
||||||
|
"INSUFFICIENT_FUNDS":
|
||||||
|
"Your account does not have sufficient balance"
|
||||||
|
}[error] ??
|
||||||
|
"Something Went Wrong";
|
||||||
|
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: errorMessage,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} catch (e) {
|
||||||
|
print('generic exception');
|
||||||
|
print(e.toString());
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: "Something went Wrong",
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
//RTGS
|
||||||
//RTGS
|
else {
|
||||||
else {
|
final rtgsTx = RtgsTransaction(
|
||||||
final rtgsTx = RtgsTransaction(
|
fromAccount: widget.debitAccountNo,
|
||||||
fromAccount: widget.debitAccountNo,
|
toAccount: widget.creditBeneficiary.accountNo,
|
||||||
toAccount: widget.creditBeneficiary.accountNo,
|
amount: _amountController.text,
|
||||||
amount: _amountController.text,
|
ifscCode: widget.creditBeneficiary.ifscCode,
|
||||||
ifscCode: widget.creditBeneficiary.ifscCode,
|
remitterName: widget.remitterName,
|
||||||
remitterName: widget.remitterName,
|
beneficiaryName: widget.creditBeneficiary.name,
|
||||||
beneficiaryName: widget.creditBeneficiary.name,
|
tpin: tpin,
|
||||||
tpin: tpin,
|
|
||||||
);
|
|
||||||
final rtgsService = getIt<RtgsService>();
|
|
||||||
final completer = Completer<PaymentResponse>();
|
|
||||||
|
|
||||||
Navigator.of(pinScreenContext).pushReplacement(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (_) => PaymentAnimationScreen(
|
|
||||||
paymentResponse: completer.future),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
final rtgsResponse =
|
|
||||||
await rtgsService.processRtgsTransaction(rtgsTx);
|
|
||||||
final paymentResponse = PaymentResponse(
|
|
||||||
isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS',
|
|
||||||
date: DateTime.now(),
|
|
||||||
creditedAccount: rtgsTx.toAccount,
|
|
||||||
amount: rtgsTx.amount,
|
|
||||||
currency: 'INR',
|
|
||||||
utr: rtgsResponse.utr,
|
|
||||||
);
|
);
|
||||||
completer.complete(paymentResponse);
|
final rtgsService = getIt<RtgsService>();
|
||||||
} on DioException catch (e) {
|
final completer = Completer<PaymentResponse>();
|
||||||
print('dio exception');
|
|
||||||
print(e.toString());
|
|
||||||
|
|
||||||
final error = jsonDecode(e.response.toString())['error'];
|
Navigator.of(pinScreenContext).pushReplacement(
|
||||||
var errorMessage = {
|
MaterialPageRoute(
|
||||||
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
builder: (_) => PaymentAnimationScreen(
|
||||||
"INSUFFICIENT_FUNDS":
|
paymentResponse: completer.future),
|
||||||
"Your account does not have sufficient balance"
|
),
|
||||||
// ignore: use_build_context_synchronously
|
);
|
||||||
}[error] ??
|
|
||||||
"Something Went Wrong";
|
|
||||||
|
|
||||||
final paymentResponse = PaymentResponse(
|
try {
|
||||||
isSuccess: false,
|
final rtgsResponse =
|
||||||
errorMessage: errorMessage,
|
await rtgsService.processRtgsTransaction(rtgsTx);
|
||||||
);
|
final paymentResponse = PaymentResponse(
|
||||||
completer.complete(paymentResponse);
|
isSuccess:
|
||||||
} catch (e) {
|
rtgsResponse.message.toUpperCase() == 'SUCCESS',
|
||||||
print('generic exception');
|
date: DateTime.now(),
|
||||||
print(e.toString());
|
creditedAccount: rtgsTx.toAccount,
|
||||||
final paymentResponse = PaymentResponse(
|
amount: rtgsTx.amount,
|
||||||
isSuccess: false,
|
currency: 'INR',
|
||||||
errorMessage: "Something Went Wrong",
|
utr: rtgsResponse.utr,
|
||||||
);
|
);
|
||||||
completer.complete(paymentResponse);
|
completer.complete(paymentResponse);
|
||||||
|
} on DioException catch (e) {
|
||||||
|
print('dio exception');
|
||||||
|
print(e.toString());
|
||||||
|
|
||||||
|
final error = jsonDecode(e.response.toString())['error'];
|
||||||
|
var errorMessage = {
|
||||||
|
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
||||||
|
"INSUFFICIENT_FUNDS":
|
||||||
|
"Your account does not have sufficient balance"
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
|
}[error] ??
|
||||||
|
"Something Went Wrong";
|
||||||
|
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: errorMessage,
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
} catch (e) {
|
||||||
|
print('generic exception');
|
||||||
|
print(e.toString());
|
||||||
|
final paymentResponse = PaymentResponse(
|
||||||
|
isSuccess: false,
|
||||||
|
errorMessage: "Something Went Wrong",
|
||||||
|
);
|
||||||
|
completer.complete(paymentResponse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -362,60 +365,61 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
if (!widget.isOwnBank) ...[
|
if (!widget.isOwnBank) ...[
|
||||||
// Transaction Mode Selection
|
// Transaction Mode Selection
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(context).selectTransactionType,
|
AppLocalizations.of(context).selectTransactionType,
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Theme.of(context).cardColor,
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
border: Border.all(color: Colors.grey.shade300),
|
|
||||||
),
|
),
|
||||||
child: ToggleButtons(
|
const SizedBox(height: 12),
|
||||||
isSelected: [
|
Container(
|
||||||
_selectedMode == TransactionMode.neft,
|
decoration: BoxDecoration(
|
||||||
_selectedMode == TransactionMode.rtgs,
|
color: Theme.of(context).cardColor,
|
||||||
_selectedMode == TransactionMode.imps,
|
borderRadius: BorderRadius.circular(12),
|
||||||
],
|
border: Border.all(color: Colors.grey.shade300),
|
||||||
onPressed: (index) {
|
),
|
||||||
setState(() {
|
child: ToggleButtons(
|
||||||
_selectedMode = TransactionMode.values[index];
|
isSelected: [
|
||||||
});
|
_selectedMode == TransactionMode.neft,
|
||||||
},
|
_selectedMode == TransactionMode.rtgs,
|
||||||
borderRadius: BorderRadius.circular(10),
|
_selectedMode == TransactionMode.imps,
|
||||||
selectedColor: Theme.of(context).colorScheme.onPrimary,
|
],
|
||||||
fillColor: Theme.of(context).primaryColor,
|
onPressed: (index) {
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
setState(() {
|
||||||
borderColor: Colors.transparent,
|
_selectedMode = TransactionMode.values[index];
|
||||||
selectedBorderColor: Colors.transparent,
|
});
|
||||||
splashColor: Theme.of(context).primaryColor.withOpacity(0.1),
|
},
|
||||||
highlightColor:
|
borderRadius: BorderRadius.circular(10),
|
||||||
Theme.of(context).primaryColor.withOpacity(0.05),
|
selectedColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
children: [
|
fillColor: Theme.of(context).primaryColor,
|
||||||
Padding(
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
padding: const EdgeInsets.symmetric(
|
borderColor: Colors.transparent,
|
||||||
horizontal: 24.0, vertical: 12.0),
|
selectedBorderColor: Colors.transparent,
|
||||||
child: Text(AppLocalizations.of(context).neft),
|
splashColor:
|
||||||
),
|
Theme.of(context).primaryColor.withOpacity(0.1),
|
||||||
Padding(
|
highlightColor:
|
||||||
padding: const EdgeInsets.symmetric(
|
Theme.of(context).primaryColor.withOpacity(0.05),
|
||||||
horizontal: 24.0, vertical: 12.0),
|
children: [
|
||||||
child: Text(AppLocalizations.of(context).rtgs),
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
Padding(
|
horizontal: 24.0, vertical: 12.0),
|
||||||
padding: const EdgeInsets.symmetric(
|
child: Text(AppLocalizations.of(context).neft),
|
||||||
horizontal: 24.0, vertical: 12.0),
|
),
|
||||||
child: Text(AppLocalizations.of(context).imps),
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.symmetric(
|
||||||
],
|
horizontal: 24.0, vertical: 12.0),
|
||||||
|
child: Text(AppLocalizations.of(context).rtgs),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24.0, vertical: 12.0),
|
||||||
|
child: Text(AppLocalizations.of(context).imps),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 24),
|
||||||
const SizedBox(height: 24),
|
],
|
||||||
],
|
|
||||||
// Amount
|
// Amount
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _amountController,
|
controller: _amountController,
|
||||||
|
@@ -22,7 +22,7 @@ class ColorThemeDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CircleAvatar(backgroundColor: Colors.green),
|
leading: const CircleAvatar(backgroundColor: Colors.green),
|
||||||
title: const Text('Green'),
|
title: Text(AppLocalizations.of(context).green),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.read<ThemeCubit>().changeTheme(ThemeType.green);
|
context.read<ThemeCubit>().changeTheme(ThemeType.green);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@@ -30,7 +30,7 @@ class ColorThemeDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const CircleAvatar(backgroundColor: Colors.orange),
|
leading: const CircleAvatar(backgroundColor: Colors.orange),
|
||||||
title: const Text('Orange'),
|
title: Text(AppLocalizations.of(context).orange),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
context.read<ThemeCubit>().changeTheme(ThemeType.orange);
|
context.read<ThemeCubit>().changeTheme(ThemeType.orange);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
@@ -53,7 +53,7 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accountType = AppLocalizations.of(context).savings;
|
accountType = 'Savings';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -572,8 +572,8 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
items: [
|
items: [
|
||||||
AppLocalizations.of(context).savings,
|
'Savings',
|
||||||
AppLocalizations.of(context).current,
|
'Current',
|
||||||
]
|
]
|
||||||
.map(
|
.map(
|
||||||
(e) => DropdownMenuItem(value: e, child: Text(e)),
|
(e) => DropdownMenuItem(value: e, child: Text(e)),
|
||||||
|
@@ -285,5 +285,8 @@
|
|||||||
"areYouSureYouWantToDeleteThisBeneficiary": "Are you sure you want to delete this beneficiary?",
|
"areYouSureYouWantToDeleteThisBeneficiary": "Are you sure you want to delete this beneficiary?",
|
||||||
"yourAccountDoesNotHaveSufficientBalance": "Your account does not have sufficient balance",
|
"yourAccountDoesNotHaveSufficientBalance": "Your account does not have sufficient balance",
|
||||||
"green": "Green",
|
"green": "Green",
|
||||||
"orange": "Orange"
|
"orange": "Orange",
|
||||||
|
"deleteBeneficiary": "Delete Beneficiary",
|
||||||
|
"beneficiarydetails": "Beneficiary Details",
|
||||||
|
"delete": "Delete"
|
||||||
}
|
}
|
||||||
|
@@ -285,5 +285,8 @@
|
|||||||
"areYouSureYouWantToDeleteThisBeneficiary": "क्या आप वाकई इस लाभार्थी को हटाना चाहते हैं?",
|
"areYouSureYouWantToDeleteThisBeneficiary": "क्या आप वाकई इस लाभार्थी को हटाना चाहते हैं?",
|
||||||
"yourAccountDoesNotHaveSufficientBalance": "आपके खाते में पर्याप्त शेष राशि नहीं है",
|
"yourAccountDoesNotHaveSufficientBalance": "आपके खाते में पर्याप्त शेष राशि नहीं है",
|
||||||
"green": "हरा",
|
"green": "हरा",
|
||||||
"orange": "नारंगी"
|
"orange": "नारंगी",
|
||||||
|
"deleteBeneficiary": "लाभार्थी हटाएं",
|
||||||
|
"beneficiarydetails": "लाभार्थी विवरण",
|
||||||
|
"delete": "मिटाओ"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user