APY integrated without testing...

This commit is contained in:
2026-03-18 12:36:41 +05:30
parent 075cb3aaad
commit 8744e69ef7
29 changed files with 1069 additions and 498 deletions

View File

@@ -93,7 +93,8 @@ class _ChequeManagementScreen extends State<ChequeManagementScreen> {
),
Expanded(
child: ChequeManagementCardTile(
icon: Symbols.check_circle, // Using check_circle for Positive Pay
icon: Symbols
.check_circle, // Using check_circle for Positive Pay
label: AppLocalizations.of(context).positivePayTitle,
onTap: () {
Navigator.push(
@@ -191,4 +192,4 @@ class ChequeManagementCardTile extends StatelessWidget {
),
);
}
}
}

View File

@@ -36,7 +36,7 @@ class _PositivePayScreenState extends State<PositivePayScreen> {
@override
void initState() {
super.initState();
_filteredUsers = widget.users
_filteredUsers = widget.users
.where((user) => ['SA', 'SB', 'CA', 'CC'].contains(user.accountType))
.toList();
// Pre-fill the account number if possible
@@ -113,7 +113,7 @@ class _PositivePayScreenState extends State<PositivePayScreen> {
super.dispose();
}
Future<void> _showResponseDialog(String title, String message) async {
Future<void> _showResponseDialog(String title, String message) async {
return showDialog<void>(
context: context,
barrierDismissible: false, // user must tap button!
@@ -145,7 +145,8 @@ Future<void> _showResponseDialog(String title, String message) async {
return Scaffold(
appBar: AppBar(
title: Text(
AppLocalizations.of(context).positivePay, // Will be replaced by localization
AppLocalizations.of(context)
.positivePay, // Will be replaced by localization
),
centerTitle: false,
),
@@ -199,12 +200,13 @@ Future<void> _showResponseDialog(String title, String message) async {
final fromCheque = int.tryParse(_ciFromCheque ?? '');
final toCheque = int.tryParse(_ciToCheque ?? '');
if (chequeNumber == null) {
return AppLocalizations.of(context).invalidChequeNumberFormatError;
return AppLocalizations.of(context)
.invalidChequeNumberFormatError;
}
if (fromCheque != null && toCheque != null) {
if (chequeNumber < fromCheque || chequeNumber > toCheque) {
return AppLocalizations.of(context).chequeNumberRangeError(
_ciFromCheque!, _ciToCheque!);
return AppLocalizations.of(context)
.chequeNumberRangeError(_ciFromCheque!, _ciToCheque!);
}
}
return null;
@@ -228,13 +230,15 @@ Future<void> _showResponseDialog(String title, String message) async {
);
if (pickedDate != null) {
// Format the date as you wish
String formattedDate = "${pickedDate.year}-${pickedDate.month.toString().padLeft(2, '0')}-${pickedDate.day.toString().padLeft(2, '0')}";
String formattedDate =
"${pickedDate.year}-${pickedDate.month.toString().padLeft(2, '0')}-${pickedDate.day.toString().padLeft(2, '0')}";
_chequeDateController.text = formattedDate;
}
},
validator: (value) {
validator: (value) {
if (value == null || value.isEmpty) {
return AppLocalizations.of(context).pleaseSelectChequeIssuedDate;
return AppLocalizations.of(context)
.pleaseSelectChequeIssuedDate;
}
return null;
},
@@ -255,7 +259,8 @@ Future<void> _showResponseDialog(String title, String message) async {
border: const OutlineInputBorder(),
prefixText: '',
),
keyboardType: const TextInputType.numberWithOptions(decimal: true),
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
validator: (value) {
if (value == null || value.isEmpty) {
return AppLocalizations.of(context).pleaseEnterAmount;
@@ -277,34 +282,34 @@ Future<void> _showResponseDialog(String title, String message) async {
try {
final response = await _chequeService.registerPPS(
cheque_no: _chequeNumberController.text,
account_number:
_selectedAccount!.accountNo!,
issue_date:
_chequeDateController.text,
account_number: _selectedAccount!.accountNo!,
issue_date: _chequeDateController.text,
amount: _amountController.text,
payee_name: _payeeController.text,
tpin: pin,
);
if (!mounted) return;
String responseString = response.toString();
if(responseString == 'PPS Registered Successfully'){
if (responseString ==
'PPS Registered Successfully') {
_showResponseDialog('REGISTRATION SUCCESFUL',
'Your Positive Pay Request has been registered succesfully');
'Your Positive Pay Request has been registered succesfully');
}
if(responseString.contains('Cheque already registered')){
if (responseString
.contains('Cheque already registered')) {
_showResponseDialog('ERROR',
'Your Request for the selected cheque number has already been registered');
'Your Request for the selected cheque number has already been registered');
}
if(responseString.contains('INCORRECT_TPIN')){
if (responseString.contains('INCORRECT_TPIN')) {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');
'The TPIN you entered is incorrect. Please try again.');
}
} on DioException catch (e) {
try {
final errorBodyString =
e.toString().split('Exception: ')[1];
final errorBody = jsonDecode(errorBodyString);
if (errorBody.containsKey('error') &&
final errorBody = jsonDecode(errorBodyString);
if (errorBody.containsKey('error') &&
errorBody['error'] == 'INCORRECT_TPIN') {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');

View File

@@ -27,7 +27,8 @@ class RevokeStopMultipleChequesScreen extends StatefulWidget {
_RevokeStopMultipleChequesScreenState();
}
class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleChequesScreen> {
class _RevokeStopMultipleChequesScreenState
extends State<RevokeStopMultipleChequesScreen> {
final _formKey = GlobalKey<FormState>();
final _stopFromChequeNoController = TextEditingController();
final _stopToChequeNoController = TextEditingController();
@@ -275,7 +276,8 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
removeToChequeNo:
_stopToChequeNoController.text,
removeIssueDate: _stopIssueDateController.text,
removeExpiryDate: _stopExpiryDateController.text,
removeExpiryDate:
_stopExpiryDateController.text,
removeAmount: _stopAmountController.text,
removeComment: _selectedComment == 'Other'
? _otherCommentController.text
@@ -284,24 +286,28 @@ class _RevokeStopMultipleChequesScreenState extends State<RevokeStopMultipleCheq
);
if (!mounted) return;
final decodedResponse = jsonDecode(response);
String responseString = response.toString(); // used as the case only for incorrect TPIN
String responseString = response
.toString(); // used as the case only for incorrect TPIN
final status = decodedResponse['status'];
final message = decodedResponse['message'];
final code = decodedResponse['code'];
if (status == 'SUCCESS') {
_showResponseDialog('Success', message);
} if (status == 'ERROR') {
}
if (status == 'ERROR') {
String errMessage = "error";
if(code == '0172') {
errMessage = 'The selected Cheque is not stopped';
} else if(code == '0748') {
errMessage = 'The selected Cheque is already presented';
if (code == '0172') {
errMessage =
'The selected Cheque is not stopped';
} else if (code == '0748') {
errMessage =
'The selected Cheque is already presented';
}
_showResponseDialog('Error', errMessage);
}
if(responseString.contains('INCORRECT_TPIN')){
if (responseString.contains('INCORRECT_TPIN')) {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');
'The TPIN you entered is incorrect. Please try again.');
}
} on Exception catch (e) {
try {

View File

@@ -10,12 +10,11 @@ class RevokeStopChequeScreen extends StatefulWidget {
final List<User> users;
final int selectedIndex;
const RevokeStopChequeScreen(
{
super.key,
required this.users,
required this.selectedIndex,
});
const RevokeStopChequeScreen({
super.key,
required this.users,
required this.selectedIndex,
});
@override
State<RevokeStopChequeScreen> createState() => _RevokeStopChequeScreenState();
@@ -199,8 +198,10 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
selectedAccount: _selectedAccount!,
date: _stCheques.first.Date!,
instrType: _stCheques.first.InstrType!,
fromCheque: _ciFromCheque ?? _stCheques.first.fromCheque!,
toCheque: _ciToCheque ?? _stCheques.first.toCheque!,
fromCheque: _ciFromCheque ??
_stCheques.first.fromCheque!,
toCheque:
_ciToCheque ?? _stCheques.first.toCheque!,
),
),
);
@@ -216,7 +217,8 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
padding: const EdgeInsets.all(16.0),
child: Center(
child: Text(
AppLocalizations.of(context).revokeSingleStopTitle,
AppLocalizations.of(context)
.revokeSingleStopTitle,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
@@ -248,8 +250,10 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
selectedAccount: _selectedAccount!,
date: _stCheques.first.Date!,
instrType: _stCheques.first.InstrType!,
fromCheque: _ciFromCheque ?? _stCheques.first.fromCheque!,
toCheque: _ciToCheque ?? _stCheques.first.toCheque!,
fromCheque: _ciFromCheque ??
_stCheques.first.fromCheque!,
toCheque:
_ciToCheque ?? _stCheques.first.toCheque!,
),
),
);
@@ -266,7 +270,7 @@ class _RevokeStopChequeScreenState extends State<RevokeStopChequeScreen> {
padding: const EdgeInsets.all(16.0),
child: Center(
child: Text(
AppLocalizations.of(context).revokeMultipleStops,
AppLocalizations.of(context).revokeMultipleStops,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,

View File

@@ -23,10 +23,12 @@ class RevokeStopSingleChequeScreen extends StatefulWidget {
required this.toCheque});
@override
State<RevokeStopSingleChequeScreen> createState() => _RevokeStopSingleChequeScreenState();
State<RevokeStopSingleChequeScreen> createState() =>
_RevokeStopSingleChequeScreenState();
}
class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScreen> {
class _RevokeStopSingleChequeScreenState
extends State<RevokeStopSingleChequeScreen> {
final _formKey = GlobalKey<FormState>();
final _stopFromChequeNoController = TextEditingController();
final _stopIssueDateController = TextEditingController();
@@ -89,7 +91,7 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).revokeSingleStopTitle)),
title: Text(AppLocalizations.of(context).revokeSingleStopTitle)),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Form(
@@ -241,7 +243,8 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
removeToChequeNo:
_stopFromChequeNoController.text,
removeIssueDate: _stopIssueDateController.text,
removeExpiryDate: _stopExpiryDateController.text,
removeExpiryDate:
_stopExpiryDateController.text,
removeAmount: _stopAmountController.text,
removeComment: _selectedComment == 'Other'
? _otherCommentController.text
@@ -250,31 +253,35 @@ class _RevokeStopSingleChequeScreenState extends State<RevokeStopSingleChequeScr
);
if (!mounted) return;
final decodedResponse = jsonDecode(response);
String responseString = response.toString(); // used as the case only for incorrect TPIN
String responseString = response
.toString(); // used as the case only for incorrect TPIN
final status = decodedResponse['status'];
final message = decodedResponse['message'];
final code = decodedResponse['code'];
if (status == 'SUCCESS') {
_showResponseDialog('Success', message);
} if (status == 'ERROR') {
}
if (status == 'ERROR') {
String errMessage = "error";
if(code == '0172') {
errMessage = 'The selected Cheque is not stopped';
} else if(code == '0748') {
errMessage = 'The selected Cheque is already presented';
if (code == '0172') {
errMessage =
'The selected Cheque is not stopped';
} else if (code == '0748') {
errMessage =
'The selected Cheque is already presented';
}
_showResponseDialog('Error', errMessage);
}
if(responseString.contains('INCORRECT_TPIN')){
if (responseString.contains('INCORRECT_TPIN')) {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');
'The TPIN you entered is incorrect. Please try again.');
}
} on DioException catch (e) {
try {
final errorBodyString =
e.toString().split('Exception: ')[1];
final errorBody = jsonDecode(errorBodyString);
if (errorBody.containsKey('error') &&
final errorBody = jsonDecode(errorBodyString);
if (errorBody.containsKey('error') &&
errorBody['error'] == 'INCORRECT_TPIN') {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');

View File

@@ -309,24 +309,28 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
);
if (!mounted) return;
final decodedResponse = jsonDecode(response);
String responseString = response.toString(); // used as the case only for incorrect TPIN
String responseString = response
.toString(); // used as the case only for incorrect TPIN
final status = decodedResponse['status'];
final message = decodedResponse['message'];
final code = decodedResponse['code'];
if (status == 'SUCCESS') {
_showResponseDialog('Success', message);
} if (status == 'ERROR') {
}
if (status == 'ERROR') {
String errMessage = "error";
if(code == '0429') {
errMessage = 'The selected Cheque is already stopped';
} else if(code == '0748') {
errMessage = 'The selected Cheque is already presented';
if (code == '0429') {
errMessage =
'The selected Cheque is already stopped';
} else if (code == '0748') {
errMessage =
'The selected Cheque is already presented';
}
_showResponseDialog('Error', errMessage);
}
if(responseString.contains('INCORRECT_TPIN')){
if (responseString.contains('INCORRECT_TPIN')) {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');
'The TPIN you entered is incorrect. Please try again.');
}
} on Exception catch (e) {
try {

View File

@@ -278,31 +278,35 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
);
if (!mounted) return;
final decodedResponse = jsonDecode(response);
String responseString = response.toString(); // used as the case only for incorrect TPIN
String responseString = response
.toString(); // used as the case only for incorrect TPIN
final status = decodedResponse['status'];
final message = decodedResponse['message'];
final code = decodedResponse['code'];
if (status == 'SUCCESS') {
_showResponseDialog('Success', message);
} if (status == 'ERROR') {
}
if (status == 'ERROR') {
String errMessage = "error";
if(code == '0429') {
errMessage = 'The selected Cheque is already stopped';
} else if(code == '0748') {
errMessage = 'The selected Cheque is already presented';
if (code == '0429') {
errMessage =
'The selected Cheque is already stopped';
} else if (code == '0748') {
errMessage =
'The selected Cheque is already presented';
}
_showResponseDialog('Error', errMessage);
}
if(responseString.contains('INCORRECT_TPIN')){
if (responseString.contains('INCORRECT_TPIN')) {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');
'The TPIN you entered is incorrect. Please try again.');
}
} on DioException catch (e) {
try {
final errorBodyString =
e.toString().split('Exception: ')[1];
final errorBody = jsonDecode(errorBodyString);
if (errorBody.containsKey('error') &&
final errorBody = jsonDecode(errorBodyString);
if (errorBody.containsKey('error') &&
errorBody['error'] == 'INCORRECT_TPIN') {
_showResponseDialog('Invalid TPIN',
'The TPIN you entered is incorrect. Please try again.');