diff --git a/android/src/main/java/com/tsidentityorchestration/TsIdentityOrchestrationModule.kt b/android/src/main/java/com/tsidentityorchestration/TsIdentityOrchestrationModule.kt index 17423c7..dbf0519 100644 --- a/android/src/main/java/com/tsidentityorchestration/TsIdentityOrchestrationModule.kt +++ b/android/src/main/java/com/tsidentityorchestration/TsIdentityOrchestrationModule.kt @@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReadableMap import com.facebook.react.bridge.WritableMap import com.transmit.idosdk.TSIdo import com.transmit.idosdk.TSIdoCallback +import com.transmit.idosdk.TSIdoClientResponseOptionType import com.transmit.idosdk.TSIdoServiceResponse import com.transmit.idosdk.TSIdoStartJourneyOptions @@ -33,15 +34,32 @@ class TsIdentityOrchestrationModule(private val reactContext: ReactApplicationCo @ReactMethod fun submitClientResponse(clientResponseOptionId: String, responseData: ReadableMap, promise: Promise) { - + TSIdo.submitClientResponse( + clientResponseOptionId = convertResponseOptionId(clientResponseOptionId).toString(), + data = responseData as? Map + ) } // region SDK API Conversion private fun convertStartJourneyOptions(rawOptions: ReadableMap?): TSIdoStartJourneyOptions? { - + if (rawOptions == null) return null + + return TSIdoStartJourneyOptions( + additionalParams = rawOptions.getMap("additionalParams") as? Map, + flowId = rawOptions.getString("flowId") + ) } + private fun convertResponseOptionId(rawResponseOptionId: String): TSIdoClientResponseOptionType { + return when (rawResponseOptionId) { + "clientInput" -> TSIdoClientResponseOptionType.ClientInput + "cancel" -> TSIdoClientResponseOptionType.Cancel + "fail" -> TSIdoClientResponseOptionType.Fail + "resend" -> TSIdoClientResponseOptionType.Resend + else -> TSIdoClientResponseOptionType.valueOf(rawResponseOptionId) + } + } // endregion companion object { @@ -49,6 +67,10 @@ class TsIdentityOrchestrationModule(private val reactContext: ReactApplicationCo } } +private fun TSIdo.submitClientResponse(clientResponseOptionId: String, data: Map?) { + +} + private fun TSIdo.startJourney(journeyId: String, options: TSIdoStartJourneyOptions?) { }