Use TruvOrderView to embed an Order, a multi-connection verification workflow that supports multiple data sources and product types.Add to your layout XML:
import com.truv.models.TruvEventPayloadimport com.truv.models.TruvOrderEventimport com.truv.webview.TruvOrderEventsListenerimport com.truv.webview.TruvOrderViewclass MyFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val orderView = view.findViewById<TruvOrderView>(R.id.orderView) orderView.addEventListener(object : TruvOrderEventsListener { override fun onOrderEvent(event: TruvOrderEvent) { when (event) { is TruvOrderEvent.Load -> { // Order page finished loading } is TruvOrderEvent.Close -> { // User closed the Order } is TruvOrderEvent.Success -> { // A task within the Order completed successfully. // The Order is still open at this point — it may show // a success screen or a self-certification screen // depending on the configuration. } is TruvOrderEvent.Completed -> { // The entire Order is complete (all tasks finished) } } } override fun onBridgeEvent(event: TruvEventPayload) { // Fired when the user interacts with the Bridge for a // sub-order (task) within the Order. // Equivalent to TruvEventsListener.onEvent(). } }) orderView.loadOrderUrl(orderToken) }}
import com.truv.models.TruvEventPayloadimport com.truv.models.TruvSuccessPayloadimport com.truv.webview.TruvBridgeViewimport com.truv.webview.TruvEventsListenerclass MyFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { val bridgeView = view.findViewById<TruvBridgeView>(R.id.bridgeView) bridgeView.addEventListener(object : TruvEventsListener { override fun onLoad() { // Bridge finished loading } override fun onClose() { // User closed the Bridge } override fun onSuccess(payload: TruvSuccessPayload) { // Called when the Bridge closes after a successful task. // payload.publicToken — use this to retrieve data server-side. // payload.metadata.taskId — the task identifier. } override fun onEvent(event: TruvEventPayload) { // Lifecycle event — see Bridge Events for all types. } }) bridgeView.loadBridgeTokenUrl(bridgeToken) }}
See Bridge Events for all event types, payloads, and error codes.