Test APK with Sim Binding and Cheque
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class Cheque {
|
||||
@@ -130,9 +128,6 @@ class ChequeService {
|
||||
'tpin': tpin,
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception(jsonEncode(response.data));
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,19 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
final _stopIssueDateController = TextEditingController();
|
||||
final _stopExpiryDateController = TextEditingController();
|
||||
final _stopAmountController = TextEditingController();
|
||||
final _stopCommentController = TextEditingController();
|
||||
final _chequeService = getIt<ChequeService>();
|
||||
|
||||
String? _selectedComment;
|
||||
final _otherCommentController = TextEditingController();
|
||||
bool _showOtherCommentField = false;
|
||||
final List<String> _commentOptions = [
|
||||
'Cheque Lost',
|
||||
'Cheque Stolen',
|
||||
'Cheque Missing',
|
||||
'Cheque Damaged',
|
||||
'Other'
|
||||
];
|
||||
|
||||
String _formatDate(String dateString) {
|
||||
if (dateString.length != 8) {
|
||||
return dateString; // Return as is if not in expected ddmmyyyy format
|
||||
@@ -51,6 +61,21 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _selectDate(TextEditingController controller) async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime.now(),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
controller.text =
|
||||
'${picked.day.toString().padLeft(2, '0')}/${picked.month.toString().padLeft(2, '0')}/${picked.year}';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showResponseDialog(String title, String message) async {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
@@ -110,6 +135,7 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).fromChequeNumberHint,
|
||||
border: const OutlineInputBorder(),
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
@@ -139,6 +165,7 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).toChequeNumberHint,
|
||||
border: const OutlineInputBorder(),
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
@@ -174,18 +201,30 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _stopIssueDateController,
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopIssueDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopIssueDateHint,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
onPressed: () => _selectDate(_stopIssueDateController),
|
||||
),
|
||||
),
|
||||
keyboardType: TextInputType.datetime,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _stopExpiryDateController,
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopExpiryDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopExpiryDateHint,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
onPressed: () => _selectDate(_stopExpiryDateController),
|
||||
),
|
||||
),
|
||||
keyboardType: TextInputType.datetime,
|
||||
),
|
||||
@@ -199,13 +238,39 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _stopCommentController,
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedComment,
|
||||
items: _commentOptions.map((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_selectedComment = newValue;
|
||||
_showOtherCommentField = newValue == 'Other';
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopCommentHint,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
if (_showOtherCommentField)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0),
|
||||
child: TextFormField(
|
||||
controller: _otherCommentController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Other Reasons :",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
validator: (value) {
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
initialValue: _formatDate(widget.date),
|
||||
@@ -236,7 +301,9 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
stopIssueDate: _stopIssueDateController.text,
|
||||
stopExpiryDate: _stopExpiryDateController.text,
|
||||
stopAmount: _stopAmountController.text,
|
||||
stopComment: _stopCommentController.text,
|
||||
stopComment: _selectedComment == 'Other'
|
||||
? _otherCommentController.text
|
||||
: _selectedComment ?? '',
|
||||
chequeIssueDate: widget.date,
|
||||
tpin: pin,
|
||||
);
|
||||
@@ -244,15 +311,19 @@ class _StopMultipleChequesScreenState extends State<StopMultipleChequesScreen> {
|
||||
final decodedResponse = jsonDecode(response);
|
||||
final status = decodedResponse['status'];
|
||||
final message = decodedResponse['message'];
|
||||
final code = decodedResponse['code'];
|
||||
if (status == 'SUCCESS') {
|
||||
_showResponseDialog('Success', message);
|
||||
} else {
|
||||
_showResponseDialog('Error', message);
|
||||
} 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';
|
||||
}
|
||||
_showResponseDialog('Error', errMessage);
|
||||
}
|
||||
} on Exception catch (e) {
|
||||
print('inside catch block');
|
||||
print(e.toString());
|
||||
|
||||
try {
|
||||
final errorBodyString =
|
||||
e.toString().split('Exception: ')[1];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:kmobile/data/models/user.dart';
|
||||
import 'package:kmobile/di/injection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -31,9 +32,19 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
|
||||
final _stopIssueDateController = TextEditingController();
|
||||
final _stopExpiryDateController = TextEditingController();
|
||||
final _stopAmountController = TextEditingController();
|
||||
final _stopCommentController = TextEditingController();
|
||||
final _chequeService = getIt<ChequeService>();
|
||||
|
||||
String? _selectedComment;
|
||||
final _otherCommentController = TextEditingController();
|
||||
bool _showOtherCommentField = false;
|
||||
final List<String> _commentOptions = [
|
||||
'Cheque Lost',
|
||||
'Cheque Stolen',
|
||||
'Cheque Missing',
|
||||
'Cheque Damaged',
|
||||
'Other'
|
||||
];
|
||||
|
||||
String _formatDate(String dateString) {
|
||||
if (dateString.length != 8) {
|
||||
return dateString; // Return as is if not in expected ddmmyyyy format
|
||||
@@ -48,6 +59,21 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _selectDate(TextEditingController controller) async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime.now(),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
controller.text =
|
||||
'${picked.day.toString().padLeft(2, '0')}/${picked.month.toString().padLeft(2, '0')}/${picked.year}';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _showResponseDialog(String title, String message) async {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
@@ -107,6 +133,7 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).chequeNumberLabel,
|
||||
border: OutlineInputBorder(),
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
validator: (value) {
|
||||
@@ -142,18 +169,30 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _stopIssueDateController,
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopIssueDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopIssueDateLabel,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
onPressed: () => _selectDate(_stopIssueDateController),
|
||||
),
|
||||
),
|
||||
keyboardType: TextInputType.datetime,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _stopExpiryDateController,
|
||||
readOnly: true,
|
||||
onTap: () => _selectDate(_stopExpiryDateController),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopExpiryDateLabel,
|
||||
border: const OutlineInputBorder(),
|
||||
suffixIcon: IconButton(
|
||||
icon: const Icon(Icons.calendar_today),
|
||||
onPressed: () => _selectDate(_stopExpiryDateController),
|
||||
),
|
||||
),
|
||||
keyboardType: TextInputType.datetime,
|
||||
),
|
||||
@@ -167,13 +206,39 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
controller: _stopCommentController,
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedComment,
|
||||
items: _commentOptions.map((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_selectedComment = newValue;
|
||||
_showOtherCommentField = newValue == 'Other';
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).stopCommentHint,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
if (_showOtherCommentField)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16.0),
|
||||
child: TextFormField(
|
||||
controller: _otherCommentController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Other Reasons :",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
validator: (value) {
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
initialValue: _formatDate(widget.date),
|
||||
@@ -205,23 +270,30 @@ class _StopSingleChequeScreenState extends State<StopSingleChequeScreen> {
|
||||
stopIssueDate: _stopIssueDateController.text,
|
||||
stopExpiryDate: _stopExpiryDateController.text,
|
||||
stopAmount: _stopAmountController.text,
|
||||
stopComment: _stopCommentController.text,
|
||||
stopComment: _selectedComment == 'Other'
|
||||
? _otherCommentController.text
|
||||
: _selectedComment ?? '',
|
||||
chequeIssueDate: widget.date,
|
||||
tpin: pin,
|
||||
);
|
||||
if (!mounted) return;
|
||||
final decodedResponse = jsonDecode(response);
|
||||
|
||||
final status = decodedResponse['status'];
|
||||
final message = decodedResponse['message'];
|
||||
final code = decodedResponse['code'];
|
||||
if (status == 'SUCCESS') {
|
||||
_showResponseDialog('Success', message);
|
||||
} else {
|
||||
_showResponseDialog('Error', message);
|
||||
} 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';
|
||||
}
|
||||
_showResponseDialog('Error', errMessage);
|
||||
}
|
||||
} on Exception catch (e) {
|
||||
print('inside catch block');
|
||||
print(e.toString());
|
||||
|
||||
} on DioException catch (e) {
|
||||
try {
|
||||
final errorBodyString =
|
||||
e.toString().split('Exception: ')[1];
|
||||
|
||||
@@ -15,13 +15,13 @@ void main() async {
|
||||
]);
|
||||
|
||||
// Check for device compromise
|
||||
// final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||
// if (compromisedMessage != null) {
|
||||
// runApp(MaterialApp(
|
||||
// home: SecurityErrorScreen(message: compromisedMessage),
|
||||
// ));
|
||||
// return;
|
||||
// }
|
||||
final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||
if (compromisedMessage != null) {
|
||||
runApp(MaterialApp(
|
||||
home: SecurityErrorScreen(message: compromisedMessage),
|
||||
));
|
||||
return;
|
||||
}
|
||||
await setupDependencies();
|
||||
runApp(const KMobile());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user