NTP-7163 | App OE - Added api retry for entire app (#14672)
This commit is contained in:
@@ -10,6 +10,7 @@ package com.naviapp.network.retrofit
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.HP_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
@@ -24,8 +25,8 @@ class NaviHttpClient(networkInfo: NetworkInfo, context: Context) :
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(NaviApplication.instance.applicationContext)
|
||||
@@ -37,9 +38,9 @@ class NaviHttpClient(networkInfo: NetworkInfo, context: Context) :
|
||||
.alwaysReadResponseBody(false)
|
||||
.build()
|
||||
)
|
||||
if (isRetryInterceptorEnabled()) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
if (isRetryInterceptorEnabled(HP_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
|
||||
@@ -109,11 +109,6 @@ import com.naviapp.payment.models.TransactionDetail
|
||||
import com.naviapp.screenOverlay.model.OverlayItemsStateUpdates
|
||||
import com.naviapp.screenOverlay.model.OverlayScreenStructure
|
||||
import com.naviapp.screenOverlay.model.ScreenOverlayActionUpdateRequest
|
||||
import java.net.ConnectException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import javax.net.ssl.SSLHandshakeException
|
||||
import javax.net.ssl.SSLPeerUnverifiedException
|
||||
import okhttp3.RequestBody
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
@@ -143,6 +138,7 @@ interface RetrofitService {
|
||||
@Header(HEADER_X_TENANT_ID) tenantId: String,
|
||||
): Response<GenericResponse<LoginOtpVerifyResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/login-service/v1/login")
|
||||
suspend fun userLogin(
|
||||
@Body loginRequest: UserLoginRequest,
|
||||
@@ -202,7 +198,9 @@ interface RetrofitService {
|
||||
@Query("subProduct") subProduct: String? = null,
|
||||
): Response<GenericResponse<List<GroupFaq>>>
|
||||
|
||||
@POST("/auth/v1/logout") suspend fun logout(): Response<GenericResponse<SuccessResponse>>
|
||||
@RetryPolicy
|
||||
@POST("/auth/v1/logout")
|
||||
suspend fun logout(): Response<GenericResponse<SuccessResponse>>
|
||||
|
||||
@GET("/login-settings")
|
||||
suspend fun fetchLoginSettings(): Response<GenericResponse<LoginSettings>>
|
||||
@@ -505,6 +503,7 @@ interface RetrofitService {
|
||||
@Body deviceDetail: DeviceDetail,
|
||||
): Response<GenericResponse<com.navi.common.network.models.SuccessResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/forge/screen/{screenId}")
|
||||
suspend fun fetchForgeScreen(
|
||||
@Header(X_IS_SCREEN_LOCK_ENABLED) isScreenLockEnabled: Boolean? = null,
|
||||
@@ -533,6 +532,7 @@ interface RetrofitService {
|
||||
@Body request: AlchemistScreenRequest?,
|
||||
): Response<GenericResponse<AlchemistScreenDefinition>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/forge/screen/{screenId}")
|
||||
suspend fun fetchNotificationForgeScreen(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@@ -546,17 +546,7 @@ interface RetrofitService {
|
||||
@Body notificationStatusRequest: List<NotificationUpdateStatus>,
|
||||
): Response<GenericResponse<Unit>>
|
||||
|
||||
@RetryPolicy(
|
||||
retryCount = 3,
|
||||
retryOn =
|
||||
[
|
||||
SocketTimeoutException::class,
|
||||
UnknownHostException::class,
|
||||
ConnectException::class,
|
||||
SSLHandshakeException::class,
|
||||
SSLPeerUnverifiedException::class,
|
||||
],
|
||||
)
|
||||
@RetryPolicy
|
||||
@GET("/forge/screen/{screenId}")
|
||||
suspend fun fetchInsuranceTabForgeScreen(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@@ -564,6 +554,7 @@ interface RetrofitService {
|
||||
@Path("screenId") screenId: String,
|
||||
): Response<GenericResponse<InsuranceTabResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/forge/screen/{screenId}")
|
||||
suspend fun fetchTrialDashboardForgeScreen(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@@ -577,6 +568,7 @@ interface RetrofitService {
|
||||
@QueryMap queryMap: Map<String, String>,
|
||||
): Response<Any>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/forge/screen/{screenId}")
|
||||
suspend fun fetchLendingPermissionScreenResponse(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@@ -610,7 +602,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<ActionData>>
|
||||
|
||||
@GET("/alchemist/inflate/v2/{screenId}")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun fetchInvestmentTabScreenResponse(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@Header("X-Target") target: String,
|
||||
@@ -628,7 +620,7 @@ interface RetrofitService {
|
||||
@Header(HEADER_X_PLATFORM) platform: String = Constants.OS_ANDROID,
|
||||
): Response<GenericResponse<OverlayScreenStructure>>
|
||||
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
@PATCH("/nudge/state")
|
||||
suspend fun updateScreenOverlayElementState(
|
||||
@Body request: OverlayItemsStateUpdates
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -13,8 +13,11 @@ import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.ap.BuildConfig
|
||||
import com.navi.ap.network.retrofit.interceptor.PlatformInterceptor
|
||||
import com.navi.ap.network.utils.NetworkInfoProvider
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.AP_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import okhttp3.OkHttpClient
|
||||
@@ -44,6 +47,9 @@ constructor(
|
||||
)
|
||||
}
|
||||
addInterceptor(platformInterceptor)
|
||||
if (isRetryInterceptorEnabled(AP_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.navi.ap.network.model.FillApplicationRequestBody
|
||||
import com.navi.base.utils.EMPTY
|
||||
import com.navi.common.model.ModuleName
|
||||
import com.navi.common.network.models.GenericResponse
|
||||
import com.navi.common.network.retry.annotations.RetryPolicy
|
||||
import com.navi.common.utils.Constants.GZIP
|
||||
import com.navi.common.utils.Constants.OS_ANDROID
|
||||
import retrofit2.Response
|
||||
@@ -57,6 +58,7 @@ interface APRetrofitService : CoinsLambdaService, GenericLambdaService {
|
||||
@Header("X-Platform") applicationHash: String = OS_ANDROID,
|
||||
): Response<GenericResponse<ApGetNextCtaResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/arc-warden/api/v3/application")
|
||||
suspend fun createApplicationAndGetCta(
|
||||
@Body applicationRequestBody: ApplicationRequestBody,
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.amc.BuildConfig
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.NAVI_AMC_RETRY_POLICY_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
@@ -38,10 +37,7 @@ class NaviHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
)
|
||||
}
|
||||
}
|
||||
if (
|
||||
isRetryInterceptorEnabled() &&
|
||||
FirebaseRemoteConfigHelper.getBoolean(NAVI_AMC_RETRY_POLICY_ENABLED)
|
||||
) {
|
||||
if (isRetryInterceptorEnabled(NAVI_AMC_RETRY_POLICY_ENABLED)) {
|
||||
okHttpClientBuilder.addInterceptor(RetryInterceptor())
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ interface RetrofitService {
|
||||
@GET("/amc/checker/CVL_KYC_CHECK")
|
||||
suspend fun fetchCheckerData(): Response<GenericResponse<CheckerResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/kyc/hpc-pan-redirection-page")
|
||||
suspend fun fetchHpcPanRedirectionData(): Response<GenericResponse<CheckerResponse>>
|
||||
|
||||
@@ -305,6 +306,7 @@ interface RetrofitService {
|
||||
@Query("fundCategory") fundCategory: String?
|
||||
): Response<GenericResponse<FundListResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET(FUND_LIST_DATA_V3)
|
||||
suspend fun fetchFundListDataV3(
|
||||
@Query("fundCategory") fundCategory: String?
|
||||
@@ -341,6 +343,7 @@ interface RetrofitService {
|
||||
@Query("redemptionOrderId") redemptionOrderId: String
|
||||
): Response<GenericResponse<UploadDataAsyncResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/my-investment/tabs")
|
||||
suspend fun fetchMyInvestmentsTabs(
|
||||
@Query("tab") tab: String?,
|
||||
@@ -396,7 +399,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<AdditionalDataAsyncResponse<NextCtaResponse>>>
|
||||
|
||||
@GET("/fund/fund-details")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun fetchFundDetails(
|
||||
@Query("isin") isin: String
|
||||
): Response<GenericResponse<FundDetails>>
|
||||
@@ -544,6 +547,7 @@ interface RetrofitService {
|
||||
@Body map: Map<String, String>?
|
||||
): Response<GenericResponse<AutoPaySetupScreenData>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/fund/v1/fund-graph/{isin}")
|
||||
suspend fun fetchFundGraphData(
|
||||
@Path("isin") isin: String?,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * Copyright © 2024-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -11,8 +11,11 @@ import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.bbps.BuildConfig
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.BBPS_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
|
||||
@@ -21,8 +24,8 @@ class NaviBbpsHttpClient(val networkInfo: NetworkInfo, private val context: Cont
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -33,6 +36,9 @@ class NaviBbpsHttpClient(val networkInfo: NetworkInfo, private val context: Cont
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if (isRetryInterceptorEnabled(BBPS_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.navi.bbps.feature.transactiondetails.model.network.BbpsBillAcknowledg
|
||||
import com.navi.bbps.feature.transactiondetails.model.network.BbpsTransactionStatusResponse
|
||||
import com.navi.common.alchemist.model.AlchemistScreenDefinition
|
||||
import com.navi.common.network.models.GenericResponse
|
||||
import com.navi.common.network.retry.annotations.RetryPolicy
|
||||
import com.navi.rr.common.models.ABSettings
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
@@ -68,6 +69,7 @@ interface NaviBbpsRetrofitService {
|
||||
@Path("savedBillId") savedBillId: String
|
||||
): Response<GenericResponse<BillTransactionHistoryResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/billpay-gateway/$NAVI_BBPS_API_VERSION/billpay/categories/{categoryId}/billers")
|
||||
suspend fun getBillers(
|
||||
@Path("categoryId") categoryId: String,
|
||||
@@ -85,6 +87,7 @@ interface NaviBbpsRetrofitService {
|
||||
@Path("billerId") billerId: String
|
||||
): Response<GenericResponse<BillerDetailsResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/billpay-gateway/$NAVI_BBPS_API_VERSION_2/billpay/bill-details")
|
||||
suspend fun getBillDetails(
|
||||
@Body billDetailsRequest: BillDetailsRequest
|
||||
@@ -95,6 +98,7 @@ interface NaviBbpsRetrofitService {
|
||||
@Path("savedBillId") savedBillId: String
|
||||
): Response<GenericResponse<BbpsGenericResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/billpay-gateway/$NAVI_BBPS_API_VERSION/billpay/bill-payment-request")
|
||||
suspend fun fetchPaymentToken(
|
||||
@Body payBillRequest: PayBillRequest
|
||||
@@ -122,12 +126,14 @@ interface NaviBbpsRetrofitService {
|
||||
suspend fun getOperatorCircleMappingFromPhoneSeries():
|
||||
Response<GenericResponse<OperatorCircleSeriesMappingResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/billpay-gateway/$NAVI_BBPS_API_VERSION/billpay/phonenumber-operator-circle")
|
||||
suspend fun getOperatorCircleMappingForPhoneNumber(
|
||||
@Body
|
||||
phoneNumberToOperatorCircleCodeMappingRequest: PhoneNumberToOperatorCircleCodeMappingRequest
|
||||
): Response<GenericResponse<PhoneNumberToOperatorCircleCodeMappingResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/billpay-gateway/$NAVI_BBPS_API_VERSION/billpay/prepaid/plans/all")
|
||||
suspend fun fetchAllPrepaidPlans(): Response<GenericResponse<AllPrepaidPlansResponse>>
|
||||
|
||||
@@ -142,6 +148,7 @@ interface NaviBbpsRetrofitService {
|
||||
@GET("/billpay-gateway/$NAVI_BBPS_API_VERSION/billpay/reward-details")
|
||||
suspend fun getRewardDetails(): Response<GenericResponse<RewardDetailsResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/alchemist/inflate/{screenId}")
|
||||
suspend fun fetchAlchemistScreenUiTronConfigs(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@@ -161,6 +168,7 @@ interface NaviBbpsRetrofitService {
|
||||
@Body category: Map<String, String> = mutableMapOf()
|
||||
): Response<GenericResponse<RewardDetailsV2Response>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("gullak/v1/discount/coin")
|
||||
suspend fun fetchCoinDiscount(
|
||||
@Query("product") product: String = "BBPS"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2020-2023 by Navi Technologies Limited
|
||||
* * Copyright © 2020-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -11,11 +11,14 @@ import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.chat.BuildConfig
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.CHAT_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.ModuleName
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.ApiConstants
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.handleException
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import java.io.IOException
|
||||
import okhttp3.*
|
||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||
@@ -26,8 +29,8 @@ class NaviChatHttpClient(networkInfo: NetworkInfo, private val context: Context)
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -38,6 +41,9 @@ class NaviChatHttpClient(networkInfo: NetworkInfo, private val context: Context)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if (isRetryInterceptorEnabled(CHAT_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
okHttpClientBuilder.addInterceptor(customChatHeaderInterceptor)
|
||||
return okHttpClientBuilder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * Copyright © 2024-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -11,6 +11,7 @@ import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.coin.BuildConfig
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.COIN_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
@@ -37,7 +38,8 @@ class CoinHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
)
|
||||
}
|
||||
}
|
||||
if (isRetryInterceptorEnabled()) okHttpClientBuilder.addInterceptor(RetryInterceptor())
|
||||
if (isRetryInterceptorEnabled(COIN_RETRY_INTERCEPTOR_ENABLED))
|
||||
okHttpClientBuilder.addInterceptor(RetryInterceptor())
|
||||
return okHttpClientBuilder
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,6 @@ import com.navi.common.network.models.GenericResponse
|
||||
import com.navi.common.network.retry.annotations.RetryPolicy
|
||||
import com.navi.rr.common.models.ABSettings
|
||||
import com.navi.rr.referral.models.ReferralContactList
|
||||
import java.net.ConnectException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
@@ -51,11 +48,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<TransactionHistoryResponse>>
|
||||
|
||||
@GET("/forge/screen/{screenId}")
|
||||
@RetryPolicy(
|
||||
retryCount = 3,
|
||||
retryOn =
|
||||
[SocketTimeoutException::class, UnknownHostException::class, ConnectException::class],
|
||||
)
|
||||
@RetryPolicy
|
||||
suspend fun fetchScreenUiTronConfigs(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@Header("X-Target") target: String,
|
||||
@@ -63,7 +56,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<ScreenDefinition>>
|
||||
|
||||
@GET("/alchemist/inflate/{screenId}")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun fetchAlchemistScreenUiTronConfigs(
|
||||
@Header("Accept-Encoding") acceptEncoding: String,
|
||||
@Header("X-Target") target: String,
|
||||
|
||||
@@ -137,6 +137,7 @@ object FirebaseRemoteConfigHelper {
|
||||
const val LOW_NETWORK_SIGNAL_THRESHOLD = "LOW_NETWORK_SIGNAL_THRESHOLD"
|
||||
const val LOW_NETWORK_BANDWIDTH_THRESHOLD = "LOW_NETWORK_BANDWIDTH_THRESHOLD"
|
||||
const val LOW_NETWORK_SPEED_THRESHOLD = "LOW_NETWORK_SPEED_THRESHOLD"
|
||||
const val API_RETRY_COUNT = "API_RETRY_COUNT"
|
||||
|
||||
// GI
|
||||
const val NAVI_GI_RETRY_POLICY_ENABLED = "NAVI_GI_RETRY_POLICY_ENABLED"
|
||||
@@ -210,9 +211,20 @@ object FirebaseRemoteConfigHelper {
|
||||
const val WEB_REDIRECTION_SMS_UPLOADED_DELAY_IN_MILLIS =
|
||||
"WEB_REDIRECTION_SMS_UPLOADED_DELAY_IN_MILLIS"
|
||||
|
||||
const val RETRY_INTERCEPTOR_ENABLED = "RETRY_INTERCEPTOR_ENABLED"
|
||||
const val ROOT_CA_ADDITION_TARGET_SDK = "ROOT_CA_ADDITION_TARGET_SDK"
|
||||
|
||||
// Api Retry constants
|
||||
const val RETRY_INTERCEPTOR_ENABLED = "RETRY_INTERCEPTOR_ENABLED"
|
||||
const val UPI_RETRY_INTERCEPTOR_ENABLED = "UPI_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val BBPS_RETRY_INTERCEPTOR_ENABLED = "BBPS_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val CHAT_RETRY_INTERCEPTOR_ENABLED = "CHAT_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val AP_RETRY_INTERCEPTOR_ENABLED = "AP_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val RR_RETRY_INTERCEPTOR_ENABLED = "RR_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val CYCS_RETRY_INTERCEPTOR_ENABLED = "CYCS_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val COIN_RETRY_INTERCEPTOR_ENABLED = "COIN_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val HP_RETRY_INTERCEPTOR_ENABLED = "HP_RETRY_INTERCEPTOR_ENABLED"
|
||||
const val MM_RETRY_INTERCEPTOR_ENABLED = "MM_RETRY_INTERCEPTOR_ENABLED"
|
||||
|
||||
const val ANR_MONITOR_ENABLED_EXPERIMENT = "ANR_MONITOR_ENABLED_EXPERIMENT"
|
||||
|
||||
// Rewards X-target migration configs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2021-2022 by Navi Technologies Limited
|
||||
* * Copyright © 2021-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -13,6 +13,8 @@ import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.BuildConfig
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
@@ -22,8 +24,8 @@ class CommonHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -34,6 +36,9 @@ class CommonHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if (isRetryInterceptorEnabled()) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
|
||||
return okHttpClientBuilder
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
package com.navi.common.network.retry.annotations
|
||||
|
||||
import java.net.ConnectException
|
||||
import java.net.SocketException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import javax.net.ssl.SSLHandshakeException
|
||||
import javax.net.ssl.SSLPeerUnverifiedException
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
/**
|
||||
@@ -21,12 +24,19 @@ import kotlin.reflect.KClass
|
||||
* @property retryCount The number of times the function should be retried upon failure. Default
|
||||
* is 0.
|
||||
* @property retryOn An array of exception classes that should trigger a retry. Defaults are
|
||||
* [SocketTimeoutException::class, UnknownHostException::class, ConnectException::class].
|
||||
* [SocketTimeoutException::class, UnknownHostException::class, ConnectException::class, SSLPeerUnverifiedException::class, SocketException::class].
|
||||
*/
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class RetryPolicy(
|
||||
val retryCount: Int = 1,
|
||||
val retryCount: Int = -1,
|
||||
val retryOn: Array<KClass<out Exception>> =
|
||||
[SocketTimeoutException::class, UnknownHostException::class, ConnectException::class],
|
||||
[
|
||||
SocketTimeoutException::class,
|
||||
UnknownHostException::class,
|
||||
ConnectException::class,
|
||||
SSLHandshakeException::class,
|
||||
SSLPeerUnverifiedException::class,
|
||||
SocketException::class,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -9,9 +9,9 @@ package com.navi.common.network.retry.interceptor
|
||||
|
||||
import com.navi.base.utils.isNotNull
|
||||
import com.navi.base.utils.isNull
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.base.utils.orZero
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.API_RETRY_COUNT
|
||||
import com.navi.common.network.retry.annotations.RetryPolicy
|
||||
import com.navi.common.network.retry.utils.RetryManager
|
||||
import com.navi.common.utils.CommonNaviAnalytics
|
||||
@@ -33,7 +33,7 @@ class RetryInterceptor : Interceptor {
|
||||
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request = chain.request()
|
||||
val tag = request.getAnnotation<RetryPolicy>() ?: return chain.proceed(request)
|
||||
val tag = getRequestRetryTag(request) ?: return chain.proceed(request)
|
||||
return handleRetryableRequest(chain, request, tag)
|
||||
}
|
||||
|
||||
@@ -112,11 +112,32 @@ class RetryInterceptor : Interceptor {
|
||||
|
||||
private fun shouldRetry(tag: RetryPolicy, exception: Exception) =
|
||||
tag.retryOn.any { it.isInstance(exception) }
|
||||
|
||||
/**
|
||||
* Retrieves the retry policy for a given request.
|
||||
*
|
||||
* This method checks if the request is annotated with a `RetryPolicy`. If the annotation is
|
||||
* present, it uses the defined retry count or fetches the retry count from Firebase Remote
|
||||
* Config. If no retry policy is defined, the method returns null.
|
||||
*
|
||||
* @param request The request for which the retry policy is to be retrieved.
|
||||
* @return A `RetryPolicy` object if the request is retryable, or null if no retry policy is
|
||||
* defined.
|
||||
*/
|
||||
private fun getRequestRetryTag(request: Request): RetryPolicy? {
|
||||
val retryPolicy = request.getAnnotation<RetryPolicy>() ?: return null
|
||||
val retryCount =
|
||||
if (retryPolicy.retryCount > 0) {
|
||||
retryPolicy.retryCount
|
||||
} else {
|
||||
FirebaseRemoteConfigHelper.getLong(API_RETRY_COUNT, 1L).toInt()
|
||||
}
|
||||
return RetryPolicy(retryCount = retryCount, retryOn = retryPolicy.retryOn)
|
||||
}
|
||||
}
|
||||
|
||||
fun isRetryInterceptorEnabled(): Boolean {
|
||||
return FirebaseRemoteConfigHelper.getBoolean(
|
||||
FirebaseRemoteConfigHelper.RETRY_INTERCEPTOR_ENABLED
|
||||
)
|
||||
.orFalse()
|
||||
fun isRetryInterceptorEnabled(
|
||||
key: String = FirebaseRemoteConfigHelper.RETRY_INTERCEPTOR_ENABLED
|
||||
): Boolean {
|
||||
return FirebaseRemoteConfigHelper.getBoolean(key)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * Copyright © 2024-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -10,8 +10,11 @@ package com.navi.cycs.network
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.CYCS_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import com.navi.cycs.BuildConfig
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
@@ -21,8 +24,8 @@ class CycsHttpClient(val networkInfo: NetworkInfo, private val context: Context)
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -33,6 +36,9 @@ class CycsHttpClient(val networkInfo: NetworkInfo, private val context: Context)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if (isRetryInterceptorEnabled(CYCS_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.navi.gold.retrofit
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.NAVI_GOLD_RETRY_POLICY_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
@@ -39,10 +38,7 @@ class NaviHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
isRetryInterceptorEnabled() &&
|
||||
FirebaseRemoteConfigHelper.getBoolean(NAVI_GOLD_RETRY_POLICY_ENABLED)
|
||||
) {
|
||||
if (isRetryInterceptorEnabled(NAVI_GOLD_RETRY_POLICY_ENABLED)) {
|
||||
okHttpClientBuilder.addInterceptor(RetryInterceptor())
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ interface RetrofitService {
|
||||
@GET("/kuber/home/sub-widgets")
|
||||
suspend fun getDigitalGoldHomePolling(): Response<GenericResponse<WidgetResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/kuber/order/get-sell-page-content")
|
||||
suspend fun getDigitalGoldSellPage(
|
||||
@Query("vendorKey") vendorKey: String?
|
||||
@@ -62,13 +63,13 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<WidgetResponse>>
|
||||
|
||||
@GET("/kuber/sip/setup-sip-page-content")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun getDigitalGoldSetupSipPage(
|
||||
@QueryMap params: Map<String, String>
|
||||
): Response<GenericResponse<WidgetResponse>>
|
||||
|
||||
@GET("/kuber/transactions/transaction-history-page-content")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun fetchDigitalGoldTransactionHistory(
|
||||
@QueryMap params: Map<String, String>
|
||||
): Response<GenericResponse<WidgetResponse>>
|
||||
@@ -98,6 +99,7 @@ interface RetrofitService {
|
||||
@Path("requestId") requestId: String?
|
||||
): Response<GenericResponse<KycCheckPollingResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/kuber/kyc/get-kyc-buy-api-decider")
|
||||
suspend fun getGoldBuyNextPageCta(
|
||||
@Body goldKycVerifyRequest: GoldKycPageRequest?
|
||||
@@ -114,13 +116,13 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<WidgetResponse>>
|
||||
|
||||
@GET("/kuber/home/get-home-content")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun getDigitalGoldHome(
|
||||
@QueryMap params: Map<String, String>
|
||||
): Response<GenericResponse<WidgetResponse>>
|
||||
|
||||
@POST("/kuber/order/sell")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun getDigitalGoldSellOrder(
|
||||
@Body goldSellOrderRequest: GoldSellOrderRequest
|
||||
): Response<GenericResponse<GoldSellOrderResponse>>
|
||||
@@ -151,7 +153,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<DigitalGoldActionCheckResponse>>
|
||||
|
||||
@GET("/kuber/order/payment-details/get-upi-page-content")
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
suspend fun fetchDigitalGoldSellUpiScreenData(
|
||||
@Query("exchangeRateId") exchangeRateId: String,
|
||||
@Query("amount") amount: Double,
|
||||
@@ -165,6 +167,7 @@ interface RetrofitService {
|
||||
@GET("/kuber/home/get-gold-blocked-page")
|
||||
suspend fun getKuberBlockerPageDetails(): Response<GenericResponse<ActionCheckResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/csat/{featureName}")
|
||||
suspend fun fetchDigitalGoldCsatResponse(
|
||||
@Path("featureName") featureName: String?,
|
||||
@@ -217,6 +220,7 @@ interface RetrofitService {
|
||||
@GET("/kuber/bank/bank-search-page")
|
||||
suspend fun fetchBankSearchPage(): Response<GenericResponse<SearchBankResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/kuber/sip/setup-sip-bottomsheet")
|
||||
suspend fun fetchSetupSipBottomSheet(
|
||||
@QueryMap params: Map<String, String?>
|
||||
@@ -237,6 +241,7 @@ interface RetrofitService {
|
||||
@Query("requestId") requestId: String
|
||||
): Response<GenericResponse<DgSipStatusResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/kuber/order/v2/buy")
|
||||
suspend fun getDigitalGoldBuyOrderV2(
|
||||
@Body goldBuyOrderRequest: GoldBuyOrderRequest
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.navi.insurance.network.retrofit
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.NAVI_GI_RETRY_POLICY_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
@@ -38,10 +37,7 @@ class GIHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
)
|
||||
}
|
||||
}
|
||||
if (
|
||||
isRetryInterceptorEnabled() &&
|
||||
FirebaseRemoteConfigHelper.getBoolean(NAVI_GI_RETRY_POLICY_ENABLED)
|
||||
) {
|
||||
if (isRetryInterceptorEnabled(NAVI_GI_RETRY_POLICY_ENABLED)) {
|
||||
okHttpClientBuilder.addInterceptor(RetryInterceptor())
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
|
||||
@@ -712,6 +712,7 @@ interface RetrofitService {
|
||||
@GET("/claims-origination/customer/activity/v2")
|
||||
suspend fun fetchClaimsActivitiesList(): Response<GenericResponse<GenericWidgetResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/pre-quotes")
|
||||
suspend fun fetchPreQuoteForm(
|
||||
@Query("applicationType") applicationType: String
|
||||
@@ -986,12 +987,14 @@ interface RetrofitService {
|
||||
@Body policyMembersRequest: PolicyMembersRequest,
|
||||
): Response<GenericResponse<PolicyMembersResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/journeys/question-journey")
|
||||
suspend fun fetchHrcHomepageAndQuestions(
|
||||
@Query("type") type: String,
|
||||
@Query("isFreeInsurance") isFreeInsurance: Boolean,
|
||||
): Response<GenericResponse<HomeAndQuestionResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/health-risk-scores")
|
||||
suspend fun fetchHrsDetailsWithQuesData(
|
||||
@Body questionSubmissionRequest: QuestionSubmissionRequest
|
||||
@@ -1171,6 +1174,7 @@ interface RetrofitService {
|
||||
@Body details: PolicyIncompleteMemberDetails? = null,
|
||||
): Response<GenericResponse<CtaData>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/journeys/quiz-journey")
|
||||
suspend fun fetchQuestionnaire(): Response<GenericResponse<QuestionnaireResponse>>
|
||||
|
||||
@@ -1197,7 +1201,7 @@ interface RetrofitService {
|
||||
@GET("/hi-quiz-scores")
|
||||
suspend fun fetchQuizResult(): Response<GenericResponse<QuizResultResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
@PATCH("/pre-quotes/{preQuoteId}/transitions/{transitionName}")
|
||||
suspend fun nextPagePreQuote(
|
||||
@Path("preQuoteId") preQuoteId: String,
|
||||
@@ -1205,7 +1209,7 @@ interface RetrofitService {
|
||||
@Body formNextPageRequest: FormWidgetRequest,
|
||||
): Response<GenericResponse<PreQuotePatchResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
@GET("/pre-quotes/{preQuoteId}")
|
||||
suspend fun fetchFormPageWithPreQuoteId(
|
||||
@Path("preQuoteId") preQuoteId: String,
|
||||
@@ -1213,21 +1217,21 @@ interface RetrofitService {
|
||||
@Query("applicationId") applicationId: String? = null,
|
||||
): Response<GenericResponse<PreQuoteJourneyPageResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
@POST("/pre-quotes")
|
||||
suspend fun fetchPreQuoteFormWithApplicationType(
|
||||
@Query("applicationType") applicationType: String,
|
||||
@Body formNextPageRequest: FormWidgetRequest,
|
||||
): Response<GenericResponse<PreQuoteJourneyPageResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
@GET("/pre-quotes")
|
||||
suspend fun fetchPreQuoteJourney(
|
||||
@Query("applicationType") applicationType: String,
|
||||
@Query("applicationId") applicationId: String? = null,
|
||||
): Response<GenericResponse<PreQuoteJourneyPageResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = 3)
|
||||
@RetryPolicy
|
||||
@POST("/quotes/{quoteId}/pages/{pageType}")
|
||||
suspend fun fetchFormPageWithQuoteId(
|
||||
@Path("quoteId") quoteId: String,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * Copyright © 2024-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -10,8 +10,11 @@ package com.navi.moneymanager.common.network
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.MM_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import com.navi.moneymanager.BuildConfig
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
@@ -21,8 +24,8 @@ class HttpClient(val networkInfo: NetworkInfo, private val context: Context) :
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -33,6 +36,9 @@ class HttpClient(val networkInfo: NetworkInfo, private val context: Context) :
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if (isRetryInterceptorEnabled(MM_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.navi.moneymanager.common.network.model.OnboardingStatusResponse
|
||||
import com.navi.moneymanager.common.network.model.PollingStatusResponse
|
||||
import com.navi.moneymanager.common.network.model.RefreshDataResponse
|
||||
import com.navi.moneymanager.common.network.model.TransactionResponse
|
||||
import com.navi.moneymanager.common.utils.Constants.API_RETRY_COUNT
|
||||
import com.navi.moneymanager.postonboard.monthlysummary.model.PostCategoryTransactionData
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
@@ -33,7 +32,7 @@ import retrofit2.http.Query
|
||||
|
||||
interface RetrofitService {
|
||||
|
||||
@RetryPolicy(retryCount = API_RETRY_COUNT)
|
||||
@RetryPolicy
|
||||
@GET("/money-manager/core/transactions")
|
||||
suspend fun fetchTransactions(
|
||||
@Query("from") from: Long,
|
||||
@@ -42,27 +41,27 @@ interface RetrofitService {
|
||||
@Query("queryBy") queryBy: String,
|
||||
): Response<GenericResponse<TransactionResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = API_RETRY_COUNT)
|
||||
@RetryPolicy
|
||||
@GET("/money-manager/core/user-onboarded")
|
||||
suspend fun fetchUserOnboardingStatus(): Response<GenericResponse<OnboardingStatusResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = API_RETRY_COUNT)
|
||||
@RetryPolicy
|
||||
@GET("/alchemist/inflate/{screenName}")
|
||||
suspend fun fetchAlchemistScreen(
|
||||
@Path("screenName") screenName: String
|
||||
): Response<GenericResponse<AlchemistScreenDefinition>>
|
||||
|
||||
@RetryPolicy(retryCount = API_RETRY_COUNT)
|
||||
@RetryPolicy
|
||||
@GET("/money-manager/core/config")
|
||||
suspend fun fetchMMConfigResponse(): Response<GenericResponse<MMConfigResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = API_RETRY_COUNT)
|
||||
@RetryPolicy
|
||||
@POST("/money-manager/core/init-onboarding")
|
||||
suspend fun fetchFinarkeinSDKInitData(
|
||||
@Body emptyBody: EmptyRequestBody = EmptyRequestBody()
|
||||
): Response<GenericResponse<FinarkeinDataResponse>>
|
||||
|
||||
@RetryPolicy(retryCount = API_RETRY_COUNT)
|
||||
@RetryPolicy
|
||||
@GET("/money-manager/core/accounts")
|
||||
suspend fun fetchUserAccounts(): Response<GenericResponse<AccountDetailResponse>>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2022-2024 by Navi Technologies Limited
|
||||
* * Copyright © 2022-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -10,9 +10,12 @@ package com.navi.pay.network
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.UPI_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.NAVI_DNS
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import com.navi.common.utils.TemporaryStorageHelper
|
||||
import com.navi.pay.BuildConfig
|
||||
import okhttp3.OkHttpClient
|
||||
@@ -23,8 +26,8 @@ class NaviPayHttpClient(val networkInfo: NetworkInfo, val context: Context) :
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -35,8 +38,9 @@ class NaviPayHttpClient(val networkInfo: NetworkInfo, val context: Context) :
|
||||
.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
with(okHttpClientBuilder) {
|
||||
if (isRetryInterceptorEnabled(UPI_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
if (TemporaryStorageHelper.isOkHttpCustomDnsV2Enabled) {
|
||||
dns(NAVI_DNS)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.navi.pay.network.retrofit
|
||||
|
||||
import com.navi.common.network.models.GenericResponse
|
||||
import com.navi.common.network.retry.annotations.RetryPolicy
|
||||
import com.navi.pay.common.model.network.RequestIdResponse
|
||||
import com.navi.pay.common.model.network.ValidateVpaRequest
|
||||
import com.navi.pay.common.model.network.ValidateVpaResponse
|
||||
@@ -109,6 +110,7 @@ interface NaviPayRetrofitService {
|
||||
private const val NAVI_PAY_API_VERSION3 = "v3"
|
||||
}
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/gateway-service/$NAVI_PAY_API_VERSION/navipay/customer")
|
||||
suspend fun getCustomer(
|
||||
@Body customerRequest: CustomerRequest
|
||||
@@ -119,6 +121,7 @@ interface NaviPayRetrofitService {
|
||||
@Body bankListRequest: BankListRequest
|
||||
): Response<GenericResponse<BankListResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/gateway-service/$NAVI_PAY_API_VERSION/navipay/banks/fetch-accounts")
|
||||
suspend fun getBankAccounts(
|
||||
@Body fetchAccountsRequest: FetchAccountsRequest
|
||||
@@ -187,14 +190,17 @@ interface NaviPayRetrofitService {
|
||||
@Body npciTokenRequest: NpciTokenRequest
|
||||
): Response<GenericResponse<NpciTokenResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@GET("/gateway-service/$NAVI_PAY_API_VERSION/navipay/npci/key")
|
||||
suspend fun fetchNpciKeys(): Response<GenericResponse<NpciKeysResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/gateway-service/$NAVI_PAY_API_VERSION/navipay/account/balance")
|
||||
suspend fun checkBalance(
|
||||
@Body checkBalanceRequest: CheckBalanceRequest
|
||||
): Response<GenericResponse<CheckBalanceResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION3/txn/sendMoney")
|
||||
suspend fun sendMoney(
|
||||
@Body sendMoneyRequest: SendMoneyRequest
|
||||
@@ -205,6 +211,7 @@ interface NaviPayRetrofitService {
|
||||
@Body mandateListRequest: MandateListRequest
|
||||
): Response<GenericResponse<MandateListResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION/vpa/validate")
|
||||
suspend fun validateVpa(
|
||||
@Body validateVpaRequest: ValidateVpaRequest
|
||||
@@ -318,6 +325,7 @@ interface NaviPayRetrofitService {
|
||||
@GET("/gateway-service/$NAVI_PAY_API_VERSION/navipay/requestId/fetch/list")
|
||||
suspend fun getRequestIdList(): Response<GenericResponse<RequestIdResponse>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/gateway-service/$NAVI_PAY_API_VERSION/navipay/phone-number/vpa")
|
||||
suspend fun payToContact(
|
||||
@Body payToContactRequest: PayToContactRequest
|
||||
|
||||
@@ -10,7 +10,6 @@ package com.navi.payment.network.retrofit
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.NAVI_PMT_RETRY_POLICY_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
@@ -27,10 +26,7 @@ class NaviPaymentsHttpClient(networkInfo: NetworkInfo, private val context: Cont
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (
|
||||
isRetryInterceptorEnabled() &&
|
||||
FirebaseRemoteConfigHelper.getBoolean(NAVI_PMT_RETRY_POLICY_ENABLED)
|
||||
) {
|
||||
if (isRetryInterceptorEnabled(NAVI_PMT_RETRY_POLICY_ENABLED)) {
|
||||
okHttpClientBuilder.addInterceptor(RetryInterceptor())
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
|
||||
@@ -25,11 +25,6 @@ import com.navi.payment.paymentscreen.model.ValidateVPAResponse
|
||||
import com.navi.payment.turbocheckout.model.PaymentScreenResponse
|
||||
import com.navi.payment.utils.Constants.PAYMENT_SDK_VERSION
|
||||
import com.navi.paymentclients.model.InitiatePaymentRequest
|
||||
import java.net.ConnectException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import javax.net.ssl.SSLHandshakeException
|
||||
import javax.net.ssl.SSLPeerUnverifiedException
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
@@ -80,6 +75,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<SyncPaymentResponse>>
|
||||
|
||||
// get ui-tron response
|
||||
@RetryPolicy
|
||||
@POST("/api/v2/get-methods")
|
||||
suspend fun getPaymentMethodsV2(
|
||||
@Header("X-Payment-SDK-Token") token: String?,
|
||||
@@ -98,17 +94,7 @@ interface RetrofitService {
|
||||
|
||||
// Pay button
|
||||
@POST("/api/v1/paynow")
|
||||
@RetryPolicy(
|
||||
retryCount = 3,
|
||||
retryOn =
|
||||
[
|
||||
SocketTimeoutException::class,
|
||||
UnknownHostException::class,
|
||||
ConnectException::class,
|
||||
SSLHandshakeException::class,
|
||||
SSLPeerUnverifiedException::class,
|
||||
],
|
||||
)
|
||||
@RetryPolicy
|
||||
suspend fun postPayNow(
|
||||
@Header("X-Payment-SDK-Token") token: String?,
|
||||
@Header("X-Target") xTarget: String,
|
||||
@@ -141,17 +127,7 @@ interface RetrofitService {
|
||||
|
||||
// transaction status
|
||||
@POST("/api/v1/transaction/status")
|
||||
@RetryPolicy(
|
||||
retryCount = 3,
|
||||
retryOn =
|
||||
[
|
||||
SocketTimeoutException::class,
|
||||
UnknownHostException::class,
|
||||
ConnectException::class,
|
||||
SSLHandshakeException::class,
|
||||
SSLPeerUnverifiedException::class,
|
||||
],
|
||||
)
|
||||
@RetryPolicy
|
||||
suspend fun fetchTransactionStatus(
|
||||
@Header("X-Payment-SDK-Token") token: String,
|
||||
@Header("X-Payment-SDK-Version")
|
||||
@@ -177,6 +153,7 @@ interface RetrofitService {
|
||||
@Header("X-Payment-SDK-Version") paymentSdkVersion: String = PAYMENT_SDK_VERSION,
|
||||
): Response<GenericResponse<Any>>
|
||||
|
||||
@RetryPolicy
|
||||
@POST("/api/v2/get-methods")
|
||||
suspend fun getPaymentScreenResponse(
|
||||
@Header("X-Payment-SDK-Token") token: String?,
|
||||
@@ -186,17 +163,7 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<PaymentScreenResponse>>
|
||||
|
||||
@POST("api/v1/one-time-payment/get-methods")
|
||||
@RetryPolicy(
|
||||
retryCount = 3,
|
||||
retryOn =
|
||||
[
|
||||
SocketTimeoutException::class,
|
||||
UnknownHostException::class,
|
||||
ConnectException::class,
|
||||
SSLHandshakeException::class,
|
||||
SSLPeerUnverifiedException::class,
|
||||
],
|
||||
)
|
||||
@RetryPolicy
|
||||
suspend fun fetchScreenData(
|
||||
@Header("X-Payment-SDK-Token") token: String?,
|
||||
@Header("X-Payment-SDK-Version") paymentSdkVersion: String,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2025 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -10,8 +10,11 @@ package com.navi.rr.common.network.retrofit
|
||||
import android.content.Context
|
||||
import com.chuckerteam.chucker.api.ChuckerCollector
|
||||
import com.chuckerteam.chucker.api.ChuckerInterceptor
|
||||
import com.navi.common.firebaseremoteconfig.FirebaseRemoteConfigHelper.RR_RETRY_INTERCEPTOR_ENABLED
|
||||
import com.navi.common.model.NetworkInfo
|
||||
import com.navi.common.network.BaseHttpClient
|
||||
import com.navi.common.network.retry.interceptor.RetryInterceptor
|
||||
import com.navi.common.network.retry.interceptor.isRetryInterceptorEnabled
|
||||
import com.navi.rr.BuildConfig
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
@@ -21,8 +24,8 @@ class NaviHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
val httpClientBuilder: OkHttpClient.Builder
|
||||
get() {
|
||||
val okHttpClientBuilder = baseHttpClientBuilder
|
||||
if (BuildConfig.DEBUG) {
|
||||
with(okHttpClientBuilder) {
|
||||
with(okHttpClientBuilder) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
addInterceptor(loggingInterceptor())
|
||||
addInterceptor(
|
||||
ChuckerInterceptor.Builder(context)
|
||||
@@ -33,6 +36,9 @@ class NaviHttpClient(networkInfo: NetworkInfo, private val context: Context) :
|
||||
.build()
|
||||
)
|
||||
}
|
||||
if (isRetryInterceptorEnabled(RR_RETRY_INTERCEPTOR_ENABLED)) {
|
||||
addInterceptor(RetryInterceptor())
|
||||
}
|
||||
}
|
||||
return okHttpClientBuilder
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user