submitFaceVerify method

Future<SubmitResponse> submitFaceVerify(
  1. dynamic image,
  2. dynamic matchPercentage
)

submit/faceVerify token retun

Implementation

Future<SubmitResponse> submitFaceVerify(image, matchPercentage) async {
  final dio = apiClient();
  Response response;
  var payload = {
    "faceImage": image,
    "faceMatchPercent": matchPercentage,
    "dataSource": ""
  };

  try {
    var data = dio.then((value) async {
      response =
          await value.post(UrlResources.submitFaceVerify, data: payload);

      if (response.statusCode == 200) {
        SubmitResponse results = SubmitResponse.fromMap(response.data);
        if (results.isSuccess) {
          accessToken = results.token;
          return results;
        } else {
          throw Exception("Documents uploading failed");
        }
      } else {
        throw Exception(" uploading failed");
      }
    }).catchError((e) {
      throw Exception(e);
    });
    return data;
  } on DioError catch (_, e) {
    throw Exception(e);
  }
}