Beneficiary details changes, cheque and yojna services

This commit is contained in:
2026-03-12 12:11:30 +05:30
parent 89569ab1c3
commit d8ebd0ed0e
5 changed files with 626 additions and 0 deletions

View File

@@ -130,4 +130,62 @@ class ChequeService {
);
return response.toString();
}
Future revokeStop({
required String accountno,
required String removeFromChequeNo,
required String instrType,
String? removeToChequeNo,
String? removeIssueDate,
String? removeExpiryDate,
String? removeAmount,
String? removeComment,
required String tpin,
}) async {
final response = await _dio.post(
'/api/cheque/removeStop',
options: Options(
validateStatus: (int? status) => true,
receiveDataWhenStatusError: true,
),
data: {
'accountNumber': accountno,
'removeFromChequeNo': removeFromChequeNo,
'instrumentType': instrType,
'removeToChequeNo': removeToChequeNo,
'removeIssueDate': removeIssueDate,
'removeExpiryDate': removeExpiryDate,
'removeAmount': removeAmount,
'removeComment': removeComment,
'tpin': tpin,
},
);
return response.toString();
}
Future registerPPS({
required String cheque_no,
required String account_number,
String? issue_date,
String? amount,
String? payee_name,
required String tpin,
}) async {
final response = await _dio.post(
'/api/pps',
options: Options(
validateStatus: (int? status) => true,
receiveDataWhenStatusError: true,
),
data: {
'cheque_no': cheque_no,
'account_number': account_number,
'issue_date': issue_date,
'amount': amount,
'payee_name': payee_name,
'tpin': tpin,
},
);
return response.toString();
}
}

View File

@@ -0,0 +1,213 @@
import 'dart:developer';
import 'package:dio/dio.dart';
class YojnaService {
final Dio _dio;
YojnaService(this._dio);
Future<dynamic> fetchpmydetails({
required String scheme,
required String action,
required String accountno,
}) async {
try {
final response = await _dio.post(
"/api/gov-scheme/req/PMJBY",
data: {
'scheme': scheme,
'action': action,
'accountNo': accountno,
},
options: Options(
headers: {
"Content-Type": "application/json",
},
),
);
log("PMY Details Response: ${response.data}");
if (response.statusCode == 200) {
return response.data;
} else {
throw Exception("INTERNAL SERVER ERROR");
}
} catch (e) {
log("Error fetching PMY details: $e");
return null;
}
}
Future secondvalidationPMJJBY({
String? aadharno,
String? accountno,
String? availablebalance,
String? country,
String? customerdob,
String? customername,
String? customerno,
String? dateofacctopening,
String? emailid,
String? financialyear,
String? gender,
String? ifsccode,
String? married,
String? mobileno,
String? pan,
String? pincode,
String? policynumber,
String? premiumamount,
String? state,
String? healthstatus,
String? collectionchannel,
String? nomineename,
String? nomineeaddress,
String? nomineerelationship,
String? nomineeminor,
String? ruralcategory,
}) async {
final response = await _dio.post(
'/api/gov-scheme/create/PMJBY',
options: Options(
validateStatus: (int? status) => true,
receiveDataWhenStatusError: true,
),
data: {
'aadharno': aadharno ,
'accountno': accountno,
'availablebalance': availablebalance,
'country': country,
'customerdob': customerdob,
'customername': customername,
'customerno': customerno,
'dateofacctopening': dateofacctopening,
'emailid': emailid,
'financialyear': financialyear,
'gender': gender,
'ifsccode': ifsccode,
'married': married,
'mobileno': mobileno,
'pan': pan,
'pincode': pincode,
'policynumber': policynumber,
'premiumamount': premiumamount,
'state': state,
'healthstatus': healthstatus,
'collectionchannel': collectionchannel,
'nomineename': nomineename,
'nomineeaddress': nomineeaddress,
'nomineerelationship': nomineerelationship,
'nomineeminor': nomineeminor,
'ruralcategory': ruralcategory,
},
);
return response.toString();
}
Future secondvalidationPMSBY({
String? aadharno,
String? accountno,
String? address1,
String? address2,
String? availablebalance,
String? city,
String? country,
String? customerdob,
String? customername,
String? customerno,
String? emailid,
String? financialyear,
String? gender,
String? married,
String? mobileno,
String? pan,
String? pincode,
String? policyno,
String? premiumamount,
String? state,
String? healthstatus,
String? nomineename,
String? nomineeadress,
String? relationwithnominee,
String? nomineeminor,
String? collectionchannel,
String? ruralcategory,
String? policystatus,
}) async {
final response = await _dio.post(
'/api/gov-scheme/create/PMSBY',
options: Options(
validateStatus: (int? status) => true,
receiveDataWhenStatusError: true,
),
data: {
"aadharno": aadharno,
"accountno": accountno,
"address1": address1,
"address2": address2,
"availablebalance": availablebalance,
"city": city,
"country": country,
"customerdob": customerdob,
"customername": customername,
"customerno": customerno,
"emailid": emailid,
"financialyear": financialyear,
"gender": gender,
"married": married,
"mobileno": mobileno,
"pan": pan,
"pincode": pincode,
"policyno": policyno,
"premiumamount": premiumamount,
"state": state,
"healthstatus": healthstatus,
"nomineename": nomineename,
"nomineeadress": nomineeadress,
"relationwithnominee": relationwithnominee,
"nomineeminor": nomineeminor,
"collectionchannel": collectionchannel,
"ruralcategory": ruralcategory,
"policystatus": policystatus,
},
);
return response.toString();
}
Future<dynamic> enquiry({
required String scheme,
required String action,
required String financialyear,
String? customerno,
}) async {
try {
final response = await _dio.get(
"/api/gov-scheme/enquiry/PMJBY",
queryParameters: {
'scheme': scheme,
'action': action,
'financialyear': financialyear,
'customerno': customerno,
},
options: Options(
headers: {
"Content-Type": "application/json",
},
),
);
log("PMY Details Response: ${response.data}");
if (response.statusCode == 200) {
return response.data;
} else {
throw Exception("INTERNAL SERVER ERROR");
}
} catch (e) {
log("Error fetching PMY details: $e");
return null;
}
}
}

