Skip to main content

Veritran Docs

Interaction

After setting the correct parameters and initializing XpressPlug, you can execute it. To do it, invoke the Sdk.start() method.

Create a new class that will implement the protocol, and modify it as a parameter to the start method. Then, invoke the start method.

XPSDK.start(XPSDKStartActionDelegate())

The XPSDKStartActionDelegate class is set as an example for this documentation, which in turn implements the XPStartActionMessageDelegate protocol.

Invoking the start method detailed above notifies the XpressPlug's initialization through a series of callback methods

XPStartActionMessageDelegate {
func onProgressMessageUpdate(message: String) {
}
func onProgressPercentageUpdate(percentage: Int32) {
}
func onFinish()
}
func onFinish(_ entryPoint: String) {
}
func onError() {
}
Callback Methods

Callback methods return different information about XpressPlug and its process status. See the table below to learn more:

onProgressMessageUpdate

Is in charge of returning the XpressPlug's status to the main application.

onProgressPercentageUpdate

XpressPlug needs data connection to update certain functionalities. This function is in charge of showing the download progress for these updates.

XpressPlugNeedsUpdate

Is in charge of displaying if the application needs a more recent version of XpressPlug.

onFinish

Notifies that the start () method was executed correctly.

onError

Notifies that there was an error executing XpressPlug. It displays UA error codes and, in some cases, an error description. To learn more about these errors, go to Mobile Error Codes.

Interacting with XpressPlug

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

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. To interact with these entrypoints, enter the syntax below:

XPSDK.runAction(“NAME_EP”, withParameters:
<DICTIONARY_INBOUNDS>, andDelegate:
<IMPLEMENTATION_XPSDKDelegate>, andViewController: self)

On the runAction name field, enter the name of the functionality as it is set in Studio. Both fields need to match in order to work correctly.

Then, create a dictionary with the entrypoints' input parameters, as shown in the example below:

var <DICTIONARY_INBOUNDS>:[String:String] = [“INPUT_1”:"VALUE_1",
“INPUT_2”:"VALUE_2", “INPUT_2”:"VALUE_3"]

Important

Both the entrypoint name and the parameter name need to match what is set in Studio on the SKD Configuration page of your application.

After this, implement XPSDKDelegate as a parameter for <IMPLEMENTATION_XPSDKDelegate>.

Interacting with the entrypoint returns a series of callback methods you need to complete. See the code and table below for more information on how to complete them.

func onMessage(_ viewController: UIViewController, entryPoint: String?, command: String, result:
XPOutboundParameters) {
}
func onError(_ viewController: UIViewController, entryPoint: String?) {
}
func onUpdateConfigurationRequired(_ viewController: UIViewController, entryPoint: String?) {
}
func onUpdateSdkRequired(_ viewController: UIViewController, entryPoint: String?) {
}
func onClose(_ viewController: UIViewController, entryPoint: String?, result: XPOutboundParameters) {
}

onMessage

Returns the XpressPlug's status to the delegate.

onException

Executes when an error occurs.

onUpdateConfigurationRequired

Displays when the configuration needs to be updated.

onUpdateSdkRequired

Displays when the SDK needs to be updated.

onClose

Displays the result obtained after executing the entrypoints. It receives a dictionary with outbound parameters as the result parameter.