Merge pull request #2315 from medici/integration/move_cross_sell_to_sa_layer
Moving cross sell api to SA layer
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.naviapp.models.request
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class CrossSellProductDetailsRequest(
|
||||
@SerializedName("journey")
|
||||
val journey: String? = null,
|
||||
@SerializedName("context")
|
||||
val context: Context? = null
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
data class Context(
|
||||
@SerializedName("loan_application_id")
|
||||
val loanApplicationId: String? = null
|
||||
) : Parcelable
|
||||
@@ -33,7 +33,7 @@ data class ProductBanner(
|
||||
val widgetName: String? = WIDGET_NAME,
|
||||
@SerializedName("url")
|
||||
val imageUrl: String? = null,
|
||||
@SerializedName("deepLinkCta")
|
||||
@SerializedName("actionData")
|
||||
val actionData: CtaData? = null
|
||||
|
||||
) {
|
||||
|
||||
@@ -743,8 +743,9 @@ interface RetrofitService {
|
||||
@GET("/banks/{code}")
|
||||
suspend fun checkIfscCode(@Path("code") code: String): Response<GenericResponse<BankBranch>>
|
||||
|
||||
@GET("/loan-applications/{loanApplicationReferenceId}/general-insurance")
|
||||
suspend fun getProductDetails(@Path("loanApplicationReferenceId") referenceId: String): Response<GenericResponse<ProductDetails>>
|
||||
@POST("/cross-sell")
|
||||
suspend fun getProductDetails(@Body crossSellProductDetailsRequest: CrossSellProductDetailsRequest):
|
||||
Response<GenericResponse<ProductDetails>>
|
||||
|
||||
@GET("/loan-accounts/{loanAccountNumber}/loan-disbursement-details")
|
||||
suspend fun getDelayedDisbursementDetails(@Path("loanAccountNumber") referenceId: String): Response<GenericResponse<DelayedDisbursementDetails>>
|
||||
|
||||
@@ -47,7 +47,10 @@ class LoanDisbursementProductPlacementActivity : BaseActivity(), HealthInsurance
|
||||
val loanApplicationId = PreferenceManager.getStringPreference(LOAN_APPLICATION_ID)
|
||||
if (!loanApplicationId.isNullOrEmpty()) {
|
||||
showLoader()
|
||||
viewModel.getProductDetails(loanApplicationId)
|
||||
viewModel.getProductDetails(
|
||||
journey = JOURNEY,
|
||||
referenceId = loanApplicationId
|
||||
)
|
||||
} else {
|
||||
viewModel.fetchLoanBasicDetails()
|
||||
}
|
||||
@@ -113,4 +116,8 @@ class LoanDisbursementProductPlacementActivity : BaseActivity(), HealthInsurance
|
||||
|
||||
override fun onBackPressed() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val JOURNEY = "personal-loan"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,21 @@
|
||||
package com.naviapp.personalloan.getloan.repositories
|
||||
|
||||
import com.naviapp.models.request.Context
|
||||
import com.naviapp.models.request.CrossSellProductDetailsRequest
|
||||
import com.naviapp.network.retrofit.ResponseCallback
|
||||
import com.naviapp.utils.retrofitService
|
||||
import com.naviapp.utils.superAppRetrofitService
|
||||
|
||||
class ProductRepository : ResponseCallback() {
|
||||
suspend fun getProductDetails(referenceId: String) =
|
||||
apiResponseCallback(retrofitService().getProductDetails(referenceId))
|
||||
suspend fun getProductDetails(
|
||||
journey: String,
|
||||
referenceId: String
|
||||
) =
|
||||
apiResponseCallback(
|
||||
superAppRetrofitService().getProductDetails(CrossSellProductDetailsRequest(
|
||||
journey = journey,
|
||||
context = Context(loanApplicationId = referenceId)
|
||||
)))
|
||||
|
||||
suspend fun fetchLoanBasicDetails() =
|
||||
apiResponseCallback(retrofitService().fetchLoanBasicDetails())
|
||||
|
||||
@@ -20,9 +20,12 @@ class LoanDisbursementProductPlacementVM(private val productRepository: ProductR
|
||||
val loanBasicDetails: LiveData<LoanBasicDetailsResponse>
|
||||
get() = _loanBasicDetails
|
||||
|
||||
fun getProductDetails(referenceId: String) {
|
||||
fun getProductDetails(journey: String, referenceId: String) {
|
||||
coroutineScope.launch {
|
||||
val response = productRepository.getProductDetails(referenceId)
|
||||
val response = productRepository.getProductDetails(
|
||||
journey = journey,
|
||||
referenceId = referenceId
|
||||
)
|
||||
if (response.error == null && response.errors.isNullOrEmpty()) {
|
||||
_productDetail.value = response.data
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user