NTP-76015 | Added new flag, migration & query update for savings supported bank (#16729)
This commit is contained in:
@@ -111,7 +111,7 @@ import com.navi.pay.utils.NAVI_PAY_SYNC_TABLE_TRANSACTION_HISTORY_KEY
|
||||
MerchantInfoEntity::class,
|
||||
],
|
||||
views = [SelfTransferView::class],
|
||||
version = 21,
|
||||
version = 22,
|
||||
exportSchema = false,
|
||||
)
|
||||
@TypeConverters(
|
||||
@@ -615,3 +615,18 @@ val NAVI_PAY_APP_DATABASE_MIGRATION_20_21 =
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val NAVI_PAY_APP_DATABASE_MIGRATION_21_22 =
|
||||
object : Migration(startVersion = 21, endVersion = 22) {
|
||||
override fun migrate(db: SupportSQLiteDatabase) {
|
||||
// Migration to add isRegularVersionSupported column in bank table
|
||||
db.execSQL(
|
||||
"ALTER TABLE $NAVI_PAY_DATABASE_BANK_TABLE_NAME ADD COLUMN isRegularVersionSupported TEXT NOT NULL DEFAULT 'A0'"
|
||||
)
|
||||
|
||||
// Delete NAVI_PAY_SYNC_TABLE_BANK_LIST_KEY from sync table to trigger re-sync
|
||||
db.execSQL(
|
||||
"DELETE FROM $NAVI_PAY_DATABASE_SYNC_TABLE_NAME WHERE syncKey = '$NAVI_PAY_SYNC_TABLE_BANK_LIST_KEY'"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_18_19
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_19_20
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_1_2
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_20_21
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_21_22
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_2_3
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_3_4
|
||||
import com.navi.pay.db.NAVI_PAY_APP_DATABASE_MIGRATION_4_5
|
||||
@@ -190,6 +191,7 @@ object NaviPayNetworkModule {
|
||||
NAVI_PAY_APP_DATABASE_MIGRATION_18_19,
|
||||
NAVI_PAY_APP_DATABASE_MIGRATION_19_20,
|
||||
NAVI_PAY_APP_DATABASE_MIGRATION_20_21,
|
||||
NAVI_PAY_APP_DATABASE_MIGRATION_21_22,
|
||||
)
|
||||
.addTypeConverter(MessageContentConverter())
|
||||
.build()
|
||||
|
||||
@@ -36,12 +36,12 @@ interface BankDao {
|
||||
fun getAllCreditLineBanksForQueryString(queryString: String): PagingSource<Int, BankEntity>
|
||||
|
||||
@Query(
|
||||
"SELECT * FROM $NAVI_PAY_DATABASE_BANK_TABLE_NAME WHERE name COLLATE NOCASE LIKE :queryString AND isCreditCardSupported = '' ORDER BY name COLLATE NOCASE ASC"
|
||||
"SELECT * FROM $NAVI_PAY_DATABASE_BANK_TABLE_NAME WHERE name COLLATE NOCASE LIKE :queryString AND isRegularVersionSupported != '' ORDER BY name COLLATE NOCASE ASC"
|
||||
)
|
||||
fun getAllNonCreditCardBanksForQueryString(queryString: String): PagingSource<Int, BankEntity>
|
||||
fun getAllSavingsBanksForQueryString(queryString: String): PagingSource<Int, BankEntity>
|
||||
|
||||
@Query(
|
||||
"SELECT * FROM $NAVI_PAY_DATABASE_BANK_TABLE_NAME WHERE popular = 1 AND isCreditCardSupported = '' ORDER BY name COLLATE NOCASE ASC"
|
||||
"SELECT * FROM $NAVI_PAY_DATABASE_BANK_TABLE_NAME WHERE popular = 1 AND isRegularVersionSupported != '' ORDER BY name COLLATE NOCASE ASC"
|
||||
)
|
||||
suspend fun getAllPopularSavingsBanks(): List<BankEntity>
|
||||
|
||||
|
||||
@@ -30,4 +30,5 @@ data class BankPspData(
|
||||
@SerializedName("isUpiLiteAutoTopUpSupported") val isUpiLiteAutoTopUpSupported: Boolean?,
|
||||
@SerializedName("isUpiBillPaymentSupported") val isUpiBillPaymentSupported: Boolean?,
|
||||
@SerializedName("isEmiConversionSupported") val isEmiConversionSupported: Boolean?,
|
||||
@SerializedName("isRegularVersionSupported") val isRegularVersionSupported: Boolean,
|
||||
)
|
||||
|
||||
@@ -32,4 +32,5 @@ data class BankEntity(
|
||||
@ColumnInfo(name = "isUpiLiteAutoTopUpSupported") val isUpiLiteAutoTopUpSupported: String,
|
||||
@ColumnInfo(name = "isUpiBillPaymentSupported") val isUpiBillPaymentSupported: String,
|
||||
@ColumnInfo(name = "isEmiConversionSupported") val isEmiConversionSupported: String,
|
||||
@ColumnInfo(name = "isRegularVersionSupported") val isRegularVersionSupported: String,
|
||||
)
|
||||
|
||||
@@ -20,4 +20,5 @@ data class BankUiModel(
|
||||
val isCreditLineSupported: Boolean,
|
||||
val isUpiLiteAutoTopUpSupported: Boolean,
|
||||
val isEmiConversionSupported: Boolean,
|
||||
val isRegularVersionSupported: Boolean,
|
||||
)
|
||||
|
||||
@@ -43,10 +43,10 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
fun getAllNonCreditCardBanksForQueryString(queryString: String): Flow<PagingData<BankUiModel>> {
|
||||
fun getAllSavingsBanksForQueryString(queryString: String): Flow<PagingData<BankUiModel>> {
|
||||
val formattedQueryString = "%$queryString%"
|
||||
return Pager(PagingConfig(pageSize = 10)) {
|
||||
bankDao.getAllNonCreditCardBanksForQueryString(queryString = formattedQueryString)
|
||||
bankDao.getAllSavingsBanksForQueryString(queryString = formattedQueryString)
|
||||
}
|
||||
.flow
|
||||
.map { pagingData -> pagingData.map { bankEntity -> bankEntity.toBankUiModel() } }
|
||||
|
||||
@@ -24,11 +24,12 @@ fun BankItemResponse.toBankEntity(): BankEntity {
|
||||
isCreditCardSupported = fetchEligibleTags { it.isCreditCardSupported },
|
||||
isUpiLiteSupported = fetchEligibleTags { it.isUpiLiteSupported },
|
||||
isAadhaarOtpSupported = fetchEligibleTags { it.isAadhaarOtpSupported },
|
||||
isUpiInternationalSupported = fetchEligibleTags { it.isUpiInternationalSupported ?: false },
|
||||
isUpiInternationalSupported = fetchEligibleTags { it.isUpiInternationalSupported },
|
||||
isCreditLineSupported = fetchEligibleTags { it.isCreditLineSupported },
|
||||
isUpiLiteAutoTopUpSupported = fetchEligibleTags { it.isUpiLiteAutoTopUpSupported ?: false },
|
||||
isUpiBillPaymentSupported = fetchEligibleTags { it.isUpiBillPaymentSupported ?: false },
|
||||
isEmiConversionSupported = fetchEligibleTags { it.isEmiConversionSupported ?: false },
|
||||
isUpiLiteAutoTopUpSupported = fetchEligibleTags { it.isUpiLiteAutoTopUpSupported == true },
|
||||
isUpiBillPaymentSupported = fetchEligibleTags { it.isUpiBillPaymentSupported == true },
|
||||
isEmiConversionSupported = fetchEligibleTags { it.isEmiConversionSupported == true },
|
||||
isRegularVersionSupported = fetchEligibleTags { it.isRegularVersionSupported },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -46,6 +47,7 @@ fun BankEntity.toBankUiModel(): BankUiModel {
|
||||
isCreditLineSupported = isCreditLineSupported.isFeatureEnabled(),
|
||||
isUpiLiteAutoTopUpSupported = isUpiLiteAutoTopUpSupported.isFeatureEnabled(),
|
||||
isEmiConversionSupported = isEmiConversionSupported.isFeatureEnabled(),
|
||||
isRegularVersionSupported = isRegularVersionSupported.isFeatureEnabled(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ constructor(
|
||||
.debounce(300)
|
||||
.distinctUntilChanged()
|
||||
.flatMapLatest { query ->
|
||||
bankRepository.getAllNonCreditCardBanksForQueryString(queryString = query)
|
||||
bankRepository.getAllSavingsBanksForQueryString(queryString = query)
|
||||
}
|
||||
.flowOn(coroutineDispatcherProvider.io)
|
||||
.cachedIn(viewModelScope)
|
||||
|
||||
Reference in New Issue
Block a user