Updated on 2026-08-14

This commit is contained in:
Tangem 2026-03-20 01:37:34 -07:00
parent 2070f1d21c
commit 8ca7bc0ca7
15 changed files with 132 additions and 53 deletions

View file

@ -0,0 +1,17 @@
package com.tangem.domain.models
enum class TangemPayEligibilityType {
BANNER,
DETAILS,
UNKNOWN,
;
companion object {
fun fromString(value: String): TangemPayEligibilityType = when (value.lowercase()) {
"banner" -> BANNER
"details" -> DETAILS
else -> UNKNOWN
}
}
}

View file

@ -2,10 +2,14 @@ package com.tangem.domain.pay
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.pay.model.TangemPayEntryPoint
interface TangemPayEligibilityManager {
suspend fun getEligibleWallets(shouldExcludePaeraCustomers: Boolean): List<UserWallet>
suspend fun getEligibleWallets(
shouldExcludePaeraCustomers: Boolean,
entryPoint: TangemPayEntryPoint?,
): List<UserWallet>
/**
* Returns all compatible user wallets without checking Tangem Pay eligibility, only used when opening deeplink
@ -13,9 +17,9 @@ interface TangemPayEligibilityManager {
* */
suspend fun getPossibleWalletsIds(shouldExcludePaeraCustomers: Boolean): List<UserWalletId>
suspend fun getTangemPayAvailability(): Boolean
suspend fun getTangemPayAvailability(entryPoint: TangemPayEntryPoint): Boolean
suspend fun isPaeraCustomerForAnyWallet(): Boolean
suspend fun isPaeraCustomerForAnyWallet(entryPoint: TangemPayEntryPoint): Boolean
fun reset()
}

View file

@ -0,0 +1,6 @@
package com.tangem.domain.pay.model
enum class TangemPayEntryPoint {
BANNER,
DETAILS,
}

View file

@ -2,6 +2,7 @@ package com.tangem.domain.pay.repository
import arrow.core.Either
import com.tangem.core.error.UniversalError
import com.tangem.domain.models.TangemPayEligibilityType
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.pay.model.CustomerInfo
import com.tangem.domain.visa.error.VisaApiError
@ -25,8 +26,8 @@ interface OnboardingRepository {
suspend fun hasTangemPayInWallet(userWalletId: UserWalletId): Either<VisaApiError, Boolean>
suspend fun checkCustomerEligibility(): Boolean
suspend fun getCustomerEligibility(): Boolean
suspend fun checkCustomerEligibility(): List<TangemPayEligibilityType>
suspend fun getCustomerEligibility(): List<TangemPayEligibilityType>
fun getSavedCustomerInfo(userWalletId: UserWalletId): CustomerInfo?

View file

@ -69,12 +69,16 @@ class TangemPayMainScreenCustomerInfoUseCase(
}
private suspend fun showOnboardingBannerIfEligible(userWalletId: UserWalletId) {
if (eligibilityManager.isPaeraCustomerForAnyWallet()) {
val tangemPayEntryPoint = TangemPayEntryPoint.BANNER
if (eligibilityManager.isPaeraCustomerForAnyWallet(tangemPayEntryPoint)) {
updateState(userWalletId, MainCustomerInfoContentState.Empty.right())
return
}
val isEligible = eligibilityManager
.getEligibleWallets(shouldExcludePaeraCustomers = false)
.getEligibleWallets(
shouldExcludePaeraCustomers = false,
entryPoint = tangemPayEntryPoint,
)
.any { it.walletId == userWalletId }
if (isEligible) {
if (onboardingRepository.getHideMainOnboardingBanner(userWalletId)) {