NTP-3561 | Gold SIP setup changes (#12623)
Co-authored-by: Aman S <aman.s@navi.com>
This commit is contained in:
@@ -24,8 +24,8 @@ constructor(
|
||||
suspend fun fetchDigitalGoldSipDetails(params: Map<String, String>) =
|
||||
apiResponseCallback(retrofitService.getDigitalGoldSipDetailsPage(params = params))
|
||||
|
||||
suspend fun fetchDigitalGoldSetupSipScreen(someArg: String?) =
|
||||
apiResponseCallback(retrofitService.getDigitalGoldSetupSipPage(someArg = someArg))
|
||||
suspend fun fetchDigitalGoldSetupSipScreen(params: Map<String, String>) =
|
||||
apiResponseCallback(retrofitService.getDigitalGoldSetupSipPage(params = params))
|
||||
|
||||
suspend fun fetchSetupSipBottomSheet(params: Map<String, String?>) =
|
||||
apiResponseCallback(retrofitService.fetchSetupSipBottomSheet(params = params))
|
||||
|
||||
@@ -62,7 +62,7 @@ interface RetrofitService {
|
||||
|
||||
@GET("/kuber/sip/setup-sip-page-content")
|
||||
suspend fun getDigitalGoldSetupSipPage(
|
||||
@Query("someArg") someArg: String?
|
||||
@QueryMap params: Map<String, String>
|
||||
): Response<GenericResponse<WidgetResponse>>
|
||||
|
||||
@GET("/kuber/transactions/transaction-history-page-content")
|
||||
|
||||
@@ -1976,7 +1976,7 @@ class DigitalGoldHomeActivity :
|
||||
}
|
||||
|
||||
private fun fetchGoldSetupSipScreen() {
|
||||
homeVM.fetchDigitalGoldSetupSipScreen("")
|
||||
homeVM.fetchDigitalGoldSetupSipScreen()
|
||||
}
|
||||
|
||||
private fun fetchBuyOrderResponse(isTurboCheckoutFlow: Boolean = false) {
|
||||
|
||||
@@ -70,6 +70,7 @@ import com.navi.gold.util.Constants.SETUP_SIP_BOTTOM_SHEET
|
||||
import com.navi.gold.util.Constants.SIP_AMOUNT
|
||||
import com.navi.gold.util.Constants.SIP_AMOUNT_CAMELCASE
|
||||
import com.navi.gold.util.Constants.SIP_FREQUENCY
|
||||
import com.navi.gold.util.Constants.SOURCE
|
||||
import com.navi.gold.util.GoldAnalytics
|
||||
import com.navi.gold.viewmodels.DigitalGoldSipVM
|
||||
import com.navi.gold.viewmodels.PaymentSharedVM
|
||||
@@ -87,6 +88,7 @@ import com.navi.naviwidgets.models.SwitchWidget
|
||||
import com.navi.naviwidgets.models.WidgetChangedData
|
||||
import com.navi.naviwidgets.utils.STORE_DIGITAL_GOLD_AMOUNT
|
||||
import com.navi.naviwidgets.utils.SWITCH_WIDGET_VALUE
|
||||
import com.navi.naviwidgets.utils.UPDATE_DEFAULT_CALENDAR_DATE
|
||||
import com.navi.naviwidgets.utils.WIDGET_STATE_CHANGE
|
||||
import com.navi.naviwidgets.utils.updateDynamicText
|
||||
import com.navi.naviwidgets.viewholder.ViewHolderFactoryImpl
|
||||
@@ -363,7 +365,19 @@ class DigitalGoldSetupSipFragment :
|
||||
} else if (!isRefreshPressed) {
|
||||
showShimmer()
|
||||
}
|
||||
viewModel.fetchDigitalGoldSetupSipScreen(arguments?.getString(KEY))
|
||||
val goldSetupSipParams = getExtraParams()
|
||||
viewModel.fetchDigitalGoldSetupSipScreen(params = goldSetupSipParams)
|
||||
}
|
||||
|
||||
private fun getExtraParams(): MutableMap<String, String> {
|
||||
val params = mutableMapOf<String, String>()
|
||||
arguments?.getString(SOURCE)?.let { params[SOURCE] = it }
|
||||
arguments?.getString(FREQUENCY)?.let { params[FREQUENCY] = it }
|
||||
arguments?.getString(SIP_AMOUNT_CAMELCASE)?.let { params[SIP_AMOUNT_CAMELCASE] = it }
|
||||
arguments?.getString(INSTALLMENT_DATE_CAMELCASE)?.let {
|
||||
params[INSTALLMENT_DATE_CAMELCASE] = it
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
private fun processHeader(response: WidgetResponse?) {
|
||||
@@ -445,6 +459,9 @@ class DigitalGoldSetupSipFragment :
|
||||
viewModel.setSipInstallmentDate((value as CalendarWidgetData).selectedItemVal ?: 0)
|
||||
viewModel.setGoldValueState()
|
||||
}
|
||||
UPDATE_DEFAULT_CALENDAR_DATE -> {
|
||||
viewModel.setSipInstallmentDate(value.toString().toInt())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,10 @@ import com.navi.gold.R
|
||||
import com.navi.gold.databinding.ActivityDigitalGoldSipBinding
|
||||
import com.navi.gold.toOpenBottomSheet
|
||||
import com.navi.gold.util.Constants
|
||||
import com.navi.gold.util.Constants.FREQUENCY
|
||||
import com.navi.gold.util.Constants.INSTALLMENT_DATE_CAMELCASE
|
||||
import com.navi.gold.util.Constants.SIP_AMOUNT_CAMELCASE
|
||||
import com.navi.gold.util.Constants.SOURCE
|
||||
import com.navi.gold.util.GoldAnalytics
|
||||
import com.navi.gold.util.startExitAnimation
|
||||
import com.navi.gold.viewmodels.DigitalGoldSipVM
|
||||
@@ -168,6 +172,14 @@ class DigitalGoldSipActivity : BasePaymentActivity(), WidgetCallback, NewBottomS
|
||||
it.getString(com.navi.common.utils.Constants.SUB_REDIRECT)
|
||||
)
|
||||
bundle?.putString(Constants.TRANSACTION_KEY, it.getString(Constants.TRANSACTION_KEY))
|
||||
it.getString(SOURCE)?.let { source -> bundle?.putString(SOURCE, source) }
|
||||
it.getString(FREQUENCY)?.let { frequency -> bundle?.putString(FREQUENCY, frequency) }
|
||||
it.getString(SIP_AMOUNT_CAMELCASE)?.let { sipAmount ->
|
||||
bundle?.putString(SIP_AMOUNT_CAMELCASE, sipAmount)
|
||||
}
|
||||
it.getString(INSTALLMENT_DATE_CAMELCASE)?.let { installmentDate ->
|
||||
bundle?.putString(INSTALLMENT_DATE_CAMELCASE, installmentDate)
|
||||
}
|
||||
}
|
||||
val fragment =
|
||||
supportFragmentManager.findFragmentByTag(screenName) ?: getFragment(screenName, bundle)
|
||||
|
||||
@@ -219,9 +219,9 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchDigitalGoldSetupSipScreen(vendorKey: String?) {
|
||||
fun fetchDigitalGoldSetupSipScreen(params: Map<String, String> = emptyMap()) {
|
||||
coroutineScope.launch {
|
||||
val response = goldSipRepo.fetchDigitalGoldSetupSipScreen(vendorKey)
|
||||
val response = goldSipRepo.fetchDigitalGoldSetupSipScreen(params)
|
||||
if (response.error.isNull() && response.errors.isNullOrEmpty()) {
|
||||
_digitalGoldSetupSipWidgets.value = response.data
|
||||
} else {
|
||||
|
||||
@@ -102,7 +102,7 @@ constructor(
|
||||
?: run { fetchDigitalGoldSipDetailsScreenRemote(params) }
|
||||
}
|
||||
|
||||
fun fetchDigitalGoldSipDetailsScreenRemote(params: Map<String, String>) {
|
||||
private fun fetchDigitalGoldSipDetailsScreenRemote(params: Map<String, String>) {
|
||||
coroutineScope.launch {
|
||||
val response = goldSipRepo.fetchDigitalGoldSipDetails(params)
|
||||
if (response.error.isNull() && response.errors.isNullOrEmpty()) {
|
||||
@@ -113,16 +113,16 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchDigitalGoldSetupSipScreen(vendorKey: String?) {
|
||||
fun fetchDigitalGoldSetupSipScreen(params: Map<String, String>) {
|
||||
TemporaryStorageHelper.SOFT_REF_CACHE.get(GOLD_SETUP_SIP)
|
||||
?.let { it as? WidgetResponse }
|
||||
?.let { cachedResponse -> _digitalGoldSetupSipWidgets.value = cachedResponse }
|
||||
?: run { fetchDigitalGoldSetupSipScreenRemote(vendorKey) }
|
||||
?: run { fetchDigitalGoldSetupSipScreenRemote(params) }
|
||||
}
|
||||
|
||||
private fun fetchDigitalGoldSetupSipScreenRemote(vendorKey: String?) {
|
||||
private fun fetchDigitalGoldSetupSipScreenRemote(params: Map<String, String>) {
|
||||
coroutineScope.launch {
|
||||
val response = goldSipRepo.fetchDigitalGoldSetupSipScreen(vendorKey)
|
||||
val response = goldSipRepo.fetchDigitalGoldSetupSipScreen(params)
|
||||
if (response.error.isNull() && response.errors.isNullOrEmpty()) {
|
||||
_digitalGoldSetupSipWidgets.value = response.data
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -62,6 +62,7 @@ data class SimpleTextWidgetData(
|
||||
@SerializedName("enableParentClick") val enableParentClick: Boolean? = false,
|
||||
@SerializedName("dynamicText") val dynamicText: DynamicText? = null,
|
||||
@SerializedName("gradient") val gradient: Gradient? = null,
|
||||
@SerializedName("startValue", alternate = ["defaultValue"]) val defaultValue: Int? = null
|
||||
) : Parcelable, Serializable
|
||||
|
||||
@Parcelize
|
||||
|
||||
@@ -196,6 +196,7 @@ const val MONTHLY = "Monthly"
|
||||
const val DAILY = "Daily"
|
||||
const val DATE_SELECTOR_CONTAINER = "DATE_SELECTOR_CONTAINER"
|
||||
const val UPDATE_CALENDAR_DATE = "UPDATE_CALENDAR_DATE"
|
||||
const val UPDATE_DEFAULT_CALENDAR_DATE = "UPDATE_DEFAULT_CALENDAR_DATE"
|
||||
const val DARK_PURPLE = "#1F002A"
|
||||
const val COLOR_TRANSPARENT = "#00FFFFFF"
|
||||
const val AP_LAUNCH = "applicationPlatform/launch"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2023 by Navi Technologies Limited
|
||||
* * Copyright © 2023-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -38,7 +38,9 @@ import com.navi.naviwidgets.extensions.setDrawables
|
||||
import com.navi.naviwidgets.extensions.showWhenDataIsAvailable
|
||||
import com.navi.naviwidgets.models.SimpleTextWidget
|
||||
import com.navi.naviwidgets.models.TextGravity
|
||||
import com.navi.naviwidgets.utils.DATE_SELECTOR_WIDGET
|
||||
import com.navi.naviwidgets.utils.TimerHelper
|
||||
import com.navi.naviwidgets.utils.UPDATE_DEFAULT_CALENDAR_DATE
|
||||
import com.navi.naviwidgets.utils.checkAndShowTimer
|
||||
import com.navi.naviwidgets.utils.setMargin
|
||||
import com.navi.naviwidgets.utils.setWidgetLayoutParams
|
||||
@@ -83,6 +85,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
span = simpleTextWidget?.widgetData?.title?.span,
|
||||
::onSpanClick
|
||||
)
|
||||
updateDefaultCalendarDate()
|
||||
tvTitle.gravity =
|
||||
when (simpleTextWidget?.widgetData?.gravity) {
|
||||
TextGravity.CENTER.name -> Gravity.CENTER
|
||||
@@ -325,6 +328,15 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
)
|
||||
}
|
||||
|
||||
private fun updateDefaultCalendarDate() {
|
||||
if (simpleTextWidget?.widgetId == DATE_SELECTOR_WIDGET) {
|
||||
widgetCallback.widgetUserData(
|
||||
UPDATE_DEFAULT_CALENDAR_DATE,
|
||||
simpleTextWidget?.widgetData?.defaultValue ?: 1
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val leftPadding = 16
|
||||
private const val rightPadding = 16
|
||||
|
||||
Reference in New Issue
Block a user