Skip to main content

Veritran Docs

Interacción

[en] After setting the correct parameters and initializing XpressPlug, all the available functions are ready to be used and interact with the SDK.

Aviso

[en] Only initialize XpressPlug once per session, preferentially during the app's launch or at the earliest stage possible. You will not be able to execute any entrypoint until XpressPlug is initialized.

[en] You can interact with XpressPlug and call for entrypoints. These entrypoints are used to connect with Veritran's functionalities, such as processes or transactions.

[en] Entrypoints can be visual, like invoking a screen that opens the device's camera to take a picture, or non-visual, such as validating a login.

[en] In the following example, the entrypoint is called I_DOCU_SDK, and its input parameters include a map with a string type username. The keys defined as output keys are "errorCode" and "age". As a result, the function returns a map with the <key, Value> format that contains values previously set in the outputKeys array. See the example below to learn how to call an entrypoint:

class EntryPointCallerExample: EntryPoint.Callback { 
 
	fun testEntryPointCall() { 	 
		val entryPointName = "I_DOCU_SDK" 
	      val parameters = hashMapOf("userName" to "Veritran") 
			val action = XpressPlug.buildEntryPoint( 
		  entryPointName,  
		  MainApplication.mainActivity 
		) 
			parameters.forEach { 
		    		action.addInput(it.key, it.value) 
			} 
			action.setCallback(this) 
			action.execute() 
	} 

} 

Nota

[en] Entrypoints names and their parameters will be provided by the Veritran team

[en] To see the entrypoints execution results, you need to implement the EntryPoint.Callback interface. See the code and table below for an example of how the interface is implemented after invoking the class above.

override fun onCompleted(results: Response?) { 
    val outputKeys = listOf("errorCode", "age") 
    var params = hashMapOf<String, String>() 
    outputKeys.forEach { param -> 
        params[param.name] = results?.getOutputValue(param.name) ?: "" 
    } 
} 
 
override fun onException(code: String?, message: Exception?) { 
} 
 
override fun onUpdateRequired(message: String?) { 
} 
 
override fun onClose(message: String?, context: Activity?) { 
} 

[en] onCompleted

[en] This is where the output parameters appear.

[en] onException

[en] Executed when an exception occurs.

[en] onUpdateRequired

[en] Displays when the SDK or configuration need to be updated.

[en] onClose

[en] Displays when the functionality is closed

[en] Result values can be accessed through the Response object, on the onCompleted method.