NTP-62752 | Shiv Natani | nps amount flicker fix (#16132)

This commit is contained in:
Shiv Natani
2025-05-20 15:54:15 +05:30
committed by GitHub
parent 17e560acbe
commit 0b10b7007c

View File

@@ -254,68 +254,63 @@ constructor(
(it as? S2sPaymentMethodResponse)?.let { paymentMethodResponse ->
updateBaseAnalyticParams(paymentMethodResponse)
_state.update {
var npsScreenState = it as NPSScreenContract.NPSScreenState
// Considering direct NPS flow from pay bill screen as well
val isDiscountPreApplied =
paymentDataProvider.isDiscountPreApplied.value ||
paymentSdkInitParams?.rewardsInfo?.burnDetails?.isOfferApplied.orFalse()
npsScreenState =
npsScreenState.copy(
npsBaseState =
npsScreenState.npsBaseState.copy(
paymentAmount =
paymentMethodResponse.methodDetails?.amount?.value.orZero(),
isCtaLoaderEnabled = false,
),
isLoading = false,
naviCoinState =
npsScreenState.naviCoinState.copy(
coinBurnDetails =
paymentMethodResponse.methodDetails?.coinDetails,
coinEarnBannerDetails =
paymentMethodResponse.methodDetails
?.bannerDetails
?.coinRewards,
isDiscountApplied = isDiscountPreApplied,
showDiscountApplyLottie = false,
showDiscountedAmount = isDiscountPreApplied,
fomoBottomSheetDetails =
paymentMethodResponse.methodDetails?.fomoBottomSheetDetails,
isDiscountPreApplied = isDiscountPreApplied,
rewardsInfoV2 =
if (
paymentSdkInitParams?.rewardsInfo?.isEnabled.orFalse()
) {
naviPaymentAnalytics.onOfferExperienceBannerShown(
rewardsInfoV2 = paymentSdkInitParams?.rewardsInfo,
baseAttributes = baseAnalyticsParams,
)
RewardsInfoV2(
earnDetails =
paymentSdkInitParams?.rewardsInfo?.earnDetails,
burnDetails =
paymentSdkInitParams?.rewardsInfo?.burnDetails,
)
} else null,
discountApplyCount =
if (paymentDataProvider.isDiscountApplyLottieShown.value) 2
else 0,
),
)
npsScreenState =
processAvailablePaymentMethods(
npsScreenState,
paymentMethodResponse.methodDetails
?.availablePaymentInstruments
.orEmpty(),
)
npsScreenState.copy(
npsBaseState =
npsScreenState.npsBaseState.copy(
mainCtaState = getMainCtaState(npsScreenState)
paymentAmount =
paymentMethodResponse.methodDetails?.amount?.value.orZero(),
isCtaLoaderEnabled = false,
)
)
}
_state.update {
val isDiscountPreApplied =
paymentDataProvider.isDiscountPreApplied.value ||
paymentSdkInitParams?.rewardsInfo?.burnDetails?.isOfferApplied.orFalse()
npsScreenState.copy(
naviCoinState =
npsScreenState.naviCoinState.copy(
coinBurnDetails = paymentMethodResponse.methodDetails?.coinDetails,
coinEarnBannerDetails =
paymentMethodResponse.methodDetails?.bannerDetails?.coinRewards,
isDiscountApplied = isDiscountPreApplied,
showDiscountApplyLottie = false,
showDiscountedAmount = isDiscountPreApplied,
fomoBottomSheetDetails =
paymentMethodResponse.methodDetails?.fomoBottomSheetDetails,
isDiscountPreApplied = isDiscountPreApplied,
rewardsInfoV2 =
if (paymentSdkInitParams?.rewardsInfo?.isEnabled.orFalse()) {
naviPaymentAnalytics.onOfferExperienceBannerShown(
rewardsInfoV2 = paymentSdkInitParams?.rewardsInfo,
baseAttributes = baseAnalyticsParams,
)
RewardsInfoV2(
earnDetails =
paymentSdkInitParams?.rewardsInfo?.earnDetails,
burnDetails =
paymentSdkInitParams?.rewardsInfo?.burnDetails,
)
} else null,
discountApplyCount =
if (paymentDataProvider.isDiscountApplyLottieShown.value) 2
else 0,
)
)
}
_state.update {
processAvailablePaymentMethods(
npsScreenState,
paymentMethodResponse.methodDetails?.availablePaymentInstruments.orEmpty(),
)
}
_state.update {
npsScreenState.copy(
npsBaseState =
npsScreenState.npsBaseState.copy(mainCtaState = getMainCtaState()),
isLoading = false,
)
}
handleLiteAccountEligibilityStateForDiscount(
paymentDataProvider.isDiscountPreApplied.value
)