Updated on 2026-08-14
This commit is contained in:
parent
d84f383cf8
commit
357bee1107
9 changed files with 7 additions and 47 deletions
|
|
@ -216,7 +216,6 @@ internal class DefaultPaymentAccountStatusFetcher @Inject constructor(
|
||||||
return if (hasActiveIssueOrder) {
|
return if (hasActiveIssueOrder) {
|
||||||
PaymentAccountStatusValue.Inactive(
|
PaymentAccountStatusValue.Inactive(
|
||||||
source = StatusSource.ACTUAL,
|
source = StatusSource.ACTUAL,
|
||||||
cryptoCurrency = tangemPayCurrencyFactory.create(userWalletId),
|
|
||||||
tariffPlan = getTangemPayTariffPlanStateUseCase(
|
tariffPlan = getTangemPayTariffPlanStateUseCase(
|
||||||
userWalletId = userWalletId,
|
userWalletId = userWalletId,
|
||||||
tariff = tariffPlan,
|
tariff = tariffPlan,
|
||||||
|
|
@ -229,7 +228,6 @@ internal class DefaultPaymentAccountStatusFetcher @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
PaymentAccountStatusValue.AwaitingPlanSelection(
|
PaymentAccountStatusValue.AwaitingPlanSelection(
|
||||||
source = StatusSource.ACTUAL,
|
source = StatusSource.ACTUAL,
|
||||||
cryptoCurrency = tangemPayCurrencyFactory.create(userWalletId),
|
|
||||||
tariffPlan = tariffPlan,
|
tariffPlan = tariffPlan,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,6 @@ internal class PaymentAccountStatusValueDMConverterTest {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
val domain = PaymentAccountStatusValue.AwaitingPlanSelection(
|
val domain = PaymentAccountStatusValue.AwaitingPlanSelection(
|
||||||
source = StatusSource.ACTUAL,
|
source = StatusSource.ACTUAL,
|
||||||
cryptoCurrency = cryptoCurrency,
|
|
||||||
tariffPlan = mockk(),
|
tariffPlan = mockk(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -128,7 +127,6 @@ internal class PaymentAccountStatusValueDMConverterTest {
|
||||||
availableBalance = BigDecimal("100"),
|
availableBalance = BigDecimal("100"),
|
||||||
currency = "USD",
|
currency = "USD",
|
||||||
),
|
),
|
||||||
cryptoCurrency = cryptoCurrency,
|
|
||||||
tariffPlan = mockk(),
|
tariffPlan = mockk(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,13 +107,11 @@ sealed class PaymentAccountStatusValue {
|
||||||
* Represents a state where KYC is approved but no tariff plan has been selected yet
|
* Represents a state where KYC is approved but no tariff plan has been selected yet
|
||||||
*
|
*
|
||||||
* @property source The source of the status information.
|
* @property source The source of the status information.
|
||||||
* @property cryptoCurrency The crypto currency held by the account.
|
|
||||||
* @property tariffPlan Current tariff plan
|
* @property tariffPlan Current tariff plan
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AwaitingPlanSelection(
|
data class AwaitingPlanSelection(
|
||||||
override val source: StatusSource,
|
override val source: StatusSource,
|
||||||
val cryptoCurrency: CryptoCurrency.Token,
|
|
||||||
val tariffPlan: TangemPayCustomerTariffPlan,
|
val tariffPlan: TangemPayCustomerTariffPlan,
|
||||||
) : PaymentAccountStatusValue()
|
) : PaymentAccountStatusValue()
|
||||||
|
|
||||||
|
|
@ -122,14 +120,12 @@ sealed class PaymentAccountStatusValue {
|
||||||
*
|
*
|
||||||
* @property source The source of the status information.
|
* @property source The source of the status information.
|
||||||
* @property fiatBalance The fiat balance of state.
|
* @property fiatBalance The fiat balance of state.
|
||||||
* @property cryptoCurrency The crypto currency held by the account.
|
|
||||||
* @property tariffPlan Current tariff plan
|
* @property tariffPlan Current tariff plan
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Inactive(
|
data class Inactive(
|
||||||
override val source: StatusSource,
|
override val source: StatusSource,
|
||||||
val fiatBalance: FiatBalance,
|
val fiatBalance: FiatBalance,
|
||||||
val cryptoCurrency: CryptoCurrency.Token,
|
|
||||||
val tariffPlan: TangemPayTariffPlanState,
|
val tariffPlan: TangemPayTariffPlanState,
|
||||||
) : PaymentAccountStatusValue()
|
) : PaymentAccountStatusValue()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ internal class GetCurrentTariffUseCaseTest {
|
||||||
private fun awaitingPlanSelection(source: StatusSource, tariff: TangemPayCustomerTariffPlan) =
|
private fun awaitingPlanSelection(source: StatusSource, tariff: TangemPayCustomerTariffPlan) =
|
||||||
PaymentAccountStatusValue.AwaitingPlanSelection(
|
PaymentAccountStatusValue.AwaitingPlanSelection(
|
||||||
source = source,
|
source = source,
|
||||||
cryptoCurrency = mockk(),
|
|
||||||
tariffPlan = tariff,
|
tariffPlan = tariff,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,30 +38,6 @@ internal class PreviewEmptyExpressTransactionsComponent : ExpressTransactionsCom
|
||||||
fromSymbol = "USD",
|
fromSymbol = "USD",
|
||||||
iconState = ExpressTransactionStateIconUM.None,
|
iconState = ExpressTransactionStateIconUM.None,
|
||||||
),
|
),
|
||||||
sampleOnrampUM(
|
|
||||||
txId = "preview-onramp-2",
|
|
||||||
title = "Buying USDC",
|
|
||||||
activeStatusText = "Waiting for payment",
|
|
||||||
activeStatus = OnrampStatus.Status.WaitingForPayment,
|
|
||||||
timestampAgo = "1h ago",
|
|
||||||
toAmount = "250.00",
|
|
||||||
toSymbol = "USDC",
|
|
||||||
fromAmount = "250.00",
|
|
||||||
fromSymbol = "EUR",
|
|
||||||
iconState = ExpressTransactionStateIconUM.Warning,
|
|
||||||
),
|
|
||||||
sampleOnrampUM(
|
|
||||||
txId = "preview-onramp-3",
|
|
||||||
title = "Buying USDC",
|
|
||||||
activeStatusText = "Failed",
|
|
||||||
activeStatus = OnrampStatus.Status.Failed,
|
|
||||||
timestampAgo = "2d ago",
|
|
||||||
toAmount = "50.00",
|
|
||||||
toSymbol = "USDC",
|
|
||||||
fromAmount = "50.00",
|
|
||||||
fromSymbol = "USD",
|
|
||||||
iconState = ExpressTransactionStateIconUM.Error,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
return ExpressTransactionsBlockState(
|
return ExpressTransactionsBlockState(
|
||||||
transactions = sample,
|
transactions = sample,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import com.tangem.domain.models.pay.TangemPayCard
|
||||||
import com.tangem.domain.models.pay.TangemPayCardLimitPeriod
|
import com.tangem.domain.models.pay.TangemPayCardLimitPeriod
|
||||||
import com.tangem.domain.models.pay.TangemPayCardState
|
import com.tangem.domain.models.pay.TangemPayCardState
|
||||||
import com.tangem.domain.models.pay.isFrozen
|
import com.tangem.domain.models.pay.isFrozen
|
||||||
|
import com.tangem.domain.pay.TangemPayCurrencyFactory
|
||||||
import com.tangem.domain.pay.flow.PaymentAccountStatusFetcher
|
import com.tangem.domain.pay.flow.PaymentAccountStatusFetcher
|
||||||
import com.tangem.domain.pay.flow.PaymentAccountStatusSupplier
|
import com.tangem.domain.pay.flow.PaymentAccountStatusSupplier
|
||||||
import com.tangem.domain.pay.model.TangemPayTopUpData
|
import com.tangem.domain.pay.model.TangemPayTopUpData
|
||||||
|
|
@ -81,6 +82,7 @@ internal class TangemPayCardPageModel @Inject constructor(
|
||||||
private val changeCardFrozenStateUseCase: ChangeCardFrozenStateUseCase,
|
private val changeCardFrozenStateUseCase: ChangeCardFrozenStateUseCase,
|
||||||
private val cardDetailsEventListener: CardDetailsEventListener,
|
private val cardDetailsEventListener: CardDetailsEventListener,
|
||||||
private val cardDetailsControllerFactory: TangemPayCardDetailsController.Factory,
|
private val cardDetailsControllerFactory: TangemPayCardDetailsController.Factory,
|
||||||
|
tangemPayCurrencyFactory: TangemPayCurrencyFactory,
|
||||||
) : Model(), ViewPinListener, ReissueCardListener, AddFundsListener, CloseCardListener {
|
) : Model(), ViewPinListener, ReissueCardListener, AddFundsListener, CloseCardListener {
|
||||||
|
|
||||||
private val params: TangemPayCardPageComponent.Params = paramsContainer.require()
|
private val params: TangemPayCardPageComponent.Params = paramsContainer.require()
|
||||||
|
|
@ -106,8 +108,7 @@ internal class TangemPayCardPageModel @Inject constructor(
|
||||||
MutableStateFlow(persistentListOf())
|
MutableStateFlow(persistentListOf())
|
||||||
val cardControllersState: StateFlow<ImmutableList<TangemPayCardDetailsController>> = _cardControllersState
|
val cardControllersState: StateFlow<ImmutableList<TangemPayCardDetailsController>> = _cardControllersState
|
||||||
|
|
||||||
private val cryptoCurrency
|
private val cryptoCurrency = tangemPayCurrencyFactory.create(userWalletId)
|
||||||
get() = currentStatus.value.cryptoCurrency
|
|
||||||
|
|
||||||
val uiState: StateFlow<TangemPayCardPageUM>
|
val uiState: StateFlow<TangemPayCardPageUM>
|
||||||
field = MutableStateFlow(
|
field = MutableStateFlow(
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import com.tangem.domain.feedback.models.WalletMetaInfo
|
||||||
import com.tangem.domain.models.TokenReceiveConfig
|
import com.tangem.domain.models.TokenReceiveConfig
|
||||||
import com.tangem.domain.models.account.*
|
import com.tangem.domain.models.account.*
|
||||||
import com.tangem.domain.models.currency.CryptoCurrency
|
import com.tangem.domain.models.currency.CryptoCurrency
|
||||||
|
import com.tangem.domain.pay.TangemPayCurrencyFactory
|
||||||
import com.tangem.domain.pay.flow.PaymentAccountStatusFetcher
|
import com.tangem.domain.pay.flow.PaymentAccountStatusFetcher
|
||||||
import com.tangem.domain.pay.flow.PaymentAccountStatusSupplier
|
import com.tangem.domain.pay.flow.PaymentAccountStatusSupplier
|
||||||
import com.tangem.domain.pay.model.TangemPayTopUpData
|
import com.tangem.domain.pay.model.TangemPayTopUpData
|
||||||
|
|
@ -84,6 +85,7 @@ internal class TangemPayDetailsModel @Inject constructor(
|
||||||
private val getCashbackSummaryUseCase: GetCashbackSummaryUseCase,
|
private val getCashbackSummaryUseCase: GetCashbackSummaryUseCase,
|
||||||
private val getCashbackDeactivationDismissedUseCase: GetCashbackDeactivationDismissedUseCase,
|
private val getCashbackDeactivationDismissedUseCase: GetCashbackDeactivationDismissedUseCase,
|
||||||
private val setCashbackDeactivationDismissedUseCase: SetCashbackDeactivationDismissedUseCase,
|
private val setCashbackDeactivationDismissedUseCase: SetCashbackDeactivationDismissedUseCase,
|
||||||
|
tangemPayCurrencyFactory: TangemPayCurrencyFactory,
|
||||||
) : Model(),
|
) : Model(),
|
||||||
TangemPayTxHistoryUiActions,
|
TangemPayTxHistoryUiActions,
|
||||||
TangemPayDetailIntents,
|
TangemPayDetailIntents,
|
||||||
|
|
@ -97,8 +99,7 @@ internal class TangemPayDetailsModel @Inject constructor(
|
||||||
private val userWalletId
|
private val userWalletId
|
||||||
get() = currentStatus.value.userWalletId
|
get() = currentStatus.value.userWalletId
|
||||||
|
|
||||||
val cryptoCurrency
|
val cryptoCurrency: CryptoCurrency.Token = tangemPayCurrencyFactory.create(userWalletId)
|
||||||
get() = currentStatus.value.cryptoCurrency
|
|
||||||
|
|
||||||
private val stateFactory = TangemPayDetailsStateFactory(
|
private val stateFactory = TangemPayDetailsStateFactory(
|
||||||
onBack = router::pop,
|
onBack = router::pop,
|
||||||
|
|
|
||||||
|
|
@ -3,21 +3,11 @@ package com.tangem.features.tangempay.utils
|
||||||
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.TangemPayCustomerTariffPlan
|
import com.tangem.domain.models.account.TangemPayCustomerTariffPlan
|
||||||
import com.tangem.domain.models.currency.CryptoCurrency
|
|
||||||
import com.tangem.domain.models.wallet.UserWalletId
|
import com.tangem.domain.models.wallet.UserWalletId
|
||||||
|
|
||||||
internal val AccountStatus.Payment.userWalletId: UserWalletId
|
internal val AccountStatus.Payment.userWalletId: UserWalletId
|
||||||
get() = account.userWalletId
|
get() = account.userWalletId
|
||||||
|
|
||||||
internal val AccountStatus.Payment.cryptoCurrency: CryptoCurrency.Token
|
|
||||||
get() = when (val v = value) {
|
|
||||||
is PaymentAccountStatusValue.Loaded -> v.cryptoCurrency
|
|
||||||
is PaymentAccountStatusValue.Deactivated -> v.cryptoCurrency
|
|
||||||
is PaymentAccountStatusValue.Inactive -> v.cryptoCurrency
|
|
||||||
is PaymentAccountStatusValue.AwaitingPlanSelection -> v.cryptoCurrency
|
|
||||||
else -> error("TangemPayDetails opened with unsupported status: $v")
|
|
||||||
}
|
|
||||||
|
|
||||||
internal val AccountStatus.Payment.customerId: String?
|
internal val AccountStatus.Payment.customerId: String?
|
||||||
get() = when (val v = value) {
|
get() = when (val v = value) {
|
||||||
is PaymentAccountStatusValue.Loaded -> v.customerId
|
is PaymentAccountStatusValue.Loaded -> v.customerId
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,7 @@ internal class TangemPayDetailsModelTest {
|
||||||
getCashbackSummaryUseCase = mockk(relaxed = true),
|
getCashbackSummaryUseCase = mockk(relaxed = true),
|
||||||
getCashbackDeactivationDismissedUseCase = mockk(relaxed = true),
|
getCashbackDeactivationDismissedUseCase = mockk(relaxed = true),
|
||||||
setCashbackDeactivationDismissedUseCase = mockk(relaxed = true),
|
setCashbackDeactivationDismissedUseCase = mockk(relaxed = true),
|
||||||
|
tangemPayCurrencyFactory = mockk(relaxed = true),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue