Skip to content

iOS - OCR Module

The OCR Module reads the data on identity cards and passports using the rear camera. Visual object analysis, hologram detection, facial photo reading, MRZ area reading, and verification of visual security elements are performed by this module.

The OCR module performs a series of control operations such as analyzing the visual objects on the ID card (ID or Passport), reading the data on the face of the ID, and reading the data in the MRZ area of the ID using images captured by the rear camera.

It is important for the ID to be properly aligned with the camera during the analysis process. Additionally, the analysis time may vary depending on the device's performance and camera quality. This module offers an effective and reliable solution for identity verification processes.

⚠atlassian-warning#FFEBE6

When the OCR module is to be used, the Core Module must be added to the project. This is necessary to provide the basic functionality of the modules.

Steps for Integrating EnQualifyOCR SDK into the Project

This guide explains how to integrate the EnQualifyOCR SDK into your project. By following the steps below, you can quickly and easily accomplish the integration.

What is the Core Module

Before adding the OCR module, the Core Module must be included in the project. You can visit the Core Module documentation to learn how to add the core module.

What is EnQualifyOCR

EnQualifyOCR is used to perform and manage operations related to identity (ID or Passport) verification and analysis. You can refer to the EnQualifyOCR Usage Guide for details regarding the use of EnQualifyOCR.

Quick Implementation

To perform a quick integration in your project, you can refer to the How to Implement the OCR Module? section.

Adding the OCR Module to the Project

EnQualify iOS SDK can be directly integrated into the project:

  • Method: Add the SDK to the project by embedding the xcframework directly and loading the required dependencies via cocoapods.
Text Only
// target 'MySampleProject' do
  use_frameworks!
  pod 'TensorFlowLiteSwift' # Identity detection
  pod 'TensorFlowLiteSwift/Metal' # Identity detection
end


post_install do |installer|
   installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
        config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
        config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = ""
        config.build_settings['VALID_ARCHS'] = "arm64 x86_64"
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.5'
        config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
    end
  end
end

Explanation of Build Settings After Installation

BUILD_LIBRARY_FOR_DISTRIBUTION = YES:

Ensures that the framework is built for distribution, so it can be used as a binary or shared framework in other projects. This is especially useful when creating XCFrameworks.

EXPANDED_CODE_SIGN_IDENTITY = "":

Clears the Code Signing Identity; thus, it ensures no specific certificate is used during the build process.

CODE_SIGNING_REQUIRED = NO:

Disables the code signing requirement during the build process. This is useful during testing or in cases where signing is not necessary.

CODE_SIGNING_ALLOWED = NO:

Ensures that Code Signing is completely disabled.

EXCLUDED_ARCHS[sdk=iphonesimulator*] = "":

Removes all previously excluded architectures for the iPhone simulator. This setting ensures compatibility during the build process.

VALID_ARCHS = "arm64 x86_64":

Specifies the valid architectures for the build. Here, it is used for arm64 (M Series) and x86_64 (Intel-based) Macs.

IPHONEOS_DEPLOYMENT_TARGET = 14.0:

Sets the minimum iOS version that the application or framework supports. This ensures compatibility with devices running iOS 14.0 and above.

ONLY_ACTIVE_ARCH = YES:

Limits the build process to only the architecture of the active build device or simulator. This can speed up the build time during development.

XCFrameworks

  • To integrate the EnQualify SDK directly into your project, you can add the core SDK files such as OCRModule.xcframework, NFCModule.xcframework, FaceModule.xcframework, CoreModule.xcframework, and VideoCallModule.xcframework directly to your project files.
  • Alternatively, if you have already copied the XCFrameworks into your project, you can add these frameworks to your project by going to Project Settings > General and selecting Embed and Sign.
  • For the dependencies of the EnQualify SDK added this way, you need to include the version numbers specified in the "podspec" file corresponding to the relevant version or provided by the provider.

How to Implement the OCR Module?

1. Adding the Modules

1.1 Implementation of the Core Module

EnQualifyOCR Module must be included in the project before using the Core Module. If you have not added it yet, you can refer to the Core Module documentation for details.

