implemented TPIN and quick pay within bank

This commit is contained in:
2025-06-23 04:47:05 +05:30
parent 0d2dfc817e
commit 77a2654401
44 changed files with 1692 additions and 1153 deletions

View File

@@ -51,4 +51,43 @@ 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 {
throw AuthException('Failed to check TPIN status');
}
} on DioException catch (e) {
if (kDebugMode) {
print(e.toString());
}
throw NetworkException('Network error during TPIN check');
} catch (e) {
throw UnexpectedException('Unexpected error during TPIN check: ${e.toString()}');
}
}
Future<void> setTpin(String tpin) async {
try {
final response = await _dio.post(
'/api/auth/tpin',
data: {'tpin': tpin},
);
if (response.statusCode != 200) {
throw AuthException('Failed to set TPIN');
}
} on DioException catch (e) {
if (kDebugMode) {
print(e.toString());
}
throw NetworkException('Network error during TPIN setup');
} catch (e) {
throw UnexpectedException('Unexpected error during TPIN setup: ${e.toString()}');
}
}
}