NTP-8377 | modify mandate crash fix (#13215)
This commit is contained in:
@@ -127,7 +127,8 @@ fun UpiLiteLoadingStates(
|
||||
RenderAPIResultScreen(
|
||||
lottieFileName = NAVI_PAY_LOADER_V2,
|
||||
titleResId = R.string.deleting_auto_top_up_for_lite,
|
||||
titleFontWeight = FontWeightEnum.NAVI_BODY_DEMI_BOLD
|
||||
titleFontWeight = FontWeightEnum.NAVI_BODY_DEMI_BOLD,
|
||||
showLottieInfiniteTimes = true
|
||||
)
|
||||
}
|
||||
UpiLiteUiState.MANDATE_DELETION_SUCCESSFUL -> {
|
||||
@@ -219,7 +220,8 @@ fun UpiLiteLoadingStates(
|
||||
lottieFileName = NAVI_PAY_AUTO_PAY_LOADER_LOTTIE,
|
||||
titleText =
|
||||
if (isUserOnboarded) titleForOnboardedUser else titleForNonOnboardedUser,
|
||||
titleFontWeight = FontWeightEnum.NAVI_BODY_DEMI_BOLD
|
||||
titleFontWeight = FontWeightEnum.NAVI_BODY_DEMI_BOLD,
|
||||
showLottieInfiniteTimes = true
|
||||
)
|
||||
}
|
||||
UpiLiteUiState.CREATION_EXECUTION_SUCCESS -> {
|
||||
|
||||
@@ -114,6 +114,7 @@ fun ModifyMandateScreen(
|
||||
modifyMandateViewModel.mandateThresholdAmount.collectAsStateWithLifecycle()
|
||||
val showModifyMandateLoaderBeforePinInput by
|
||||
modifyMandateViewModel.showModifyMandateLoaderBeforePinInput.collectAsStateWithLifecycle()
|
||||
val maxTopUpLimit by modifyMandateViewModel.maxTopUpLimit.collectAsStateWithLifecycle()
|
||||
|
||||
BackHandler {
|
||||
if (uiState is ModifyMandateScreenState.MainScreen) {
|
||||
@@ -189,7 +190,8 @@ fun ModifyMandateScreen(
|
||||
newTopUpAmount = newTopUpAmount,
|
||||
onNewTopUpAmountValueChanged =
|
||||
modifyMandateViewModel::onNewTopUpAmountValueChanged,
|
||||
mandateThresholdAmount = mandateThresholdAmount
|
||||
mandateThresholdAmount = mandateThresholdAmount,
|
||||
maxTopUpLimit = maxTopUpLimit
|
||||
)
|
||||
}
|
||||
ModifyMandateScreenState.Success -> {
|
||||
@@ -271,6 +273,7 @@ fun RenderModifyMandateScreen(
|
||||
newTopUpAmount: String,
|
||||
onNewTopUpAmountValueChanged: (String) -> Unit,
|
||||
mandateThresholdAmount: Int,
|
||||
maxTopUpLimit: Int
|
||||
) {
|
||||
Column(modifier = modifier.fillMaxSize()) {
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
@@ -351,7 +354,9 @@ fun RenderModifyMandateScreen(
|
||||
TextFieldDefaults.TextFieldDecorationBox(
|
||||
value = newTopUpAmount,
|
||||
visualTransformation =
|
||||
CurrencyMaskTransformation(amountMaxLength = AMOUNT_MAX_LENGTH),
|
||||
CurrencyMaskTransformation(
|
||||
amountMaxLength = maxTopUpLimit.toString().length
|
||||
),
|
||||
innerTextField = it,
|
||||
singleLine = true,
|
||||
enabled = true,
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.google.gson.reflect.TypeToken
|
||||
import com.navi.base.cache.model.NaviCacheEntity
|
||||
import com.navi.base.cache.repository.NaviCacheRepository
|
||||
import com.navi.base.utils.ResourceProvider
|
||||
import com.navi.base.utils.ZERO_STRING
|
||||
import com.navi.common.R as CommonR
|
||||
import com.navi.common.network.models.isSuccessWithData
|
||||
import com.navi.pay.R
|
||||
@@ -31,6 +32,7 @@ import com.navi.pay.common.utils.DeviceInfoProvider
|
||||
import com.navi.pay.common.utils.NaviPayCommonUtils
|
||||
import com.navi.pay.common.viewmodel.NaviPayBaseVM
|
||||
import com.navi.pay.management.common.sendmoney.model.view.EligibilityState
|
||||
import com.navi.pay.management.common.sendmoney.util.SendMoneyUtils.getValidatedAmountNumber
|
||||
import com.navi.pay.management.lite.models.NaviPayUpiLiteConfig
|
||||
import com.navi.pay.management.lite.util.getLiteMandateMetaDataFromMap
|
||||
import com.navi.pay.management.mandate.model.network.MandateItem
|
||||
@@ -46,6 +48,7 @@ import com.navi.pay.npcicl.CredDataProvider
|
||||
import com.navi.pay.npcicl.NpciRepository
|
||||
import com.navi.pay.npcicl.NpciResult
|
||||
import com.navi.pay.onboarding.account.detail.model.view.LinkedAccountEntity
|
||||
import com.navi.pay.utils.AMOUNT_MAX_LENGTH_AFTER_DECIMAL
|
||||
import com.navi.pay.utils.ConfigKey
|
||||
import com.navi.pay.utils.KEY_UPI_LITE_MANDATE_INFO
|
||||
import com.navi.pay.utils.getDisplayableAmount
|
||||
@@ -143,7 +146,8 @@ constructor(
|
||||
b = maxTopUpLimit.value.toDouble()
|
||||
)
|
||||
.toString()
|
||||
.getDisplayableAmount()
|
||||
.getFormattedAmountWithDecimal()
|
||||
.replace(".00", "") // currencyMaskTransformation handles formatting here
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +217,17 @@ constructor(
|
||||
}
|
||||
|
||||
fun onNewTopUpAmountValueChanged(newTopUpAmountEntered: String) {
|
||||
_newTopUpAmount.update { newTopUpAmountEntered }
|
||||
if (newTopUpAmountEntered.isEmpty() || newTopUpAmountEntered == ZERO_STRING) {
|
||||
_newTopUpAmount.update { "" }
|
||||
} else {
|
||||
_newTopUpAmount.update {
|
||||
getValidatedAmountNumber(
|
||||
text = newTopUpAmountEntered,
|
||||
amountMaxLengthAfterDecimal = AMOUNT_MAX_LENGTH_AFTER_DECIMAL,
|
||||
amountMaxLengthBeforeDecimal = maxTopUpLimit.value.toString().length
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: check if common function can be used
|
||||
|
||||
@@ -383,7 +383,8 @@ fun LinkedAccountDetailScreen(
|
||||
LinkedAccountDetailScreenUIState.MandateDeletionInProgress -> {
|
||||
RenderAPIResultScreen(
|
||||
lottieFileName = NAVI_PAY_LOADER_V2,
|
||||
titleResId = R.string.deleting_auto_top_up_for_lite
|
||||
titleResId = R.string.deleting_auto_top_up_for_lite,
|
||||
showLottieInfiniteTimes = true
|
||||
)
|
||||
}
|
||||
LinkedAccountDetailScreenUIState.MandateDeletionSuccessful -> {
|
||||
|
||||
Reference in New Issue
Block a user