NTP-67678 | Accounts already added error fix (#16303)

This commit is contained in:
Aditya Narayan Malik
2025-05-27 20:33:53 +05:30
committed by GitHub
parent bea5928f9e
commit 961df376bc
7 changed files with 64 additions and 2 deletions

View File

@@ -11,7 +11,8 @@ import com.google.gson.annotations.SerializedName
import com.navi.pay.common.model.view.PspType
data class FetchAccountsResponse(
@SerializedName("bankAccounts") val accounts: List<AccountItemResponse>
@SerializedName("bankAccounts") val accounts: List<AccountItemResponse>,
@SerializedName("accountsAlreadyAdded") val accountsAlreadyAdded: Boolean,
)
data class AccountItemResponse(

View File

@@ -19,6 +19,8 @@ sealed class AccountAdditionBottomSheetType {
data object NoLinkedAccounts : AccountAdditionBottomSheetType()
data object AccountsAlreadyAdded : AccountAdditionBottomSheetType()
data class AddAccountSuccess(
val titleText: String,
val descriptionText: String? = null,

View File

@@ -26,7 +26,9 @@ import com.navi.pay.common.ui.TitleDescriptionWithLinearProgressBar
import com.navi.pay.onboarding.account.add.model.view.AccountAdditionBottomSheetType
import com.navi.pay.onboarding.account.add.model.view.BankUiModel
import com.navi.pay.onboarding.account.common.model.view.AccountAdditionScreenContract
import com.navi.pay.onboarding.common.utils.getDescriptionTextIdForLinkedAccountAlreadyAddedAsPerAccountType
import com.navi.pay.onboarding.common.utils.getDescriptionTextIdForNoLinkedAccountsAsPerAccountType
import com.navi.pay.onboarding.common.utils.getHeaderTextIdForLinkedAccountAlreadyAddedAsPerAccountType
import com.navi.pay.onboarding.common.utils.getHeaderTextIdForNoLinkedAccountsAsPerAccountType
@Composable
@@ -88,6 +90,26 @@ fun AccountAdditionBottomSheetContent(
},
)
}
is AccountAdditionBottomSheetType.AccountsAlreadyAdded -> {
BottomSheetContentWithIconHeaderDescButton(
iconId = CommonR.drawable.ic_exclamation_red_border,
headerTextId =
getHeaderTextIdForLinkedAccountAlreadyAddedAsPerAccountType(
accountType = state.enabledAccountTypes[state.selectedTabIndex]
),
descriptionTextId =
getDescriptionTextIdForLinkedAccountAlreadyAddedAsPerAccountType(
accountType = state.enabledAccountTypes[state.selectedTabIndex]
),
buttonTextId = R.string.np_okay_got_it,
isPrimaryTypeButton = true,
onButtonClicked = {
eventDispatcher(
AccountAdditionScreenContract.Event.OnLinkedAccountsAlreadyAddedCtaClicked
)
},
)
}
is AccountAdditionBottomSheetType.AddAccountSuccess -> {
SuccessBottomSheetContent(
title = bottomSheetType.titleText,

View File

@@ -15,6 +15,7 @@ import androidx.lifecycle.viewModelScope
import androidx.paging.PagingData
import androidx.paging.cachedIn
import com.navi.base.utils.BaseUtils
import com.navi.base.utils.EMPTY
import com.navi.base.utils.ResourceProvider
import com.navi.common.di.CoroutineDispatcherProvider
import com.navi.common.network.ApiConstants.API_LIMIT_EXCEEDED
@@ -306,7 +307,9 @@ constructor(
return@safeLaunch
}
val fetchBankAccountResponse = fetchBankAccountApiResponse.data!!.accounts
val accountsAlreadyAdded = fetchBankAccountApiResponse.data!!.accountsAlreadyAdded
handleFetchedAccounts(
accountsAlreadyAdded = accountsAlreadyAdded,
fetchBankAccountResponse = fetchBankAccountResponse,
selectedBank = selectedBank,
selectedAccountType = selectedAccountType,
@@ -405,8 +408,18 @@ constructor(
fetchBankAccountResponse: List<AccountItemResponse>,
selectedBank: BankUiModel,
selectedAccountType: AccountType,
accountsAlreadyAdded: Boolean,
) {
if (fetchBankAccountResponse.isEmpty()) {
if (accountsAlreadyAdded) {
_bindingProgress.update { 0f }
onSearchQueryChanged(EMPTY)
updateBottomSheetUIState(
showBottomSheet = true,
bottomSheetStateChange = true,
bottomSheetUIState = AccountAdditionBottomSheetType.AccountsAlreadyAdded,
)
return
} else if (fetchBankAccountResponse.isEmpty()) {
_bindingProgress.update { 0f }
updateBottomSheetUIState(
showBottomSheet = true,

View File

@@ -56,6 +56,8 @@ interface AccountAdditionScreenContract :
data object OnZeroLinkedAccountsCtaClicked : Event()
data object OnLinkedAccountsAlreadyAddedCtaClicked : Event()
data class OnUpiGuidelinesContinueClicked(val accountEntity: LinkedAccountEntity) : Event()
data class OnFetchedAccountSelected(

View File

@@ -41,9 +41,25 @@ fun getHeaderTextIdForNoLinkedAccountsAsPerAccountType(accountType: AccountType)
AccountType.UPICREDIT -> R.string.credit_line_no_account_found_header
}
fun getHeaderTextIdForLinkedAccountAlreadyAddedAsPerAccountType(accountType: AccountType): Int =
when (accountType) {
AccountType.SAVINGS -> R.string.np_bank_account_already_linked
AccountType.CREDIT -> R.string.np_rupay_credit_card_already_linked
AccountType.UPICREDIT -> R.string.np_credit_line_account_already_linked
}
fun getDescriptionTextIdForNoLinkedAccountsAsPerAccountType(accountType: AccountType): Int =
when (accountType) {
AccountType.SAVINGS -> R.string.no_banks_found_desc
AccountType.CREDIT -> R.string.credit_card_bank_no_account_found_description
AccountType.UPICREDIT -> R.string.credit_line_no_account_found_description
}
fun getDescriptionTextIdForLinkedAccountAlreadyAddedAsPerAccountType(
accountType: AccountType
): Int =
when (accountType) {
AccountType.SAVINGS -> R.string.np_bank_accounts_already_linked
AccountType.CREDIT -> R.string.np_rupay_credit_card_accounts_already_linked
AccountType.UPICREDIT -> R.string.np_rupay_credit_card_accounts_already_linked
}

View File

@@ -1111,4 +1111,10 @@
<string name="np_check_balance_limit_exceeded">You have reached the daily limit for checking your balance. Please try again after some time.</string>
<string name="np_upi_lite_not_eligible">Amount exceeds UPI Lite limit</string>
<string name="np_upi_lite_transaction_exceeded_description">UPI Lite can be used for payments up to ₹1000 only. Please choose a different payment option to continue.</string>
<string name="np_bank_account_already_linked">Bank account already linked</string>
<string name="np_rupay_credit_card_already_linked">Rupay Credit Card already linked</string>
<string name="np_credit_line_account_already_linked">Credit Line already linked</string>
<string name="np_bank_accounts_already_linked">This bank account linked to your phone number is already added to Navi UPI.</string>
<string name="np_rupay_credit_card_accounts_already_linked">This Rupay Credit Card linked to your phone number is already added to Navi UPI.</string>
<string name="np_credit_line_accounts_already_linked">This Credit Line linked to your phone number is already added to Navi UPI.</string>
</resources>