makeFaceMatchCall static method

Future<void> makeFaceMatchCall({
  1. required String endpoint,
  2. required String faceUri,
  3. required String documentUri,
  4. required Map parameters,
  5. required Map headers,
  6. FaceMatchMode faceMatchMode = FaceMatchMode.faceId,
  7. required dynamic onComplete(
    1. HVResponse?,
    2. HVError?
    ),
})

Makes a face match API call using a face image and a document image.

Parameters:

  • endpoint: The endpoint URL to obtain the face match response.
  • faceUri: The path/URI of the face image on which the face match call has to be performed.
  • documentUri: The path/URI of the document image on which the face match call has to be performed.
  • parameters: A map/json containing key-value pairs of different fraud/malice checks provided by Hyperverge.co.
  • headers: A map/json containing key-value pairs of different header options provided by Hyperverge.co.
  • faceMatchMode: The mode to be used for face matching. Default value is FaceMatchMode.faceId.
  • onComplete: A callback function Function(HVResponse?, HVError?) that will be called when the face match call is complete.

Implementation

static Future<void> makeFaceMatchCall({
  required String endpoint,
  required String faceUri,
  required String documentUri,
  required Map parameters,
  required Map headers,
  FaceMatchMode faceMatchMode = FaceMatchMode.faceId,
  required Function(HVResponse?, HVError?) onComplete,
}) async {
  try {
    final resMap = await _hvNetworkHelperChannel.invokeMethod(
      HyperSnapSDKConstants.networkHelperMakeFaceMatchCall,
      {
        'endpoint': endpoint,
        'faceUri': faceUri,
        'documentUri': documentUri,
        'faceMatchMode': faceMatchMode.faceMatchModeString,
        'parameters': parameters,
        'headers': headers,
      },
    );

    final errorObj = resMap['errorObj'];
    final resObj = resMap['resultObj'];
    final hvError = errorObj.isEmpty ? null : HVError.fromMap(errorObj);
    final hvResponse = resObj.isEmpty ? null : HVResponse.fromMap(resObj);

    onComplete(hvResponse, hvError);
  } catch (e) {
    log(e.toString());
  }
}