SDK Response

SDK Listener

Use the following code snippet to receive SDK callbacks

VIDVOCRListener vidvOcrListener= new VIDVOCRListener() {
            @Override
            public void onOCRResult(VIDVOCRResponse response) {
                if (response instanceof Success) {
                   
                     
                     
                     //an example code to use the response in your app : 
                     String firstName = ((Success) response).getData().getOcrResult().getFirstName();
                     //firstName variable will hold the first name of the scanned National ID
                     
                     
                     // Add your own code
                     
                     
                } else if (response instanceof CapturedImages) {
                
               
                         // Add your own code  
                                       
                } else if (response instanceof UserExit) {
                
                      // Add your own code
                
                } else if (response instanceof ServiceFailure) {
                
                        // Add your own code
                
                } else if (response instanceof BuilderError) {
                
                      // Add your own code
                
                }
            }
        };

Response Instances

Success : Process finished successfully

CapturedImages: Images captured are returned in real-time

Note: ForCapturedImagesinstance, images are not processed yet

BuilderError : Process terminated due to an error in the builder

Note: Check your configurations

ServiceFailure : Process finished with the user's failure to pass the service requirements

UserExit : Process terminated by the user with no errors

Primary Response Object

VIDVOCRResult

Note: This is the first-level object that contains all the second-level objects. It is present in these type of response and holds data related to the responses, includingSuccess,ServiceFailure, and UserExit.

Here is the attributes of VIDVOCRResultclass that represents the data that could be retrived from the response object VIDVOCRResponse using getData() method that returnsVIDVOCRResultobject like in the example code above showing a use of Success response.

  • captures : <Captures>

  • documentVerificationResult : <DocumentVerificationResult>

  • ocrResult : <VIDVOCRData>

  • decryptionKeys : <VIDVDecryptionKeys>

  • hmacDataList : <List<HmacData>>

  • sessionID : <String>

Object Body

  • sessionID <string>

ocrResult <sub-object>
  • firstName <string>

  • fullName <string>

  • religion <string>

  • gender <string>

  • dateOfBirth <string>

  • age <string>

  • maritalStatus <string>

  • husbandName <string>

  • street <string>

  • birthGovernorate <string>

  • policeStation <string>

  • governorate <string>

  • profession <string>

  • releaseDate <string>

  • expiryDate <string>

  • expired <boolean> : indicates whether the NID is past its expiry date.

  • serialNumber <string>

  • frontNid <string>

  • backNid <string>

  • frontDataValidity <boolean> : data on the front side is valid or not.

  • backDataValidity <boolean> : data on the back side is valid or not.

  • frontConfidence <int> : indicates if the front of the document is real or fake.

  • backConfidence <int> : indicates if the back of the document is real or fake.

  • isRootOfTrustCompatible <boolean>

  • transactionIdFront <string> : This could be used in face match in liveness sdk.

  • transactionIdBack <string>

  • combinationID <string>

  • documentVerificationPlus <object>

    • frontDataValidity <boolean> : data on the front side is valid or not.

    • backDataValidity <boolean> : data on the back side is valid or not.

    • isFrontGreyscale<boolean>

    • backConfidence <int>

    • isBackGreyscale<boolean>

    • expired <boolean>

    • reviewRequiredArrayList<string> : an ArrayList of the names of fields that is invalid.

  • advancedConfidence <object>

    • fraudDetectionZone <int>

    • fraudDetectionDetails <object>

      • faceFraudZone <int>

      • faceFraudConfidence <float>

      • frontImageManipulationZone <int>

      • frontImageManipulationConfidence <float>

documentVerificationResult <sub-object>
  • success <boolean>

captures <sub-object>
  • nationalIdFront <base64-string>

  • nationalIdBack <base64-string>

hmacDataList <list>
  • serviceID : ocr

  • hmacDigest <string>

  • rawResponse <string>

decryptionKeys <sub-object>
  • nationalIdFrontRequestKey [UInt8]

  • nationalIdBackRequestKey [UInt8]

  • combineResponseKey [UInt8]

The raw response in hmacDataList should be mapped to the result object as per the HMAC validation documentation

Instance Responses

Success

  • VIDVOCRResult <object>

CapturedImages

CapturedImageData <object>
  • nationalIDLabel <string>

  • nationalIdImage <base64-string>

UserExit

  • VIDVOCRResult <object>

  • step <string>

Note: step <string> identifies the point where the user chose to exit the SDK

ServiceFailure

  • VIDVOCRResult <object>

  • code <string>

  • message <string>

BuilderError

  • code <string>

  • message <string>

Last updated