Interacción
Después de configurar los parámetros correctos e inicializar XpressPlug, puedes ejecutarlo. Para ello, invoca el método Sdk.start().
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.
Crea una clase nueva que implementará el protocolo y modifícala como un parámetro del método de inicio. Luego, invócalo.
[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); } };