Updated on 2026-08-14
This commit is contained in:
parent
c4b3de5e85
commit
73ca4410e1
4 changed files with 10 additions and 2 deletions
|
|
@ -44,6 +44,7 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor(
|
|||
|
||||
override suspend fun getTangemPayAvailability(): Boolean {
|
||||
return onboardingRepository.checkCustomerEligibility()
|
||||
.also { isEligible -> if (!isEligible) reset() }
|
||||
}
|
||||
|
||||
private suspend fun getUserWalletsData(): List<UserWalletData> {
|
||||
|
|
@ -120,7 +121,7 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun reset() {
|
||||
override fun reset() {
|
||||
cachedEligibleWallets = null
|
||||
eligibleWalletsDeferred?.cancel()
|
||||
eligibleWalletsDeferred = null
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ interface TangemPayEligibilityManager {
|
|||
|
||||
suspend fun getEligibleWallets(shouldExcludePaeraCustomers: Boolean): List<UserWallet>
|
||||
suspend fun getTangemPayAvailability(): Boolean
|
||||
fun reset()
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.tangem.core.decompose.di.ModelScoped
|
|||
import com.tangem.core.decompose.model.Model
|
||||
import com.tangem.core.decompose.model.ParamsContainer
|
||||
import com.tangem.domain.pay.KycStartInfo
|
||||
import com.tangem.domain.pay.TangemPayEligibilityManager
|
||||
import com.tangem.domain.pay.repository.KycRepository
|
||||
import com.tangem.domain.tangempay.TangemPayAnalyticsEvents
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
|
|
@ -22,6 +23,7 @@ class DefaultKycModel @Inject constructor(
|
|||
analytics: AnalyticsEventHandler,
|
||||
override val dispatchers: CoroutineDispatcherProvider,
|
||||
private val kycRepository: KycRepository,
|
||||
private val tangemPayEligibilityManager: TangemPayEligibilityManager,
|
||||
) : Model() {
|
||||
|
||||
private val params: KycComponent.Params = paramsContainer.require()
|
||||
|
|
@ -33,7 +35,10 @@ class DefaultKycModel @Inject constructor(
|
|||
analytics.send(TangemPayAnalyticsEvents.KycFlowOpened())
|
||||
modelScope.launch {
|
||||
try {
|
||||
kycRepository.getKycStartInfo(params.userWalletId).getOrNull()?.let { _uiState.emit(it) }
|
||||
kycRepository.getKycStartInfo(params.userWalletId).getOrNull()?.let { state ->
|
||||
_uiState.emit(state)
|
||||
tangemPayEligibilityManager.reset()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
|
|||
if (isEligible) {
|
||||
router.openTangemPayOnboarding(mode = AppRoute.TangemPayOnboarding.Mode.FromBannerOnMain(userWalletId))
|
||||
} else {
|
||||
stateHolder.update(transformer = TangemPayHideOnboardingStateTransformer(userWalletId))
|
||||
tangemPayMainScreenCustomerInfoUseCase.fetch(userWalletId)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue