NEFT and RTGS transaction error resolved
This commit is contained in:
@@ -107,35 +107,50 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
);
|
||||
completer.complete(paymentResponse);
|
||||
} on DioException catch (e) {
|
||||
print('dio exception');
|
||||
print(e.toString());
|
||||
|
||||
final error = jsonDecode(e.response.toString())['error'];
|
||||
var errorMessage = {
|
||||
"INCORRECT_TPIN":
|
||||
AppLocalizations.of(context).correctTpin,
|
||||
"INSUFFICIENT_FUNDS":
|
||||
AppLocalizations.of(context).insufficientFund
|
||||
}[error] ??
|
||||
AppLocalizations.of(context).somethingWentWrong;
|
||||
|
||||
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";
|
||||
}
|
||||
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(context).somethingWentWrong,
|
||||
errorMessage: AppLocalizations.of(pinScreenContext)
|
||||
.somethingWentWrong,
|
||||
);
|
||||
completer.complete(paymentResponse);
|
||||
print(
|
||||
"NEFT transaction failed with generic exception."); // Add
|
||||
}
|
||||
}
|
||||
|
||||
//IMPS transaction
|
||||
else if (_selectedMode == TransactionMode.imps) {
|
||||
final impsTx = ImpsTransaction(
|
||||
@@ -195,7 +210,9 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
);
|
||||
completer.complete(paymentResponse);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
//RTGS
|
||||
else {
|
||||
final rtgsTx = RtgsTransaction(
|
||||
fromAccount: widget.debitAccountNo,
|
||||
toAccount: widget.creditBeneficiary.accountNo,
|
||||
@@ -233,13 +250,12 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
|
||||
final error = jsonDecode(e.response.toString())['error'];
|
||||
var errorMessage = {
|
||||
"INCORRECT_TPIN":
|
||||
AppLocalizations.of(context).correctTpin,
|
||||
"INCORRECT_TPIN": "Please Enter the correct TPIN",
|
||||
"INSUFFICIENT_FUNDS":
|
||||
AppLocalizations.of(context).insufficientFund
|
||||
"Your account does not have sufficient balance"
|
||||
// ignore: use_build_context_synchronously
|
||||
}[error] ??
|
||||
AppLocalizations.of(context).somethingWentWrong;
|
||||
"Something Went Wrong";
|
||||
|
||||
final paymentResponse = PaymentResponse(
|
||||
isSuccess: false,
|
||||
@@ -251,8 +267,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
|
||||
print(e.toString());
|
||||
final paymentResponse = PaymentResponse(
|
||||
isSuccess: false,
|
||||
errorMessage:
|
||||
AppLocalizations.of(context).somethingWentWrong,
|
||||
errorMessage: "Something Went Wrong",
|
||||
);
|
||||
completer.complete(paymentResponse);
|
||||
}
|
||||
|
Reference in New Issue
Block a user