Beneficiary Localization Chamges

This commit is contained in:
2025-08-14 16:15:35 +05:30
parent f48bfabb4a
commit e2a809d363
12 changed files with 324 additions and 39 deletions

View File

@@ -1,8 +1,6 @@
// ignore_for_file: avoid_print
import 'dart:async';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:kmobile/api/services/neft_service.dart';
@@ -70,13 +68,13 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: const Text('Invalid Amount for RTGS'),
content: const Text(
'RTGS transactions require a minimum amount of 200,000. Please enter a higher amount or select NEFT as the transaction mode.'),
title: Text(AppLocalizations.of(context).invalidRtgs),
content: Text(
AppLocalizations.of(context).invalidRtgsPopUp),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
child: const Text('OK'),
child: Text(AppLocalizations.of(context).ok),
),
],
),
@@ -129,9 +127,9 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
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";
"INCORRECT_TPIN" : AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS": AppLocalizations.of(context).insufficientFund
}[error] ?? AppLocalizations.of(context).somethingWentWrong;
final paymentResponse = PaymentResponse(
isSuccess: false,
@@ -143,11 +141,70 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
print(e.toString());
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: "Something went Wrong",
errorMessage: AppLocalizations.of(context).somethingWentWrong,
);
completer.complete(paymentResponse);
}
} else {
}
// else if (_selectedMode == TransactionMode.imps){
// final rtgsTx = RtgsTransaction(
// fromAccount: widget.debitAccountNo,
// toAccount: widget.creditBeneficiary.accountNo,
// amount: _amountController.text,
// ifscCode: widget.creditBeneficiary.ifscCode,
// remitterName: widget.remitterName,
// beneficiaryName: widget.creditBeneficiary.name,
// tpin: tpin,
// );
// final rtgsService = getIt<RtgsService>();
// final completer = Completer<PaymentResponse>();
// Navigator.of(pinScreenContext).pushReplacement(
// MaterialPageRoute(
// builder: (_) => PaymentAnimationScreen(
// paymentResponse: completer.future),
// ),
// );
// try {
// final rtgsResponse =
// await rtgsService.processRtgsTransaction(rtgsTx);
// final paymentResponse = PaymentResponse(
// isSuccess: rtgsResponse.message.toUpperCase() == 'SUCCESS',
// date: DateTime.now(),
// creditedAccount: rtgsTx.toAccount,
// amount: rtgsTx.amount,
// currency: 'INR',
// 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: "Something went Wrong",
// );
// completer.complete(paymentResponse);
// }
// }
else {
final rtgsTx = RtgsTransaction(
fromAccount: widget.debitAccountNo,
toAccount: widget.creditBeneficiary.accountNo,
@@ -186,9 +243,10 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
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";
"INCORRECT_TPIN" : AppLocalizations.of(context).correctTpin,
"INSUFFICIENT_FUNDS": AppLocalizations.of(context).insufficientFund
// ignore: use_build_context_synchronously
}[error] ?? AppLocalizations.of(context).somethingWentWrong;
final paymentResponse = PaymentResponse(
isSuccess: false,
@@ -200,7 +258,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
print(e.toString());
final paymentResponse = PaymentResponse(
isSuccess: false,
errorMessage: "Something went Wrong",
errorMessage: AppLocalizations.of(context).somethingWentWrong,
);
completer.complete(paymentResponse);
}
@@ -248,7 +306,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
// Credit Account (Beneficiary)
Text(
"Credit To",
AppLocalizations.of(context).creditedTo,
style: Theme.of(context).textTheme.titleSmall,
),
Card(
@@ -264,7 +322,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
// Transaction Mode Selection
Text(
"Select Transaction Mode",
AppLocalizations.of(context).selectTransactionType,
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 12),
@@ -292,15 +350,19 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
selectedBorderColor: Colors.transparent,
splashColor: Theme.of(context).primaryColor.withOpacity(0.1),
highlightColor: Theme.of(context).primaryColor.withOpacity(0.05),
children: const [
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
child: Text('NEFT'),
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
child: Text(AppLocalizations.of(context).neft),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
child: Text('RTGS'),
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
child: Text(AppLocalizations.of(context).rtgs),
),
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
// child: Text(AppLocalizations.of(context).imps),
// ),
],
),
),
@@ -336,7 +398,7 @@ class _FundTransferAmountScreenState extends State<FundTransferAmountScreen> {
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
child: const Text("Proceed"),
child: Text(AppLocalizations.of(context).proceed),
),
),
],