NTP-60662 | Vedant Aggarwal | Delayed Validate VPA fix (#16083)
This commit is contained in:
@@ -19,6 +19,7 @@ import com.navi.pay.common.model.network.ValidateVpaRequest
|
||||
import com.navi.pay.common.model.network.ValidateVpaResponse
|
||||
import com.navi.pay.common.model.view.NaviPayFlowType
|
||||
import com.navi.pay.common.model.view.NaviPaySessionHelper
|
||||
import com.navi.pay.common.model.view.PspType
|
||||
import com.navi.pay.common.repository.CommonRepository
|
||||
import com.navi.pay.common.setup.NaviPayCustomerStatusHandler
|
||||
import com.navi.pay.common.utils.getMetricInfo
|
||||
@@ -64,16 +65,25 @@ constructor(
|
||||
naviPayAnalytics.onValidateVpaStart(
|
||||
naviPaySessionAttributes = naviPaySessionHelper.getNaviPaySessionAttributes()
|
||||
)
|
||||
if (!skipCustomerOnboardingCheck && !isCustomerOnboardedOnAnySupportedPsp(screenName)) {
|
||||
val isCustomerExists = isCustomerExistsOnAnySupportedPsp(screenName)
|
||||
if (!skipCustomerOnboardingCheck && !isCustomerExists) {
|
||||
naviPayAnalytics.onValidateVpaAbort(naviPaySessionHelper.getNaviPaySessionAttributes())
|
||||
return null // early return
|
||||
}
|
||||
|
||||
var customerOnboardingEntity: NaviPayCustomerOnboardingEntity? = null
|
||||
|
||||
evaluateAndBindPspForVpaValidation(
|
||||
onPspEvaluatedSuccess = { customerOnboardingEntity = it }
|
||||
)
|
||||
if (isCustomerExists) {
|
||||
// TODO: Hardcoded PSP to be removed in multibank
|
||||
customerOnboardingEntity =
|
||||
naviPayCustomerStatusHandler.getCustomerOnboardingEntity(
|
||||
pspType = PspType.JUSPAY_AXIS
|
||||
)
|
||||
} else {
|
||||
evaluateAndBindPspForVpaValidation(
|
||||
onPspEvaluatedSuccess = { customerOnboardingEntity = it }
|
||||
)
|
||||
}
|
||||
|
||||
if (customerOnboardingEntity == null) {
|
||||
return null
|
||||
@@ -225,7 +235,7 @@ constructor(
|
||||
}
|
||||
|
||||
// returns true if customer has done binding or has at least one account in db
|
||||
private suspend fun isCustomerOnboardedOnAnySupportedPsp(screenName: String): Boolean {
|
||||
private suspend fun isCustomerExistsOnAnySupportedPsp(screenName: String): Boolean {
|
||||
val accounts = accountsRepository.getAllAccounts()
|
||||
if (accounts.isNotEmpty()) {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user