NTP-3108 | fixed bbps status polling and coin banner (#12643)
This commit is contained in:
@@ -127,6 +127,7 @@ const val NAVI_BBPS_BILL_CATEGORY_MAX_COIN_EARN_FLOW = 100
|
||||
const val NAVI_BBPS_PAY_BILL_MIN_COIN_EARN_FLOW = 10
|
||||
const val CASH_REWARDS = "\${cashReward}"
|
||||
const val COINS = "\${coins}"
|
||||
const val CREDIT_CARD_DISCOUNT_PERCENTAGE = "1%"
|
||||
|
||||
// datastore constants
|
||||
const val NAVI_BBPS_COINS = "navi_bbps_coins"
|
||||
|
||||
@@ -52,9 +52,10 @@ data class CoinUtilisationConfig(
|
||||
data class InJourneyRewardsNudgeConfig(
|
||||
@SerializedName("rechargeNudgeSuffix") val rechargeNudgeSuffix: String = "on every recharge",
|
||||
@SerializedName("billPaymentNudgeSuffix") val billPaymentNudgeSuffix: String = "on every bill",
|
||||
@SerializedName("creditCardNudgeSuffix") val creditCardNudgeSuffix: String = "on every bill",
|
||||
@SerializedName("creditCardNudgeSuffix")
|
||||
val creditCardNudgeSuffix: String = "on credit card bill payments",
|
||||
@SerializedName("billPaymentNudgePrefix") val billPaymentNudgePrefix: String = "Win up to",
|
||||
@SerializedName("creditCardNudgePrefix") val creditCardNudgePrefix: String = "Win up to",
|
||||
@SerializedName("billPaymentAmount") val billPaymentAmount: String = "1,000",
|
||||
@SerializedName("creditCardAmount") val creditCardAmount: String = "1,000",
|
||||
@SerializedName("creditCardNudgePrefix") val creditCardNudgePrefix: String = "Flat",
|
||||
@SerializedName("billPaymentAmount") val billPaymentFormattedAmount: String = "1,000",
|
||||
@SerializedName("creditCardAmount") val creditCardFormattedAmount: String = "1%",
|
||||
)
|
||||
|
||||
@@ -669,15 +669,15 @@ constructor(
|
||||
val prefixText =
|
||||
if (isCreditCardCategory) nudgeConfig.creditCardNudgePrefix
|
||||
else nudgeConfig.billPaymentNudgePrefix
|
||||
val amount =
|
||||
if (isCreditCardCategory) nudgeConfig.creditCardAmount
|
||||
else nudgeConfig.billPaymentAmount
|
||||
val formattedAmount =
|
||||
if (isCreditCardCategory) nudgeConfig.creditCardFormattedAmount
|
||||
else nudgeConfig.billPaymentFormattedAmount
|
||||
|
||||
val updatedNudgeDetailEntity =
|
||||
nudgeDetailEntity?.copy(
|
||||
suffixText = suffixText,
|
||||
prefixText = prefixText,
|
||||
amount = amount
|
||||
formattedAmount = formattedAmount
|
||||
)
|
||||
|
||||
_rewardsNudgeDetailEntity.update { updatedNudgeDetailEntity }
|
||||
|
||||
@@ -301,8 +301,8 @@ private fun PendingBillItem(
|
||||
),
|
||||
color = NaviBbpsColor.textPrimary,
|
||||
fontFamily = ttComposeFontFamily,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = getFontWeight(FontWeightEnum.NAVI_HEADLINE_REGULAR),
|
||||
fontSize = 12.sp,
|
||||
fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_DEMI_BOLD),
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
|
||||
@@ -541,8 +541,8 @@ constructor(
|
||||
if (isCreditCardCategory) nudgeConfig.creditCardNudgePrefix
|
||||
else nudgeConfig.billPaymentNudgePrefix
|
||||
val amount =
|
||||
if (isCreditCardCategory) nudgeConfig.creditCardAmount
|
||||
else nudgeConfig.billPaymentAmount
|
||||
if (isCreditCardCategory) nudgeConfig.creditCardFormattedAmount
|
||||
else nudgeConfig.billPaymentFormattedAmount
|
||||
|
||||
val updatedNudgeDetailEntity =
|
||||
nudgeDetailEntity?.copy(
|
||||
|
||||
@@ -324,7 +324,9 @@ fun CustomerDataInputScreen(
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Spacer(Modifier.height(16.dp))
|
||||
CoinUtilisationBottomNudge()
|
||||
CoinUtilisationBottomNudge(
|
||||
categoryId = billCategoryEntity.categoryId
|
||||
)
|
||||
}
|
||||
} else if (billCategoryEntity.categoryId != CATEGORY_ID_CREDIT_CARD) {
|
||||
Column(
|
||||
|
||||
@@ -36,6 +36,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.navi.bbps.R
|
||||
import com.navi.bbps.common.CATEGORY_ID_CREDIT_CARD
|
||||
import com.navi.bbps.common.CREDIT_CARD_DISCOUNT_PERCENTAGE
|
||||
import com.navi.bbps.common.NAVI_BBPS_MAX_COIN_EARN
|
||||
import com.navi.bbps.common.theme.NaviBbpsColor
|
||||
import com.navi.bbps.common.ui.NaviBbpsLottieAnimation
|
||||
@@ -50,14 +51,17 @@ import com.navi.design.theme.ttComposeFontFamily
|
||||
import com.navi.naviwidgets.extensions.NaviText
|
||||
|
||||
@Composable
|
||||
fun CoinUtilisationBottomNudge() {
|
||||
fun CoinUtilisationBottomNudge(categoryId: String) {
|
||||
val isCreditCardCategory = categoryId == CATEGORY_ID_CREDIT_CARD
|
||||
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
NaviText(
|
||||
text = stringResource(id = R.string.bbps_win_up_to),
|
||||
text =
|
||||
if (isCreditCardCategory) stringResource(id = R.string.bbps_flat)
|
||||
else stringResource(id = R.string.bbps_win_up_to),
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 18.sp,
|
||||
fontFamily = ttComposeFontFamily,
|
||||
@@ -71,7 +75,7 @@ fun CoinUtilisationBottomNudge() {
|
||||
modifier = Modifier.size(12.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(2.dp))
|
||||
val descriptionText = coinUtilisationBottomText()
|
||||
val descriptionText = coinUtilisationBottomText(isCreditCardCategory)
|
||||
NaviText(
|
||||
text = descriptionText,
|
||||
fontSize = 12.sp,
|
||||
@@ -97,11 +101,22 @@ fun CoinUtilisationBottomNudge() {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun coinUtilisationBottomText(): AnnotatedString {
|
||||
fun coinUtilisationBottomText(isCreditCardCategory: Boolean): AnnotatedString {
|
||||
val descriptionText = buildAnnotatedString {
|
||||
val fullText =
|
||||
stringResource(id = R.string.bbps_coin_utilisation_description, NAVI_BBPS_MAX_COIN_EARN)
|
||||
val wordToHighlight = NAVI_BBPS_MAX_COIN_EARN
|
||||
if (isCreditCardCategory) {
|
||||
stringResource(
|
||||
id = R.string.bbps_credit_card_bill_coin_utilisation_description,
|
||||
CREDIT_CARD_DISCOUNT_PERCENTAGE
|
||||
)
|
||||
} else {
|
||||
stringResource(
|
||||
id = R.string.bbps_coin_utilisation_description,
|
||||
NAVI_BBPS_MAX_COIN_EARN
|
||||
)
|
||||
}
|
||||
val wordToHighlight =
|
||||
if (isCreditCardCategory) CREDIT_CARD_DISCOUNT_PERCENTAGE else NAVI_BBPS_MAX_COIN_EARN
|
||||
append(fullText)
|
||||
|
||||
addStyle(
|
||||
|
||||
@@ -470,11 +470,15 @@ fun PayBillScreen(
|
||||
|
||||
if (
|
||||
isCoinUtilisationExperimentEnabled &&
|
||||
billCategoryEntity.categoryId != CATEGORY_ID_CREDIT_CARD
|
||||
!(isCreditCardV2Enabled &&
|
||||
billCategoryEntity.categoryId ==
|
||||
CATEGORY_ID_CREDIT_CARD)
|
||||
) {
|
||||
Spacer(Modifier.weight(1f))
|
||||
Spacer(modifier = Modifier.height(32.dp))
|
||||
CoinUtilisationBottomNudge()
|
||||
CoinUtilisationBottomNudge(
|
||||
categoryId = billCategoryEntity.categoryId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,10 @@ constructor(
|
||||
}
|
||||
|
||||
private fun prepareRefundStatusWidgetProperties() {
|
||||
if (billTransactionItemEntity.value.acknowledgementStatus !is TransactionStatus.Failed) {
|
||||
if (
|
||||
billTransactionItemEntity.value.txnStatus is TransactionStatus.Failed ||
|
||||
billTransactionItemEntity.value.acknowledgementStatus !is TransactionStatus.Failed
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -333,12 +336,17 @@ constructor(
|
||||
_navigateToNextScreenFromHelpCta.emit(ctaData)
|
||||
}
|
||||
|
||||
private fun isBillAcknowledgmentPollingRequired(): Boolean {
|
||||
return billTransactionItemEntity.value.txnStatus is TransactionStatus.Success &&
|
||||
isBillAcknowledgmentStatusPending()
|
||||
}
|
||||
|
||||
private suspend fun startTransactionStatusPolling() {
|
||||
// If transaction status is pending, then start transaction status polling
|
||||
// If not, check if bill acknowledgment status is pending, then start bill acknowledgment
|
||||
// status
|
||||
if (!isTransactionStatusPending()) {
|
||||
if (isBillAcknowledgmentStatusPending()) {
|
||||
if (isBillAcknowledgmentPollingRequired()) {
|
||||
startBillAcknowledgmentStatusPolling()
|
||||
}
|
||||
return
|
||||
@@ -423,7 +431,7 @@ constructor(
|
||||
}
|
||||
|
||||
private suspend fun startBillAcknowledgmentStatusPolling() {
|
||||
if (!isBillAcknowledgmentStatusPending()) {
|
||||
if (!isBillAcknowledgmentPollingRequired()) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -448,7 +456,7 @@ constructor(
|
||||
it.copy(acknowledgementStatus = acknowledgementStatus)
|
||||
}
|
||||
|
||||
if (!isBillAcknowledgmentStatusPending()) {
|
||||
if (!isBillAcknowledgmentPollingRequired()) {
|
||||
acknowledgmentStatusPoller.stopPolling()
|
||||
}
|
||||
|
||||
@@ -560,14 +568,18 @@ constructor(
|
||||
|
||||
val billAndPaymentStatus = billTransactionItemEntity?.billTransactionStatus()
|
||||
|
||||
val displayPaymentStatusMessage =
|
||||
billTransactionItemEntity?.acknowledgementStatus == TransactionStatus.Pending
|
||||
val displayPaymentStatusSuccessMessage =
|
||||
billTransactionItemEntity?.txnStatus == TransactionStatus.Success &&
|
||||
billTransactionItemEntity.acknowledgementStatus == TransactionStatus.Pending
|
||||
|
||||
val displayPaymentStatusFailureMessage =
|
||||
billTransactionItemEntity?.txnStatus == TransactionStatus.Failed
|
||||
|
||||
return when (billAndPaymentStatus) {
|
||||
TransactionStatus.Success ->
|
||||
TransactionHistoryDetailItemProperty(
|
||||
bannerTransactionStatusTextId =
|
||||
if (displayPaymentStatusMessage) {
|
||||
if (displayPaymentStatusSuccessMessage) {
|
||||
R.string.bbps_payment_successful
|
||||
} else {
|
||||
when (isRechargeCategory(myBillEntity.categoryId)) {
|
||||
@@ -604,7 +616,7 @@ constructor(
|
||||
null ->
|
||||
TransactionHistoryDetailItemProperty(
|
||||
bannerTransactionStatusTextId =
|
||||
if (displayPaymentStatusMessage) {
|
||||
if (displayPaymentStatusFailureMessage) {
|
||||
R.string.bbps_payment_failed
|
||||
} else {
|
||||
when (isRechargeCategory(myBillEntity.categoryId)) {
|
||||
|
||||
@@ -205,8 +205,10 @@
|
||||
<string name="bbps_discount_coin_earn_nudge_text">Pay & win upto</string>
|
||||
<string name="bbps_win_upto">Win upto</string>
|
||||
<string name="bbps_win_up_to">Win up to</string>
|
||||
<string name="bbps_flat">Flat</string>
|
||||
<string name="bbps_on_every_payment">on every payment</string>
|
||||
<string name="bbps_coin_utilisation_description">%s on paying via Navi UPI</string>
|
||||
<string name="bbps_credit_card_bill_coin_utilisation_description">%s on credit card bill payments</string>
|
||||
<string name="bbps_coin_to_amount_value">10= ₹1</string>
|
||||
<string name="earn_rewards_subtitle">on every bill payment</string>
|
||||
<string name="bbps_zero">ZERO</string>
|
||||
@@ -217,7 +219,7 @@
|
||||
<string name="bbps_get_discount">Get ₹%s OFF on any bill using</string>
|
||||
<string name="bbps_rupee_symbol_x_off">₹%s OFF</string>
|
||||
<string name="bbps_rupee_symbol_x_lowercase_off">₹%s off</string>
|
||||
<string name="bbps_pay_bill_discount_info">>to get up to ₹%s OFF on the next step</string>
|
||||
<string name="bbps_pay_bill_discount_info">to get up to ₹%s OFF on the next step</string>
|
||||
<string name="bbps_pay_bill_dynamic_discount_info">to get ₹%s OFF on the next step</string>
|
||||
<string name="bbps_use_your">Use your</string>
|
||||
<string name="bbps_pay">to pay</string>
|
||||
|
||||
@@ -360,6 +360,9 @@ object Constants {
|
||||
const val RETRY_COUNT = "retry_count"
|
||||
const val INSURANCE_TAB_URL = "HOME/DASHBOARD/Insurance_tab_page"
|
||||
|
||||
// navi bbps litmus experiments keys
|
||||
const val LITMUS_EXPERIMENT_BBPS_REWARD_NUDGES = "NaviBBPS-exp-reward-callout"
|
||||
|
||||
// navi pay litmus experiments keys
|
||||
const val NAVI_PAY_LITMUS_EXPERIMENTS_CACHE_KEY = "NAVI_PAY_LITMUS_EXPERIMENTS_CACHE_KEY"
|
||||
const val LITMUS_EXPERIMENT_NAVIPAY_PPS_TDS = "NaviPay-exp-pps_tds"
|
||||
@@ -370,7 +373,8 @@ object Constants {
|
||||
listOf(
|
||||
LITMUS_EXPERIMENT_NAVIPAY_PPS_TDS,
|
||||
LITMUS_EXPERIMENT_NAVIPAY_REWARD_NUDGES,
|
||||
LITMUS_EXPERIMENT_NAVIPAY_SEND_MONEY
|
||||
LITMUS_EXPERIMENT_NAVIPAY_SEND_MONEY,
|
||||
LITMUS_EXPERIMENT_BBPS_REWARD_NUDGES
|
||||
)
|
||||
|
||||
const val COMPOSABLE_ID = "COMPOSABLE_ID"
|
||||
@@ -386,7 +390,4 @@ object Constants {
|
||||
const val TOGGLE_SWITCH_CHECKED_STATE = "checked"
|
||||
const val AUTHENTICATION_SESSION_TIME_OUT_THRESHOLD = 5 * 60 * 1000L // 5 mins
|
||||
}
|
||||
|
||||
// navi bbps litmus experiments keys
|
||||
const val LITMUS_EXPERIMENT_BBPS_REWARD_NUDGES = "NaviBBPS-exp-reward-callout"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user