NTP-24754 | Fixed field params not getting set for linked account entity (#14814)

This commit is contained in:
Ujjwal Kumar
2025-02-02 17:24:42 +05:30
committed by GitHub
parent 0c2ce61b5d
commit 4843cd32a8
2 changed files with 65 additions and 2 deletions

View File

@@ -142,6 +142,7 @@ import com.navi.pay.onboarding.account.add.model.view.AccountType
import com.navi.pay.onboarding.account.common.model.view.VpaEntity
import com.navi.pay.onboarding.account.common.model.view.VpaStatus
import com.navi.pay.onboarding.account.detail.model.view.LinkedAccountEntity
import com.navi.pay.onboarding.account.detail.model.view.deepCopy
import com.navi.pay.utils.ACTION_PIN_SET
import com.navi.pay.utils.ALL_ENABLED_ACCOUNTS
import com.navi.pay.utils.AMOUNT_MAX_LENGTH
@@ -1536,7 +1537,7 @@ constructor(
if (isPaymentFromLiteAccount) { // For further process we shift to actual accountId
selectedBankAccount =
selectedBankAccount.copy(
selectedBankAccount.deepCopy(
accountId = selectedBankAccount.accountId.substringBefore(UNDERSCORE)
)
}
@@ -2638,7 +2639,7 @@ constructor(
// Payer VPA will be UMN in case of mandate, so getting this from
// collect
// request item.
selectedBankAccount.value?.copy(
selectedBankAccount.value?.deepCopy(
vpaEntityList =
listOf(
VpaEntity(

View File

@@ -107,3 +107,65 @@ data class LinkedAccountEntity(
@IgnoredOnParcel var isArcProtected: Boolean = false
}
fun LinkedAccountEntity.deepCopy(
accountId: String = this.accountId,
bankCode: String = this.bankCode,
bankName: String = this.bankName,
name: String = this.name,
ifsc: String = this.ifsc,
fallbackBankLogoResId: Int = this.fallbackBankLogoResId,
maskedAccountNumber: String = this.maskedAccountNumber,
originalMaskedAccountNumber: String = this.originalMaskedAccountNumber,
accountType: String = this.accountType,
vpaEntityList: List<VpaEntity> = this.vpaEntityList.map { it.copy() },
isMPinSet: Boolean = this.isMPinSet,
mPinLength: String = this.mPinLength,
otpLength: String = this.otpLength,
atmPinLength: String = this.atmPinLength,
isAadhaarConsentProvided: Boolean = this.isAadhaarConsentProvided,
bankIconImageUrl: String = this.bankIconImageUrl,
isAccountPrimary: Boolean = this.isAccountPrimary,
upiLiteInfo: List<UPILiteEntity> = this.upiLiteInfo.map { it.copy() },
balance: String? = this.balance,
accountTypeFormatted: String = this.accountTypeFormatted,
creditLineAllowedMCC: List<String> = this.creditLineAllowedMCC.toList(),
creditLineNotAllowedMCC: List<String> = this.creditLineNotAllowedMCC.toList(),
updatedAt: DateTime? = this.updatedAt,
): LinkedAccountEntity {
return LinkedAccountEntity(
accountId = accountId,
bankCode = bankCode,
bankName = bankName,
name = name,
ifsc = ifsc,
fallbackBankLogoResId = fallbackBankLogoResId,
maskedAccountNumber = maskedAccountNumber,
originalMaskedAccountNumber = originalMaskedAccountNumber,
accountType = accountType,
vpaEntityList = vpaEntityList,
isMPinSet = isMPinSet,
mPinLength = mPinLength,
otpLength = otpLength,
atmPinLength = atmPinLength,
isAadhaarConsentProvided = isAadhaarConsentProvided,
bankIconImageUrl = bankIconImageUrl,
isAccountPrimary = isAccountPrimary,
upiLiteInfo = upiLiteInfo,
balance = balance,
accountTypeFormatted = accountTypeFormatted,
creditLineAllowedMCC = creditLineAllowedMCC,
creditLineNotAllowedMCC = creditLineNotAllowedMCC,
updatedAt = updatedAt,
)
.apply {
eligibilityState = this@deepCopy.eligibilityState.copy()
bankUptimeEntity = this@deepCopy.bankUptimeEntity?.copy()
isDisabled = this@deepCopy.isDisabled
infoMessage = this@deepCopy.infoMessage
creditLineAccSubType = this@deepCopy.creditLineAccSubType
isArcProtected = this@deepCopy.isArcProtected
// lazy params will be calculated on demand
}
}