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:
rahul bhat
2022-02-03 11:15:04 +05:30
committed by GitHub Enterprise
6 changed files with 47 additions and 8 deletions

View File

@@ -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

View File

@@ -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
) {

View File

@@ -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>>

View File

@@ -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"
}
}

View File

@@ -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())

View File

@@ -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 {