Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-29 18:24:12 +05:00
parent 7f1d49444c
commit 53bde31f89
16 changed files with 287 additions and 8 deletions

View file

@ -0,0 +1,20 @@
package com.tangem.domain.models.account
import kotlinx.serialization.Serializable
/**
* Bank (fiat) credentials for a Virtual Account on-ramp the wire/ACH requisites a user transfers funds to.
*
* Returned by `bff-v2/v1/account/bank-credentials/{product_instance_id}`. Sensitive data kept transient
* (never persisted in the local payment-account cache).
*/
@Serializable
data class BankCredentials(
val type: String,
val beneficiaryName: String,
val beneficiaryAddress: String,
val beneficiaryBankName: String,
val beneficiaryBankAddress: String,
val accountNumber: String,
val routingNumber: String,
)

View file

@ -149,6 +149,8 @@ sealed class PaymentAccountStatusValue {
* [totalFiatBalance] resolves to [TotalFiatBalance.Failed].
* @property error Transient error overlaid on top of cached data when a refresh fails
* (see [copySealed]), or `null` when the status is up to date. Not persisted.
* @property virtualAccount Virtual Account (Visa on-ramp) availability VA MVP0 (TWI-1638).
* Transient: not persisted in the local cache.
*/
@Serializable
data class Loaded(
@ -160,6 +162,7 @@ sealed class PaymentAccountStatusValue {
val cards: List<TangemPayCard>,
val fiatRate: SerializedBigDecimal?,
val error: Error?,
val virtualAccount: VirtualAccountOnramp,
) : PaymentAccountStatusValue() {
val cryptoCurrencyStatus: CryptoCurrencyStatus = CryptoCurrencyStatus(
currency = cryptoCurrency,

View file

@ -0,0 +1,28 @@
package com.tangem.domain.models.account
import kotlinx.serialization.Serializable
/**
* Virtual Account (Visa on-ramp) availability for a payment account VA MVP0 (TWI-1638).
*
* Computed in the payment-account fetcher and surfaced on [PaymentAccountStatusValue.Loaded].
* Transient: [Available.bankCredentials] is never persisted in the local cache.
*/
@Serializable
sealed interface VirtualAccountOnramp {
/** On-ramp not applicable: feature toggle off, or wallet not eligible. */
@Serializable
data object None : VirtualAccountOnramp
/** No VA product instance yet, but the wallet is eligible to add funds (channel `VISA_VIRTUAL_ACCOUNT`). */
@Serializable
data object Eligible : VirtualAccountOnramp
/** VA product instance exists; [bankCredentials] are the fiat requisites for the bank-transfer top-up. */
@Serializable
data class Available(
val productInstanceId: String,
val bankCredentials: BankCredentials,
) : VirtualAccountOnramp
}

View file

@ -10,6 +10,8 @@ enum class TangemPayEligibilityType {
DETAILS_VIRTUAL_ACCOUNT,
DEEPLINK_VIRTUAL_ACCOUNT,
VISA_VIRTUAL_ACCOUNT,
UNKNOWN,
;
@ -21,6 +23,7 @@ enum class TangemPayEligibilityType {
"BANNER_VIRTUAL_ACCOUNT" -> BANNER_VIRTUAL_ACCOUNT
"DETAILS_VIRTUAL_ACCOUNT" -> DETAILS_VIRTUAL_ACCOUNT
"DEEPLINK_VIRTUAL_ACCOUNT" -> DEEPLINK_VIRTUAL_ACCOUNT
"VISA_VIRTUAL_ACCOUNT" -> VISA_VIRTUAL_ACCOUNT
else -> UNKNOWN
}
}

View file

@ -67,6 +67,7 @@ data class CustomerInfo(
val actualCardLimit: TangemPayCardLimit?,
val adminCardLimit: TangemPayCardLimit?,
val status: Status,
val specificationDataType: SpecificationDataType,
) {
enum class Status {
NEW,
@ -82,6 +83,12 @@ data class CustomerInfo(
CANCELED,
UNKNOWN,
}
/** `ACCOUNT` marks a Virtual Account instance (vs. a `CARD`); used by VA MVP0 (TWI-1638). */
enum class SpecificationDataType {
ACCOUNT,
CARD,
}
}
data class CardInfo(

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.account.BankCredentials
import com.tangem.domain.models.pay.TangemPayEligibilityType
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.pay.model.CustomerInfo
@ -17,6 +18,12 @@ interface OnboardingRepository {
suspend fun getCustomerInfo(userWalletId: UserWalletId): Either<VisaApiError, CustomerInfo>
/** Fiat bank requisites for the wallet's Virtual Account on-ramp instance (VA MVP0, TWI-1638). */
suspend fun getBankCredentials(
userWalletId: UserWalletId,
productInstanceId: String,
): Either<VisaApiError, BankCredentials>
suspend fun createOrder(userWalletId: UserWalletId): Either<VisaApiError, String>
suspend fun clearOrderId(userWalletId: UserWalletId)
@ -28,6 +35,14 @@ interface OnboardingRepository {
suspend fun checkCustomerEligibility(): List<TangemPayEligibilityType>
suspend fun getCustomerEligibility(): List<TangemPayEligibilityType>
/**
* Fetches eligibility channels fresh via the user token (always hits the network, no cache read/write).
* Differs from [checkCustomerEligibility] (static token, caches) and [getCustomerEligibility] (cache only).
*/
suspend fun fetchCustomerEligibility(
userWalletId: UserWalletId,
): Either<VisaApiError, List<TangemPayEligibilityType>>
fun getSavedCustomerInfo(userWalletId: UserWalletId): CustomerInfo?
suspend fun getHideMainOnboardingBanner(userWalletId: UserWalletId): Boolean