NTP-2564 | Sohan Reddy | Dynamic X-Target handling for rewards apis. (#12246)
Co-authored-by: Kishan Kumar <kishan.kumar@navi.com>
This commit is contained in:
committed by
GitHub
parent
2682c4d387
commit
831a78e3dc
@@ -11,6 +11,9 @@ import com.navi.coin.models.model.TransactionHistoryResponse
|
||||
import com.navi.coin.network.RetrofitService
|
||||
import com.navi.coin.utils.constant.Constants.SCREENS.TRANSACTION_HISTORY_CASH_SCREEN_NAME
|
||||
import com.navi.coin.utils.constant.Constants.SCREENS.TRANSACTION_HISTORY_COINS_SCREEN_NAME
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.REWARDS_LEDGER_HISTORY_HEADER
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.SHAREABLE_DETAILS_HEADER
|
||||
import com.navi.common.forge.model.ScreenDefinition
|
||||
import com.navi.common.model.ModuleNameV2
|
||||
import com.navi.common.network.models.RepoResult
|
||||
@@ -74,9 +77,11 @@ constructor(
|
||||
pageNo: Int,
|
||||
pageSize: Int
|
||||
): RepoResult<TransactionHistoryResponse> {
|
||||
var target = FirebaseRemoteConfigHelper.getString(REWARDS_LEDGER_HISTORY_HEADER)
|
||||
if (target.isEmpty()) target = ModuleNameV2.REWARDS.name
|
||||
return responseHandler.handleResponse(
|
||||
retrofitService.getRewardsTransactions(
|
||||
target = ModuleNameV2.REWARDS.name,
|
||||
target = target,
|
||||
pageNumber = pageNo.toString(),
|
||||
pageSize = pageSize.toString()
|
||||
)
|
||||
@@ -84,8 +89,8 @@ constructor(
|
||||
}
|
||||
|
||||
suspend fun fetchUserData(): RepoResult<ReferralContactList> {
|
||||
return responseHandler.handleResponse(
|
||||
retrofitService.getUserData(target = ModuleNameV2.REWARDS.name)
|
||||
)
|
||||
var target = FirebaseRemoteConfigHelper.getString(SHAREABLE_DETAILS_HEADER)
|
||||
if (target.isEmpty()) target = ModuleNameV2.REWARDS.name
|
||||
return responseHandler.handleResponse(retrofitService.getUserData(target = target))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ package com.navi.coin.repo.repository
|
||||
import com.navi.coin.models.model.ScratchCardHistoryResponse
|
||||
import com.navi.coin.network.RetrofitService
|
||||
import com.navi.coin.utils.constant.Constants.SCREENS.REWARDS_SCRATCH_CARD_SUMMARY_SCREEN_NAME
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.SCRATCH_CARD_HISTORY_HEADER
|
||||
import com.navi.common.forge.model.ScreenDefinition
|
||||
import com.navi.common.model.ModuleNameV2
|
||||
import com.navi.common.network.models.RepoResult
|
||||
@@ -44,9 +46,11 @@ constructor(
|
||||
pageNo: Int,
|
||||
pageSize: Int
|
||||
): RepoResult<ScratchCardHistoryResponse> {
|
||||
var target = FirebaseRemoteConfigHelper.getString(SCRATCH_CARD_HISTORY_HEADER)
|
||||
if (target.isEmpty()) target = ModuleNameV2.REWARDS.name
|
||||
return responseHandler.handleResponse(
|
||||
retrofitService.fetchScratchCardHistoryList(
|
||||
target = ModuleNameV2.REWARDS.name,
|
||||
target = target,
|
||||
pageNumber = pageNo.toString(),
|
||||
pageSize = pageSize.toString()
|
||||
)
|
||||
|
||||
@@ -207,6 +207,15 @@ object FirebaseRemoteConfigHelper {
|
||||
|
||||
const val RETRY_INTERCEPTOR_ENABLED = "RETRY_INTERCEPTOR_ENABLED"
|
||||
|
||||
// Rewards X-target migration configs
|
||||
// TODO will remove these in future
|
||||
const val SHAREABLE_DETAILS_HEADER = "SHAREABLE_DETAILS_HEADER"
|
||||
const val REWARD_INFO_HEADER = "REWARD_INFO_HEADER"
|
||||
const val REWARD_INFO_OBJECTIVE_HEADER = "REWARD_INFO_OBJECTIVE_HEADER"
|
||||
const val REWARDS_LEDGER_HISTORY_HEADER = "REWARDS_LEDGER_HISTORY_HEADER"
|
||||
const val SCRATCH_CARD_HISTORY_HEADER = "SCRATCH_CARD_HISTORY_HEADER"
|
||||
const val SCRATCH_CARD_SCRATCHING_HEADER = "SCRATCH_CARD_SCRATCHING_HEADER"
|
||||
|
||||
private fun getFirebaseRemoteConfig(): FirebaseRemoteConfig {
|
||||
val remoteConfig = Firebase.remoteConfig
|
||||
val configSettings = remoteConfigSettings {
|
||||
|
||||
@@ -574,4 +574,28 @@
|
||||
<key>NAVI_PAY_BANK_LOGOS_V2_URL</key>
|
||||
<value>https://public-assets.prod.navi-pay.in/bank-logos-v2/bankIdentifier.png</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>SHAREABLE_DETAILS_HEADER</key>
|
||||
<value>REWARDS</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>REWARD_INFO_HEADER</key>
|
||||
<value>REWARDS</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>REWARD_INFO_OBJECTIVE_HEADER</key>
|
||||
<value>REWARDS</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>REWARDS_LEDGER_HISTORY_HEADER</key>
|
||||
<value>REWARDS</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>SCRATCH_CARD_HISTORY_HEADER</key>
|
||||
<value>REWARDS</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>SCRATCH_CARD_SCRATCHING_HEADER</key>
|
||||
<value>REWARDS</value>
|
||||
</entry>
|
||||
</defaultsMap>
|
||||
@@ -7,8 +7,11 @@
|
||||
|
||||
package com.navi.rr.scratchcard.repo
|
||||
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.REWARD_INFO_HEADER
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.REWARD_INFO_OBJECTIVE_HEADER
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.SCRATCH_CARD_SCRATCHING_HEADER
|
||||
import com.navi.common.forge.model.ScreenDefinition
|
||||
import com.navi.common.model.ModuleName
|
||||
import com.navi.common.model.ModuleNameV2
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.utils.Constants.GZIP
|
||||
@@ -30,23 +33,29 @@ constructor(
|
||||
product: String,
|
||||
objective: String
|
||||
): RepoResult<ScratchCardNudgeResponse> {
|
||||
var target = FirebaseRemoteConfigHelper.getString(REWARD_INFO_OBJECTIVE_HEADER)
|
||||
if (target.isEmpty()) target = ModuleNameV2.REWARDS.name
|
||||
return responseHandler.handleResponse(
|
||||
retrofitService.getNudgeRewardObjective(
|
||||
product = product,
|
||||
objective = objective,
|
||||
target = ModuleName.REWARDS.name
|
||||
target = target
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun getNudgeRewardInfo(eventId: String): RepoResult<ScratchCardResponse> {
|
||||
var target = FirebaseRemoteConfigHelper.getString(REWARD_INFO_HEADER)
|
||||
if (target.isEmpty()) target = ModuleNameV2.REWARDS.name
|
||||
return responseHandler.handleResponse(
|
||||
retrofitService.getNudgeRewardInfo(eventId = eventId, target = ModuleName.REWARDS.name)
|
||||
retrofitService.getNudgeRewardInfo(eventId = eventId, target = target)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun putScratchCompleted(requestId: String) {
|
||||
retrofitService.putScratchCompleted(target = ModuleName.REWARDS.name, requestId)
|
||||
var target = FirebaseRemoteConfigHelper.getString(SCRATCH_CARD_SCRATCHING_HEADER)
|
||||
if (target.isEmpty()) target = ModuleNameV2.REWARDS.name
|
||||
retrofitService.putScratchCompleted(target = target, requestId)
|
||||
}
|
||||
|
||||
suspend fun fetchScratchCardTemplate(): RepoResult<ScreenDefinition> {
|
||||
|
||||
Reference in New Issue
Block a user