NTP-39209 | lite balance consistency logic (#15486)

This commit is contained in:
Shaurya Rehan
2025-03-21 19:33:08 +05:30
committed by GitHub
parent 41ce6c8284
commit 8fe8eb787c
2 changed files with 20 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import com.navi.pay.common.bankuptime.model.view.BankUptimeEntity
import com.navi.pay.common.bankuptime.model.view.BankUptimeStatus
import com.navi.pay.common.bankuptime.repository.BankUptimeRepository
import com.navi.pay.common.model.config.NaviPayDefaultAccountSelectionConfig
import com.navi.pay.common.model.view.PspType
import com.navi.pay.common.theme.color.NaviPayColor
import com.navi.pay.management.common.sendmoney.model.view.EligibilityState
import com.navi.pay.management.lite.util.UpiLiteClHelper
@@ -192,6 +193,12 @@ constructor(
val accountWithActiveUpiLite =
updatedLinkedAccounts.singleOrNull { it.hasActiveLiteAccount }
if (accountWithActiveUpiLite != null) {
val buid =
accountWithActiveUpiLite
.getBuidByPsp(
psp = accountWithActiveUpiLite.activeLiteAccountPsp ?: PspType.JUSPAY_AXIS
)
.orEmpty()
val updatedAccountWithActiveUpiLite =
accountWithActiveUpiLite.copy(
accountId =
@@ -204,7 +211,7 @@ constructor(
bankIconImageUrl = NAVI_PAY_UPI_LITE_LOGO_URL,
maskedAccountNumber = EMPTY,
originalMaskedAccountNumber = EMPTY,
balance = upiLiteBalanceUseCase.execute(),
balance = upiLiteCLHelper.getUpiLiteBalance(buid = buid),
)
// For UPI Lite, Bank uptime will always be UP

View File

@@ -240,6 +240,18 @@ constructor(
liteAccount: UPILiteEntity,
linkedAccountEntity: LinkedAccountEntity,
) {
val buid = linkedAccountEntity.getBuidByPsp(liteAccount.psp).orEmpty()
val upiLiteBoundStatus = upiLiteClHelper.checkUpiLiteBoundStatus(buid = buid)
val liteAccountInfoFromCache =
naviCacheRepository.get(KEY_UPI_LITE_ACTIVE_ACCOUNT_INFO)?.value.orEmpty()
// If CL is bound, load data in cache if empty
if (
upiLiteBoundStatus?.isLiteInSyncedState() == true && liteAccountInfoFromCache.isBlank()
) {
checkIfClIsBoundUpdateBalance(buid = buid)
}
if (!isUserOnboarded(psp = liteAccount.psp)) {
naviPayAnalytics.onDevGenericEvent(
event = "Lite_Sync_execution_started",
@@ -252,8 +264,6 @@ constructor(
)
return
}
val buid = linkedAccountEntity.getBuidByPsp(liteAccount.psp).orEmpty()
val upiLiteBoundStatus = upiLiteClHelper.checkUpiLiteBoundStatus(buid = buid)
if (upiLiteBoundStatus?.status == null) {
naviPayAnalytics.onDevGenericEvent(
event = "Sync_CL_For_Upi_Lite_Failed",