acceptConsent method

Future<void> acceptConsent(
  1. String id
)

Implementation

Future<void> acceptConsent(String id) async {
  final baseUrl = ConfigManager.current.baseUrl;
  final url = Uri.parse('$baseUrl$_consentEndpoint/$id/accept');
  final token = await storage.getTokenOrThrow();

  final headers = {
    'Authorization': 'Bearer $token',
  };


  try {
    final response = await http.post(
      url,
      headers: headers,
    );
    await _checkResponseData(response, 'Failed to post IDV Terms');
  } on SDKException {
    rethrow;
  } catch (e) {
    throw SDKException.withMessage(
      'PlumCheck SDK Exeption - Failed to post Consent, Description: ${e.toString()}');
  }
}