handleCompletionWithUpload method

void handleCompletionWithUpload(
  1. DocReaderAction action,
  2. Results? result,
  3. DocReaderException? error
)

Implementation

void handleCompletionWithUpload(
  DocReaderAction action,
  Results? result,
  DocReaderException? error,
) async {
  debugPrint("action: $action");
  debugPrint("result: ${result?.transactionInfo?.transactionId}");
  debugPrint("CheckResult: ${result?.status.portrait.value}");
  debugPrint("error: ${error?.message}");

  if (action == DocReaderAction.COMPLETE && result != null) {
    var surname = await result.textFieldValueByType(FieldType.SURNAME);
    var givenName = await result.textFieldValueByType(FieldType.GIVEN_NAMES);

    var surnameAndGivenNames = await result.textFieldValueByType(
      FieldType.SURNAME_AND_GIVEN_NAMES,
    );
    final (face, faceLivenessTransactionId) =
        await faceSdkSteps.startLiveness();
    debugPrint("surname: $surname");
    debugPrint("givenName: $givenName");
    debugPrint("surnameAndGivenNames: $surnameAndGivenNames");

    if (result.authenticityResult == null) {
      debugPrint("Authenticity Result: null");
    } else {
      debugPrint(
        "Authenticity Result: ${result.authenticityResult?.toJson()}",
      );
    }
    for (var check in result.authenticityResult!.checks) {
      debugPrint("Authenticity Check of upload: ${check.toJson()}");
    }

    final transactionId = await docReaderSdkSteps.finalise();
    debugPrint("Transaction ID: $transactionId");

    if (_onTransactionIds != null) {
      _onTransactionIds!(faceLivenessTransactionId, transactionId);
    }
  }
}