Skip to content

Commit

Permalink
MOB-1000 #comment implemented Android API
Browse files Browse the repository at this point in the history
  • Loading branch information
shachartransmit committed May 7, 2024
1 parent 343e1fe commit 2e3fe61
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,22 +34,43 @@ 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<String, Any>
)
}

// region SDK API Conversion

private fun convertStartJourneyOptions(rawOptions: ReadableMap?): TSIdoStartJourneyOptions? {

if (rawOptions == null) return null

return TSIdoStartJourneyOptions(
additionalParams = rawOptions.getMap("additionalParams") as? Map<String, Any>,
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 {
const val NAME = "TsIdentityOrchestration"
}
}

private fun TSIdo.submitClientResponse(clientResponseOptionId: String, data: Map<String, Any>?) {

}

private fun TSIdo.startJourney(journeyId: String, options: TSIdoStartJourneyOptions?) {

}

0 comments on commit 2e3fe61

Please sign in to comment.