Implementation of on-boarding journeys – GBG IDscan Documentation

Implementation of on-boarding journeys

The main class you should be using to communicate with a backend is IDSEnterpriseService


In order to create a new journey, you need to use submit document builder method by setting credentials, adding an extracted document image (Smart capture or Manual Extraction results) and finally uploading to IEOS backend.

Swift

// Build customisable request.
  IDSEnterpriseService.submitDocumentConstructing({ (request: IDSEnterpriseSendRequest) in
                request.credentials = credentials
                request.addDocument(docImage)
                request.isExtracted = false
                request.documentSource = .identity
            }, progress: nil) { (response: IDSEnterpriseResponse?, error: Error?) in
                if let error = error {
                    self.showPopup(title: "Error", message: error.localizedDescription)
                } else {
                    let information = "Reference: \(String(describing: response?.scanReference)) \n Result: \(String(describing: response?.highLevelResult))"
                    self.showPopup(title: "Success", message: information)
                }
            }

Once you receive a response, you should follow required action requested by the backend and invoke specific component

Swift

// Check what's the next required action
response.requiredActionState.action

To continue journey with the next step, you need to provide journey ID from the initial response, hence all metadata gets uploaded to the right place

Swift

// Backend asked for selfie, you used selfie scanner to take an image, now you need to upload it to the backend
   IDSEnterpriseService.submitDocumentConstructing({ (request: IDSEnterpriseSendRequest) in
                request.credentials = credentials
                request.addSelfieImage(selfieImage)
                request.journeyID = firstResponse.journeyID
                request.documentSource = .identity
            }, progress: nil) { (response: IDSEnterpriseResponse?, error: Error?) in
                if let error = error {
                    self.showPopup(title: "Error", message: error.localizedDescription)
                } else {
                    let information = "Reference: \(String(describing: response?.scanReference)) \n Result: \(String(describing: response?.highLevelResult))"
                    self.showPopup(title: "Success", message: information)
                }
            }

If you have a passive liveness  in your journey, you need to take a selfie (you could use a document scanner for that) and upload it to the backend using the following method

Swift

// Backend asked for passive liveness selfie, you used selfie scanner to take an image, now you need to upload it to the backend
     IDSEnterpriseService.submitPassiveLiveness { (request:IDSEnterprisePassiveLivenessRequest) in
            request.credentials = credentials
            request.journeyId = "JOURNEY ID"
            request.inputImage = selfieImage
 
        } completion: { (response: IDSEnterpriseResponse?, error: Error?) in
            // Handle the response here
        }

Please note: Liveness

For active liveness and NFC steps, those components will take care of uploading everything to the backend

The journey ends when the required action is “NONE”.

After the final step, you can retrieve full journey result using getJourney() call in IDSEnterpriseService

Following is an example of how you might be able to find High Level Result (HLR) after completing all journey steps.

Swift

IDSEnterpriseService.getJourney("GUID", credentials: credentials, progress: nil) { (result: IDSEnterpriseJourneyResponse?, error: Error?) in
         guard let resultUnwrapped = result else { return }
            switch resultUnwrapped.highLevelResult {
            case .passed: break
            case .refer: break
            case .notSupported: break
            case .notAccepted: break
            case .expired: break
            case .undefined: break
            case .unknown: break
            default: break
            }
     }

Was this page helpful?