Payment Error Message and Beneficiary Page
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||
import 'package:kmobile/data/models/ifsc.dart';
|
||||
import 'package:kmobile/data/models/beneficiary.dart';
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
import 'beneficiary_result_page.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../../di/injection.dart';
|
||||
@@ -36,12 +35,11 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
final TextEditingController phoneController = TextEditingController();
|
||||
final service = getIt<BeneficiaryService>();
|
||||
|
||||
String? _beneficiaryName;
|
||||
bool _isValidating = false;
|
||||
bool _isBeneficiaryValidated = false;
|
||||
// ignore: unused_field
|
||||
String? _validationError;
|
||||
late String accountType;
|
||||
final String _selectedAccountType = 'Savings'; // default value
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -335,6 +333,10 @@ class _AddBeneficiaryScreen extends State<AddBeneficiaryScreen> {
|
||||
// 🔹 IFSC Code Field
|
||||
TextFormField(
|
||||
controller: ifscController,
|
||||
maxLength: 11,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(11),
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).ifscCode,
|
||||
border: const OutlineInputBorder(),
|
||||
|
@@ -61,13 +61,20 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
}
|
||||
|
||||
Widget _getBankLogo(String? bankName) {
|
||||
if (bankName != null && bankName.toLowerCase().contains('state bank of india')) {
|
||||
if (bankName != null && bankName.toLowerCase().contains('state bank')) {
|
||||
return Image.asset(
|
||||
'assets/images/sbi_logo.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
);
|
||||
}
|
||||
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
|
||||
return Image.asset(
|
||||
'assets/images/icon.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
);
|
||||
}
|
||||
if (bankName != null && bankName.toLowerCase().contains('hdfc bank ltd')) {
|
||||
return Image.asset(
|
||||
'assets/images/hdfc_logo.png',
|
||||
@@ -113,11 +120,11 @@ class _ManageBeneficiariesScreen extends State<ManageBeneficiariesScreen> {
|
||||
backgroundColor: Colors.transparent,
|
||||
child: _getBankLogo(item.bankName),
|
||||
),
|
||||
title: Text(item.name ?? 'Unknown'),
|
||||
title: Text(item.name),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(item.accountNo ?? 'No account number'),
|
||||
Text(item.accountNo),
|
||||
if (item.bankName != null && item.bankName!.isNotEmpty)
|
||||
Text(
|
||||
item.bankName!,
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:kmobile/api/services/neft_service.dart';
|
||||
import 'package:kmobile/api/services/rtgs_service.dart';
|
||||
import 'package:kmobile/data/models/beneficiary.dart';
|
||||
@@ -119,10 +120,28 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
utr: neftResponse.utr,
|
||||
);
|
||||
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: e.toString(),
|
||||
errorMessage: "Something went Wrong",
|
||||
);
|
||||
completer.complete(paymentResponse);
|
||||
}
|
||||
@@ -158,10 +177,28 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
utr: rtgsResponse.utr,
|
||||
);
|
||||
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: e.toString(),
|
||||
errorMessage: "Something went Wrong",
|
||||
);
|
||||
completer.complete(paymentResponse);
|
||||
}
|
||||
|
@@ -154,12 +154,19 @@ class _FundTransferBeneficiaryScreenState
|
||||
}
|
||||
|
||||
Widget _getBankLogo(String? bankName) {
|
||||
if (bankName != null && bankName.toLowerCase().contains('state bank of india')) {
|
||||
if (bankName != null && bankName.toLowerCase().contains('state bank ')) {
|
||||
return Image.asset(
|
||||
'assets/images/sbi_logo.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
);
|
||||
}
|
||||
if (bankName != null && bankName.toLowerCase().contains('kangra central')) {
|
||||
return Image.asset(
|
||||
'assets/images/icon.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
);
|
||||
}
|
||||
if (bankName != null && bankName.toLowerCase().contains('hdfc bank ltd')) {
|
||||
return Image.asset(
|
||||
|
@@ -397,9 +397,8 @@ class _PaymentAnimationScreenState extends State<PaymentAnimationScreen> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (response.errorMessage != null)
|
||||
Text(
|
||||
response.errorMessage!,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
Text(response.errorMessage ?? '',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@@ -21,28 +21,6 @@ class PreferenceScreen extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
return ListView(
|
||||
children: [
|
||||
// Theme Mode Switch (Light/Dark)
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.brightness_6),
|
||||
// title: const Text("Theme Mode"),
|
||||
// trailing: Switch(
|
||||
// value: state.isDarkMode,
|
||||
// onChanged: (val) {
|
||||
// context.read<ThemeCubit>().toggleDarkMode(val);
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
//Color_Theme_Selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.color_lens),
|
||||
title: Text(AppLocalizations.of(context).themeColor),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => const ColorThemeDialog(),
|
||||
);
|
||||
}
|
||||
),
|
||||
// Language Selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
@@ -54,7 +32,31 @@ class PreferenceScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
//Theme Mode Switch (Light/Dark)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.brightness_6),
|
||||
title: Text(AppLocalizations.of(context).themeMode),
|
||||
enabled: false,
|
||||
//trailing: Switch(
|
||||
// value: state.isDarkMode,
|
||||
// onChanged: (val) {
|
||||
// context.read<ThemeCubit>().toggleDarkMode(val);
|
||||
// },
|
||||
//),
|
||||
),
|
||||
//Color_Theme_Selection
|
||||
ListTile(
|
||||
leading: const Icon(Icons.color_lens),
|
||||
title: Text(AppLocalizations.of(context).themeColor),
|
||||
enabled: false,
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) => const ColorThemeDialog(),
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:kmobile/api/services/neft_service.dart';
|
||||
import 'package:kmobile/api/services/rtgs_service.dart';
|
||||
import 'package:kmobile/data/models/neft_transaction.dart';
|
||||
|
@@ -4,14 +4,12 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_swipe_button/flutter_swipe_button.dart';
|
||||
import 'package:kmobile/api/services/beneficiary_service.dart';
|
||||
import 'package:kmobile/api/services/payment_service.dart';
|
||||
import 'package:kmobile/data/models/payment_response.dart';
|
||||
import 'package:kmobile/data/models/transfer.dart';
|
||||
import 'package:kmobile/di/injection.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/payment_animation.dart';
|
||||
import 'package:material_symbols_icons/material_symbols_icons.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../../fund_transfer/screens/transaction_pin_screen.dart';
|
||||
//import 'package:flutter_neumorphic/flutter_neumorphic.dart';
|
||||
|
||||
class QuickPayWithinBankScreen extends StatefulWidget {
|
||||
final String debitAccount;
|
||||
|
Reference in New Issue
Block a user