Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-30 03:18:34 -07:00
parent 8b06c1c5c7
commit dce35fc26b
4 changed files with 48 additions and 0 deletions

View file

@ -319,6 +319,11 @@ sealed class TangemPayAnalyticsEvents(
event = "Success Screen Activation", event = "Success Screen Activation",
) )
class VaPreparationPopupShowed : TangemPayAnalyticsEvents(
categoryName = "Visa VA Topup",
event = "Preparation Popup Showed",
)
class VaConditionsPopupShowed : TangemPayAnalyticsEvents( class VaConditionsPopupShowed : TangemPayAnalyticsEvents(
categoryName = "Visa VA Topup", categoryName = "Visa VA Topup",
event = "Conditions Popup Showed", event = "Conditions Popup Showed",
@ -334,6 +339,11 @@ sealed class TangemPayAnalyticsEvents(
event = "Banking Details Showed", event = "Banking Details Showed",
) )
class VaDetailsErrorShowed : TangemPayAnalyticsEvents(
categoryName = "Visa VA Topup",
event = "Details Error Showed",
)
class VaShareDetailsButtonClicked : TangemPayAnalyticsEvents( class VaShareDetailsButtonClicked : TangemPayAnalyticsEvents(
categoryName = "Visa VA Topup", categoryName = "Visa VA Topup",
event = "Share Details Button Clicked", event = "Share Details Button Clicked",

View file

@ -476,6 +476,7 @@ internal class TangemPayCardPageModel @Inject constructor(
} }
fun showVaBankingDetailsError() { fun showVaBankingDetailsError() {
analytics.send(TangemPayAnalyticsEvents.VaDetailsErrorShowed())
bottomSheetNavigation.dismiss() bottomSheetNavigation.dismiss()
bottomSheetNavigation.activate( bottomSheetNavigation.activate(
TangemPayCardNavigation.VaBankingDetailsError(userWalletId = userWalletId), TangemPayCardNavigation.VaBankingDetailsError(userWalletId = userWalletId),
@ -483,6 +484,7 @@ internal class TangemPayCardPageModel @Inject constructor(
} }
private fun showVaPreparing() { private fun showVaPreparing() {
analytics.send(TangemPayAnalyticsEvents.VaPreparationPopupShowed())
bottomSheetNavigation.dismiss() bottomSheetNavigation.dismiss()
uiMessageSender.send(message = TangemPayMessagesFactory.createVaPreparingMessage()) uiMessageSender.send(message = TangemPayMessagesFactory.createVaPreparingMessage())
} }

View file

@ -380,6 +380,7 @@ internal class TangemPayDetailsModel @Inject constructor(
} }
fun showVaBankingDetailsError() { fun showVaBankingDetailsError() {
analytics.send(TangemPayAnalyticsEvents.VaDetailsErrorShowed())
bottomSheetNavigation.dismiss() bottomSheetNavigation.dismiss()
bottomSheetNavigation.activate( bottomSheetNavigation.activate(
TangemPayDetailsNavigation.VaBankingDetailsError(userWalletId = userWalletId), TangemPayDetailsNavigation.VaBankingDetailsError(userWalletId = userWalletId),
@ -387,6 +388,7 @@ internal class TangemPayDetailsModel @Inject constructor(
} }
private fun showVaPreparing() { private fun showVaPreparing() {
analytics.send(TangemPayAnalyticsEvents.VaPreparationPopupShowed())
bottomSheetNavigation.dismiss() bottomSheetNavigation.dismiss()
uiMessageSender.send(message = TangemPayMessagesFactory.createVaPreparingMessage()) uiMessageSender.send(message = TangemPayMessagesFactory.createVaPreparingMessage())
} }

View file

@ -7,6 +7,7 @@ import com.tangem.core.decompose.model.MutableParamsContainer
import com.tangem.domain.models.StatusSource import com.tangem.domain.models.StatusSource
import com.tangem.domain.models.account.AccountStatus import com.tangem.domain.models.account.AccountStatus
import com.tangem.domain.models.account.PaymentAccountStatusValue import com.tangem.domain.models.account.PaymentAccountStatusValue
import com.tangem.domain.models.account.VirtualAccountOnramp
import com.tangem.domain.models.pay.TangemPayCardFrozenState import com.tangem.domain.models.pay.TangemPayCardFrozenState
import com.tangem.domain.models.pay.TangemPayDetailsInitialRoute import com.tangem.domain.models.pay.TangemPayDetailsInitialRoute
import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.models.wallet.UserWalletId
@ -30,6 +31,7 @@ import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource import org.junit.jupiter.params.provider.MethodSource
import java.math.BigDecimal import java.math.BigDecimal
@ -82,6 +84,36 @@ internal class TangemPayDetailsModelTest {
model.onDestroy() model.onDestroy()
} }
@Test
fun `GIVEN virtual account is processing WHEN bank transfer clicked THEN preparation popup event sent`() =
runTest {
// GIVEN
val model = createModel(testScope = this, virtualAccount = VirtualAccountOnramp.Processing)
advanceUntilIdle()
// WHEN
model.onClickBankTransfer()
// THEN
verify(exactly = 1) { analytics.send(ofType<TangemPayAnalyticsEvents.VaPreparationPopupShowed>()) }
verify(exactly = 0) { analytics.send(ofType<TangemPayAnalyticsEvents.VaTopupButtonClicked>()) }
model.onDestroy()
}
@Test
fun `GIVEN loaded status WHEN banking details error shown THEN details error event sent`() = runTest {
// GIVEN
val model = createModel(testScope = this)
advanceUntilIdle()
// WHEN
model.showVaBankingDetailsError()
// THEN
verify(exactly = 1) { analytics.send(ofType<TangemPayAnalyticsEvents.VaDetailsErrorShowed>()) }
model.onDestroy()
}
private fun createModel( private fun createModel(
testScope: TestScope, testScope: TestScope,
statusSource: StatusSource = StatusSource.ACTUAL, statusSource: StatusSource = StatusSource.ACTUAL,
@ -89,11 +121,13 @@ internal class TangemPayDetailsModelTest {
availableForWithdrawal: BigDecimal = BigDecimal.ZERO, availableForWithdrawal: BigDecimal = BigDecimal.ZERO,
accountError: PaymentAccountStatusValue.Error? = null, accountError: PaymentAccountStatusValue.Error? = null,
statusValue: PaymentAccountStatusValue? = null, statusValue: PaymentAccountStatusValue? = null,
virtualAccount: VirtualAccountOnramp? = null,
): TangemPayDetailsModel { ): TangemPayDetailsModel {
val loaded: PaymentAccountStatusValue.Loaded = mockk(relaxed = true) { val loaded: PaymentAccountStatusValue.Loaded = mockk(relaxed = true) {
every { source } returns statusSource every { source } returns statusSource
every { error } returns accountError every { error } returns accountError
every { customerId } returns "customer-id" every { customerId } returns "customer-id"
every { this@mockk.virtualAccount } returns virtualAccount
every { cards } returns listOf(tangemPayCard()) every { cards } returns listOf(tangemPayCard())
every { balance } returns PaymentAccountStatusValue.Balance( every { balance } returns PaymentAccountStatusValue.Balance(
fiatBalance = PaymentAccountStatusValue.FiatBalance( fiatBalance = PaymentAccountStatusValue.FiatBalance(