Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-23 16:59:15 +04:00
parent 8aa7bf9b75
commit 4032360f13
34 changed files with 679 additions and 101 deletions

View file

@ -1,19 +1,28 @@
package com.tangem.domain.pay.model
import java.math.BigDecimal
private const val APPROVED_KYC_STATUS = "APPROVED"
private const val ACTIVE_PI_STATUS = "active"
data class CustomerInfo(
val productInstance: ProductInstance?,
val kycStatus: String?,
val cardInfo: CardInfo?,
) {
data class ProductInstance(
val id: String,
val status: String,
)
data class CardInfo(
val lastFourDigits: String,
val balance: BigDecimal,
val currencyCode: String,
)
fun isKycApproved() = kycStatus == APPROVED_KYC_STATUS
fun isProductInstanceActive() = productInstance?.status == ACTIVE_PI_STATUS
}
data class ProductInstance(
val id: String,
val status: String,
)
}

View file

@ -9,4 +9,9 @@ interface OnboardingRepository {
suspend fun validateDeeplink(link: String): Either<UniversalError, Boolean>
suspend fun getCustomerInfo(): Either<UniversalError, CustomerInfo>
/**
* Returns only if the user already authorised at least once
*/
suspend fun getMainScreenCustomerInfo(): Either<UniversalError, CustomerInfo>
}

View file

@ -0,0 +1,15 @@
package com.tangem.domain.pay.usecase
import com.tangem.domain.pay.model.CustomerInfo
import com.tangem.domain.pay.repository.OnboardingRepository
/**
* Returns tangem pay customer info for the main screen banner
* Works only if the user already authorised at least once (won't emit anything otherwise)
*/
class TangemPayMainScreenCustomerInfoUseCase(
private val repository: OnboardingRepository,
) {
suspend operator fun invoke(): CustomerInfo? = repository.getMainScreenCustomerInfo().getOrNull()
}