Updated on 2026-08-14
This commit is contained in:
parent
2fd16863a7
commit
9b6de19ebe
25 changed files with 376 additions and 201 deletions
1
domain/visa/.gitignore
vendored
Normal file
1
domain/visa/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
22
domain/visa/build.gradle.kts
Normal file
22
domain/visa/build.gradle.kts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
plugins {
|
||||
alias(deps.plugins.android.library)
|
||||
alias(deps.plugins.kotlin.android)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.tangem.domain.visa"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
/** Project - Domain */
|
||||
implementation(projects.core.utils)
|
||||
implementation(projects.domain.core)
|
||||
implementation(projects.domain.wallets.models)
|
||||
implementation(projects.domain.tokens.models)
|
||||
implementation(projects.domain.appCurrency.models)
|
||||
|
||||
/** Libs - Other */
|
||||
implementation(deps.jodatime)
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.tangem.domain.visa
|
||||
|
||||
import arrow.core.Either
|
||||
import com.tangem.domain.visa.model.VisaCurrency
|
||||
import com.tangem.domain.visa.repository.VisaRepository
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
|
||||
class GetVisaCurrencyUseCase(
|
||||
private val repository: VisaRepository,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(
|
||||
userWalletId: UserWalletId,
|
||||
isRefresh: Boolean = false,
|
||||
): Either<Throwable, VisaCurrency> {
|
||||
return Either.catch { repository.getVisaCurrency(userWalletId, isRefresh) }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.tangem.domain.visa.model
|
||||
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import org.joda.time.DateTime
|
||||
import java.math.BigDecimal
|
||||
|
||||
data class VisaCurrency(
|
||||
val networkName: String,
|
||||
val symbol: String,
|
||||
val decimals: Int,
|
||||
val fiatRate: BigDecimal?,
|
||||
val fiatCurrency: AppCurrency,
|
||||
val balances: Balances,
|
||||
val limits: Limits,
|
||||
) {
|
||||
|
||||
data class Balances(
|
||||
val total: BigDecimal,
|
||||
val verified: BigDecimal,
|
||||
val available: BigDecimal,
|
||||
val blocked: BigDecimal,
|
||||
val debt: BigDecimal,
|
||||
val pendingRefund: BigDecimal,
|
||||
)
|
||||
|
||||
data class Limits(
|
||||
val remainingOtp: BigDecimal,
|
||||
val remainingNoOtp: BigDecimal,
|
||||
val singleTransaction: BigDecimal,
|
||||
val expirationDate: DateTime,
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.tangem.domain.visa.repository
|
||||
|
||||
import com.tangem.domain.visa.model.VisaCurrency
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
|
||||
interface VisaRepository {
|
||||
|
||||
suspend fun getVisaCurrency(userWalletId: UserWalletId, isRefresh: Boolean = false): VisaCurrency
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue