feedbackSession method

Future<RemoteResponse<bool>> feedbackSession({
  1. required String sessionId,
  2. required String accessToken,
  3. required Map<String, dynamic> feedbackParams,
})

Implementation

Future<RemoteResponse<bool>> feedbackSession({
  required String sessionId,
  required String accessToken,
  required Map<String,dynamic> feedbackParams,
}) async {
  try {
    Dio dio = getDio(accessToken);

    final body = {
      "feedback_params": feedbackParams,
    };

    final response = await dio.put<Map<String, dynamic>>(
      feedbackSessionPath(sessionId),
      data: body,
    );
    final Map<String, dynamic>? data = response.data;
    log('DATA: $data');
    if (response.statusCode == 200) {
      final Map<String, dynamic> payload =
      data?['payload'] as Map<String, dynamic>;
      if (payload['result']==true) {
        return const RemoteResponse.withNewData(true);
      } else {
        return const RemoteResponse.withNewData(false);
      }
    } else {
      throw EkycApiException.fromJson(response.data!);
    }

  } on DioError catch (e) {
    return handleDioError(e);
  }
}