1.2 Adding the OCR Module to the Project

You can find the necessary instructions for integrating the OCR Module under the Adding the OCR Module to the Project section. Follow these steps to include the OCR module in the project.


2. Permissions

2.1 Adding Camera Permission to Info.plist

First, you need to add camera permission to the Info.plist file. This allows your application to access the camera hardware.

Text Only
<key>NSCameraUsageDescription</key>

2.2 Requesting Runtime Permissions

Camera permission is requested within the initialize function.

Text Only
EnQualifyOCR.initialize(_ sender: Any?,
                        sessionModel: SessionModelOCR? = nil,
                        baseModel: BaseModelOCR? = nil)

If camera permission is not granted, the initializeFailed(with key: CustomNSError) delegate is triggered. If granted, the initializeCompleted(moduleName: String) delegate is triggered.


3. Adding EnQualifyOCRDelegate Interface

EnQualifyOCRDelegate includes the necessary delegate methods to manage OCR processes. By implementing this interface, you can listen to and manage OCR-related events. For detailed information, you can refer to the EnQualifyOCR Usage Guide.

3.1 Adding EnQualifyOCRDelegate to the Class

Text Only
class ViewController: EnQualifyOCRDelegate {

3.2 Overriding Delegate Functions

Text Only
class ViewController: EnQualifyOCRDelegate {
     func hologramCheckVerified() {}

     func idDocTypeCheckVerified(isFront: Bool) {}

     func idDocFrontCompleted() {}

     func idDocBackCompleted() {}

     func idDocCompleted() {}

     func idDocFailed(error: EnQualifyOcrError) {}

     func initializeCompleted(moduleName: String) {}

     func initializeFailed(with key: CustomNSError) {}

     func sessionCloseCompleted(status: String) {}

     func sessionCloseFailed() {}

     func tokenCreateCompleted() {}

     func tokenCreateFailed() {}

     func integrationAddCompleted() {}

     func integrationAddFailed() {}

     func sessionAddFailed() {}

     func settingGetFailed() {}

     func signingSetCompleted() {}

     func signingCompleted() {}

     func signingSetFailed(error: String) {}
}

4. Initializing EnQualifyOCR and Token, Settings, and Session Operations

Before initializing core;

