TP-23497 | PS | AMC RPD experimentation changes (#5914)
* TP-23497 | PS | added upi availability query param in rpd methods api * TP-23497 | PS | added upi intent uri constant
This commit is contained in:
committed by
GitHub Enterprise
parent
c4c468ed00
commit
da2b74a96e
@@ -26,13 +26,14 @@ import com.navi.amc.utils.AmcAnalytics
|
||||
import com.navi.amc.utils.AmcAnalytics.BANK_VERIFICATION_OPTIONS
|
||||
import com.navi.amc.utils.AmcAnalytics.CHANGE_BANK
|
||||
import com.navi.amc.utils.AmcAnalytics.PENNY_DROP_OPTIONS
|
||||
import com.navi.amc.utils.AmcAnalytics.UPI_APP_AVAILABLE
|
||||
import com.navi.amc.utils.Constant.PD
|
||||
import com.navi.amc.utils.Constant.RPD
|
||||
import com.navi.amc.utils.Constant.TOKEN
|
||||
import com.navi.amc.utils.Constant.UPILINK
|
||||
import com.navi.amc.utils.isUpiAppAvailable
|
||||
import com.navi.amc.utils.orValue
|
||||
import com.navi.base.model.ActionData
|
||||
import com.navi.base.model.CtaData
|
||||
import com.navi.common.firebasedb.FirebaseStatusType
|
||||
import com.navi.common.listeners.FragmentInterchangeListener
|
||||
import com.navi.common.listeners.HeaderInteractionListener
|
||||
@@ -232,6 +233,8 @@ class PennyDropOptionsFragment() : AmcBaseFragment() {
|
||||
}
|
||||
startActivityForResult(intent, REQUEST_CODE)
|
||||
} catch (ex: Exception) {
|
||||
sendEvent(AmcAnalytics.RPD_ABORTED,
|
||||
hashMapOf(UPI_APP_AVAILABLE to viewModel.isUpiAppAvailable.toString()))
|
||||
ex.log()
|
||||
}
|
||||
}
|
||||
@@ -259,12 +262,14 @@ class PennyDropOptionsFragment() : AmcBaseFragment() {
|
||||
viewModel.postPaymentSignal(it, RPD)
|
||||
}
|
||||
} else {
|
||||
sendEvent(AmcAnalytics.RPD_ABORTED)
|
||||
sendEvent(AmcAnalytics.RPD_ABORTED,
|
||||
hashMapOf(UPI_APP_AVAILABLE to viewModel.isUpiAppAvailable.toString()))
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchData() {
|
||||
showLoader()
|
||||
viewModel.isUpiAppAvailable = isUpiAppAvailable(requireContext())
|
||||
arguments?.getString(TOKEN)?.let{
|
||||
viewModel.fetchData(it)
|
||||
}
|
||||
|
||||
@@ -11,8 +11,9 @@ class PennyDropOptionsRepository @Inject constructor(private val retrofitService
|
||||
|
||||
suspend fun fetchPennyDropOptions(
|
||||
token: String,
|
||||
xTarget: String = PAYMENTS
|
||||
) = apiResponseCallback(retrofitService.fetchPennyDropOptions(token, xTarget))
|
||||
xTarget: String = PAYMENTS,
|
||||
isUpiAppAvailable: Boolean
|
||||
) = apiResponseCallback(retrofitService.fetchPennyDropOptions(token, xTarget, isUpiAppAvailable))
|
||||
|
||||
suspend fun fetchInitPaymentMethodDetails(
|
||||
methodId: String,
|
||||
|
||||
@@ -41,10 +41,11 @@ class PennyDropOptionsViewModel @Inject constructor(private val repository: Penn
|
||||
|
||||
var paymentMethod: PennyDropOption? = null
|
||||
|
||||
var isUpiAppAvailable: Boolean = false
|
||||
|
||||
fun fetchData(token: String) {
|
||||
viewModelScope.launch {
|
||||
val response = repository.fetchPennyDropOptions(token = token)
|
||||
val response = repository.fetchPennyDropOptions(token = token, isUpiAppAvailable = isUpiAppAvailable)
|
||||
if (response.error == null && response.errors.isNullOrEmpty())
|
||||
_pennyDropOptionsData.value = response.data
|
||||
else {
|
||||
|
||||
@@ -402,7 +402,8 @@ interface RetrofitService {
|
||||
@GET("/payment-method")
|
||||
suspend fun fetchPennyDropOptions(
|
||||
@Header("X-Payments-SDK-Token") token: String,
|
||||
@Header("X-Target") header: String
|
||||
@Header("X-Target") header: String,
|
||||
@Query("isUpiPossible") isUpiPossible: Boolean
|
||||
): Response<GenericResponse<PennyDropOptionsScreenData>>
|
||||
|
||||
@GET("/payment-method/details/{methodId}")
|
||||
|
||||
@@ -170,6 +170,7 @@ object AmcAnalytics {
|
||||
const val CHANGE_BANK = "changeBank"
|
||||
const val RPD_SUCCESS_SCREEN = "amc_init_kyc_bank_verify_success"
|
||||
const val RPD_ABORTED = "rpd_aborted"
|
||||
const val UPI_APP_AVAILABLE = "isUpiAppAvailable"
|
||||
|
||||
const val AMC_INIT_SIMPLIFIED_LUMPSUM = "amc_init_simplified_lumpsum"
|
||||
const val AMC_INIT_SIMPLIFIED_SIP = "amc_init_simplified_sip"
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.navi.amc.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.navi.amc.common.model.AdditionalDataAsyncResponse
|
||||
import com.navi.amc.common.model.CheckerResponse
|
||||
import com.navi.amc.common.model.NextCtaResponse
|
||||
import com.navi.amc.fundbuy.models.FundDuration
|
||||
import com.navi.amc.fundbuy.models.NavInfo
|
||||
import com.navi.amc.utils.Constant.UPI_APP_INTENT_URL
|
||||
import kotlin.math.max
|
||||
|
||||
fun calculateInvestmentReturnsAmount(
|
||||
@@ -66,4 +70,14 @@ fun generateFundDocumentName(title: String): String {
|
||||
fun getCheckerResponse(data: AdditionalDataAsyncResponse<NextCtaResponse>?): CheckerResponse? {
|
||||
data?.data?.checkerData?.content?.asyncData = data
|
||||
return data?.data?.checkerData
|
||||
}
|
||||
|
||||
fun isUpiAppAvailable(context: Context): Boolean {
|
||||
val upiIntent = Intent(Intent.ACTION_VIEW, Uri.parse(UPI_APP_INTENT_URL))
|
||||
val pm = context.packageManager
|
||||
pm?.let {
|
||||
val upiActivities = it.queryIntentActivities(upiIntent, 0)
|
||||
return (upiActivities.isNotEmpty())
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -122,4 +122,6 @@ object Constant {
|
||||
const val OTP_FLOW_TYPE_SIP_PURCHASE = "SIP_PURCHASE"
|
||||
const val OTP_FLOW_TYPE_REDEEMPTION = "REDEMPTION"
|
||||
const val OTP_FLOW_TYPE_RETRY_PAYMENT = "RETRY_PAYMENT"
|
||||
|
||||
const val UPI_APP_INTENT_URL = "upi://pay"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user