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

  • [en] EntryPointName: String for the entrypoint's name.

  • [en] InputParameters: (Map>Key, Value>).

  • [en] OutputKeys: Keys for the output values (Array<String>).

XpressPlugModule.callEntryPoint (entryPointName, inputParameters, outputKeys); 

Nota

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

[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.

[en] See the example below to learn how to call an entrypoint:

 const onPressCallXpressPlug = async () => { 
    clearResults(); 
    try { 
      console.log('---- ReactNative | Calling XpressPlugModule EntryPoint'); 
      const entryPointName = 'I_DOCU_SDK'; 
      const parameters = {userName: userName}; 
      const outputKeys = ['errorCode', 'age']; 
      const result = await XpressPlugModule.callEntryPoint( 
        entryPointName, 
        parameters, 
        outputKeys, 
      ); 
      console.log( 
        `---- ReactNative | XpressPlugModule EntryPoint Result -> errorCode:${result.errorCode}, age: ${result.age}`, 
      ); 
      setResultsTitle('Result:'); 
      setResultCode(result.errorCode); 
      setResultAge(result.age); 
    } catch (e) { 
      console.error(e); 
    } 
  };