Prepare the EnterpriseService object:
Java
EnterpriseService enterprise=new EnterpriseService(getApplicationContext()); enterprise.setBaseUrl("base");
Kotlin supports builder pattern witch allows to provide credentials and base url in EnterpriseService itself.
Kotlin
val enterpriseService = EnterpriseService.Builder(this)
.baseUrl(baseUrl)
.credentials(credentials)
.build()
Create a new journey by setting Upload credentials, setting a random journey GUID, adding an extracted document image (Smart capture or Manual Extraction results) and finally uploading to IEOS backend.
Java
// Build customisable request
RequestDocumentSend request = new RequestDocumentSend(); request.setCredentials(SampleApplication.CREDENTIALS_UPLOAD); request.setDocumentImage(documentImage);
// Send our request for Upload
enterprise.submitDocument(request, mDocumentSubmittedListener);
Kotlin
val request = RequestDocumentSend()
request.setDocumentImage(bitmap)
enterpriseService?.submitDocument(request, documentSubmittedListener)
Get the required result from supplied OnDocumentSubmittedListener.
Java
responseUpload.getRequiredAction()
responseUpload.getJourneyId();
Kotlin
responseUpload.getJourneyId()
responseUpload.requiredAction
To continue journeys, we need the next required action and journey id.
Java
// Build customizable request
RequestDocumentSend request = new RequestDocumentSend(); request.setCredentials(SampleApplication.CREDENTIALS_UPLOAD); request.setJourneyId(responseUpload.getJourneyId()
// For Front and Back actions and their rescans request.setDocumentImage(documentImage);
// For Selfie and first Liveness action and their rescans replace setDocumentImage() to setSelfieImage() request.setSelfieImage(SampleApplication.mSelfieImage);
// For Proof of address actions default setDocumentImage() and add setSource() as A4_SCANNER request.setDocumentImage(documentImage); request.setSource(RequestDocumentSend.Source.A4_SCANNER);
// Send our request for Upload
enterprise.submitDocument(request, mDocumentSubmittedListener);
Kotlin
// Build customizable request
val request = RequestDocumentSend() request.setJourneyId(responseUpload.getJourneyId())
// For Front and Back actions and their rescans request.setDocumentImage(bitmap)
// For Selfie and first Liveness action and their rescans replace setDocumentImage() to setSelfieImage() request.setDocumentImage(bitmap)
// For Proof of address actions default setDocumentImage() and add setSource() as A4_SCANNER request.setDocumentImage(bitmap) request.setSource(RequestDocumentSend.Source.A4_SCANNER)
// Send our request for Upload. enterpriseService?.submitDocument(request, documentSubmittedListener)
For liveness you will get 2 identical actions for second action you need to call Liveness and you will get the same response object as submitDocument
mRequestLiveness = new RequestLiveness(); mRequestLiveness.setJourneyId(journeyID); mRequestLiveness.setFinalResult(aggregatedResult.getFinalResult().getValue());
mRequestLiveness.setActionDetails(ActionResultMapper.mapToActionDetails(aggregatedResult.getActionResultState())); enterpriseService.submitLiveness(RequestLiveness, false, Credentials, DocumentSubmittedListener);
The journey ends when required action is “NONE”.
The final journey result can be found in responseUpload.getHighLevelResultEnum(); To retrieve the final journey result, please use getJourney()
Liveness: For liveness refer to section: “How to send data to serve FaceMatch and Liveness”
The journey ends when required action is “NONE”.
After final step you can retrieve full journey result using getJourney() call in EnterpriseService. The final journey result can be found in responseJourney.getHighLevelResultEnum();