Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-14 12:37:27 +03:00
parent ce948a71ae
commit ad9def0d21
27 changed files with 6 additions and 291 deletions

View file

@ -1,77 +0,0 @@
package com.tangem.domain.onramp
import arrow.core.Either
import arrow.core.getOrElse
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.onramp.repositories.OnrampRepository
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.onramp.model.OnrampCountry
class OnrampSepaAvailableUseCase(
private val repository: OnrampRepository,
) {
suspend operator fun invoke(
userWallet: UserWallet,
country: OnrampCountry,
cryptoCurrency: CryptoCurrency,
): Boolean {
if (country.code !in SEPA_AVAILABLE_COUNTRY_CODES) {
return false
}
return Either.catch {
repository.hasSepaMethod(
userWallet = userWallet,
country = country,
cryptoCurrency = cryptoCurrency,
)
}.getOrElse { false }
}
companion object {
val SEPA_AVAILABLE_COUNTRY_CODES = listOf(
"AL", // Albania
"AD", // Andorra
"AT", // Austria
"BE", // Belgium
"BG", // Bulgaria
"HR", // Croatia
"CY", // Cyprus
"CZ", // Czech Republic
"DK", // Denmark
"EE", // Estonia
"FI", // Finland
"FR", // France
"DE", // Germany
"GR", // Greece
"HU", // Hungary
"IS", // Iceland
"IE", // Ireland
"IT", // Italy
"LV", // Latvia
"LI", // Liechtenstein
"LT", // Lithuania
"LU", // Luxembourg
"MT", // Malta
"MD", // Moldova
"MC", // Monaco
"ME", // Montenegro
"NL", // Netherlands
"MK", // North Macedonia
"NO", // Norway
"PL", // Poland
"PT", // Portugal
"RO", // Romania
"SM", // San Marino
"RS", // Serbia
"SK", // Slovakia
"SI", // Slovenia
"ES", // Spain
"SE", // Sweden
"CH", // Switzerland
"GB", // United Kingdom
"VA", // Vatican City
)
}
}

View file

@ -15,7 +15,6 @@ interface OnrampRepository {
suspend fun getCountriesSync(): List<OnrampCountry>?
suspend fun getCountryByIp(userWallet: UserWallet, fromCache: Boolean = false): OnrampCountry
suspend fun getStatus(userWallet: UserWallet, txId: String): OnrampStatus
suspend fun hasSepaMethod(userWallet: UserWallet, country: OnrampCountry, cryptoCurrency: CryptoCurrency): Boolean
suspend fun fetchCurrencies(userWallet: UserWallet)
suspend fun fetchCountries(userWallet: UserWallet): List<OnrampCountry>
suspend fun fetchPaymentMethodsIfAbsent(userWallet: UserWallet)