NTP-3825 | PS | fix for multi payment attempt for NaviUpi from NPS (#12580)
This commit is contained in:
@@ -29,6 +29,7 @@ import com.navi.pay.onboarding.account.linked.model.network.CheckBalanceResponse
|
||||
import com.navi.pay.onboarding.account.linked.model.network.LinkedAccountsRequest
|
||||
import com.navi.pay.onboarding.account.linked.model.network.LinkedAccountsResponse
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
|
||||
class AccountsRepository
|
||||
@Inject
|
||||
@@ -81,7 +82,14 @@ constructor(
|
||||
accountDao.insertAll(accountEntities = accountEntities)
|
||||
|
||||
fun getAllAccountByStatusAsFlow(status: AccountStatus) =
|
||||
accountDao.getAllAccountByStatusAsFlow(status = status)
|
||||
accountDao.getAllAccountByStatusAsFlow(status = status).distinctUntilChanged { old, new ->
|
||||
if (old.size != new.size) {
|
||||
return@distinctUntilChanged false
|
||||
}
|
||||
val newAccountsSet = new.map { it.copy(id = 0) }.toSet()
|
||||
|
||||
old.all { oldAccount -> newAccountsSet.contains(oldAccount.copy(id = 0)) }
|
||||
}
|
||||
|
||||
suspend fun deleteAllAccounts() = accountDao.deleteAll()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user