9
0

[MWA-5012] MetaPlugin-Integration-Demo aktualisieren

This commit is contained in:
Simon Hagen 2025-08-04 11:08:02 +02:00
parent 183eb583eb
commit 2f66be046b
3 changed files with 42 additions and 13 deletions

View File

@ -4,14 +4,14 @@ plugins {
}
android {
compileSdk 34
compileSdk 35
namespace "de.webidsolutions.metaplugindemo"
defaultConfig {
applicationId "de.webidsolutions.metaplugindemo"
minSdkVersion 28
targetSdkVersion 34
targetSdkVersion 35
versionCode 1
versionName "1.0.0"

View File

@ -15,6 +15,7 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import de.webidsolutions.auto_ident_on_server_product_plugin.AutoIdentOnServerProductPlugin
import de.webidsolutions.eid_on_server_product_plugin.EIdOnServerProductPlugin
import de.webidsolutions.meta_plugin.EMetaPluginFailReason
import de.webidsolutions.meta_plugin.WebIdMetaPlugin
import de.webidsolutions.metaplugindemo.tasks.EApiResult
import de.webidsolutions.metaplugindemo.tasks.MetaPluginVerifyTask
@ -23,12 +24,15 @@ import de.webidsolutions.mobile_app.sdk.WebIdSdkEnvironment
import de.webidsolutions.mobile_app.sdk.domain.VerifyActionIdResult
import de.webidsolutions.mobile_app.sdk.impl.AsyncTaskResultGeneric
import de.webidsolutions.pay_on_server_product_plugin.PayOnServerProductPlugin
import de.webidsolutions.plugin_core.EProductPluginErrors
import de.webidsolutions.plugin_core.IEPluginError
import de.webidsolutions.plugin_core.IProductPluginWebId
import de.webidsolutions.plugin_core.IProductPluginWebId.Companion.getProductPluginResult
import de.webidsolutions.plugin_core.ProductPluginErrorResult
import de.webidsolutions.plugin_core.ProductPluginResult
import de.webidsolutions.plugin_core.WebIdPluginInterruptedException
import de.webidsolutions.video_ident.plugin.videocall.VideoOptionsConfig
import de.webidsolutions.video_ident_product_plugin.EVideoIdentProductPluginFailReasons
import de.webidsolutions.video_ident_product_plugin.VideoIdentProductPlugin
import java.lang.Integer.parseInt
import java.net.URI
@ -41,7 +45,7 @@ private val config = VideoOptionsConfig(
)
// TODO insert your Action id
private const val actionId = "304914809"
private const val actionId = "<9_digit_webid_transaction_id>"
// TODO choose your environment
private val chosenEnvironment: EWebIDEnv = EWebIDEnv.TEST
@ -171,35 +175,59 @@ internal class MainActivity : AppCompatActivity() {
}
private fun onPluginResultCallback(activityResult: ActivityResult) {
var result = ""
var metaPluginActivityResult = activityResult
var result: String?
try {
// Get data and handle potential null case
// If data is null, plugin was interrupted
val data: Intent = activityResult.data ?: throw WebIdPluginInterruptedException()
val pluginResult: ProductPluginResult<*> =
IProductPluginWebId.getProductPluginResult<IEPluginError>(
data, activityResult.resultCode
)
// Retrieve the plugin result and handle any errors
val pluginResult: ProductPluginResult<*> = getProductPluginResult<IEPluginError>(
data, activityResult.resultCode
)
val resultInfo: String? = pluginResult.info
val failReason: ProductPluginErrorResult<*>? = pluginResult.error
// success
// Successful plugin execution
if (failReason == null) {
result = "Success"
if (resultInfo != null) {
result += " $resultInfo"
// your code to handle the successful plugin execution
}
} else {
// failure case
if (failReason.specificResult != null) {
val specificResult: IEPluginError? =
failReason.specificResult as IEPluginError?
result = specificResult.toString()
} else if (failReason.genericResult != null) {
result = failReason.genericResult.toString()
// handle EMetaPluginFailReason
if (specificResult is EMetaPluginFailReason) {
if (specificResult == EMetaPluginFailReason.EID_PENDING_AUTHADA) {
// handle EID_PENDING_AUTHADA as described in code documentation
} else {
// handle all other EMetaPluginFailReason as described in code documentation
}
} else {
// handle EVideoIdentProductPluginFailReasons
if (specificResult is EVideoIdentProductPluginFailReasons) {
if (specificResult == EVideoIdentProductPluginFailReasons.CALL_CENTER_CLOSED) {
// handle CALL_CENTER_CLOSED as described in code documentation
} else {
// handle all other EVideoIdentProductPluginFailReasons errors as described in the code documentation
}
}
}
} else {
if (failReason.genericResult == EProductPluginErrors.UNKNOWN) {
// handle UNKNOWN as described in code documentation
} else {
// handle all other EProductPluginErrors errors as described in the code documentation
}
}
}
} catch (e: WebIdPluginInterruptedException) {
// Handle interruption in your preferred way
writeLog(e.toString())
}
writeLog(result)
}
/* MISC */

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<TextView