View File

@@ -6,6 +6,7 @@ class Beneficiary {
final String ifscCode;
final String? bankName;
final String? branchName;
final String? transactionLimit;
final String? tpin;
Beneficiary({
@@ -16,6 +17,7 @@ class Beneficiary {
required this.ifscCode,
this.bankName,
this.branchName,
this.transactionLimit,
this.tpin,
});
@@ -30,6 +32,7 @@ class Beneficiary {
ifscCode: json['ifsc_code'] ?? json['ifscCode'] ?? '',
bankName: json['bank_name'] ?? json['bankName'] ?? '',
branchName: json['branch_name'] ?? json['branchName'] ?? '',
transactionLimit: json['transactionLimit'] ?? '',
);
}

View File

@@ -119,6 +119,7 @@ class BeneficiaryDetailsScreen extends StatelessWidget {
beneficiary.ifscCode),
_buildDetailRow('${AppLocalizations.of(context).branchName} ',
beneficiary.branchName ?? 'N/A'),
_buildDetailRow("Beneficiary Transactional Limit", beneficiary.transactionLimit ?? 'N/A'),
const Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,

View File

@@ -0,0 +1,351 @@
// import 'package:kmobile/data/models/user.dart';
// import 'package:kmobile/di/injection.dart';
// import 'package:flutter/material.dart';
// import 'package:kmobile/api/services/cheque_service.dart';
// // import 'package:kmobile/features/cheque/screens/revoke_stop_multiple_screen.dart';
// // import 'package:kmobile/features/cheque/screens/revoke_stop_single_screen.dart';
// import 'package:kmobile/l10n/app_localizations.dart';
// class RevokeStopChequeScreen extends StatefulWidget {
// final List<User> users;
// final int selectedIndex;
// const RevokeStopChequeScreen(
// {
// super.key,
// required this.users,
// required this.selectedIndex,
// });
// @override
// State<RevokeStopChequeScreen> createState() => _RevokeStopChequeScreenState();
// }
// class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
// User? _selectedAccount;
// var service = getIt<ChequeService>();
// bool _isLoading = true;
// List<Cheque> _stCheques = [];
// List<User> _filteredUsers = [];
// @override
// void initState() {
// super.initState();
// _filteredUsers = widget.users
// .where((user) => ['SA', 'SB', 'CA', 'CC'].contains(user.accountType))
// .toList();
// if (widget.users.isNotEmpty && widget.selectedIndex < widget.users.length) {
// if (_filteredUsers.isNotEmpty) {
// if (_filteredUsers.contains(widget.users[widget.selectedIndex])) {
// _selectedAccount = widget.users[widget.selectedIndex];
// } else {
// _selectedAccount = _filteredUsers.first;
// }
// } else {
// _selectedAccount = widget.users[widget.selectedIndex];
// }
// } else {
// if (_filteredUsers.isNotEmpty) {
// _selectedAccount = _filteredUsers.first;
// }
// }
// _loadCheques();
// }
// Future<void> _loadCheques() async {
// if (_selectedAccount == null) {
// setState(() {
// _isLoading = false;
// _stCheques = [];
// });
// return;
// }
// setState(() {
// _isLoading = true;
// });
// String instrType;
// switch (_selectedAccount!.accountType) {
// case 'SA':
// case 'SB':
// instrType = '10';
// break;
// case 'CA':
// instrType = '11';
// break;
// case 'CC':
// instrType = '13';
// break;
// default:
// instrType = '10';
// }
// try {
// final data = await service.ChequeEnquiry(
// accountNumber: _selectedAccount!.accountNo!, instrType: instrType);
// final stCheques = data.where((cheque) => cheque.type == 'ST').toList();
// setState(() {
// _stCheques = stCheques;
// _isLoading = false;
// });
// } catch (e) {
// setState(() {
// _isLoading = false;
// _stCheques = [];
// });
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text('Failed to fetch cheque status: ${e.toString()}'),
// ),
// );
// }
// }
// String _getAccountTypeDisplayName(String accountType) {
// switch (accountType.toLowerCase()) {
// case 'sa':
// return AppLocalizations.of(context).savingsAccount;
// case 'sb':
// return AppLocalizations.of(context).savingsAccount;
// case 'ca':
// return "Current Account";
// case 'cc':
// return "Cash Credit Account";
// default:
// return accountType;
// }
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text(AppLocalizations.of(context).revokeStop),
// centerTitle: false,
// ),
// body: Stack(
// children: [
// Padding(
// padding: const EdgeInsets.all(16.0),
// child: Column(children: [
// Card(
// elevation: 4,
// margin: const EdgeInsets.symmetric(vertical: 8.0),
// child: Padding(
// padding: const EdgeInsets.all(16.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// AppLocalizations.of(context).accountNumber,
// style: const TextStyle(
// fontWeight: FontWeight.bold, fontSize: 18),
// ),
// const SizedBox(width: 16),
// if (_selectedAccount != null)
// Expanded(
// child: DropdownButton<User>(
// value: _selectedAccount,
// onChanged: (User? newUser) {
// if (newUser != null) {
// setState(() {
// _selectedAccount = newUser;
// _loadCheques();
// });
// }
// },
// items: _filteredUsers.map((user) {
// return DropdownMenuItem<User>(
// value: user,
// child: Text(user.accountNo.toString()),
// );
// }).toList(),
// ),
// )
// else
// Text(AppLocalizations.of(context).noAccountsFound),
// ],
// ),
// ),
// ),
// const SizedBox(height: 20),
// Row(
// children: [
// Expanded(
// child: Card(
// color: Theme.of(context).colorScheme.primaryContainer,
// elevation: 4,
// child: InkWell(
// onTap: () {
// if (_selectedAccount != null &&
// _stCheques.isNotEmpty) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// RevokeStopSingleChequeScreen(
// selectedAccount: _selectedAccount!,
// date: _stCheques.first.Date!,
// instrType: _stCheques.first.InstrType!,
// fromCheque: _stCheques.first.fromCheque!,
// toCheque: _stCheques.first.toCheque!,
// ),
// ),
// );
// } else {
// ScaffoldMessenger.of(context).showSnackBar(
// const SnackBar(
// content: Text("No stopped cheques present"),
// ),
// );
// }
// },
// child: Padding(
// padding: const EdgeInsets.all(16.0),
// child: Center(
// child: Text(
// AppLocalizations.of(context).revokeSingleStopTitle,
// textAlign: TextAlign.center,
// style: TextStyle(
// fontSize: 16,
// fontWeight: FontWeight.bold,
// color: Theme.of(context)
// .colorScheme
// .onPrimaryContainer,
// ),
// ),
// ),
// ),
// ),
// ),
// ),
// const SizedBox(width: 10),
// Expanded(
// child: Card(
// color: Theme.of(context).colorScheme.primaryContainer,
// elevation: 4,
// child: InkWell(
// onTap: () {
// if (_selectedAccount != null &&
// _stCheques.isNotEmpty) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// RevokeStopMultipleChequesScreen(
// selectedAccount: _selectedAccount!,
// date: _stCheques.first.Date!,
// instrType: _stCheques.first.InstrType!,
// fromCheque: _stCheques.first.fromCheque!,
// toCheque: _stCheques.first.toCheque!,
// ),
// ),
// );
// } else {
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(AppLocalizations.of(context)
// .pleaseSelectAccountFirst),
// ),
// );
// }
// },
// child: Padding(
// padding: const EdgeInsets.all(16.0),
// child: Center(
// child: Text(
// AppLocalizations.of(context).revokeMultipleStops,
// textAlign: TextAlign.center,
// style: TextStyle(
// fontSize: 16,
// fontWeight: FontWeight.bold,
// color: Theme.of(context)
// .colorScheme
// .onSecondaryContainer,
// ),
// ),
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// const SizedBox(height: 20),
// Expanded(
// child: _isLoading
// ? const Center(child: CircularProgressIndicator())
// : _stCheques.isEmpty
// ? Center(
// child: Text(AppLocalizations.of(context)
// .noChequeIssuedStatus))
// : ListView.builder(
// itemCount: _stCheques.length,
// itemBuilder: (context, index) {
// return _buildSTTile(context, _stCheques[index]);
// },
// ),
// ),
// ]),
// ),
// IgnorePointer(
// child: Center(
// child: Opacity(
// opacity: 0.07, // Reduced opacity
// child: ClipOval(
// child: Image.asset(
// 'assets/images/logo.png',
// width: 200, // Adjust size as needed
// height: 200, // Adjust size as needed
// ),
// ),
// ),
// ),
// ),
// ],
// ),
// );
// }
// Widget _buildSTTile(BuildContext context, Cheque cheque) {
// return Card(
// margin: const EdgeInsets.symmetric(
// vertical: 8.0,
// ),
// child: Padding(
// padding: const EdgeInsets.all(16.0),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(AppLocalizations.of(context).stopChequeLabel,
// style: Theme.of(context).textTheme.titleLarge),
// const SizedBox(height: 8),
// _buildInfoRow('From Cheque:', cheque.fromCheque),
// _buildInfoRow('To Cheque:', cheque.toCheque),
// _buildInfoRow('Account Type:',
// _getAccountTypeDisplayName(_selectedAccount!.accountType!)),
// _buildInfoRow('Branch Code:', cheque.branchCode),
// _buildInfoRow('Stop Issue Date:', cheque.stopIssueDate),
// _buildInfoRow('Stop Expiry Date:', cheque.StopExpiryDate),
// _buildInfoRow('Cheques Count:', cheque.Chequescount),
// ],
// ),
// ),
// );
// }
// Widget _buildInfoRow(String label, String? value) {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 4.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
// Text(value ?? ''),
// ],
// ),
// );
// }
// }