  • The EnQualifyOCRDelegate methods should be added to the delegate field of the UIViewController in which they will be used.
  • SessionModelOCR is a model containing the parameters to be used for starting the OCR and should be added to the relevant field during the initialization process. For detailed information, see the SessionModelOCR section.
  • BaseModelOCR is a model that includes the certificate and base URL information required for OCR and should be added to the relevant field during the initialization process. For detailed information, see the BaseModelOCR section.

Before starting OCR operations, the EnQualifyOCR class must be initialized. This process initiates the necessary token, settings, and session operations. Moreover, it is important to inform the user that preparations for the OCR process are complete and then start the operation.

Text Only
func initialize(_ sender: Any?,
                sessionModel: SessionModelOCR? = nil,
                baseModel: BaseModelOCR? = nil) {

Parameters

Parameter Type Description
delegate Any? Indicates which UIViewController the application will be used in.
sessionModel SessionModelOCR Contains session information to be used during the OCR process.
baseModel BaseModelOCR A model that carries basic data in the verification process.

Once EnQualifyOCR is initialized, an instance of EnQualifyOCR is created, and then the necessary operations to create a token, settings, and session are initiated. After the initialize process, the token, settings, and session are managed by the SDK.

After creating an EnQualifyOCR instance, the following steps are executed in order:

  1. Token Creation

  2. EnQualifyOCR initiates the token creation process.

  3. If an error occurs during token creation, the tokenCreateFailed delegate is triggered.
Text Only
func tokenCreateFailed() {}
  • Once the token is successfully created, it proceeds to the next step, which is the session operation.
  • Starting the Session Operation

  • After successfully obtaining the token, the session initiation process begins.

  • If an error occurs during session initiation, the sessionAddFailed delegate is triggered.
Text Only
func sessionAddFailed() {}
  • When the session operation is completed successfully, the SDK establishes the connection with the back office and becomes ready to initiate the process.
  • Retrieving Settings

  • Once the session is successfully created, the retrieval of settings defined in the back office is initiated.

  • If an error occurs during this process, the settingsGetFailed delegate is triggered, and an error message is communicated to the client.
Text Only
func settingGetFailed() {}
  • Once settings are successfully retrieved, the SDK configures the related configurations and initiates the session operation.
  • Completing the Operation

  • When all steps are completed without issues, the initializeCompleted delegate is triggered. This indicates that the SDK has been successfully initialized and is ready for OCR operations.

Text Only
func initializeCompleted(moduleName: String) {}

This process is designed to ensure that the EnQualifyOCR operates reliably. Possible errors are communicated to the client or user via the relevant delegates to facilitate the necessary actions.


5. Starting the OCR Operation

In this section, we explain step by step how to start and manage OCR operations.

5.1 User Notification

It is recommended to inform the user before starting the OCR operation. An OCRInfo page can be created for this purpose.
This page provides information about the OCR operation to the user and enhances their experience.

5.2 OCR Operations

For detailed information about OCR functions and delegates, you can refer to the EnQualifyOCR Usage Guide.

  • idDocTypeCheckStart(in vc: UIViewController, isFront: Bool)
  • hologramCheckStart(in vc: UIViewController)
  • idDocFrontStart(in vc: UIViewController, withVisualAnalysis: Bool)
  • idDocBackStart(in vc: UIViewController, withVisualAnalysis: Bool)
  • idDocComplete(withDelay delay: TimeInterval = 0.0)
  • sessionClose(finished: Bool)

5.2.1 Performing Identity Type Recognition

To start the identity type recognition process, use the idDocTypeCheckStart function. This operation is managed by the EnQualifyOCR API and is called as follows.

Text Only
EnQualifyOCR.idDocTypeCheckStart(in: self, isFront: true)

Delegate Mechanism

When the identity type recognition process is successfully completed, the idDocTypeCheckVerified delegate is triggered. Within this delegate, further actions to be taken after the process are handled.

Text Only
func idDocTypeCheckVerified(isFront: Bool) {}

5.2.2 Performing Identity Front Side Scanning

To start scanning the front side of the identity card, the idDocFrontStart function is used. This operation is managed by the EnQualifyOCR API and is called as follows.

Text Only
EnQualifyOCR.idDocFrontStart(in: self, withVisualAnalysis: true)

Delegate Mechanism

When the identity front scanning operation is successfully completed, the idDocFrontCompleted delegate is triggered. Within this delegate, further actions to be taken after the process are handled.

Text Only
func idDocFrontCompleted() {}

5.2.3 Performing Hologram Detection on the Identity Front Side

To start the detection of holograms on the identity front, use the hologramCheckStart function. This operation is managed by the EnQualifyOCR API and is called as follows.

Text Only
EnQualifyOCR.hologramCheckStart(in: self)

Delegate Mechanism

When the hologram detection process on the identity front side is successfully completed, the hologramCheckVerified delegate is triggered. Within this delegate, further actions to be taken after the process are handled.

Text Only
 func hologramCheckVerified() {}

5.2.4 Performing Identity Back Side Scanning

To start scanning the back side of the identity card, use the idDocBackStart function. This operation is managed by the EnQualifyOCR API and is called as follows.

Text Only
EnQualifyOCR.idDocBackStart(in: self, withVisualAnalysis: true)

Delegate Mechanism

When the identity back scanning operation is successfully completed, the idDocBackCompleted delegate is triggered. Within this delegate, further actions to be taken after the process are handled.

Text Only
func idDocBackCompleted() {}

5.2.5 Notifying that Identity Detection (OCR) Flow is Complete

When all identity detection steps are completed, the idDocComplete function is used to inform the SDK that the operations have ended. This function also stops the analyses made by the camera, concludes the operation process, and initiates the process of sending the read data to the back office.

Text Only
EnQualifyOCR.idDocComplete(withDelay: 0.0)

When the data read is sent to the back office, the idDocCompleted delegate is triggered.

Text Only
func idDocCompleted() {}

5.2.6 Closing the SDK Session

Closing the Session Operation

To close the session used by the SDKs for communication with backend services, the sessionClose function is used. This operation is managed by the EnQualifyCore API but is called in the API of each SDK as follows.

⚠atlassian-warning#FFEBE6

Once a session has been closed by an SDK, if it will be reused, the SDK needs to be re-initialized.

Text Only
EnQualifyOCR.sessionClose(finished: false)

Delegate Mechanism

When the session closure operation is successfully completed, the sessionCloseCompleted delegate is triggered. Within this delegate, further actions to be taken after the process are handled.

Text Only
func sessionCloseCompleted(status: String) {}

If the session closure operation fails, the sessionCloseFailed delegate is triggered. Within this delegate, further actions to be taken after the process are handled.

Text Only
func sessionCloseFailed() {}

5.2.7 Replace Sound

Text Only
func replaceSound(currentVoice: [String], newVoice: String)

The replaceSound function is used to play a different sound file in place of a specific sound file within the SDK or to prevent the related sound from playing.
This feature is designed to provide dynamic sound control in specific situations within the user flow (for example, when a certain number of errors occur or when the flow direction changes).


Parameters

Parameter Type Description
currentVoice [String] The names of the current sound(s) that are to be changed or prevented from playing. This parameter comes as an array since, for instance, in OCR, NFC, or Face phases, multiple error types (like timeout, fail, etc.) can be associated with different sounds.
newVoice String The name of the new sound that will be played instead of the sound(s) specified in the currentVoice parameter. If an empty ("") string is given, the SDK skips this step silently and does not play any sound.

Usage Scenario

For example, if your user flow includes a scenario of redirecting to a video call after three failed OCR attempts, the "fail_ocr_voice" sound can be played on the first two failed attempts.
However, if you want the sound "go_to_videocall" to play instead of "fail_ocr_voice" on the third error, you can use the replaceSound function as follows:

Text Only
replaceSound(currentVoice: ["fail_ocr_voice"], newVoice: "go_to_videocall")

Note:

To display the read data on the result page, you can refer to the CustomerIdentity section. This section ensures that the read data is presented to the user in a clear and understandable way.

EnQualifyOCR Usage Guide

The EnQualifyOCR module is used to perform a series of control operations such as analyzing visual objects on the ID card (ID or Passport) using images captured with the rear camera, hologram analysis, reading the data on the face of the ID, and reading the data in the MRZ area of the ID. Below are the relevant functions and delegates explained.

Functions

initialize(...) : EnQualifyOCR

Text Only
func initialize(_ sender: Any?,
                sessionModel: SessionModelOCR? = nil,
                baseModel: BaseModelOCR? = nil) {

The EnQualifyOCR must be initialized to manage identity verification processes. When initializing this API;

  • sender: Any** :** Determines which class will respond to the application's delegate methods.
  • sessionModel: SessionModelOCR : Contains session information to be used during the OCR process.
  • baseModel: BaseModelOCR : A model that carries basic data in the verification process.

may be provided.

The API works in a singleton structure, so operations are performed through the same instance throughout the application session. This saves resources and increases process consistency. The initialization process automatically performs the following operations:

  • Token creation
  • Settings configuration
  • Session initiation If there is an existing session, a new session will not be created, and the current session will continue to be used.

Delegates

Token / Session / Settings Delegates

tokenCreateCompleted()

  • Triggered when the token creation process is completed.
  • If there is an existing token, it will not be recreated, and the existing token will be used.

tokenCreateFailed()

  • Triggered if an error occurs while creating the token.

settingsGetFailed()

  • Triggered if an error occurs while fetching the settings information.

sessionAddFailed()

  • Triggered if an error occurs while creating a new session.

sessionCloseCompleted(status: String)

  • Triggered when the session is closed.
  • Parameter:

  • status : The status information of the session when it is closed.


sessionCloseFailed()

  • Triggered if an error occurs while closing the session.

integrationAddCompleted()

  • Triggered when the request to the IntegrationAdd service is completed.

integrationAddFailed()

  • Triggered if an error occurs when the request is made to the IntegrationAdd service.

OCR Callbacks

IDDocFailed(error: EnQualifyOcrError)

Text Only
public enum EnQualifyOcrError: Error {
    case timeout(OCRState, String)
    case idDocSave(String)
    case idDocFailed(OCRState, String)
    case cameraSetup(String)

    public var ocrErrorDescription: String {
        switch self {
        case .timeout(let state, let message):
            return "Timeout during \(state) state with \(message)"
        case .idDocSave(let message):
            return "Error while saving id document"
        case .idDocFailed(let state, let message):
            return "Authentication failed during \(state). Please try again."
        case .cameraSetup(let message):
            return "Camera setup failed: \(message)"
        }
    }
}
  • Triggered when an error occurs or fails during identity verification processes.
  • Parameters:

  • state: The OCR phase.

  • ocrErrorDescription: Error message.

idDocTypeCheckVerifiedFront()

  • Triggered when the identity type is successfully determined after calling the idDocTypeCheckStartFront function for the purpose of detecting the identity type. Continues with the idDocFrontStart function.

hologramCheckVerified()

  • Triggered after the hologramCheckStart function, called for the purpose of detecting the hologram on the identity front, when the hologram is successfully detected.

idDocFrontCompleted()

  • Triggered after the idDocFrontStart function, called to recognize the front side of the identity and read its data when the process is successfully completed.

idDocTypeCheckVerifiedBack()

  • Triggered when the identity type is successfully determined after calling the idDocTypeCheckStartBack function for the purpose of detecting the identity type. Continues with the idDocBackStart function.

idDocBackCompleted()

  • Triggered after the idDocBackStart function, called to recognize the back side of the identity and read the data in the MRZ area when the process is successfully completed.

idDocComplete(withDelay: 0.0)

  • When all identity detection steps are completed, the idDocComplete function is used to inform the SDK that the operations have ended. This function also stops the analyses made by the camera, concludes the operation process and initiates the process of sending the read data to the back office.
  • Parameters:

  • withDelay : Determines how long the camera session should wait before closing.


idDocCompleted()

  • Triggered after the identity verification process is successfully completed and the read data is successfully sent to the back office.

Models

BaseModelOCR

BaseModelOCR is the data model that contains the certificate information and server connection address used in the verification processes. Signaling and MAPI certificates are stored both in file (.der) format and in Base64 text format.

Model

Text Only
class BaseModelOCR(
    var signallingCertificateList: [String]? = nil
    var mapiCertificateList: [String]? = nil
    var signallingCertificateBase64List: [String]? = nil
    var mapiCertificateBase64List: [String]? = nil
    var baseURL: String //Required field
    var locale: String? = nil
    var mobileUser: String? = nil
    var countryCode: String? = nil
)

Properties

Property Type Description
signallingCertificateList [String]? An array of signaling certificates. Certificates are stored in text format.
mapiCertificateList [String]? An array of MAPI certificates. Certificates are stored in text format.
signallingCertificateBase64List [String]? The Base64 encoded versions of signaling certificates.
mapiCertificateBase64List [String]? The Base64 encoded versions of MAPI certificates.
*baseURL String The base server address used for API verification operations.
locale String? Determines the language of the voice guidance messages.
mobileUser String? Represents the anonymous user information used during authorization.
countryCode String? Used to ensure the necessary data is obtained regionally when verification is done regionally.

Usage Example

In the following example, the BaseModelOCR instance is created, and certificate information and server address are defined:

Text Only
var baseModelOCR = BaseModelOCR(
    signallingCertificateList: ["AI_CERT_1", "AI_CERT_2"],
    mapiCertificateList: ["MAPI_CERT_1", "MAPI_CERT_2"],
    signallingCertificateBase64List: ["QUlDRVJU...", "Q0VSVF8y..."],
    mapiCertificateBase64List: ["TU9SRSB...", "Q0VSVF8z..."],
    baseURL: "API_SERVER_URL",
    locale: "TR",
    mobileUser: "mobile",
    countryCode: "TUR"
)

Explanations

  • Certificates (signallingCertificateList, mapiCertificateList): Certificate information is stored in plain text format.
  • Base64 Certificates (signallingCertificateList, mapiCertificateBase64List): The Base64 format versions of the certificates.
  • Server Connection (baseURL): The server URL where verification or certificate operations will be performed.

SessionModelOCR

SessionModelOCR is the data model containing user and identity information during a calling session. It includes call type, user details, identity information, and additional parameters related to the session.

Model Definition

Text Only
class SessionModelOCR(
    var callType: String, // Required field
    var userName: String? = nil,
    var surname: String? = nil,
    var phone: String? = nil,
    var email: String? = nil,
    var identityType: String? = nil,
    var identityNo: String? = nil,
    var reference: String, // Required field
    var canAutoClose: Bool = false, // Default: false
    var isContinue: Bool = false, // Default: false
    var category: String? = nil,
    var taxNumber: String? = nil,
    var businessReference: String? = nil,
    var handicapped: Bool? = false
)

Properties

Property Type Description
\*callType String Required. A parameter indicating the type of call (for example: "NewCustomer").
userName String? The user's first name. Can be empty.
surname String? The user's last name. Can be empty.
phone String? The user's phone number. Can be empty.
email String? The user's email address. Can be empty.
identityType String? The type of identity (for example: "I"(Turkish Identity Card), "P"(Passport)). Can be empty.
identityNo String? The user's identity number. Can be empty.
\*reference String Required. The reference ID for the session.
canAutoClose Bool Determines whether the session can close automatically. Default: false.
isContinue Bool Determines whether the session will continue. Default: false.
category String? The category of the session. Can be empty.
taxNumber String? The user's tax number. Can be empty.
businessReference String? Business-related reference information. Can be empty.
handicapped Bool A flag indicating whether the user is disabled. Default: false.

Usage Example

In the following example, the SessionModelOCR instance is created, and session information is defined:

Text Only
var sessionModelOCR = SessionModelOCR(
    callType: "NewCustomer",
    userName: "Enqura",
    surname: "Information",
    phone: "+905551234567",
    email: "enqualifyplus@enqura.com",
    identityType: "TC. Kimlik Kartı",
    identityNo: "12345678901",
    reference: "REF123456",
    canAutoClose: true,
    isContinue: true,
    category: "category",
    taxNumber: "9876543210",
    businessReference: "COMPANY",
    handicapped: false
)

Explanations

  • Required Fields: The callType and reference parameters must be specified.
  • User Information: Fields such as userName, surname, phone, email are optional.
  • Identity Information: identityType and identityNo can be used during NFC verification or identity identification processes.
  • Disability Status: The handicapped parameter indicates whether the user has special requirements.
  • Auto Close: The canAutoClose may allow the session to close automatically when a specific condition occurs.
  • Continuation Status: The isContinue checks whether the session is an ongoing process or not.

CustomerIdentity

This class represents the data model where the information read from a document (like an ID or passport) is stored.

Model

Text Only
@objc public class CustomerIdentity: NSObject {
    @objc public static let shared = CustomerIdentity()

    @objc public func getIdentityType() -> String? {}

    @objc public func getIssuingState() -> String? {}

    @objc public func getDocumentNumber() -> String? {}

    @objc public func getIdentityNumber() -> String? {}

    @objc public func getDateOfBirthDay() -> String? {}

    @objc public func getExpiryDate() -> String? {}

    @objc public func getNationality() -> String? {}

    @objc public func getSurname() -> String? {}

    @objc public func getName() -> String? {}

    @objc public func getGender() -> String? {}

    @objc public func getFrontImage() -> ConfidenceItem? {}

    @objc public func getBackImage() -> ConfidenceItem? {}

    @objc public func getPersonImage() -> ConfidenceItem? {}

    @objc public func getHoloFrontImage() -> ConfidenceItem? {}

    @objc public func getFrontIdentityNumber() -> String? {}

    @objc public func getFrontDateOfBirthDay() -> String? {}

    @objc public func getTuri1fFlag() -> ConfidenceItem? {}

    @objc public func getTuri1fMli() -> ConfidenceItem? {}

    @objc public func getTuri1fSignature() -> ConfidenceItem? {}

    @objc public func getTuri1fHologram1() -> ConfidenceItem? {}

    @objc public func getTuri1bBarcod() -> ConfidenceItem? {}

    @objc public func getTuri1bChip() -> ConfidenceItem? {}

    @objc public func getTuri1bICAOlogo() -> ConfidenceItem? {}
}

Usage Example

In the following example, the information is obtained from the model and displayed on the OCR results page after the OCR process.

Text Only
func setCustomerChipValues() {
    let customerCard = CustomerIdentity.shared

    chipData[0].value = customerDoc.getName() ?? ""
    chipData[1].value = customerDoc.getSurname() ?? ""
    chipData[2].value = (customerDoc.getFrontDateOfBirthDay() ?? "").convertDateFormat()
    chipData[3].value = customerDoc.getIdentityNumber() ?? ""
    chipData[4].value = customerDoc.getDocumentNumber() ?? ""
    chipData[5].value = customerDoc.getGender() ?? ""
    chipData[6].value = customerDoc.getNationality() ?? ""
    chipData[7].value = (customerDoc.getExpiryDate() ?? "").convertDateFormat()

    ocrImageData.holoPage = customerDoc.getHoloFrontImage()?.image ?? UIImage()
    ocrImageData.frontPage = customerDoc.getFrontImage()?.image ?? UIImage()
    ocrImageData.backPage = customerDoc.getBackImage()?.image ?? UIImage()
}

Touch Test

The touch test process is initiated after the OCR step for the relevant identity has been successfully completed.

How to Implement the Touch Test?

1. Adding the Modules

Adding the OCR Module to the Project

The touch test must be included in the project before using it. If you have not yet added it, refer to the OCR Module documentation for details.

2. Adding EnQualifyOCRDelegate Interface

EnQualifyOCRDelegate contains the necessary delegate methods for managing the touch test. By implementing this interface, you can listen to and manage events related to the touch test. For detailed information, refer to the Touch Test Usage Guide.

2.1 Adding EnQualifyOCRDelegate to the Class

Text Only
class ViewController: EnQualifyOCRDelegate {

2.2 Overriding Delegate Functions

Text Only
class ViewController: EnQualifyOCRDelegate {
    // Other delegate methods added for OCR
    // ...
    func frontCrescentConcealVerified() {}
    func frontMLIConcealVerified() {}
    func frontSignatureConcealVerified() {}
    func backOVIConcealVerified() {}
    func idDocConcealCompleted() {}
    func idDocConcealFailed() {}
}

3. Managing the Touch Test

In this section, we explain step by step how to manage touch test operations.

3.1 User Notification

Before starting the touch test, it is recommended to inform the user. An Touch Test Info page can be created for this purpose.
This page provides information about the touch test operation to the user and enhances their experience.

3.2 Touch Test Operations

For detailed information about touch test functions and delegates, you can refer to the Touch Test Usage Guide.

  • performFrontCrescentConceal(in vc: UIViewController)
  • performFrontMLIConceal(in vc: UIViewController)
  • performFrontSignatureConceal(in vc: UIViewController)
  • performBackOVIConceal(in vc: UIViewController)
  • idDocConcealComplete(withDelay delay: TimeInterval)

3.2.1 Performing Front Crescent Touch Operation

To start the front crescent touch operation, use the performFrontCrescentConceal function. This operation is managed by the EnQualifyOCR API and is called as follows.

Text Only
EnQualifyOCR.performFrontCrescentConceal(in: self)

Delegate Mechanism

When the front crescent touch operation is successfully completed, the frontCrescentConcealVerified delegate is triggered. Within this delegate, further actions to be taken after