NTP-30850 | Shiv Natani | republic day celebration (#14626)
This commit is contained in:
@@ -42,7 +42,9 @@ import com.navi.pay.common.ui.FullScreenLottieV2
|
||||
import com.navi.pay.common.ui.NaviPayLottieAnimationV2
|
||||
import com.navi.pay.common.utils.NaviPayMediaPlayer
|
||||
import com.navi.pay.utils.NAVI_PAY_PAYMENT_PROGRESS_LOTTIE
|
||||
import com.navi.pay.utils.NAVI_PAY_PAYMENT_PROGRESS_REPUBLIC_DAY_LOTTIE
|
||||
import com.navi.pay.utils.NAVI_PAY_PAYMENT_SUCCESSFUL_MAIN_LOTTIE_V2
|
||||
import com.navi.pay.utils.NAVI_PAY_PAYMENT_SUCCESSFUL_REPUBLIC_DAY_LOTTIE
|
||||
import com.navi.pay.utils.clearBackStackUpToAndNavigate
|
||||
import com.navi.pay.utils.getDisplayableAmount
|
||||
import com.navi.payment.nativepayment.NaviPaymentAnalyticScreenName
|
||||
@@ -115,6 +117,8 @@ fun TransactionPollingScreen(
|
||||
transactionPollingViewModel.isProgressTextVisible.collectAsStateWithLifecycle()
|
||||
val lottieBackgroundColor by
|
||||
transactionPollingViewModel.lottieBackgroundColor.collectAsStateWithLifecycle()
|
||||
val isRepublicDayExperimentEnabled by
|
||||
transactionPollingViewModel.isRepublicDayExperimentEnabled.collectAsStateWithLifecycle()
|
||||
val discountAdjustedAmount by remember {
|
||||
mutableStateOf(
|
||||
getDiscountAdjustedAmount(amount = paymentAmount, discountValue = redeemedCoinsValue)
|
||||
@@ -244,7 +248,10 @@ fun TransactionPollingScreen(
|
||||
FullScreenLottie(lottieFileName = "gold_processing_transaction_lottie.json")
|
||||
} else {
|
||||
FullScreenLottieV2(
|
||||
lottieFileName = NAVI_PAY_PAYMENT_PROGRESS_LOTTIE,
|
||||
lottieFileName =
|
||||
if (isRepublicDayExperimentEnabled)
|
||||
NAVI_PAY_PAYMENT_PROGRESS_REPUBLIC_DAY_LOTTIE
|
||||
else NAVI_PAY_PAYMENT_PROGRESS_LOTTIE,
|
||||
title =
|
||||
stringResource(
|
||||
id = R.string.payment_in_progress_v2,
|
||||
@@ -256,7 +263,10 @@ fun TransactionPollingScreen(
|
||||
}
|
||||
is PollingScreenState.Success -> {
|
||||
NaviPayLottieAnimationV2(
|
||||
lottieFileName = NAVI_PAY_PAYMENT_SUCCESSFUL_MAIN_LOTTIE_V2,
|
||||
lottieFileName =
|
||||
if (isRepublicDayExperimentEnabled)
|
||||
NAVI_PAY_PAYMENT_SUCCESSFUL_REPUBLIC_DAY_LOTTIE
|
||||
else NAVI_PAY_PAYMENT_SUCCESSFUL_MAIN_LOTTIE_V2,
|
||||
onAnimationEnd = {
|
||||
finishWithData.invoke((screenState as PollingScreenState.Success).data)
|
||||
},
|
||||
|
||||
@@ -23,9 +23,10 @@ import com.navi.common.extensions.or
|
||||
import com.navi.common.model.RequestConfig
|
||||
import com.navi.common.network.models.GenericErrorResponse
|
||||
import com.navi.common.network.models.isSuccessWithData
|
||||
import com.navi.common.utils.toJsonObject
|
||||
import com.navi.common.usecase.LitmusExperimentsUseCase
|
||||
import com.navi.pay.R
|
||||
import com.navi.pay.common.theme.color.NaviPayColor
|
||||
import com.navi.pay.utils.LITMUS_EXPERIMENT_NAVI_REPUBLIC_DAY
|
||||
import com.navi.payment.model.common.SignalPaymentData
|
||||
import com.navi.payment.model.paymentmethod.Amount
|
||||
import com.navi.payment.nativepayment.NaviPaymentAnalyticScreenName
|
||||
@@ -53,7 +54,6 @@ import com.navi.payment.paymentscreen.model.PMSErrorReason
|
||||
import com.navi.payment.paymentscreen.model.PaymentErrorData
|
||||
import com.navi.payment.paymentscreen.model.PaymentErrorDataWrapper
|
||||
import com.navi.payment.paymentscreen.model.TransactionDetails
|
||||
import com.navi.payment.paymentscreen.model.TransactionStatus
|
||||
import com.navi.payment.paymentscreen.model.TransactionStatusRequest
|
||||
import com.navi.payment.paymentscreen.model.TransactionStatusResponseData
|
||||
import com.navi.payment.utils.PaymentSource
|
||||
@@ -80,6 +80,7 @@ constructor(
|
||||
private val paymentDataProvider: PaymentDataProvider,
|
||||
private val transactionStatusUseCase: TransactionStatusUseCase,
|
||||
private val pmsSendMoneyUseCase: PmsSendMoneyUseCase,
|
||||
private val litmusExperimentUseCase: LitmusExperimentsUseCase,
|
||||
) : NaviPaymentBaseVM(NaviPaymentAnalyticScreenName.TRANSACTION_POLLING_SCREEN.screenName) {
|
||||
|
||||
private val token = savedStateHandle.get<String>("token").orEmpty()
|
||||
@@ -115,10 +116,26 @@ constructor(
|
||||
MutableStateFlow<TransactionPollingApiStateV2>(TransactionPollingApiStateV2.Init)
|
||||
val paymentTransactionStatus = _paymentTransactionStatus.asStateFlow()
|
||||
|
||||
private val _isRepublicDayExperimentEnabled = MutableStateFlow(false)
|
||||
val isRepublicDayExperimentEnabled = _isRepublicDayExperimentEnabled.asStateFlow()
|
||||
|
||||
val pollingStartTime = System.currentTimeMillis()
|
||||
|
||||
init {
|
||||
if (naviUpiTransactionInfo.isNull()) pollTransactionStatus() else executeSendMoney()
|
||||
setLitmusExperimentValues()
|
||||
}
|
||||
|
||||
private fun setLitmusExperimentValues() {
|
||||
viewModelScope.safeLaunch(Dispatchers.IO) {
|
||||
_isRepublicDayExperimentEnabled.update {
|
||||
litmusExperimentUseCase
|
||||
.execute(experimentName = LITMUS_EXPERIMENT_NAVI_REPUBLIC_DAY)
|
||||
?.variant
|
||||
?.enabled
|
||||
.orFalse()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun executeSendMoney() {
|
||||
@@ -133,10 +150,6 @@ constructor(
|
||||
transactionDetails =
|
||||
getUpiTransactionDetails(status = FAILURE, txnTimeStamp = txnTimeStamp),
|
||||
)
|
||||
notifyNaviUpiExitWithError(
|
||||
status = TransactionStatus.ERROR.name,
|
||||
error = errorConfig.toNaviPaymentErrorConfig(),
|
||||
)
|
||||
},
|
||||
tstoreOrderId = tstoreOrderReferenceId,
|
||||
screenName = screenName,
|
||||
@@ -162,14 +175,11 @@ constructor(
|
||||
sendMoneyResponse.data?.transactionTimestamp.toString(),
|
||||
),
|
||||
)
|
||||
notifyNaviUpiExitWithError(
|
||||
status = TransactionStatus.ERROR.name,
|
||||
error = errorConfig,
|
||||
)
|
||||
},
|
||||
paymentAmount = paymentAmount.toString(),
|
||||
)
|
||||
}
|
||||
viewModelScope.safeLaunch(Dispatchers.IO) { notifyNaviUpiExit() }
|
||||
}
|
||||
|
||||
private fun pollTransactionStatus(pollingCount: Int = 0) {
|
||||
@@ -356,19 +366,15 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
private fun notifyNaviUpiExitWithError(status: String, error: NaviPaymentErrorConfig?) {
|
||||
coroutineScope.safeLaunch(Dispatchers.IO) {
|
||||
transactionStatusUseCase.fetchOrUpdateTransactionStatusRequest(
|
||||
token = token,
|
||||
transactionStatusRequest =
|
||||
TransactionStatusRequest(
|
||||
transactionReferenceId = request?.transactionReferenceId,
|
||||
event = error.toJsonObject().toString(),
|
||||
screenType = sourceDestination,
|
||||
status = status,
|
||||
),
|
||||
)
|
||||
}
|
||||
private suspend fun notifyNaviUpiExit() {
|
||||
transactionStatusUseCase.fetchOrUpdateTransactionStatusRequest(
|
||||
token = token,
|
||||
transactionStatusRequest =
|
||||
TransactionStatusRequest(
|
||||
transactionReferenceId = request?.transactionReferenceId,
|
||||
screenType = sourceDestination,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun processPaymentSuccess(transactionDetails: TransactionDetails) {
|
||||
|
||||
Reference in New Issue
Block a user