NTP-7179 | Narayan | Send money linked accounts sorted by eligibility (#14417)
This commit is contained in:
committed by
GitHub
parent
c28509ed77
commit
0a0ad9beaa
@@ -1265,6 +1265,13 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun getSortedLinkedAccounts(
|
||||
linkedAccounts: List<LinkedAccountEntity>
|
||||
): List<LinkedAccountEntity> =
|
||||
linkedAccounts.sortedWith(
|
||||
compareByDescending<LinkedAccountEntity> { it.eligibilityState.isAccountEligible }
|
||||
)
|
||||
|
||||
private fun executeAutoSelectionOfBankAccount(preferredAccountId: String?) {
|
||||
if (selectedBankAccount.value.isNotNull()) {
|
||||
return
|
||||
@@ -1381,16 +1388,18 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
if (postProcessedLinkedAccounts.isEmpty()) {
|
||||
val sortedPostProcessedLinkedAccounts = getSortedLinkedAccounts(postProcessedLinkedAccounts)
|
||||
|
||||
if (sortedPostProcessedLinkedAccounts.isEmpty()) {
|
||||
updateBankAccountState(bankAccountsState = BankAccountsState.NoAccountLinked)
|
||||
} else {
|
||||
updateBankAccountState(
|
||||
bankAccountsState =
|
||||
BankAccountsState.AccountList(accounts = postProcessedLinkedAccounts)
|
||||
BankAccountsState.AccountList(accounts = sortedPostProcessedLinkedAccounts)
|
||||
)
|
||||
}
|
||||
|
||||
return postProcessedLinkedAccounts
|
||||
return sortedPostProcessedLinkedAccounts
|
||||
}
|
||||
|
||||
private suspend fun updateAttributesForLinkedAccounts(
|
||||
|
||||
Reference in New Issue
Block a user