diff --git a/data/visa/src/main/kotlin/com/tangem/data/pay/DefaultTangemPayEligibilityManager.kt b/data/visa/src/main/kotlin/com/tangem/data/pay/DefaultTangemPayEligibilityManager.kt index 9c27024b35..1f2acd1d9b 100644 --- a/data/visa/src/main/kotlin/com/tangem/data/pay/DefaultTangemPayEligibilityManager.kt +++ b/data/visa/src/main/kotlin/com/tangem/data/pay/DefaultTangemPayEligibilityManager.kt @@ -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 { @@ -120,7 +121,7 @@ internal class DefaultTangemPayEligibilityManager @Inject constructor( } } - private fun reset() { + override fun reset() { cachedEligibleWallets = null eligibleWalletsDeferred?.cancel() eligibleWalletsDeferred = null diff --git a/domain/visa/src/main/kotlin/com/tangem/domain/pay/TangemPayEligibilityManager.kt b/domain/visa/src/main/kotlin/com/tangem/domain/pay/TangemPayEligibilityManager.kt index cc26e4832a..fcb41b6984 100644 --- a/domain/visa/src/main/kotlin/com/tangem/domain/pay/TangemPayEligibilityManager.kt +++ b/domain/visa/src/main/kotlin/com/tangem/domain/pay/TangemPayEligibilityManager.kt @@ -6,4 +6,5 @@ interface TangemPayEligibilityManager { suspend fun getEligibleWallets(shouldExcludePaeraCustomers: Boolean): List suspend fun getTangemPayAvailability(): Boolean + fun reset() } \ No newline at end of file diff --git a/features/kyc/impl/src/main/kotlin/com/tangem/features/kyc/DefaultKycModel.kt b/features/kyc/impl/src/main/kotlin/com/tangem/features/kyc/DefaultKycModel.kt index ba0446ea8a..f729fe489c 100644 --- a/features/kyc/impl/src/main/kotlin/com/tangem/features/kyc/DefaultKycModel.kt +++ b/features/kyc/impl/src/main/kotlin/com/tangem/features/kyc/DefaultKycModel.kt @@ -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) } diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt index e7a6f9325e..d3f7ede20a 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/TangemPayClickIntents.kt @@ -198,6 +198,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) } }