denyEnrollment method

Future<void> denyEnrollment(
  1. String enrollmentId
)

Deny an enrollment

Implementation

Future<void> denyEnrollment(String enrollmentId) async {
  if (!_initialized) {
    throw Exception('Manager not initialized. Call initialize() first.');
  }

  try {
    _logger.info('Denying enrollment: $enrollmentId');

    // Use the EnrollmentService to deny
    final enrollmentService = _atClient.enrollmentService;
    if (enrollmentService == null) {
      throw Exception('EnrollmentService not available');
    }

    // Create the denial decision
    final decision = EnrollmentRequestDecision.denied(enrollmentId);

    // Deny using the enrollment service
    final response = await enrollmentService.deny(decision);

    _logger.info('Successfully denied enrollment: $enrollmentId. Response: ${response.enrollStatus}');
  } catch (e, s) {
    _logger.severe('Failed to deny enrollment $enrollmentId: $e', e, s);
    rethrow;
  }
}