NTP-59148 | remove dependency on backend api for recent bills (#16015)
This commit is contained in:
@@ -313,6 +313,15 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun updateRecentBillsEntity() {
|
||||
recentBillsEntity =
|
||||
if (billCategoryEntity.categoryId != CATEGORY_ID_MOBILE_POSTPAID) {
|
||||
getRecentBills()
|
||||
} else {
|
||||
RecentBillsEntity(title = "", bills = listOf())
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteBill(myBillEntity: MyBillEntity) {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val savedBills =
|
||||
@@ -321,22 +330,15 @@ constructor(
|
||||
)
|
||||
|
||||
if (savedBills.isNotEmpty()) {
|
||||
val myBillEntity =
|
||||
savedBills.find { it.customerParams == myBillEntity.customerParams }
|
||||
if (myBillEntity.isNotNull()) {
|
||||
val deleteBillResponse =
|
||||
bbpsCommonRepository.deleteBill(
|
||||
myBillEntity!!.billId,
|
||||
myBillEntity.billId,
|
||||
metricInfo = getBbpsMetricInfo(screenName = naviBbpsVmData.screen.name),
|
||||
)
|
||||
if (deleteBillResponse.isSuccessWithData()) {
|
||||
myBillsSyncJob.refreshBills(naviBbpsVmData.screen.screenName)
|
||||
recentBillsEntity =
|
||||
if (billCategoryEntity.categoryId != CATEGORY_ID_MOBILE_POSTPAID) {
|
||||
getRecentBills()
|
||||
} else {
|
||||
RecentBillsEntity(title = "", bills = listOf())
|
||||
}
|
||||
updateRecentBillsEntity()
|
||||
if (billerListState.value is BillerListState.Loaded) {
|
||||
updateBillerListState(
|
||||
BillerListState.Loaded(
|
||||
@@ -502,7 +504,7 @@ constructor(
|
||||
}
|
||||
|
||||
val deviceLocation = deviceLocationProvider.getDeviceLocation()
|
||||
|
||||
updateRecentBillsEntity()
|
||||
if (cachedBillers.isEmpty() || searchQuery.isNotEmpty()) {
|
||||
billerListResponse =
|
||||
billerListRepository.fetchBillerList(
|
||||
@@ -519,7 +521,7 @@ constructor(
|
||||
naviBbpsAnalytics.onBillersFetched(
|
||||
deviceLocation = deviceLocation,
|
||||
billerGroupsCount = billerListResponse.data?.billerGroups?.size ?: 0,
|
||||
recentBillsCount = billerListResponse.data?.recentBills?.bills?.size ?: 0,
|
||||
recentBillsCount = recentBillsEntity.bills.count(),
|
||||
sessionAttribute = getNaviBbpsSessionAttributes(),
|
||||
source = source,
|
||||
initialSource = initialSource,
|
||||
@@ -578,12 +580,6 @@ constructor(
|
||||
|
||||
val popularBillers =
|
||||
billerGroupItemEntities.flatMap { it.billers.filter { biller -> biller.isPopular } }
|
||||
recentBillsEntity =
|
||||
if (categoryIdClicked != CATEGORY_ID_MOBILE_POSTPAID) {
|
||||
getRecentBills()
|
||||
} else {
|
||||
RecentBillsEntity(title = "", bills = listOf())
|
||||
}
|
||||
updateBillerListState(
|
||||
BillerListState.Loaded(
|
||||
recentBills = recentBillsEntity,
|
||||
|
||||
@@ -10,28 +10,7 @@ package com.navi.bbps.feature.billerlist.model.network
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class BillerListResponse(
|
||||
@SerializedName("recentBills") val recentBills: RecentBillItemResponse?,
|
||||
@SerializedName("billerGroups") val billerGroups: List<BillerGroupItemResponse>?,
|
||||
)
|
||||
|
||||
data class RecentBillItemResponse(
|
||||
@SerializedName("title") val title: String?,
|
||||
@SerializedName("bills") val bills: List<BillItemResponse>?,
|
||||
)
|
||||
|
||||
data class BillItemResponse(
|
||||
@SerializedName("billerId") val billerId: String,
|
||||
@SerializedName("billerName") val billerName: String,
|
||||
@SerializedName("billerLogoUrl") val billerLogoUrl: String?,
|
||||
@SerializedName("status") val status: String?,
|
||||
@SerializedName("isAdhoc") val isAdhoc: Boolean,
|
||||
@SerializedName("paymentAmountExactness") val paymentAmountExactness: String,
|
||||
@SerializedName("lastPaidOn") val lastPaidOn: String?,
|
||||
@SerializedName("lastPaidAmount") val lastPaidAmount: String?,
|
||||
@SerializedName("isConsentProvided") val isConsentProvided: Boolean?,
|
||||
@SerializedName("isConsentRequired") val isConsentRequired: Boolean?,
|
||||
@SerializedName("primaryCustomerParam") val primaryCustomerParam: String,
|
||||
@SerializedName("customerParams") val customerParams: Map<String, String>,
|
||||
@SerializedName("billerGroups") val billerGroups: List<BillerGroupItemResponse>?
|
||||
)
|
||||
|
||||
data class BillerGroupItemResponse(
|
||||
|
||||
Reference in New Issue
Block a user