diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/BillerListViewModel.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/BillerListViewModel.kt index 736b684f13..31bddfba3d 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/BillerListViewModel.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/BillerListViewModel.kt @@ -11,12 +11,14 @@ import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.viewModelScope import com.google.firebase.crashlytics.FirebaseCrashlytics import com.navi.base.utils.BaseUtils +import com.navi.base.utils.EMPTY import com.navi.base.utils.isNotNull import com.navi.base.utils.orFalse import com.navi.bbps.R import com.navi.bbps.common.CATEGORY_ID_CREDIT_CARD import com.navi.bbps.common.CATEGORY_ID_FASTAG import com.navi.bbps.common.CATEGORY_ID_MOBILE_POSTPAID +import com.navi.bbps.common.CATEGORY_ID_MOBILE_PREPAID import com.navi.bbps.common.DATE_TIME_FORMAT_DATE_MONTH_NAME_YEAR import com.navi.bbps.common.MY_NUMBER import com.navi.bbps.common.NaviBbpsAnalytics @@ -27,8 +29,12 @@ import com.navi.bbps.common.model.view.NaviBbpsSessionHelper import com.navi.bbps.common.model.view.NaviPermissionResult import com.navi.bbps.common.repository.BbpsCommonRepository import com.navi.bbps.common.usecase.NaviBbpsConfigUseCase +import com.navi.bbps.common.utils.BillDetailsResponseToEntityMapper +import com.navi.bbps.common.utils.MyBillEntityToBillCategoryEntityMapper +import com.navi.bbps.common.utils.MyBillEntityToBillerDetailsEntityMapper import com.navi.bbps.common.utils.NaviBbpsDateUtils import com.navi.bbps.common.utils.getDefaultConfig +import com.navi.bbps.common.utils.toBillerAdditionalParams import com.navi.bbps.common.viewmodel.NaviBbpsBaseVM import com.navi.bbps.feature.billerlist.model.network.BillerGroupItemResponse import com.navi.bbps.feature.billerlist.model.network.BillerItemResponse @@ -40,13 +46,18 @@ import com.navi.bbps.feature.billerlist.model.view.BillerListBottomSheetType import com.navi.bbps.feature.billerlist.model.view.BillerListState import com.navi.bbps.feature.billerlist.model.view.RecentBillsEntity import com.navi.bbps.feature.category.model.view.BillCategoryEntity +import com.navi.bbps.feature.contactlist.PhoneContactManager import com.navi.bbps.feature.contactlist.model.view.PhoneContactEntity +import com.navi.bbps.feature.customerinput.model.network.BillDetailsResponse import com.navi.bbps.feature.customerinput.model.view.BillerDetailsEntity import com.navi.bbps.feature.destinations.PayBillScreenDestination +import com.navi.bbps.feature.destinations.PrepaidRechargeScreenDestination import com.navi.bbps.feature.mybills.MyBillsSyncJob import com.navi.bbps.feature.mybills.model.view.MyBillEntity import com.navi.bbps.feature.paybill.model.network.PaymentAmountExactness import com.navi.bbps.feature.paybill.model.view.PayBillSource +import com.navi.bbps.feature.prepaidrecharge.model.view.OperatorItemEntity +import com.navi.bbps.feature.prepaidrecharge.model.view.PlanItemEntity import com.navi.common.di.CoroutineDispatcherProvider import com.navi.common.geocoding.DeviceLocationProvider import com.navi.common.geocoding.model.DeviceLocation @@ -94,7 +105,11 @@ constructor( private val deviceLocationProvider: DeviceLocationProvider, private val myBillsSyncJob: MyBillsSyncJob, private val rewardsNudgeEntityFetchUseCase: RewardsNudgeEntityFetchUseCase, - private val naviBbpsSessionHelper: NaviBbpsSessionHelper + private val naviBbpsSessionHelper: NaviBbpsSessionHelper, + private val myBillEntityToBillerDetailsEntityMapper: MyBillEntityToBillerDetailsEntityMapper, + private val myBillEntityToBillCategoryEntityMapper: MyBillEntityToBillCategoryEntityMapper, + private val billDetailsResponseToEntityMapper: BillDetailsResponseToEntityMapper, + private val phoneContactManager: PhoneContactManager ) : NaviBbpsBaseVM(naviBbpsVmData = NaviBbpsVmData(screen = NaviBbpsScreen.NAVI_BBPS_BILLER_LIST)) { private val naviBbpsAnalytics: NaviBbpsAnalytics.BillerList = @@ -249,11 +264,190 @@ constructor( initialValue = false ) + private fun fetchBillDetailsResponse(myBillEntity: MyBillEntity): BillDetailsResponse { + val billerDetails = + myBillEntityToBillerDetailsEntityMapper.mapMyBillEntityToBillerDetailsEntity( + myBillEntity = myBillEntity + ) + + return BillDetailsResponse( + billId = myBillEntity.billId, + billerId = billerDetails.billerId, + referenceId = myBillEntity.unpaidBillDetails?.referenceId.orEmpty(), + amount = myBillEntity.unpaidBillDetails?.amount, + billDate = myBillEntity.unpaidBillDetails?.billDate, + dueDate = myBillEntity.unpaidBillDetails?.dueDate, + billNumber = myBillEntity.unpaidBillDetails?.billNumber, + accountHolderName = myBillEntity.unpaidBillDetails?.accountHolderName, + billerAdditionalParams = + myBillEntity.unpaidBillDetails?.billerAdditionalParams?.map { + it.toBillerAdditionalParams() + } + ) + } + + private suspend fun navigateToNextScreen( + billDetails: BillDetailsResponse, + billerDetails: BillerDetailsEntity, + myBillEntity: MyBillEntity + ) { + val categoryId = myBillEntity.categoryId + if (categoryId == CATEGORY_ID_MOBILE_PREPAID) { + _navigateToNextScreen.emit( + PayBillScreenDestination( + billCategoryEntity = + myBillEntityToBillCategoryEntityMapper.mapMyBillEntityToBillCategoryEntity( + myBillEntity + ), + payBillScreenSource = + PayBillSource.Prepaid( + planItemEntity = + PlanItemEntity( + planName = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("planName") + .orEmpty(), + price = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("price") + .orEmpty(), + validity = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("validity") + .orEmpty(), + talkTime = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("talkTime") + .orEmpty(), + packageDescription = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("packageDescription") + .orEmpty() + ), + billDetailsEntity = + billDetailsResponseToEntityMapper.mapBillDetailsResponseToEntity( + billDetails + ), + operatorItemEntity = + OperatorItemEntity( + operatorLogoUrl = billerDetails.billerLogoUrl, + operatorCode = EMPTY, + operatorName = myBillEntity.billerName, + billerId = billerDetails.billerId + ), + customerParams = myBillEntity.customerParams, + billerId = billerDetails.billerId, + amount = billDetails.amount.orEmpty(), + formattedLastPaidDate = myBillEntity.formattedLastPaidDate, + formattedLastPaidAmount = myBillEntity.formattedLastPaidAmount + ), + phoneNumberDetail = + PhoneContactEntity( + name = + phoneContactManager.getContactNameFromPhoneNumber( + myBillEntity.primaryCustomerParamValue + ), + phoneNumber = myBillEntity.primaryCustomerParamValue, + normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue + ), + isRootScreen = isRootScreen, + source = NaviBbpsScreen.NAVI_BBPS_BILL_CATEGORIES.name, + initialSource = initialSource + ) + ) + } else { + _navigateToNextScreen.emit( + PayBillScreenDestination( + billCategoryEntity = + myBillEntityToBillCategoryEntityMapper.mapMyBillEntityToBillCategoryEntity( + myBillEntity + ), + payBillScreenSource = + PayBillSource.Others( + billerDetailsEntity = billerDetails, + billDetailsEntity = + billDetailsResponseToEntityMapper.mapBillDetailsResponseToEntity( + billDetails + ), + customerParams = myBillEntity.customerParams, + billerId = billerDetails.billerId, + amount = billDetails.amount.orEmpty(), + formattedLastPaidDate = myBillEntity.formattedLastPaidDate, + formattedLastPaidAmount = myBillEntity.formattedLastPaidAmount + ), + phoneNumberDetail = + PhoneContactEntity( + name = + phoneContactManager.getContactNameFromPhoneNumber( + myBillEntity.primaryCustomerParamValue + ), + phoneNumber = myBillEntity.primaryCustomerParamValue, + normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue + ), + isRootScreen = isRootScreen, + source = NaviBbpsScreen.NAVI_BBPS_BILL_CATEGORIES.name, + initialSource = initialSource + ) + ) + } + } + + private fun goToPayBillScreen( + billerDetails: BillerDetailsEntity, + myBillEntity: MyBillEntity, + billResponse: BillDetailsResponse + ) { + viewModelScope.launch(dispatcherProvider.io) { + navigateToNextScreen( + billDetails = billResponse, + billerDetails = billerDetails, + myBillEntity = myBillEntity + ) + } + } + fun onRecentBillItemClicked(myBillEntity: MyBillEntity) { viewModelScope.safeLaunch(dispatcherProvider.io) { - navigateToNextScreen( - preparePayBillScreenDestinationFromRecentBill(myBillEntity = myBillEntity) - ) + val billResponse = fetchBillDetailsResponse(myBillEntity) + val billerDetails = + myBillEntityToBillerDetailsEntityMapper.mapMyBillEntityToBillerDetailsEntity( + myBillEntity = myBillEntity + ) + if ( + myBillEntity.unpaidBillDetails?.planItemDetails.isNullOrEmpty() && + myBillEntity.categoryId == CATEGORY_ID_MOBILE_PREPAID + ) { + _navigateToNextScreen.emit( + PrepaidRechargeScreenDestination( + phoneNumberDetail = + PhoneContactEntity( + name = + phoneContactManager.getContactNameFromPhoneNumber( + myBillEntity.primaryCustomerParamValue + ), + phoneNumber = myBillEntity.primaryCustomerParamValue, + normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue + ), + myBillEntityToBillCategoryEntityMapper.mapMyBillEntityToBillCategoryEntity( + myBillEntity + ), + isRootScreen = isRootScreen, + source = NaviBbpsScreen.NAVI_BBPS_BILL_CATEGORIES.name, + initialSource = initialSource + ) + ) + } else { + goToPayBillScreen( + billerDetails = billerDetails, + myBillEntity = myBillEntity, + billResponse = billResponse + ) + } } } diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/ui/RenderBillerListScreen.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/ui/RenderBillerListScreen.kt index 9160394a8b..f2e6ac9245 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/ui/RenderBillerListScreen.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/billerlist/ui/RenderBillerListScreen.kt @@ -51,12 +51,14 @@ import androidx.compose.ui.unit.sp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.navi.base.utils.isNotNullAndNotEmpty import com.navi.bbps.R +import com.navi.bbps.common.BULLET import com.navi.bbps.common.NaviBbpsAnalytics import com.navi.bbps.common.NaviBbpsDimens import com.navi.bbps.common.theme.NaviBbpsColor import com.navi.bbps.common.ui.BbpsCircleImage import com.navi.bbps.common.ui.ImageWithCircularBackground import com.navi.bbps.common.ui.NaviBbpsLottieAnimation +import com.navi.bbps.common.utils.getDisplayableAmount import com.navi.bbps.customHide import com.navi.bbps.feature.billerlist.BillerListViewModel import com.navi.bbps.feature.billerlist.model.view.BillerGroupItemEntity @@ -387,7 +389,7 @@ fun RecentBillerItem( text = myBillEntity.billerName, fontFamily = ttComposeFontFamily, fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR), - fontSize = 14.sp, + fontSize = 12.sp, color = NaviBbpsColor.textPrimary, lineHeight = 20.sp, maxLines = 1, @@ -399,7 +401,7 @@ fun RecentBillerItem( NaviText( text = primaryCustomerParamValue, fontFamily = ttComposeFontFamily, - fontSize = 14.sp, + fontSize = 12.sp, color = NaviBbpsColor.textPrimary, lineHeight = 20.sp ) @@ -407,13 +409,41 @@ fun RecentBillerItem( Spacer(modifier = Modifier.height(6.dp)) if (isLastPaidDateVisible) { - NaviText( - text = - "${stringResource(id = R.string.bbps_last_paid_on)} ${myBillEntity.formattedLastPaidDate} ", - fontFamily = ttComposeFontFamily, - fontSize = 12.sp, - color = NaviBbpsColor.textTertiary - ) + Row(verticalAlignment = Alignment.CenterVertically) { + if (myBillEntity.unpaidBillDetails?.amount?.isNotEmpty() == true) { + NaviText( + text = + stringResource( + id = R.string.bbps_rupee_symbol_x, + myBillEntity.unpaidBillDetails.amount + .getDisplayableAmount(), + ), + color = NaviBbpsColor.textPrimary, + fontFamily = ttComposeFontFamily, + fontSize = 12.sp, + fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR), + overflow = TextOverflow.Ellipsis + ) + Spacer(modifier = Modifier.width(4.dp)) + NaviText( + text = BULLET, + color = NaviBbpsColor.textPrimary, + fontFamily = ttComposeFontFamily, + fontSize = 12.sp, + fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR) + ) + Spacer(modifier = Modifier.width(4.dp)) + } + NaviText( + text = myBillEntity.unpaidBillWarning, + color = NaviBbpsColor.onSurfaceCritical, + fontFamily = ttComposeFontFamily, + fontSize = 12.sp, + fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR), + overflow = TextOverflow.Ellipsis, + maxLines = 1 + ) + } } } diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ContactListViewModel.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ContactListViewModel.kt index 1683de2bcd..8098b7573a 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ContactListViewModel.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ContactListViewModel.kt @@ -29,13 +29,18 @@ import com.navi.bbps.common.model.view.NaviBbpsSessionHelper import com.navi.bbps.common.model.view.NaviPermissionResult import com.navi.bbps.common.repository.BbpsCommonRepository import com.navi.bbps.common.usecase.NaviBbpsConfigUseCase +import com.navi.bbps.common.utils.BillDetailsResponseToEntityMapper +import com.navi.bbps.common.utils.MyBillEntityToBillCategoryEntityMapper +import com.navi.bbps.common.utils.MyBillEntityToBillerDetailsEntityMapper import com.navi.bbps.common.utils.getDefaultConfig +import com.navi.bbps.common.utils.toBillerAdditionalParams import com.navi.bbps.common.viewmodel.NaviBbpsBaseVM import com.navi.bbps.feature.billerlist.model.view.RecentBillsEntity import com.navi.bbps.feature.category.model.view.BillCategoryEntity import com.navi.bbps.feature.contactlist.model.view.ContactListBottomSheetType import com.navi.bbps.feature.contactlist.model.view.ContactListState import com.navi.bbps.feature.contactlist.model.view.PhoneContactEntity +import com.navi.bbps.feature.customerinput.model.network.BillDetailsResponse import com.navi.bbps.feature.customerinput.model.view.BillerDetailsEntity import com.navi.bbps.feature.destinations.BillerListScreenDestination import com.navi.bbps.feature.destinations.PayBillScreenDestination @@ -43,6 +48,8 @@ import com.navi.bbps.feature.destinations.PrepaidRechargeScreenDestination import com.navi.bbps.feature.mybills.MyBillsSyncJob import com.navi.bbps.feature.mybills.model.view.MyBillEntity import com.navi.bbps.feature.paybill.model.view.PayBillSource +import com.navi.bbps.feature.prepaidrecharge.model.view.OperatorItemEntity +import com.navi.bbps.feature.prepaidrecharge.model.view.PlanItemEntity import com.navi.common.di.CoroutineDispatcherProvider import com.navi.common.model.common.NudgeDetailEntity import com.navi.common.network.models.isSuccessWithData @@ -78,7 +85,11 @@ constructor( private val myBillsSyncJob: MyBillsSyncJob, private val naviBbpsConfigUseCase: NaviBbpsConfigUseCase, private val rewardsNudgeEntityFetchUseCase: RewardsNudgeEntityFetchUseCase, - private val naviBbpsSessionHelper: NaviBbpsSessionHelper + private val naviBbpsSessionHelper: NaviBbpsSessionHelper, + private val phoneContactManager: PhoneContactManager, + private val myBillEntityToBillerDetailsEntityMapper: MyBillEntityToBillerDetailsEntityMapper, + private val myBillEntityToBillCategoryEntityMapper: MyBillEntityToBillCategoryEntityMapper, + private val billDetailsResponseToEntityMapper: BillDetailsResponseToEntityMapper ) : NaviBbpsBaseVM( naviBbpsVmData = NaviBbpsVmData(screen = NaviBbpsScreen.NAVI_BBPS_CONTACT_LIST_SCREEN) @@ -404,53 +415,188 @@ constructor( ) } - fun onRecentBillItemClicked(phoneNumberDetail: PhoneContactEntity, myBillEntity: MyBillEntity) { - viewModelScope.launch(Dispatchers.IO) { - naviBbpsAnalytics.onRecentBillClicked( - myBillEntity = myBillEntity, - billCategoryEntity = billCategoryEntity, - sessionAttribute = getNaviPaySessionAttributes(), - source = source, - initialSource = initialSource + private fun fetchBillDetailsResponse(myBillEntity: MyBillEntity): BillDetailsResponse { + val billerDetails = + myBillEntityToBillerDetailsEntityMapper.mapMyBillEntityToBillerDetailsEntity( + myBillEntity = myBillEntity ) - if (billCategoryEntity.categoryId == CATEGORY_ID_MOBILE_PREPAID) { - updateNextScreenDestinationState( + + return BillDetailsResponse( + billId = myBillEntity.billId, + billerId = billerDetails.billerId, + referenceId = myBillEntity.unpaidBillDetails?.referenceId.orEmpty(), + amount = myBillEntity.unpaidBillDetails?.amount, + billDate = myBillEntity.unpaidBillDetails?.billDate, + dueDate = myBillEntity.unpaidBillDetails?.dueDate, + billNumber = myBillEntity.unpaidBillDetails?.billNumber, + accountHolderName = myBillEntity.unpaidBillDetails?.accountHolderName, + billerAdditionalParams = + myBillEntity.unpaidBillDetails?.billerAdditionalParams?.map { + it.toBillerAdditionalParams() + } + ) + } + + private suspend fun navigateToNextScreen( + billDetails: BillDetailsResponse, + billerDetails: BillerDetailsEntity, + myBillEntity: MyBillEntity + ) { + val categoryId = myBillEntity.categoryId + if (categoryId == CATEGORY_ID_MOBILE_PREPAID) { + _navigateToNextScreen.emit( + PayBillScreenDestination( + billCategoryEntity = + myBillEntityToBillCategoryEntityMapper.mapMyBillEntityToBillCategoryEntity( + myBillEntity + ), + payBillScreenSource = + PayBillSource.Prepaid( + planItemEntity = + PlanItemEntity( + planName = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("planName") + .orEmpty(), + price = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("price") + .orEmpty(), + validity = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("validity") + .orEmpty(), + talkTime = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("talkTime") + .orEmpty(), + packageDescription = + myBillEntity.unpaidBillDetails + ?.planItemDetails + ?.get("packageDescription") + .orEmpty() + ), + billDetailsEntity = + billDetailsResponseToEntityMapper.mapBillDetailsResponseToEntity( + billDetails + ), + operatorItemEntity = + OperatorItemEntity( + operatorLogoUrl = billerDetails.billerLogoUrl, + operatorCode = EMPTY, + operatorName = myBillEntity.billerName, + billerId = billerDetails.billerId + ), + customerParams = myBillEntity.customerParams, + billerId = billerDetails.billerId, + amount = billDetails.amount.orEmpty(), + formattedLastPaidDate = myBillEntity.formattedLastPaidDate, + formattedLastPaidAmount = myBillEntity.formattedLastPaidAmount + ), + phoneNumberDetail = + PhoneContactEntity( + name = + phoneContactManager.getContactNameFromPhoneNumber( + myBillEntity.primaryCustomerParamValue + ), + phoneNumber = myBillEntity.primaryCustomerParamValue, + normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue + ), + isRootScreen = isRootScreen, + source = NaviBbpsScreen.NAVI_BBPS_BILL_CATEGORIES.name, + initialSource = initialSource + ) + ) + } else { + _navigateToNextScreen.emit( + PayBillScreenDestination( + billCategoryEntity = + myBillEntityToBillCategoryEntityMapper.mapMyBillEntityToBillCategoryEntity( + myBillEntity + ), + payBillScreenSource = + PayBillSource.Others( + billerDetailsEntity = billerDetails, + billDetailsEntity = + billDetailsResponseToEntityMapper.mapBillDetailsResponseToEntity( + billDetails + ), + customerParams = myBillEntity.customerParams, + billerId = billerDetails.billerId, + amount = billDetails.amount.orEmpty(), + formattedLastPaidDate = myBillEntity.formattedLastPaidDate, + formattedLastPaidAmount = myBillEntity.formattedLastPaidAmount + ), + phoneNumberDetail = + PhoneContactEntity( + name = + phoneContactManager.getContactNameFromPhoneNumber( + myBillEntity.primaryCustomerParamValue + ), + phoneNumber = myBillEntity.primaryCustomerParamValue, + normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue + ), + isRootScreen = isRootScreen, + source = NaviBbpsScreen.NAVI_BBPS_BILL_CATEGORIES.name, + initialSource = initialSource + ) + ) + } + } + + private fun goToPayBillScreen( + billerDetails: BillerDetailsEntity, + myBillEntity: MyBillEntity, + billResponse: BillDetailsResponse + ) { + viewModelScope.launch(dispatcherProvider.io) { + navigateToNextScreen( + billDetails = billResponse, + billerDetails = billerDetails, + myBillEntity = myBillEntity + ) + } + } + + fun onRecentBillItemClicked(phoneNumberDetail: PhoneContactEntity, myBillEntity: MyBillEntity) { + viewModelScope.safeLaunch(dispatcherProvider.io) { + val billResponse = fetchBillDetailsResponse(myBillEntity) + val billerDetails = + myBillEntityToBillerDetailsEntityMapper.mapMyBillEntityToBillerDetailsEntity( + myBillEntity = myBillEntity + ) + if ( + myBillEntity.unpaidBillDetails?.planItemDetails.isNullOrEmpty() && + myBillEntity.categoryId == CATEGORY_ID_MOBILE_PREPAID + ) { + _navigateToNextScreen.emit( PrepaidRechargeScreenDestination( phoneNumberDetail = PhoneContactEntity( - name = phoneNumberDetail.name, - phoneNumber = phoneNumberDetail.phoneNumber, - normalisedPhoneNumber = phoneNumberDetail.normalisedPhoneNumber - ), - billCategoryEntity = - BillCategoryEntity( - categoryId = billCategoryEntity.categoryId, - title = billCategoryEntity.title, - iconUrl = "", - searchBoxPlaceholderText = "", - billerListStateHeading = "", - billerListAllHeading = "" + name = + phoneContactManager.getContactNameFromPhoneNumber( + myBillEntity.primaryCustomerParamValue + ), + phoneNumber = myBillEntity.primaryCustomerParamValue, + normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue ), + myBillEntityToBillCategoryEntityMapper.mapMyBillEntityToBillCategoryEntity( + myBillEntity + ), isRootScreen = isRootScreen, - source = NaviBbpsScreen.NAVI_BBPS_CONTACT_LIST_SCREEN.name, + source = NaviBbpsScreen.NAVI_BBPS_BILL_CATEGORIES.name, initialSource = initialSource ) ) } else { - val billerDetails = - BillerDetailsEntity( - billerId = myBillEntity.billerId, - billerName = myBillEntity.billerName, - billerLogoUrl = myBillEntity.billerLogoUrl, - status = myBillEntity.status, - isAdhoc = myBillEntity.isAdhoc, - fetchOption = EMPTY, - paymentAmountExactness = myBillEntity.paymentAmountExactness - ) - navigateToNextScreen( + goToPayBillScreen( billerDetails = billerDetails, - phoneNumberDetail = phoneNumberDetail, - myBillEntity = myBillEntity + myBillEntity = myBillEntity, + billResponse = billResponse ) } } diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ui/RenderContactListScreen.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ui/RenderContactListScreen.kt index b133e00ead..19d0bfa35e 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ui/RenderContactListScreen.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/contactlist/ui/RenderContactListScreen.kt @@ -37,6 +37,7 @@ import com.google.accompanist.permissions.MultiplePermissionsState import com.navi.base.utils.isNotNullAndNotEmpty import com.navi.bbps.R import com.navi.bbps.clickableDebounce +import com.navi.bbps.common.BULLET import com.navi.bbps.common.MOBILE_NUMBER_LENGTH import com.navi.bbps.common.NaviBbpsDimens import com.navi.bbps.common.model.view.NaviPermissionResult @@ -46,6 +47,7 @@ import com.navi.bbps.common.ui.ContactIconView import com.navi.bbps.common.ui.InputTextFieldWithDescriptionHeader import com.navi.bbps.common.ui.PermissionTile import com.navi.bbps.common.ui.RewardsNudgeWithBg +import com.navi.bbps.common.utils.getDisplayableAmount import com.navi.bbps.feature.contactlist.model.view.ContactListState import com.navi.bbps.feature.contactlist.model.view.PhoneContactEntity import com.navi.bbps.feature.mybills.model.view.MyBillEntity @@ -371,17 +373,41 @@ fun RecentBillerItem( Spacer(modifier = Modifier.height(6.dp)) if (isLastPaidDateVisible) { - NaviText( - text = - stringResource( - id = R.string.bbps_last_recharge_x_amount_on_y_date, - myBillEntity.formattedLastPaidAmount, - myBillEntity.formattedLastPaidDate - ), - fontFamily = ttComposeFontFamily, - fontSize = 12.sp, - color = NaviBbpsColor.textTertiary - ) + Row(verticalAlignment = Alignment.CenterVertically) { + if (myBillEntity.unpaidBillDetails?.amount?.isNotEmpty() == true) { + NaviText( + text = + stringResource( + id = R.string.bbps_rupee_symbol_x, + myBillEntity.unpaidBillDetails.amount + .getDisplayableAmount(), + ), + color = NaviBbpsColor.textPrimary, + fontFamily = ttComposeFontFamily, + fontSize = 12.sp, + fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR), + overflow = TextOverflow.Ellipsis + ) + Spacer(modifier = Modifier.width(4.dp)) + NaviText( + text = BULLET, + color = NaviBbpsColor.textPrimary, + fontFamily = ttComposeFontFamily, + fontSize = 12.sp, + fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR) + ) + Spacer(modifier = Modifier.width(4.dp)) + } + NaviText( + text = myBillEntity.unpaidBillWarning, + color = NaviBbpsColor.onSurfaceCritical, + fontFamily = ttComposeFontFamily, + fontSize = 12.sp, + fontWeight = getFontWeight(FontWeightEnum.NAVI_BODY_REGULAR), + overflow = TextOverflow.Ellipsis, + maxLines = 1 + ) + } } }