TP-45866 | VKYC Bug Fix (#9816)
This commit is contained in:
@@ -1745,7 +1745,7 @@ internal class PLLambdaImpl(
|
||||
when {
|
||||
lambdaResponse.data.isNotNull() -> {
|
||||
lambdaHandler.bridge.executeActions(lambdaApiAction.onSuccess)
|
||||
LambdaState.Success(LambdaResponseType())
|
||||
LambdaState.Loading
|
||||
}
|
||||
|
||||
lambdaResponse.errorBottomSheetStructure.isNotNull() -> {
|
||||
|
||||
@@ -425,7 +425,7 @@ class PLLambdaRepository @Inject constructor(private val retrofitService: APRetr
|
||||
loanApplicationId: String?
|
||||
): ApRepoResult<VKYCAgentAssignedResponse> {
|
||||
val response = retrofitService.fetchVkycAgentAssignedStatus(
|
||||
clientReferenceId = clientReferenceId,
|
||||
clientReferenceId = clientReferenceId.orEmpty(),
|
||||
loanApplicationId = loanApplicationId
|
||||
)
|
||||
logApiResponseEvents(methodName = ::fetchVKYCAgentAssignedStatus.name, response = response)
|
||||
@@ -456,7 +456,7 @@ class PLLambdaRepository @Inject constructor(private val retrofitService: APRetr
|
||||
loanApplicationId: String?
|
||||
): ApRepoResult<VkycCancelStatus> {
|
||||
val response = retrofitService.cancelVKYCCall(
|
||||
clientReferenceId = clientReferenceId,
|
||||
clientReferenceId = clientReferenceId.orEmpty(),
|
||||
loanApplicationId = loanApplicationId,
|
||||
cancelVKYCRequestData = CancelVKYCRequestData(reason = getCancelVKYCCallReason())
|
||||
)
|
||||
|
||||
@@ -76,8 +76,7 @@ enum class ScreenType {
|
||||
DEFAULT,
|
||||
LOADER_SCREEN,
|
||||
ERROR_TRANSIENT_SCREEN,
|
||||
SUCCESS_TRANSIENT_SCREEN,
|
||||
VKYC_WAITING_SCREEN_AGENT_POILING
|
||||
SUCCESS_TRANSIENT_SCREEN
|
||||
}
|
||||
|
||||
enum class ScreenBehaviourType {
|
||||
|
||||
@@ -206,15 +206,15 @@ interface PlLambdaService {
|
||||
@GET("/kyc/vkyc-agent-assigned/{clientReferenceId}")
|
||||
suspend fun fetchVkycAgentAssignedStatus(
|
||||
@Header("X-Target") target: String = ModuleName.KYC_GATEWAY.name,
|
||||
@Path("clientReferenceId") clientReferenceId: String?,
|
||||
@Query("loan_application_id") loanApplicationId: String?
|
||||
@Path("clientReferenceId") clientReferenceId: String,
|
||||
@Query("loan_application_id") loanApplicationId: String? = null
|
||||
): Response<GenericResponse<VKYCAgentAssignedResponse>>
|
||||
|
||||
@POST("/kyc/cancel-vkyc/{clientReferenceId}")
|
||||
suspend fun cancelVKYCCall(
|
||||
@Header("X-Target") target: String = ModuleName.KYC_GATEWAY.name,
|
||||
@Path("clientReferenceId") clientReferenceId: String?,
|
||||
@Query("loan_application_id") loanApplicationId: String?,
|
||||
@Path("clientReferenceId") clientReferenceId: String,
|
||||
@Query("loan_application_id") loanApplicationId: String? = null,
|
||||
@Body cancelVKYCRequestData: CancelVKYCRequestData
|
||||
): Response<GenericResponse<VkycCancelStatus>>
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import com.navi.ap.common.models.ScreenType
|
||||
import com.navi.ap.common.viewmodel.ApplicationPlatformVM
|
||||
import com.navi.ap.network.model.getBottomSheetStructure
|
||||
import com.navi.ap.screens.vkyc.models.action.InitiateVKYCAgentPollingAction
|
||||
import com.navi.ap.screens.vkyc.utils.ErrorType
|
||||
import com.navi.ap.screens.vkyc.utils.getVKYCBottomSheetFields
|
||||
import com.navi.ap.screens.vkyc.vm.VKYCViewModel
|
||||
import com.navi.ap.utils.PeriodicTaskScheduler
|
||||
import com.navi.ap.utils.helper.BottomSheetHelper
|
||||
import com.navi.base.utils.orElse
|
||||
import com.navi.common.model.RequestConfig
|
||||
import com.navi.common.utils.Constants
|
||||
@@ -39,7 +39,7 @@ private fun startAgentAssignedPolling(
|
||||
onTimeout = {
|
||||
viewModel?.stopApiPolling()
|
||||
val errorBottomSheetFields =
|
||||
BottomSheetHelper.getGenericErrorBottomSheet(ScreenType.VKYC_WAITING_SCREEN_AGENT_POILING.name)
|
||||
getVKYCBottomSheetFields(ErrorType.VKYC_WAITING_SCREEN_AGENT_POILING_API_TIMEOUT.name)
|
||||
getBottomSheetStructure(errorBottomSheetFields)
|
||||
},
|
||||
maxAttempts = requestConfig?.numOfRetries.orElse(Constants.FORTY),
|
||||
@@ -47,4 +47,4 @@ private fun startAgentAssignedPolling(
|
||||
taskIntervalSeconds = requestConfig?.interval?.toLong().orElse(Constants.FOUR_SECONDS),
|
||||
task = { viewModel?.fetchVkycAgentAssignedStatus() })
|
||||
viewModel?.periodicTaskScheduler?.startTask()
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import com.navi.ap.common.models.ApScreenData
|
||||
import com.navi.ap.common.models.ApScreenDefinitionState
|
||||
import com.navi.ap.common.models.ApScreenDefinitionStructure
|
||||
import com.navi.ap.common.models.NetworkResultState
|
||||
import com.navi.ap.common.models.ScreenType
|
||||
import com.navi.ap.common.ui.ApplicationPlatformActivity
|
||||
import com.navi.ap.common.ui.InitScreenComponent
|
||||
import com.navi.ap.common.ui.composables.ShowShimmerLoader
|
||||
@@ -30,6 +29,7 @@ import com.navi.ap.screens.genericscreen.vm.ApGenericScreenVM
|
||||
import com.navi.ap.screens.vkyc.models.VKYCAgentAssignedResponse
|
||||
import com.navi.ap.screens.vkyc.models.VKYCSettingsData
|
||||
import com.navi.ap.screens.vkyc.utils.AGENT_CONNECTED_TOAST_TIMEOUT
|
||||
import com.navi.ap.screens.vkyc.utils.ErrorType
|
||||
import com.navi.ap.screens.vkyc.utils.HMS_AUTH_TOKEN
|
||||
import com.navi.ap.screens.vkyc.utils.HMS_SDK_SETTINGS_DATA
|
||||
import com.navi.ap.screens.vkyc.utils.HMS_USER_NAME
|
||||
@@ -43,6 +43,7 @@ import com.navi.ap.screens.vkyc.utils.VKYC_AGENT_POLLING_TIMEOUT
|
||||
import com.navi.ap.screens.vkyc.utils.VKYC_AGENT_STATUS
|
||||
import com.navi.ap.screens.vkyc.utils.VKYC_SETTINGS_PREVIEW_PUT_URL
|
||||
import com.navi.ap.screens.vkyc.utils.VKYC_SETTINGS_REFERENCE_ID
|
||||
import com.navi.ap.screens.vkyc.utils.getVKYCBottomSheetFields
|
||||
import com.navi.ap.screens.vkyc.vm.VKYCViewModel
|
||||
import com.navi.ap.utils.PeriodicTaskScheduler
|
||||
import com.navi.ap.utils.constants.AGENT_JOINED
|
||||
@@ -57,7 +58,6 @@ import com.navi.ap.utils.constants.ApNavigationActions
|
||||
import com.navi.ap.utils.constants.CLIENT_REFERENCE_ID
|
||||
import com.navi.ap.utils.constants.DEFAULT_SCREEN_STATE_ID
|
||||
import com.navi.ap.utils.constants.UNDERSCORE_POLL
|
||||
import com.navi.ap.utils.helper.BottomSheetHelper
|
||||
import com.navi.ap.utils.initScreenEvent
|
||||
import com.navi.ap.utils.logApEvent
|
||||
import com.navi.base.utils.orElse
|
||||
@@ -72,7 +72,8 @@ import com.ramcosta.composedestinations.annotation.Destination
|
||||
@Destination
|
||||
@Composable
|
||||
fun VKYCWaitingScreen(
|
||||
activity: ApplicationPlatformActivity, bundle: Bundle? = null,
|
||||
activity: ApplicationPlatformActivity,
|
||||
bundle: Bundle? = null,
|
||||
viewModel: VKYCViewModel = hiltViewModel(),
|
||||
) {
|
||||
val lifeCycleOwner = LocalLifecycleOwner.current
|
||||
@@ -273,7 +274,7 @@ private fun handleVKYAgentAssignedResponseState(
|
||||
errorFields = vkycAgentAssignedResponse.genericErrorBottomSheetFields,
|
||||
queryMap = viewModel.getQueryMap()
|
||||
)
|
||||
onAgentAssignedTimeout(viewModel)
|
||||
showErrorBottomSheet(viewModel, ErrorType.VKYC_WAITING_SCREEN_AGENT_POLLING_API_FAILED.name)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
@@ -287,7 +288,7 @@ private fun startAgentAssignedPolling(
|
||||
viewModel.periodicTaskScheduler = PeriodicTaskScheduler(
|
||||
onTimeout = {
|
||||
logApEvent(eventName = VKYC_AGENT_POLLING_TIMEOUT)
|
||||
onAgentAssignedTimeout(viewModel)
|
||||
showErrorBottomSheet(viewModel, ErrorType.VKYC_WAITING_SCREEN_AGENT_POILING_API_TIMEOUT.name)
|
||||
},
|
||||
maxAttempts = requestConfig?.numOfRetries.orElse(FORTY),
|
||||
initialDelaySeconds = requestConfig?.initialDelay?.toLong().orElse(ONE_SECOND),
|
||||
@@ -296,10 +297,10 @@ private fun startAgentAssignedPolling(
|
||||
viewModel.periodicTaskScheduler?.startTask()
|
||||
}
|
||||
|
||||
private fun onAgentAssignedTimeout(viewModel: VKYCViewModel) {
|
||||
private fun showErrorBottomSheet(viewModel: VKYCViewModel, errorType: String) {
|
||||
viewModel.stopApiPolling()
|
||||
val errorBottomSheetFields =
|
||||
BottomSheetHelper.getGenericErrorBottomSheet(ScreenType.VKYC_WAITING_SCREEN_AGENT_POILING.name)
|
||||
getVKYCBottomSheetFields(errorType)
|
||||
viewModel.setBottomSheetStructure(
|
||||
ApScreenDefinitionStructure(
|
||||
ApScreenData(
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.navi.ap.screens.vkyc.utils
|
||||
|
||||
import com.navi.ap.network.model.getHideBottomSheetAction
|
||||
import com.navi.ap.network.model.getHideBottomSheetAndStartVkycAgentPoll
|
||||
import com.navi.common.CommonLibManager
|
||||
import com.navi.common.R
|
||||
import com.navi.common.network.models.GenericErrorBottomSheetFields
|
||||
import com.navi.common.permission.Permission
|
||||
import com.navi.common.permission.PermissionTypeGranted
|
||||
|
||||
@@ -23,4 +28,47 @@ fun getNetworkQuality(downLinkQuality: Int?): String {
|
||||
}
|
||||
}
|
||||
|
||||
fun getCancelVKYCCallReason(): String = "User has canceled the call"
|
||||
fun getCancelVKYCCallReason(): String = "User has canceled the call"
|
||||
|
||||
|
||||
fun getVKYCBottomSheetFields(errorType: String?) = when (errorType) {
|
||||
ErrorType.VKYC_WAITING_SCREEN_AGENT_POILING_API_TIMEOUT.name -> GenericErrorBottomSheetFields(
|
||||
title =
|
||||
CommonLibManager.application.getString(
|
||||
R.string.taking_longer_time_title
|
||||
),
|
||||
description =
|
||||
CommonLibManager.application.getString(
|
||||
R.string.taking_longer_time_desc
|
||||
),
|
||||
ctaTitle = CommonLibManager.application.getString(com.navi.naviwidgets.R.string.retry_label),
|
||||
ctaAction = getHideBottomSheetAndStartVkycAgentPoll(),
|
||||
isCancellable = false
|
||||
)
|
||||
|
||||
ErrorType.VKYC_WAITING_SCREEN_AGENT_POLLING_API_FAILED.name -> GenericErrorBottomSheetFields(
|
||||
title =
|
||||
CommonLibManager.application.getString(
|
||||
R.string.something_went_wrong
|
||||
),
|
||||
description = CommonLibManager.application.getString(R.string.technical_issue_text),
|
||||
ctaTitle = CommonLibManager.application.getString(com.navi.naviwidgets.R.string.retry_label),
|
||||
ctaAction = getHideBottomSheetAndStartVkycAgentPoll(),
|
||||
isCancellable = false
|
||||
)
|
||||
|
||||
else -> GenericErrorBottomSheetFields(
|
||||
title =
|
||||
CommonLibManager.application.getString(
|
||||
R.string.something_went_wrong
|
||||
),
|
||||
description = CommonLibManager.application.getString(R.string.technical_issue),
|
||||
ctaTitle = CommonLibManager.application.getString(R.string.okay),
|
||||
ctaAction = getHideBottomSheetAction()
|
||||
)
|
||||
}
|
||||
|
||||
enum class ErrorType {
|
||||
VKYC_WAITING_SCREEN_AGENT_POILING_API_TIMEOUT,
|
||||
VKYC_WAITING_SCREEN_AGENT_POLLING_API_FAILED
|
||||
}
|
||||
@@ -91,6 +91,7 @@ class VKYCViewModel @Inject constructor(private val repository: PLLambdaReposito
|
||||
}
|
||||
|
||||
override fun cancelVKYCCall(lambdaApiAction: LambdaApiAction?) {
|
||||
stopApiPolling()
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
_cancelVKYCCall.value = NetworkResultState.Loading()
|
||||
val cancelVKYCResponse = repository.cancelVKYCCall(
|
||||
|
||||
@@ -25,10 +25,12 @@ import com.navi.ap.common.deserializer.ApUiTronActionDeserializer
|
||||
import com.navi.ap.common.deserializer.CustomUiTronDataDeserializer
|
||||
import com.navi.ap.common.deserializer.KYCSDKSettingsDataDeserializer
|
||||
import com.navi.ap.common.models.ApScreenDefinitionStructure
|
||||
import com.navi.ap.common.ui.ApplicationPlatformActivity
|
||||
import com.navi.ap.common.viewmodel.ApplicationPlatformVM
|
||||
import com.navi.ap.common.models.NetworkResultState
|
||||
import com.navi.ap.common.sdk.model.KYCSdkSettingData
|
||||
import com.navi.ap.common.ui.ApplicationPlatformActivity
|
||||
import com.navi.ap.common.viewmodel.ApplicationPlatformVM
|
||||
import com.navi.ap.network.di.APNetworkModule.providesDeserializer
|
||||
import com.navi.ap.network.di.APNetworkModule.providesSerializer
|
||||
import com.navi.ap.network.retrofit.ApRepoResult
|
||||
import com.navi.ap.screens.genericscreen.vm.ApGenericScreenVM
|
||||
import com.navi.ap.utils.constants.APP_FROM_SCREEN_ID
|
||||
@@ -39,7 +41,9 @@ import com.navi.ap.utils.constants.LATITUDE
|
||||
import com.navi.ap.utils.constants.LAYOUT_ID
|
||||
import com.navi.ap.utils.constants.LONGITUDE
|
||||
import com.navi.ap.utils.constants.METHOD_NAME
|
||||
import com.navi.ap.utils.constants.PARENT
|
||||
import com.navi.ap.utils.constants.RESULT
|
||||
import com.navi.ap.utils.constants.STATE_ID
|
||||
import com.navi.ap.utils.constants.STATUS_CODE
|
||||
import com.navi.ap.utils.constants.VIEW_ID
|
||||
import com.navi.ap.utils.constants.WIDGET_ID
|
||||
@@ -66,9 +70,6 @@ import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Response
|
||||
import java.util.Stack
|
||||
import com.navi.ap.network.di.APNetworkModule.providesDeserializer
|
||||
import com.navi.ap.network.di.APNetworkModule.providesSerializer
|
||||
import com.navi.ap.utils.constants.PARENT
|
||||
|
||||
fun bundleToMap(extras: Bundle?): MutableMap<String, String?> {
|
||||
val queryMap = mutableMapOf<String, String?>()
|
||||
@@ -284,7 +285,7 @@ fun appendIndexToWidget(widget: JSONObject, widgetIndex: Int) {
|
||||
}
|
||||
|
||||
is String -> {
|
||||
if ((key == WIDGET_ID || key == LAYOUT_ID || key == VIEW_ID) && value != PARENT) {
|
||||
if ((key == WIDGET_ID || key == LAYOUT_ID || key == VIEW_ID || key == STATE_ID) && value != PARENT) {
|
||||
currentObject.putOpt(key, "${value}_${widgetIndex}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ const val WIDGET_DATA = "widget_data_"
|
||||
const val LAYOUT_ID = "layoutId"
|
||||
const val VIEW_ID = "viewId"
|
||||
const val WIDGET_ID = "widgetId"
|
||||
const val STATE_ID = "stateId"
|
||||
const val PARENT = "parent"
|
||||
const val INVALID_IFSC_CODE = "INVALID_IFSC_CODE"
|
||||
const val SOURCE = "source"
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.navi.ap.network.model.getHideBottomSheetAction
|
||||
import com.navi.ap.network.model.getHideBottomSheetAndRetryGetNextScreen
|
||||
import com.navi.ap.network.retrofit.getApiRetryActions
|
||||
import com.navi.ap.network.retrofit.getApiRetryCtaText
|
||||
import com.navi.ap.network.model.getHideBottomSheetAndStartVkycAgentPoll
|
||||
import com.navi.common.CommonLibManager
|
||||
import com.navi.common.R
|
||||
import com.navi.common.network.models.GenericErrorBottomSheetFields
|
||||
@@ -27,20 +26,6 @@ object BottomSheetHelper {
|
||||
ctaAction = getHideBottomSheetAndRetryGetNextScreen(),
|
||||
isCancellable = false
|
||||
)
|
||||
ScreenType.VKYC_WAITING_SCREEN_AGENT_POILING.name -> GenericErrorBottomSheetFields(
|
||||
title =
|
||||
CommonLibManager.application.getString(
|
||||
R.string.taking_longer_time_title
|
||||
),
|
||||
description =
|
||||
CommonLibManager.application.getString(
|
||||
R.string.taking_longer_time_desc
|
||||
),
|
||||
ctaTitle = CommonLibManager.application.getString(WidgetsR.string.retry_label),
|
||||
ctaAction = getHideBottomSheetAndStartVkycAgentPoll(),
|
||||
isCancellable = false
|
||||
)
|
||||
|
||||
else -> GenericErrorBottomSheetFields(
|
||||
title =
|
||||
CommonLibManager.application.getString(
|
||||
|
||||
@@ -206,5 +206,7 @@
|
||||
<string name="continue_with_the_call">Continue with the call</string>
|
||||
<string name="navi_executive">Navi executive</string>
|
||||
<string name="connected_with">Connected with</string>
|
||||
<string name="technical_issue_text">We are facing a technical issue at this time. Please retry or try again after some time.</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user