NTP-8931 | Change add for Platform endpoints (#13336)
Signed-off-by: kishan kumar <kishan.kumar@navi.com>
This commit is contained in:
@@ -60,6 +60,7 @@ import com.navi.ap.utils.constants.REASON
|
||||
import com.navi.ap.utils.constants.SCREEN_NAME
|
||||
import com.navi.ap.utils.constants.SCREEN_TYPE
|
||||
import com.navi.ap.utils.constants.SUBMIT_EVENT_HASH_EVENT
|
||||
import com.navi.ap.utils.getMetricInfoForApplicationType
|
||||
import com.navi.ap.utils.helper.BottomSheetHelper
|
||||
import com.navi.ap.utils.helper.PeriodicTaskSchedulerFacade
|
||||
import com.navi.ap.utils.toMap
|
||||
@@ -73,6 +74,7 @@ import com.navi.base.utils.orElse
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.common.constants.API_SUCCESS_CODE
|
||||
import com.navi.common.network.ApiConstants
|
||||
import com.navi.common.network.models.isSuccessWithData
|
||||
import com.navi.common.uitron.model.action.AnalyticsActionV2
|
||||
import com.navi.common.uitron.model.action.AnalyticsActionV2.PredefinedEventProperty
|
||||
import com.navi.common.uitron.model.action.FillApiData
|
||||
@@ -321,7 +323,15 @@ abstract class ApplicationPlatformVM(
|
||||
configVersion = configVersion,
|
||||
backScreenId = handle[APP_PLATFORM_BACK_SCREEN_ID] ?: DEFAULT_SOURCE_SCREEN,
|
||||
backScreenStateId =
|
||||
handle[APP_PLATFORM_BACK_SCREEN_STATE_ID] ?: DEFAULT_SOURCE_SCREEN
|
||||
handle[APP_PLATFORM_BACK_SCREEN_STATE_ID] ?: DEFAULT_SOURCE_SCREEN,
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
|
||||
systemBackAction = response.data?.screenData?.screenStructure?.systemBackCta
|
||||
@@ -395,7 +405,15 @@ abstract class ApplicationPlatformVM(
|
||||
configVersion = configVersion,
|
||||
backScreenId = handle[APP_PLATFORM_BACK_SCREEN_ID] ?: DEFAULT_SOURCE_SCREEN,
|
||||
backScreenStateId =
|
||||
handle[APP_PLATFORM_BACK_SCREEN_STATE_ID] ?: DEFAULT_SOURCE_SCREEN
|
||||
handle[APP_PLATFORM_BACK_SCREEN_STATE_ID] ?: DEFAULT_SOURCE_SCREEN,
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
|
||||
_effects.emit(
|
||||
@@ -435,7 +453,15 @@ abstract class ApplicationPlatformVM(
|
||||
applicationId = applicationId,
|
||||
applicationType = applicationType,
|
||||
verticalType = verticalType,
|
||||
applicationHashRequestBody = applicationHashRequestBody
|
||||
applicationHashRequestBody = applicationHashRequestBody,
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
if (response.errors.isNotNull() || response.error.isNotNull()) {
|
||||
handleAction(
|
||||
@@ -474,7 +500,15 @@ abstract class ApplicationPlatformVM(
|
||||
applicationId = applicationId,
|
||||
applicationType = applicationType,
|
||||
verticalType = verticalType,
|
||||
fillApplicationRequestBody = fillApplicationRequestBody
|
||||
fillApplicationRequestBody = fillApplicationRequestBody,
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
|
||||
shouldPollStrategyUseCase.execute(
|
||||
@@ -542,6 +576,14 @@ abstract class ApplicationPlatformVM(
|
||||
currentScreenState =
|
||||
getQueryMap()[APP_PLATFORM_SCREEN_STATE_ID] ?: DEFAULT_SCREEN_STATE_ID,
|
||||
idempotencyKey = idempotencyKey,
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
|
||||
shouldPollStrategyUseCase.execute(
|
||||
@@ -604,7 +646,15 @@ abstract class ApplicationPlatformVM(
|
||||
repository.createApplicationAndGetCta(
|
||||
applicationType = applicationType,
|
||||
verticalType = verticalType,
|
||||
applicationRequestBody = applicationRequestBody
|
||||
applicationRequestBody = applicationRequestBody,
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
|
||||
shouldPollStrategyUseCase.execute(
|
||||
@@ -719,7 +769,16 @@ abstract class ApplicationPlatformVM(
|
||||
verticalType =
|
||||
queryMap[APP_PLATFORM_VERTICAL_TYPE]
|
||||
?: queryMap[APP_PLATFORM_APPLICATION_TYPE].orEmpty(),
|
||||
screenId = this@ApplicationPlatformVM.queryMap[APP_PLATFORM_SCREEN_ID].orEmpty()
|
||||
screenId =
|
||||
this@ApplicationPlatformVM.queryMap[APP_PLATFORM_SCREEN_ID].orEmpty(),
|
||||
metricInfo =
|
||||
getMetricInfoForApplicationType(
|
||||
applicationType =
|
||||
handle.get<String>(APP_PLATFORM_APPLICATION_TYPE).orEmpty(),
|
||||
screenName = handle.get<String>(APP_PLATFORM_SCREEN_ID).orEmpty()
|
||||
) {
|
||||
it.isSuccessWithData()
|
||||
}
|
||||
)
|
||||
_ctaResponseState.value =
|
||||
when {
|
||||
|
||||
@@ -30,6 +30,8 @@ import com.navi.ap.utils.constants.RESULT
|
||||
import com.navi.ap.utils.constants.STATUS_CODE
|
||||
import com.navi.ap.utils.constants.SUBMIT_HASH_BODY
|
||||
import com.navi.ap.utils.logApEvent
|
||||
import com.navi.common.checkmate.model.MetricInfo
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.uitron.model.action.ApiType
|
||||
import com.navi.common.utils.Constants.APP_PLATFORM_APPLICATION_ID
|
||||
import com.navi.common.utils.Constants.APP_PLATFORM_APPLICATION_TYPE
|
||||
@@ -50,6 +52,7 @@ constructor(private val service: APRetrofitService) :
|
||||
configVersion: String,
|
||||
backScreenId: String,
|
||||
backScreenStateId: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApScreenDefinitionStructure>>,
|
||||
): ApRepoResult<ApScreenDefinitionStructure> {
|
||||
|
||||
val response =
|
||||
@@ -82,7 +85,11 @@ constructor(private val service: APRetrofitService) :
|
||||
Pair(METHOD_NAME, ::fetchScreenDefinition.name),
|
||||
Pair(STATUS_CODE, response.code().toString())
|
||||
)
|
||||
return apiResponseCallback(response = response, apiTag = ApiType.GetScreenDefinition.name)
|
||||
return apiResponseCallback(
|
||||
response = response,
|
||||
apiTag = ApiType.GetScreenDefinition.name,
|
||||
metricInfo = metricInfo
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun submitScreenHash(
|
||||
@@ -90,6 +97,7 @@ constructor(private val service: APRetrofitService) :
|
||||
applicationType: String,
|
||||
verticalType: String,
|
||||
applicationHashRequestBody: ApplicationHashRequestBody,
|
||||
metricInfo: MetricInfo<RepoResult<ApScreenDefinitionStructure>>
|
||||
): ApRepoResult<ApScreenDefinitionStructure> {
|
||||
val response =
|
||||
service.submitScreenHash(
|
||||
@@ -110,7 +118,11 @@ constructor(private val service: APRetrofitService) :
|
||||
Pair(METHOD_NAME, ::submitScreenHash.name),
|
||||
Pair(STATUS_CODE, response.code().toString())
|
||||
)
|
||||
return apiResponseCallback(response = response, apiTag = ApiType.SubmitScreenHash.name)
|
||||
return apiResponseCallback(
|
||||
response = response,
|
||||
apiTag = ApiType.SubmitScreenHash.name,
|
||||
metricInfo = metricInfo
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun fillApplication(
|
||||
@@ -118,6 +130,7 @@ constructor(private val service: APRetrofitService) :
|
||||
applicationType: String,
|
||||
verticalType: String,
|
||||
fillApplicationRequestBody: FillApplicationRequestBody,
|
||||
metricInfo: MetricInfo<RepoResult<ApGetNextCtaResponse>>
|
||||
): ApRepoResult<ApGetNextCtaResponse> {
|
||||
val response =
|
||||
service.fillApplication(
|
||||
@@ -138,7 +151,11 @@ constructor(private val service: APRetrofitService) :
|
||||
Pair(METHOD_NAME, ::fillApplication.name),
|
||||
Pair(STATUS_CODE, response.code().toString())
|
||||
)
|
||||
return apiResponseCallback(response = response, apiTag = ApiType.FillApi.name)
|
||||
return apiResponseCallback(
|
||||
response = response,
|
||||
apiTag = ApiType.FillApi.name,
|
||||
metricInfo = metricInfo
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun getCta(
|
||||
@@ -151,6 +168,7 @@ constructor(private val service: APRetrofitService) :
|
||||
currentScreen: String,
|
||||
currentScreenState: String,
|
||||
idempotencyKey: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApGetNextCtaResponse>>
|
||||
): ApRepoResult<ApGetNextCtaResponse> {
|
||||
val apApiRequest =
|
||||
ApApiRequest(
|
||||
@@ -182,13 +200,18 @@ constructor(private val service: APRetrofitService) :
|
||||
Pair(STATUS_CODE, response.code().toString())
|
||||
)
|
||||
|
||||
return apiResponseCallback(response = response, apiTag = ApiType.GetNextScreenData.name)
|
||||
return apiResponseCallback(
|
||||
response = response,
|
||||
apiTag = ApiType.GetNextScreenData.name,
|
||||
metricInfo = metricInfo
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun createApplicationAndGetCta(
|
||||
applicationRequestBody: ApplicationRequestBody,
|
||||
applicationType: String,
|
||||
verticalType: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApCreateApplicationResponse>>
|
||||
): ApRepoResult<ApCreateApplicationResponse> {
|
||||
val response =
|
||||
service.createApplicationAndGetCta(
|
||||
@@ -207,7 +230,11 @@ constructor(private val service: APRetrofitService) :
|
||||
Pair(STATUS_CODE, response.code().toString()),
|
||||
Pair(FILL_REQUEST_BODY, applicationRequestBody.toString())
|
||||
)
|
||||
return apiResponseCallback(response = response, apiTag = ApiType.GetApplicationId.name)
|
||||
return apiResponseCallback(
|
||||
response = response,
|
||||
apiTag = ApiType.GetApplicationId.name,
|
||||
metricInfo = metricInfo
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun endRouting(
|
||||
@@ -215,6 +242,7 @@ constructor(private val service: APRetrofitService) :
|
||||
applicationId: String,
|
||||
verticalType: String,
|
||||
screenId: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApCtaResponse>>
|
||||
): ApRepoResult<ApCtaResponse> {
|
||||
val response = service.endRouting(applicationType, verticalType, applicationId, screenId)
|
||||
logApEvent(
|
||||
@@ -229,6 +257,6 @@ constructor(private val service: APRetrofitService) :
|
||||
Pair(METHOD_NAME, ::endRouting.name),
|
||||
Pair(STATUS_CODE, response.code().toString())
|
||||
)
|
||||
return apiResponseCallback(response = response)
|
||||
return apiResponseCallback(response = response, metricInfo = metricInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.navi.ap.network.model.ApplicationHashRequestBody
|
||||
import com.navi.ap.network.model.ApplicationRequestBody
|
||||
import com.navi.ap.network.model.FillApplicationRequestBody
|
||||
import com.navi.ap.network.retrofit.ApRepoResult
|
||||
import com.navi.common.checkmate.model.MetricInfo
|
||||
import com.navi.common.network.models.RepoResult
|
||||
|
||||
interface ApplicationPlatformRepository {
|
||||
suspend fun fetchScreenDefinition(
|
||||
@@ -27,6 +29,7 @@ interface ApplicationPlatformRepository {
|
||||
configVersion: String,
|
||||
backScreenId: String,
|
||||
backScreenStateId: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApScreenDefinitionStructure>>
|
||||
): ApRepoResult<ApScreenDefinitionStructure>
|
||||
|
||||
suspend fun submitScreenHash(
|
||||
@@ -34,6 +37,7 @@ interface ApplicationPlatformRepository {
|
||||
applicationType: String,
|
||||
verticalType: String,
|
||||
applicationHashRequestBody: ApplicationHashRequestBody,
|
||||
metricInfo: MetricInfo<RepoResult<ApScreenDefinitionStructure>>
|
||||
): ApRepoResult<ApScreenDefinitionStructure>
|
||||
|
||||
suspend fun fillApplication(
|
||||
@@ -41,6 +45,7 @@ interface ApplicationPlatformRepository {
|
||||
applicationType: String,
|
||||
verticalType: String,
|
||||
fillApplicationRequestBody: FillApplicationRequestBody,
|
||||
metricInfo: MetricInfo<RepoResult<ApGetNextCtaResponse>>
|
||||
): ApRepoResult<ApGetNextCtaResponse>
|
||||
|
||||
suspend fun getCta(
|
||||
@@ -53,18 +58,21 @@ interface ApplicationPlatformRepository {
|
||||
currentScreen: String,
|
||||
currentScreenState: String,
|
||||
idempotencyKey: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApGetNextCtaResponse>>
|
||||
): ApRepoResult<ApGetNextCtaResponse>
|
||||
|
||||
suspend fun createApplicationAndGetCta(
|
||||
applicationRequestBody: ApplicationRequestBody,
|
||||
applicationType: String,
|
||||
verticalType: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApCreateApplicationResponse>>
|
||||
): ApRepoResult<ApCreateApplicationResponse>
|
||||
|
||||
suspend fun endRouting(
|
||||
applicationType: String,
|
||||
applicationId: String,
|
||||
verticalType: String,
|
||||
screenId: String
|
||||
screenId: String,
|
||||
metricInfo: MetricInfo<RepoResult<ApCtaResponse>>
|
||||
): ApRepoResult<ApCtaResponse>
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.navi.ap.common.ui.ApplicationPlatformActivity
|
||||
import com.navi.ap.network.di.APNetworkModule.providesDeserializer
|
||||
import com.navi.ap.network.di.APNetworkModule.providesSerializer
|
||||
import com.navi.ap.screens.genericscreen.vm.ApGenericScreenVM
|
||||
import com.navi.ap.utils.constants.ApplicationType
|
||||
import com.navi.ap.utils.constants.CODE
|
||||
import com.navi.ap.utils.constants.DEFAULT_SCREEN_STATE_ID
|
||||
import com.navi.ap.utils.constants.DEFAULT_SOURCE_SCREEN
|
||||
@@ -45,6 +46,8 @@ import com.navi.ap.utils.constants.WIDGET_ID
|
||||
import com.navi.ap.utils.extractor.filterEntries
|
||||
import com.navi.base.AppServiceManager
|
||||
import com.navi.base.utils.isNotNull
|
||||
import com.navi.common.checkmate.model.MetricInfo
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.uitron.model.action.FillApiData
|
||||
import com.navi.common.uitron.model.action.SourceType
|
||||
import com.navi.common.utils.CommonUtils
|
||||
@@ -374,3 +377,18 @@ fun getValueAtJsonPath(dataObj: Any, jsonPath: String): Any? {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> getMetricInfoForApplicationType(
|
||||
applicationType: String,
|
||||
screenName: String,
|
||||
isNae: (RepoResult<T>) -> Boolean
|
||||
): MetricInfo<RepoResult<T>> {
|
||||
return when (applicationType) {
|
||||
ApplicationType.HPC.name -> {
|
||||
MetricInfo.AppMetric(screen = screenName, isNae = isNae)
|
||||
}
|
||||
else -> {
|
||||
MetricInfo.AppMetric(screen = screenName, isNae = isNae)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -101,5 +101,6 @@ enum class ApplicationType {
|
||||
COINS,
|
||||
PL_REPEAT,
|
||||
PL_TOP_UP,
|
||||
PL_REFILL
|
||||
PL_REFILL,
|
||||
HPC
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user