NTP-70793 | Priority API onboarding for UPI module & updated contract for merchantInfo (#16561)

This commit is contained in:
Ujjwal Kumar
2025-06-12 17:07:19 +05:30
committed by GitHub
parent d8e8027036
commit 5eccff6ebe
6 changed files with 49 additions and 20 deletions

View File

@@ -22,6 +22,7 @@ import com.navi.pay.tstore.merchant.repository.MerchantInfoRepository
import com.navi.pay.utils.NAVI_PAY_DATA_REFRESH_DEFAULT_MIN_TIMESTAMP
import com.navi.pay.utils.NAVI_PAY_MERCHANT_INFO_SYNC_PAGINATION_TOKEN_KEY
import com.navi.pay.utils.NAVI_PAY_SYNC_TABLE_MERCHANT_INFO_KEY
import java.util.Locale
import javax.inject.Inject
class MerchantInfoSyncUseCase
@@ -88,8 +89,7 @@ constructor(
val merchantInfoEntities =
merchantInfoList.map { item ->
MerchantInfoEntity(
id = item.id,
name = item.name,
name = item.name.trim().lowercase(Locale.US),
iconUrl = item.iconUrl,
isDeleted = item.isDeleted,
updatedAt = item.updatedAt,

View File

@@ -605,8 +605,7 @@ val NAVI_PAY_APP_DATABASE_MIGRATION_20_21 =
db.execSQL(
"""
CREATE TABLE IF NOT EXISTS $NAVI_PAY_DATABASE_MERCHANT_INFO_TABLE_NAME (
id TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL,
name TEXT NOT NULL PRIMARY KEY,
iconUrl TEXT NOT NULL,
isDeleted INTEGER NOT NULL DEFAULT 0,
updatedAt TEXT NOT NULL DEFAULT ''
@@ -614,14 +613,5 @@ val NAVI_PAY_APP_DATABASE_MIGRATION_20_21 =
"""
.trimIndent()
)
// Create index on name column for faster lookups
db.execSQL(
"""
CREATE INDEX IF NOT EXISTS index_merchantInfo_name
ON $NAVI_PAY_DATABASE_MERCHANT_INFO_TABLE_NAME (name)
"""
.trimIndent()
)
}
}

View File

@@ -16,6 +16,7 @@ import com.navi.common.model.ModuleName
import com.navi.common.model.ModuleNameV2
import com.navi.common.model.NetworkInfo
import com.navi.common.network.converter.EmptyBodyHandlingConverterFactory
import com.navi.common.network.requestmanager.PriorityRequestManagerFacade
import com.navi.pay.common.batman.DarkKnightScheduler
import com.navi.pay.common.batman.DarkKnightSchedulerImpl
import com.navi.pay.common.connectivity.NaviPayNetworkConnectivity
@@ -133,9 +134,16 @@ object NaviPayNetworkModule {
fun providesRetrofitClient(
naviPayHttpClient: NaviPayHttpClient,
@NaviPayGsonBuilder deserializer: Gson,
priorityRequestManagerFacade: PriorityRequestManagerFacade,
): Retrofit =
Retrofit.Builder()
.baseUrl(naviPayHttpClient.networkInfo.baseUrl)
.callFactory(
priorityRequestManagerFacade.getPriorityHandlerFactory(
naviPayHttpClient.httpClientBuilder,
naviPayHttpClient.networkInfo.baseUrl,
)
)
.client(naviPayHttpClient.httpClientBuilder.build())
.addConverterFactory(EmptyBodyHandlingConverterFactory(ModuleNameV2.NAVIPAY.name))
.addConverterFactory(GsonConverterFactory.create(deserializer))

View File

@@ -10,6 +10,7 @@ package com.navi.pay.network.retrofit
import com.navi.common.model.ModuleNameV2
import com.navi.common.model.common.InvoiceDownloadData
import com.navi.common.network.models.GenericResponse
import com.navi.common.network.requestmanager.request.Priority
import com.navi.common.network.retry.annotations.RetryPolicy
import com.navi.pay.common.model.network.ActivateVpaRequest
import com.navi.pay.common.model.network.DeactivateVpaRequest
@@ -129,6 +130,7 @@ interface NaviPayRetrofitService {
private const val NAVI_PAY_API_VERSION4 = "v4"
}
@Priority(Priority.Order.HIGH)
@RetryPolicy
@POST("/gateway-service/$NAVI_PAY_API_VERSION3/navipay/customer/fetch")
suspend fun getCustomer(
@@ -138,32 +140,38 @@ interface NaviPayRetrofitService {
@GET("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/list-banks")
suspend fun getAllBanks(): Response<GenericResponse<BankListResponse>>
@Priority(Priority.Order.HIGH)
@RetryPolicy
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/banks/fetch-accounts")
suspend fun getBankAccounts(
@Body fetchAccountsRequest: FetchAccountsRequest
): Response<GenericResponse<FetchAccountsResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/banks/add-account")
suspend fun addBankAccount(
@Body addAccountRequest: AddAccountRequest
): Response<GenericResponse<Any?>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION3/navipay/customer/bind")
suspend fun bindDevice(
@Body bindDeviceRequest: BindDeviceRequest
): Response<GenericResponse<BindDeviceResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION3/navipay/bind-device/status")
suspend fun bindDeviceStatus(
@Body bindDeviceStatusRequest: BindDeviceStatusRequest
): Response<GenericResponse<BindDeviceStatusResponse>>
@Priority(Priority.Order.LOW)
@POST("/gateway-service/$NAVI_PAY_API_VERSION3/navipay/bind-device/decline")
suspend fun declineDeviceBinding(
@Body declineDeviceRequest: DeclineDeviceRequest
): Response<GenericResponse<DeclineDeviceResponse>>
@Priority(Priority.Order.HIGH)
@GET("/gateway-service/$NAVI_PAY_API_VERSION3/navipay/account/linked-accounts")
suspend fun fetchLinkedAccounts(): Response<GenericResponse<LinkedAccountsResponse>>
@@ -182,40 +190,49 @@ interface NaviPayRetrofitService {
@Body deleteAccountRequest: DeleteAccountRequest
): Response<GenericResponse<Any?>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/account/otp")
suspend fun getOtp(@Body otpRequest: OtpRequest): Response<GenericResponse<OtpResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/account/pin/reset")
suspend fun setResetPin(@Body pinResetRequest: PinResetRequest): Response<GenericResponse<Any?>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/banks/aadhaar-consent")
suspend fun checkAadhaarSupport(
@Body aadhaarConsentRequest: AadhaarConsentRequest
): Response<GenericResponse<AadhaarConsentResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/account/pin/change")
suspend fun changePin(@Body pinChangeRequest: PinChangeRequest): Response<GenericResponse<Any?>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/npci/token")
suspend fun fetchNpciToken(
@Body npciTokenRequest: NpciTokenRequest
): Response<GenericResponse<NpciTokenResponse>>
@Priority(Priority.Order.HIGH)
@RetryPolicy
@GET("/gateway-service/$NAVI_PAY_API_VERSION/navipay/npci/key")
suspend fun fetchNpciKeys(): Response<GenericResponse<NpciKeysResponse>>
@Priority(Priority.Order.HIGH)
@RetryPolicy
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/account/balance")
suspend fun checkBalance(
@Body checkBalanceRequest: CheckBalanceRequest
): Response<GenericResponse<CheckBalanceResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION4/txn/sendMoney")
suspend fun sendMoney(
@Body sendMoneyRequest: SendMoneyRequest
): Response<GenericResponse<TransactionResponse>>
@Priority(Priority.Order.HIGH)
@POST("/valhalla/navipay/$NAVI_PAY_API_VERSION/transactions")
suspend fun coreSendMoney(
@Header("X-Upi-Request-Id") upiRequestId: String,
@@ -228,6 +245,7 @@ interface NaviPayRetrofitService {
@Body mandateListRequest: MandateListRequest
): Response<GenericResponse<MandateListResponse>>
@Priority(Priority.Order.HIGH)
@RetryPolicy
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/vpa/validate")
suspend fun validateVpa(
@@ -237,41 +255,49 @@ interface NaviPayRetrofitService {
@GET("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/txn/listPending")
suspend fun fetchPendingCollectRequests(): Response<GenericResponse<CollectRequestsResponse>>
@Priority(Priority.Order.LOW)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/vpa/blockAndSpam")
suspend fun blockSpamUser(
@Body blockSpamUserRequest: BlockSpamUserRequest
): Response<GenericResponse<Any?>>
@Priority(Priority.Order.LOW)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/vpa/block/list")
suspend fun fetchBlockedUsers(
@Body blockedUsersListRequest: BlockedUsersListRequest
): Response<GenericResponse<BlockedUsersListResponse>>
@Priority(Priority.Order.LOW)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/vpa/unblock")
suspend fun unblockUser(
@Body unblockActionRequest: UnblockActionRequest
): Response<GenericResponse<Any?>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION4/txn/approve-decline")
suspend fun processCollectRequest(
@Body collectRequestActionRequest: CollectRequestActionRequest
): Response<GenericResponse<TransactionResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/mandates/create")
suspend fun createMandate(
@Body createMandateRequest: CreateMandateRequest
): Response<GenericResponse<CreateMandateResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/mandates/review")
suspend fun reviewMandate(
@Body reviewMandateRequest: ReviewMandateRequest
): Response<GenericResponse<ReviewMandateResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/mandates/pause")
suspend fun pauseUnpauseMandate(
@Body pauseUnpauseRequest: PauseUnpauseRequest
): Response<GenericResponse<PauseUnpauseResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/mandates/revoke")
suspend fun revokeMandate(
@Body revokeMandateRequest: RevokeMandateRequest
@@ -282,11 +308,13 @@ interface NaviPayRetrofitService {
@Body mandateStatusRequest: MandateStatusRequest
): Response<GenericResponse<MandateStatusResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION/navipay/mandates/execute")
suspend fun executeMandate(
@Body executeMandateRequest: ExecuteMandateRequest
): Response<GenericResponse<TransactionResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION/navipay/mandates/update-lite")
suspend fun updateMandate(
@Body updateMandateRequest: UpdateMandateRequest
@@ -325,25 +353,30 @@ interface NaviPayRetrofitService {
@Body mandateDetailRequest: MandateDetailRequest
): Response<GenericResponse<MandateItem>>
@Priority(Priority.Order.HIGH)
@GET("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/fetch/requestId/list")
suspend fun getRequestIdSuffixList(): Response<GenericResponse<RequestIdResponse>>
@Priority(Priority.Order.HIGH)
@RetryPolicy
@POST("/gateway-service/navipay/$NAVI_PAY_API_VERSION2/vpa/phone-number/vpa")
suspend fun payToContact(
@Body payToContactRequest: PayToContactRequest
): Response<GenericResponse<ValidateVpaResponse>>
@Priority(Priority.Order.LOW)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/comms/send")
suspend fun sendNpsComms(
@Body npsCommsRequest: NpsCommsRequest
): Response<GenericResponse<Any?>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/upi-lite/lite-registration")
suspend fun liteRegistration(
@Body liteRegistrationRequest: LiteRegistrationRequest
): Response<GenericResponse<LiteRegistrationResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/upi-lite/lite-sync")
suspend fun liteSync(
@Body liteSyncRequest: LiteSyncRequest
@@ -386,6 +419,7 @@ interface NaviPayRetrofitService {
@Body createConversationRequest: CreateConversationRequest,
): Response<GenericResponse<CreateConversationResponse>>
@Priority(Priority.Order.HIGH)
@POST("/gateway-service/$NAVI_PAY_API_VERSION/upi-management/vpa/activate")
suspend fun activateVpa(
@Body activateVpaRequest: ActivateVpaRequest
@@ -446,6 +480,7 @@ interface NaviPayRetrofitService {
@Body forecloseEmiRequest: ForecloseEmiRequest
): Response<GenericResponse<ForecloseEmiResponse>>
@Priority(Priority.Order.LOW)
@POST("/gateway-service/$NAVI_PAY_API_VERSION2/navipay/customer/deregister")
suspend fun deregisterNaviPay(
@Body deregisterNaviPayRequest: DeregisterNaviPayRequest

View File

@@ -16,7 +16,6 @@ data class MerchantInfoResponse(
)
data class MerchantInfoItem(
@SerializedName("id") val id: String,
@SerializedName("name") val name: String,
@SerializedName("iconUrl") val iconUrl: String,
@SerializedName("isDeleted") val isDeleted: Boolean,

View File

@@ -9,7 +9,6 @@ package com.navi.pay.tstore.merchant.model.view
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import com.navi.pay.utils.NAVI_PAY_DATABASE_MERCHANT_INFO_TABLE_NAME
@@ -19,16 +18,14 @@ import com.navi.pay.utils.NAVI_PAY_DATABASE_MERCHANT_INFO_TABLE_NAME
* history, the merchant name is looked up in this table to fetch the appropriate icon URL for
* display in the transaction list.
*
* @property id Unique identifier for the merchant, serves as primary key
* @property name Merchant name, indexed for lookups
* @property name Merchant name, primary key
* @property iconUrl URL of the merchant's logo/icon to be displayed in transaction history
* @property isDeleted Whether this merchant is marked as deleted
* @property updatedAt Last update timestamp for this merchant
*/
@Entity(tableName = NAVI_PAY_DATABASE_MERCHANT_INFO_TABLE_NAME, indices = [Index(value = ["name"])])
@Entity(tableName = NAVI_PAY_DATABASE_MERCHANT_INFO_TABLE_NAME)
data class MerchantInfoEntity(
@PrimaryKey @ColumnInfo("id") val id: String,
@ColumnInfo("name") val name: String,
@PrimaryKey @ColumnInfo("name") val name: String,
@ColumnInfo("iconUrl") val iconUrl: String,
@ColumnInfo("isDeleted") val isDeleted: Boolean,
@ColumnInfo("updatedAt") val updatedAt: String,