Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-20 21:03:08 +05:00
parent a41dd9aace
commit 41fb5d5bcc
55 changed files with 709 additions and 173 deletions

View file

@ -0,0 +1,8 @@
package com.tangem.domain.pay.flow
import com.tangem.domain.core.flow.FlowFetcher
import com.tangem.domain.models.wallet.UserWalletId
interface PaymentAccountStatusFetcher : FlowFetcher<PaymentAccountStatusFetcher.Params> {
data class Params(val userWalletId: UserWalletId)
}

View file

@ -0,0 +1,11 @@
package com.tangem.domain.pay.flow
import com.tangem.domain.core.flow.FlowProducer
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.pay.PaymentAccountStatus
interface PaymentAccountStatusProducer : FlowProducer<PaymentAccountStatus> {
data class Params(val userWalletId: UserWalletId)
interface Factory : FlowProducer.Factory<Params, PaymentAccountStatusProducer>
}

View file

@ -0,0 +1,10 @@
package com.tangem.domain.pay.flow
import com.tangem.domain.core.flow.FlowCachingSupplier
import com.tangem.domain.pay.PaymentAccountStatus
@Suppress("UnnecessaryAbstractClass")
abstract class PaymentAccountStatusSupplier(
override val factory: PaymentAccountStatusProducer.Factory,
override val keyCreator: (PaymentAccountStatusProducer.Params) -> String,
) : FlowCachingSupplier<PaymentAccountStatusProducer, PaymentAccountStatusProducer.Params, PaymentAccountStatus>()

View file

@ -1,6 +1,6 @@
package com.tangem.domain.pay.model
import com.tangem.domain.visa.model.TangemPayCardFrozenState
import com.tangem.domain.models.kyc.KycStatus
import java.math.BigDecimal
sealed class MainCustomerInfoContentState {
@ -22,31 +22,15 @@ data class CustomerInfo(
val cardInfo: CardInfo?,
) {
enum class KycStatus {
/** Initial state */
INIT,
/** Performing the check */
PENDING,
/** SumSub approved */
APPROVED,
/** The check failed, documents rejected */
REJECTED,
}
data class ProductInstance(
val id: String,
val cardId: String,
val cardFrozenState: TangemPayCardFrozenState,
)
data class CardInfo(
val lastFourDigits: String,
val balance: BigDecimal,
val currencyCode: String,
val customerWalletAddress: String,
val depositAddress: String?,
val isPinSet: Boolean,
)

View file

@ -1,9 +1,9 @@
package com.tangem.domain.pay.model
enum class OrderStatus(val apiName: String) {
UNKNOWN(""),
NEW("NEW"),
PROCESSING("PROCESSING"),
COMPLETED("COMPLETED"),
CANCELED("CANCELED"),
enum class OrderStatus {
UNKNOWN, // TODO remove it after TangemPay accounts refactor TANGEM_PAY_ACCOUNTS_REFACTOR_ENABLED
NEW,
PROCESSING,
COMPLETED,
CANCELED,
}

View file

@ -23,7 +23,7 @@ interface OnboardingRepository {
suspend fun getOrderId(userWalletId: UserWalletId): String?
suspend fun checkCustomerWallet(userWalletId: UserWalletId): Either<VisaApiError, Boolean>
suspend fun hasTangemPayInWallet(userWalletId: UserWalletId): Either<VisaApiError, Boolean>
suspend fun checkCustomerEligibility(): Boolean
suspend fun getCustomerEligibility(): Boolean

View file

@ -3,6 +3,7 @@ package com.tangem.domain.pay.usecase
import arrow.core.Either
import arrow.core.left
import arrow.core.right
import com.tangem.domain.models.kyc.KycStatus
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.pay.TangemPayEligibilityManager
import com.tangem.domain.pay.model.*
@ -38,7 +39,7 @@ class TangemPayMainScreenCustomerInfoUseCase(
return // fast exit
}
onboardingRepository.checkCustomerWallet(userWalletId)
onboardingRepository.hasTangemPayInWallet(userWalletId)
.fold(
ifLeft = { error ->
Timber.tag(TAG).e("Failed checkCustomerWallet for $userWalletId: ${error.javaClass.simpleName}")
@ -125,7 +126,7 @@ class TangemPayMainScreenCustomerInfoUseCase(
}
.map { customerInfo ->
Timber.tag(TAG).i("customerInfo")
if (customerInfo.cardInfo == null && customerInfo.kycStatus == CustomerInfo.KycStatus.APPROVED) {
if (customerInfo.cardInfo == null && customerInfo.kycStatus == KycStatus.APPROVED) {
// If order id wasn't saved -> start order creation and get customer info
onboardingRepository.createOrder(userWalletId)
}
@ -151,7 +152,7 @@ class TangemPayMainScreenCustomerInfoUseCase(
info = CustomerInfo(
customerId = null,
productInstance = null,
kycStatus = CustomerInfo.KycStatus.APPROVED,
kycStatus = KycStatus.APPROVED,
cardInfo = null,
),
orderStatus = orderData.status,

View file

@ -1,3 +1,3 @@
package com.tangem.domain.tangempay.model
data class TangemPayTxHistoryListConfig(val customerWalletAddress: String, val shouldRefresh: Boolean)
data class TangemPayTxHistoryListConfig(val shouldRefresh: Boolean)