Localization Changes #3
This commit is contained in:
@@ -4,7 +4,6 @@ import '../../features/auth/models/auth_token.dart';
|
||||
import '../../features/auth/models/auth_credentials.dart';
|
||||
import '../../core/errors/exceptions.dart';
|
||||
|
||||
|
||||
class AuthService {
|
||||
final Dio _dio;
|
||||
AuthService(this._dio);
|
||||
@@ -15,7 +14,7 @@ class AuthService {
|
||||
'/api/auth/login',
|
||||
data: credentials.toJson(),
|
||||
);
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return AuthToken.fromJson(response.data);
|
||||
} else {
|
||||
@@ -30,7 +29,8 @@ class AuthService {
|
||||
}
|
||||
throw NetworkException('Network error during login');
|
||||
} catch (e) {
|
||||
throw UnexpectedException('Unexpected error during login: ${e.toString()}');
|
||||
throw UnexpectedException(
|
||||
'Unexpected error during login: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class AuthService {
|
||||
'/auth/refresh',
|
||||
data: {'refresh_token': refreshToken},
|
||||
);
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return AuthToken.fromJson(response.data);
|
||||
} else {
|
||||
@@ -54,7 +54,7 @@ class AuthService {
|
||||
Future<bool> checkTpin() async {
|
||||
try {
|
||||
final response = await _dio.get('/api/auth/tpin');
|
||||
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return response.data['tpinSet'] as bool;
|
||||
} else {
|
||||
@@ -66,7 +66,8 @@ class AuthService {
|
||||
}
|
||||
throw NetworkException('Network error during TPIN check');
|
||||
} catch (e) {
|
||||
throw UnexpectedException('Unexpected error during TPIN check: ${e.toString()}');
|
||||
throw UnexpectedException(
|
||||
'Unexpected error during TPIN check: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ class AuthService {
|
||||
'/api/auth/tpin',
|
||||
data: {'tpin': tpin},
|
||||
);
|
||||
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
throw AuthException('Failed to set TPIN');
|
||||
}
|
||||
@@ -86,8 +87,8 @@ class AuthService {
|
||||
}
|
||||
throw NetworkException('Network error during TPIN setup');
|
||||
} catch (e) {
|
||||
throw UnexpectedException('Unexpected error during TPIN setup: ${e.toString()}');
|
||||
throw UnexpectedException(
|
||||
'Unexpected error during TPIN setup: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -22,8 +22,8 @@ class ImpsService {
|
||||
throw Exception(
|
||||
'RTGS transaction failed with status code: ${response.statusCode}');
|
||||
}
|
||||
} on DioException {
|
||||
rethrow ;
|
||||
} on DioException {
|
||||
rethrow;
|
||||
} catch (e) {
|
||||
throw Exception('An unexpected error occurred: ${e.toString()}');
|
||||
}
|
||||
|
@@ -7,7 +7,8 @@ class NeftService {
|
||||
|
||||
NeftService(this._dio);
|
||||
|
||||
Future<NeftResponse> processNeftTransaction(NeftTransaction transaction) async {
|
||||
Future<NeftResponse> processNeftTransaction(
|
||||
NeftTransaction transaction) async {
|
||||
try {
|
||||
await Future.delayed(const Duration(seconds: 3));
|
||||
final response = await _dio.post(
|
||||
|
@@ -10,7 +10,7 @@ class PaymentService {
|
||||
Future<PaymentResponse> processQuickPayWithinBank(Transfer transfer) async {
|
||||
try {
|
||||
await Future.delayed(const Duration(seconds: 3)); // Simulate delay
|
||||
|
||||
|
||||
await _dio.post('/api/payment/transfer', data: transfer.toJson());
|
||||
|
||||
return PaymentResponse(
|
||||
|
@@ -22,8 +22,8 @@ class RtgsService {
|
||||
throw Exception(
|
||||
'RTGS transaction failed with status code: ${response.statusCode}');
|
||||
}
|
||||
} on DioException {
|
||||
rethrow ;
|
||||
} on DioException {
|
||||
rethrow;
|
||||
} catch (e) {
|
||||
throw Exception('An unexpected error occurred: ${e.toString()}');
|
||||
}
|
||||
|
@@ -28,4 +28,4 @@ class UserService {
|
||||
throw Exception('Unexpected error: ${e.toString()}');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user