Updated on 2026-08-14
This commit is contained in:
parent
98301bcf59
commit
2eee398c36
10 changed files with 147 additions and 7 deletions
|
|
@ -293,4 +293,55 @@ sealed class TangemPayAnalyticsEvents(
|
||||||
categoryName = "Visa Card Management",
|
categoryName = "Visa Card Management",
|
||||||
event = "Visa Extra Card Issuance Confirmed",
|
event = "Visa Extra Card Issuance Confirmed",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class VaTopupButtonShowed : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Visa VA Topup Button Showed",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaTopupButtonClicked : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Visa VA Topup Button Clicked",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaConditionsPopupShowedFirstTime : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Conditions Popup Showed First Time",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaShowDetailsFirstTimeClicked : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Show Details First Time Clicked",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaSuccessScreenActivation : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Success Screen Activation",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaConditionsPopupShowed : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Conditions Popup Showed",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaShowDetailsClicked : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Show Details Clicked",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaBankingDetailsShowed : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Banking Details Showed",
|
||||||
|
)
|
||||||
|
|
||||||
|
class VaShareDetailsButtonClicked : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Share Details Button Clicked",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class VaCopyFieldClicked(val field: String) : TangemPayAnalyticsEvents(
|
||||||
|
categoryName = "Visa VA Topup",
|
||||||
|
event = "Copy Field Clicked",
|
||||||
|
params = mapOf("field" to field),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -125,6 +125,9 @@ internal class TangemPayCardPageScreenComponent(
|
||||||
dailyDepositLimit = VA_DAILY_DEPOSIT_LIMIT_PLACEHOLDER,
|
dailyDepositLimit = VA_DAILY_DEPOSIT_LIMIT_PLACEHOLDER,
|
||||||
shouldSkipIntro = true,
|
shouldSkipIntro = true,
|
||||||
listener = VirtualAccountAddFundsListener { model.bottomSheetNavigation.dismiss() },
|
listener = VirtualAccountAddFundsListener { model.bottomSheetNavigation.dismiss() },
|
||||||
|
onDetailsShown = model::onVaBankingDetailsShown,
|
||||||
|
onShareClicked = model::onVaShareDetailsClicked,
|
||||||
|
onFieldCopied = model::onVaFieldCopied,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
is TangemPayCardNavigation.Receive -> tokenReceiveComponentFactory.create(
|
is TangemPayCardNavigation.Receive -> tokenReceiveComponentFactory.create(
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,9 @@ internal class TangemPayDetailsComponent(
|
||||||
dailyDepositLimit = VA_DAILY_DEPOSIT_LIMIT_PLACEHOLDER,
|
dailyDepositLimit = VA_DAILY_DEPOSIT_LIMIT_PLACEHOLDER,
|
||||||
shouldSkipIntro = true,
|
shouldSkipIntro = true,
|
||||||
listener = VirtualAccountAddFundsListener { model.bottomSheetNavigation.dismiss() },
|
listener = VirtualAccountAddFundsListener { model.bottomSheetNavigation.dismiss() },
|
||||||
|
onDetailsShown = model::onVaBankingDetailsShown,
|
||||||
|
onShareClicked = model::onVaShareDetailsClicked,
|
||||||
|
onFieldCopied = model::onVaFieldCopied,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
is TangemPayDetailsNavigation.IssueAdditionalCard -> TangemPayIssueAdditionalCardComponent(
|
is TangemPayDetailsNavigation.IssueAdditionalCard -> TangemPayIssueAdditionalCardComponent(
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
package com.tangem.features.tangempay.model
|
package com.tangem.features.tangempay.model
|
||||||
|
|
||||||
import androidx.compose.runtime.Stable
|
import androidx.compose.runtime.Stable
|
||||||
|
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||||
import com.tangem.core.decompose.di.ModelScoped
|
import com.tangem.core.decompose.di.ModelScoped
|
||||||
import com.tangem.core.decompose.model.Model
|
import com.tangem.core.decompose.model.Model
|
||||||
import com.tangem.core.decompose.model.ParamsContainer
|
import com.tangem.core.decompose.model.ParamsContainer
|
||||||
import com.tangem.domain.models.ReceiveAddressModel
|
import com.tangem.domain.models.ReceiveAddressModel
|
||||||
import com.tangem.domain.models.ReceiveAddressModel.DisplayType
|
import com.tangem.domain.models.ReceiveAddressModel.DisplayType
|
||||||
import com.tangem.domain.pay.model.TangemPayTopUpData
|
import com.tangem.domain.pay.model.TangemPayTopUpData
|
||||||
|
import com.tangem.domain.tangempay.TangemPayAnalyticsEvents
|
||||||
import com.tangem.features.tangempay.TangemPayFeatureToggles
|
import com.tangem.features.tangempay.TangemPayFeatureToggles
|
||||||
import com.tangem.features.tangempay.components.TangemPayAddFundsComponent
|
import com.tangem.features.tangempay.components.TangemPayAddFundsComponent
|
||||||
import com.tangem.features.tangempay.entity.TangemPayAddFundsUM
|
import com.tangem.features.tangempay.entity.TangemPayAddFundsUM
|
||||||
|
|
@ -21,13 +23,22 @@ internal class TangemPayAddFundsModel @Inject constructor(
|
||||||
paramsContainer: ParamsContainer,
|
paramsContainer: ParamsContainer,
|
||||||
override val dispatchers: CoroutineDispatcherProvider,
|
override val dispatchers: CoroutineDispatcherProvider,
|
||||||
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
|
private val tangemPayFeatureToggles: TangemPayFeatureToggles,
|
||||||
private val virtualAccountToggles: VirtualAccountFeatureToggles,
|
virtualAccountToggles: VirtualAccountFeatureToggles,
|
||||||
|
analytics: AnalyticsEventHandler,
|
||||||
) : Model() {
|
) : Model() {
|
||||||
|
|
||||||
private val params = paramsContainer.require<TangemPayAddFundsComponent.Params>()
|
private val params = paramsContainer.require<TangemPayAddFundsComponent.Params>()
|
||||||
|
|
||||||
|
private val isBankTransferShown = virtualAccountToggles.isVaMvp0Enabled && params.virtualAccountOnramp != null
|
||||||
|
|
||||||
val uiState: TangemPayAddFundsUM = getInitialState()
|
val uiState: TangemPayAddFundsUM = getInitialState()
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (isBankTransferShown) {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaTopupButtonShowed())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getInitialState(): TangemPayAddFundsUM {
|
private fun getInitialState(): TangemPayAddFundsUM {
|
||||||
val data = TangemPayTopUpData(
|
val data = TangemPayTopUpData(
|
||||||
currency = params.cryptoCurrency,
|
currency = params.cryptoCurrency,
|
||||||
|
|
@ -45,7 +56,7 @@ internal class TangemPayAddFundsModel @Inject constructor(
|
||||||
return TangemPayAddFundsUMConverter(
|
return TangemPayAddFundsUMConverter(
|
||||||
listener = params.listener,
|
listener = params.listener,
|
||||||
isRedesignEnabled = tangemPayFeatureToggles.isRedesignEnabled,
|
isRedesignEnabled = tangemPayFeatureToggles.isRedesignEnabled,
|
||||||
shouldShowBankTransfer = virtualAccountToggles.isVaMvp0Enabled && params.virtualAccountOnramp != null,
|
shouldShowBankTransfer = isBankTransferShown,
|
||||||
).convert(data)
|
).convert(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -489,6 +489,7 @@ internal class TangemPayCardPageModel @Inject constructor(
|
||||||
override fun onClickBankTransfer() {
|
override fun onClickBankTransfer() {
|
||||||
val loaded = currentStatus.value.ifLoadedOrNull { it } ?: return
|
val loaded = currentStatus.value.ifLoadedOrNull { it } ?: return
|
||||||
val onramp = loaded.virtualAccount ?: return
|
val onramp = loaded.virtualAccount ?: return
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaTopupButtonClicked())
|
||||||
bottomSheetNavigation.dismiss()
|
bottomSheetNavigation.dismiss()
|
||||||
bottomSheetNavigation.activate(
|
bottomSheetNavigation.activate(
|
||||||
TangemPayCardNavigation.VirtualAccountDeposit(
|
TangemPayCardNavigation.VirtualAccountDeposit(
|
||||||
|
|
@ -500,6 +501,7 @@ internal class TangemPayCardPageModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onVirtualAccountOrderCreated() {
|
fun onVirtualAccountOrderCreated() {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaSuccessScreenActivation())
|
||||||
bottomSheetNavigation.dismiss()
|
bottomSheetNavigation.dismiss()
|
||||||
router.push(TangemPayCardDetailsInnerRoute.VirtualAccountDepositSuccess)
|
router.push(TangemPayCardDetailsInnerRoute.VirtualAccountDepositSuccess)
|
||||||
}
|
}
|
||||||
|
|
@ -514,6 +516,18 @@ internal class TangemPayCardPageModel @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onVaBankingDetailsShown() {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaBankingDetailsShowed())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onVaShareDetailsClicked() {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaShareDetailsButtonClicked())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onVaFieldCopied(field: String) {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaCopyFieldClicked(field))
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDismissAddFunds() {
|
override fun onDismissAddFunds() {
|
||||||
bottomSheetNavigation.dismiss()
|
bottomSheetNavigation.dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -367,6 +367,7 @@ internal class TangemPayDetailsModel @Inject constructor(
|
||||||
override fun onClickBankTransfer() {
|
override fun onClickBankTransfer() {
|
||||||
val loaded = currentStatus.value.ifLoadedOrNull { it } ?: return
|
val loaded = currentStatus.value.ifLoadedOrNull { it } ?: return
|
||||||
val onramp = loaded.virtualAccount ?: return
|
val onramp = loaded.virtualAccount ?: return
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaTopupButtonClicked())
|
||||||
bottomSheetNavigation.dismiss()
|
bottomSheetNavigation.dismiss()
|
||||||
bottomSheetNavigation.activate(
|
bottomSheetNavigation.activate(
|
||||||
TangemPayDetailsNavigation.VirtualAccountDeposit(
|
TangemPayDetailsNavigation.VirtualAccountDeposit(
|
||||||
|
|
@ -378,6 +379,7 @@ internal class TangemPayDetailsModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onVirtualAccountOrderCreated() {
|
fun onVirtualAccountOrderCreated() {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaSuccessScreenActivation())
|
||||||
bottomSheetNavigation.dismiss()
|
bottomSheetNavigation.dismiss()
|
||||||
router.push(TangemPayAccountDetailsInnerRoute.VirtualAccountDepositSuccess)
|
router.push(TangemPayAccountDetailsInnerRoute.VirtualAccountDepositSuccess)
|
||||||
}
|
}
|
||||||
|
|
@ -392,6 +394,18 @@ internal class TangemPayDetailsModel @Inject constructor(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onVaBankingDetailsShown() {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaBankingDetailsShowed())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onVaShareDetailsClicked() {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaShareDetailsButtonClicked())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun onVaFieldCopied(field: String) {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaCopyFieldClicked(field))
|
||||||
|
}
|
||||||
|
|
||||||
override fun onClickReceive(data: TangemPayTopUpData) {
|
override fun onClickReceive(data: TangemPayTopUpData) {
|
||||||
analytics.send(TangemPayAnalyticsEvents.ReceiveFundsClicked())
|
analytics.send(TangemPayAnalyticsEvents.ReceiveFundsClicked())
|
||||||
bottomSheetNavigation.dismiss()
|
bottomSheetNavigation.dismiss()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.tangem.features.tangempay.model
|
package com.tangem.features.tangempay.model
|
||||||
|
|
||||||
import androidx.compose.runtime.Stable
|
import androidx.compose.runtime.Stable
|
||||||
|
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||||
import com.tangem.core.decompose.di.ModelScoped
|
import com.tangem.core.decompose.di.ModelScoped
|
||||||
import com.tangem.core.decompose.model.Model
|
import com.tangem.core.decompose.model.Model
|
||||||
import com.tangem.core.decompose.model.ParamsContainer
|
import com.tangem.core.decompose.model.ParamsContainer
|
||||||
|
|
@ -10,6 +11,7 @@ import com.tangem.core.ui.extensions.resourceReference
|
||||||
import com.tangem.core.ui.message.ToastMessage
|
import com.tangem.core.ui.message.ToastMessage
|
||||||
import com.tangem.domain.models.account.VirtualAccountOnramp
|
import com.tangem.domain.models.account.VirtualAccountOnramp
|
||||||
import com.tangem.domain.pay.usecase.CreateVirtualAccountOrderUseCase
|
import com.tangem.domain.pay.usecase.CreateVirtualAccountOrderUseCase
|
||||||
|
import com.tangem.domain.tangempay.TangemPayAnalyticsEvents
|
||||||
import com.tangem.features.tangempay.components.TangemPayVirtualAccountDepositComponent
|
import com.tangem.features.tangempay.components.TangemPayVirtualAccountDepositComponent
|
||||||
import com.tangem.features.tangempay.details.impl.R
|
import com.tangem.features.tangempay.details.impl.R
|
||||||
import com.tangem.features.tangempay.entity.TangemPayVirtualAccountDepositUM
|
import com.tangem.features.tangempay.entity.TangemPayVirtualAccountDepositUM
|
||||||
|
|
@ -29,6 +31,7 @@ internal class TangemPayVirtualAccountDepositModel @Inject constructor(
|
||||||
private val urlOpener: UrlOpener,
|
private val urlOpener: UrlOpener,
|
||||||
private val uiMessageSender: UiMessageSender,
|
private val uiMessageSender: UiMessageSender,
|
||||||
private val createVirtualAccountOrderUseCase: CreateVirtualAccountOrderUseCase,
|
private val createVirtualAccountOrderUseCase: CreateVirtualAccountOrderUseCase,
|
||||||
|
private val analytics: AnalyticsEventHandler,
|
||||||
) : Model() {
|
) : Model() {
|
||||||
|
|
||||||
private val params = paramsContainer.require<TangemPayVirtualAccountDepositComponent.Params>()
|
private val params = paramsContainer.require<TangemPayVirtualAccountDepositComponent.Params>()
|
||||||
|
|
@ -55,14 +58,29 @@ internal class TangemPayVirtualAccountDepositModel @Inject constructor(
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
val event = if (params.virtualAccountOnramp is VirtualAccountOnramp.Eligible) {
|
||||||
|
TangemPayAnalyticsEvents.VaConditionsPopupShowedFirstTime()
|
||||||
|
} else {
|
||||||
|
TangemPayAnalyticsEvents.VaConditionsPopupShowed()
|
||||||
|
}
|
||||||
|
analytics.send(event)
|
||||||
|
}
|
||||||
|
|
||||||
fun onDismiss() {
|
fun onDismiss() {
|
||||||
params.onDismiss()
|
params.onDismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onShowDetailsClick() {
|
private fun onShowDetailsClick() {
|
||||||
when (params.virtualAccountOnramp) {
|
when (params.virtualAccountOnramp) {
|
||||||
is VirtualAccountOnramp.Available -> params.onShowDetails(params.virtualAccountOnramp)
|
is VirtualAccountOnramp.Available -> {
|
||||||
VirtualAccountOnramp.Eligible -> createVirtualAccountOrder()
|
analytics.send(TangemPayAnalyticsEvents.VaShowDetailsClicked())
|
||||||
|
params.onShowDetails(params.virtualAccountOnramp)
|
||||||
|
}
|
||||||
|
VirtualAccountOnramp.Eligible -> {
|
||||||
|
analytics.send(TangemPayAnalyticsEvents.VaShowDetailsFirstTimeClicked())
|
||||||
|
createVirtualAccountOrder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import arrow.core.Either
|
||||||
import arrow.core.left
|
import arrow.core.left
|
||||||
import arrow.core.right
|
import arrow.core.right
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||||
import com.tangem.core.decompose.model.MutableParamsContainer
|
import com.tangem.core.decompose.model.MutableParamsContainer
|
||||||
import com.tangem.core.decompose.ui.UiMessageSender
|
import com.tangem.core.decompose.ui.UiMessageSender
|
||||||
import com.tangem.core.navigation.url.UrlOpener
|
import com.tangem.core.navigation.url.UrlOpener
|
||||||
|
|
@ -12,6 +13,7 @@ import com.tangem.domain.models.account.BankCredentials
|
||||||
import com.tangem.domain.models.account.VirtualAccountOnramp
|
import com.tangem.domain.models.account.VirtualAccountOnramp
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
import com.tangem.domain.pay.usecase.CreateVirtualAccountOrderUseCase
|
import com.tangem.domain.pay.usecase.CreateVirtualAccountOrderUseCase
|
||||||
|
import com.tangem.domain.tangempay.TangemPayAnalyticsEvents
|
||||||
import com.tangem.domain.visa.error.VisaApiError
|
import com.tangem.domain.visa.error.VisaApiError
|
||||||
import com.tangem.features.tangempay.components.TangemPayVirtualAccountDepositComponent
|
import com.tangem.features.tangempay.components.TangemPayVirtualAccountDepositComponent
|
||||||
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
import com.tangem.utils.coroutines.TestingCoroutineDispatcherProvider
|
||||||
|
|
@ -39,10 +41,11 @@ internal class TangemPayVirtualAccountDepositModelTest {
|
||||||
private val createVirtualAccountOrderUseCase: CreateVirtualAccountOrderUseCase = mockk()
|
private val createVirtualAccountOrderUseCase: CreateVirtualAccountOrderUseCase = mockk()
|
||||||
private val onShowDetails: (VirtualAccountOnramp.Available) -> Unit = mockk(relaxed = true)
|
private val onShowDetails: (VirtualAccountOnramp.Available) -> Unit = mockk(relaxed = true)
|
||||||
private val onOrderCreated: () -> Unit = mockk(relaxed = true)
|
private val onOrderCreated: () -> Unit = mockk(relaxed = true)
|
||||||
|
private val analytics: AnalyticsEventHandler = mockk(relaxed = true)
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
fun resetMocks() {
|
fun resetMocks() {
|
||||||
clearMocks(createVirtualAccountOrderUseCase, onShowDetails, onOrderCreated, uiMessageSender)
|
clearMocks(createVirtualAccountOrderUseCase, onShowDetails, onOrderCreated, uiMessageSender, analytics)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -58,6 +61,8 @@ internal class TangemPayVirtualAccountDepositModelTest {
|
||||||
// Assert
|
// Assert
|
||||||
verify(exactly = 1) { onShowDetails(onramp) }
|
verify(exactly = 1) { onShowDetails(onramp) }
|
||||||
coVerify(exactly = 0) { createVirtualAccountOrderUseCase(any(), any()) }
|
coVerify(exactly = 0) { createVirtualAccountOrderUseCase(any(), any()) }
|
||||||
|
verify(exactly = 1) { analytics.send(ofType<TangemPayAnalyticsEvents.VaConditionsPopupShowed>()) }
|
||||||
|
verify(exactly = 1) { analytics.send(ofType<TangemPayAnalyticsEvents.VaShowDetailsClicked>()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -74,6 +79,8 @@ internal class TangemPayVirtualAccountDepositModelTest {
|
||||||
coVerify(exactly = 1) { createVirtualAccountOrderUseCase(userWalletId, paymentAccountAddress) }
|
coVerify(exactly = 1) { createVirtualAccountOrderUseCase(userWalletId, paymentAccountAddress) }
|
||||||
verify(exactly = 1) { onOrderCreated() }
|
verify(exactly = 1) { onOrderCreated() }
|
||||||
assertThat(model.uiState.value.isLoading).isFalse()
|
assertThat(model.uiState.value.isLoading).isFalse()
|
||||||
|
verify(exactly = 1) { analytics.send(ofType<TangemPayAnalyticsEvents.VaConditionsPopupShowedFirstTime>()) }
|
||||||
|
verify(exactly = 1) { analytics.send(ofType<TangemPayAnalyticsEvents.VaShowDetailsFirstTimeClicked>()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -130,6 +137,7 @@ internal class TangemPayVirtualAccountDepositModelTest {
|
||||||
urlOpener = urlOpener,
|
urlOpener = urlOpener,
|
||||||
uiMessageSender = uiMessageSender,
|
uiMessageSender = uiMessageSender,
|
||||||
createVirtualAccountOrderUseCase = createVirtualAccountOrderUseCase,
|
createVirtualAccountOrderUseCase = createVirtualAccountOrderUseCase,
|
||||||
|
analytics = analytics,
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun bankCredentials() = BankCredentials(
|
private fun bankCredentials() = BankCredentials(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@ interface VirtualAccountAddFundsBottomSheetComponent : ComposableBottomSheetComp
|
||||||
val dailyDepositLimit: String,
|
val dailyDepositLimit: String,
|
||||||
val listener: VirtualAccountAddFundsListener,
|
val listener: VirtualAccountAddFundsListener,
|
||||||
val shouldSkipIntro: Boolean = false,
|
val shouldSkipIntro: Boolean = false,
|
||||||
|
// Analytics hooks — supplied by callers that track this sheet (e.g. TangemPay VA topup); no-op otherwise.
|
||||||
|
val onDetailsShown: () -> Unit = {},
|
||||||
|
val onShareClicked: () -> Unit = {},
|
||||||
|
val onFieldCopied: (fieldName: String) -> Unit = {},
|
||||||
)
|
)
|
||||||
|
|
||||||
data class RequisitesRow(
|
data class RequisitesRow(
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,13 @@ internal class VirtualAccountAddFundsModel @Inject constructor(
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (params.shouldSkipIntro) {
|
||||||
|
// send analytics
|
||||||
|
params.onDetailsShown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun onDismiss() {
|
fun onDismiss() {
|
||||||
params.listener.onAddFundsDismiss()
|
params.listener.onAddFundsDismiss()
|
||||||
}
|
}
|
||||||
|
|
@ -44,6 +51,7 @@ internal class VirtualAccountAddFundsModel @Inject constructor(
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun showDetailsContent() {
|
private fun showDetailsContent() {
|
||||||
|
params.onDetailsShown()
|
||||||
uiState.update { state -> state.copy(content = buildDetailsContent()) }
|
uiState.update { state -> state.copy(content = buildDetailsContent()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,13 +60,19 @@ internal class VirtualAccountAddFundsModel @Inject constructor(
|
||||||
.map { detailItem(label = it.title, value = it.value) }
|
.map { detailItem(label = it.title, value = it.value) }
|
||||||
.toImmutableList(),
|
.toImmutableList(),
|
||||||
dailyLimit = params.dailyDepositLimit,
|
dailyLimit = params.dailyDepositLimit,
|
||||||
onShareClick = { shareManager.shareText(buildShareText()) },
|
onShareClick = {
|
||||||
|
params.onShareClicked()
|
||||||
|
shareManager.shareText(buildShareText())
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun detailItem(label: String, value: String) = VirtualAccountAddFundsUM.DetailItem(
|
private fun detailItem(label: String, value: String) = VirtualAccountAddFundsUM.DetailItem(
|
||||||
label = stringReference(label),
|
label = stringReference(label),
|
||||||
value = value,
|
value = value,
|
||||||
onCopyClick = { clipboardManager.setText(text = value, isSensitive = true) },
|
onCopyClick = {
|
||||||
|
params.onFieldCopied(label)
|
||||||
|
clipboardManager.setText(text = value, isSensitive = true)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun buildShareText(): String {
|
private fun buildShareText(): String {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue