Test Sim Binding APK

This commit is contained in:
2025-12-11 12:18:25 +05:30
parent 8149ef2a5b
commit 715162b713
5 changed files with 159 additions and 185 deletions

View File

@@ -8,73 +8,40 @@ class AuthService {
final Dio _dio;
AuthService(this._dio);
Future <void> simVerify(String uuid, String cifNo) async{
Future<void> simVerify(String uuid, String cifNo) async {
try {
final response = await _dio.post('/api/sim-details-verify', data: {
'uuid': uuid,
'cifNo': cifNo,
});
try{
final response = await _dio.post(
'/api/sim-details-verify',
data: {
'uuid': uuid,
'cifNo': cifNo,
}
);
if (response.statusCode == 200) {
final String message = response.data.toString().toUpperCase();
if (message.contains("VERIFIED")) {
return; // Success
} else {
throw AuthException(message); // Throw message received
}
if (response.statusCode == 200) {
final String message = response.data.toString().toUpperCase();
if (message.contains("VERIFIED")) {
return; // Success
} else {
throw AuthException('Verification Failed');
throw AuthException(message); // Throw message received
}
} on DioException catch (e) {
if (kDebugMode) {
print(e.toString());
}
if (e.response?.statusCode == 401) {
throw AuthException(
e.response?.data['error'] ?? 'SOMETHING WENT WRONG');
}
throw NetworkException('Network error during verification');
} else {
throw AuthException('Verification Failed');
}
} on DioException catch (e) {
if (kDebugMode) {
print(e.toString());
}
catch (e) {
throw UnexpectedException(
'Unexpected error during verification: ${e.toString()}');
if (e.response?.statusCode == 401) {
throw AuthException(
e.response?.data['error'] ?? 'SOMETHING WENT WRONG');
}
throw NetworkException('Network error during verification');
} catch (e) {
throw UnexpectedException(
'Unexpected error during verification: ${e.toString()}');
}
}
Future<AuthToken> login(AuthCredentials credentials) async {
try {