Updated on 2026-08-14
This commit is contained in:
parent
b43aa204d3
commit
40f7df2c5d
25 changed files with 90 additions and 48 deletions
|
|
@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
|
|||
* @property hasPinCode whether the card has a PIN code set.
|
||||
* @property displayName optional human-readable name assigned to the card; `null` if not set.
|
||||
* @property limit spending limit configuration for the card; `null` if not configured or not yet loaded.
|
||||
* @property isFrozen whether the card is currently frozen (blocked for payments).
|
||||
* @property frozenState whether the card is currently frozen (blocked for payments).
|
||||
* @property lastDigits The last four digits of the card number.
|
||||
*/
|
||||
@Serializable
|
||||
|
|
@ -20,7 +20,10 @@ data class TangemPayCard(
|
|||
@SerialName("has_pin_code") val hasPinCode: Boolean,
|
||||
@SerialName("display_name") val displayName: CardDisplayName?,
|
||||
@SerialName("limit") val limit: TangemPayCardLimitData?,
|
||||
@SerialName("is_frozen") val isFrozen: Boolean,
|
||||
@SerialName("frozen_state") val frozenState: TangemPayCardFrozenState,
|
||||
@SerialName("last_digits") val lastDigits: String,
|
||||
@SerialName("is_reissuing") val isReissuing: Boolean,
|
||||
)
|
||||
)
|
||||
|
||||
val TangemPayCard.isFrozen
|
||||
get() = frozenState == TangemPayCardFrozenState.Frozen
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.tangem.domain.models.pay
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
enum class TangemPayCardFrozenState {
|
||||
@SerialName("Pending")
|
||||
Pending,
|
||||
|
||||
@SerialName("Frozen")
|
||||
Frozen,
|
||||
|
||||
@SerialName("Unfrozen")
|
||||
Unfrozen,
|
||||
;
|
||||
|
||||
override fun toString() = when (this) {
|
||||
Pending -> "Pending"
|
||||
Frozen -> "Frozen"
|
||||
Unfrozen -> "Unfrozen"
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun fromString(value: String) = when (value) {
|
||||
"Frozen" -> Frozen
|
||||
"Unfrozen" -> Unfrozen
|
||||
else -> Pending
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package com.tangem.domain.visa.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
sealed class TangemPayCardFrozenState {
|
||||
data object Pending : TangemPayCardFrozenState()
|
||||
data object Frozen : TangemPayCardFrozenState()
|
||||
data object Unfrozen : TangemPayCardFrozenState()
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ import com.tangem.domain.models.account.CardDisplayName
|
|||
import com.tangem.domain.models.account.PaymentAccountStatusValue
|
||||
import com.tangem.domain.models.kyc.KycStatus
|
||||
import com.tangem.domain.models.pay.TangemPayCardLimit
|
||||
import com.tangem.domain.visa.model.TangemPayCardFrozenState
|
||||
import com.tangem.domain.models.pay.TangemPayCardFrozenState
|
||||
import java.math.BigDecimal
|
||||
import java.util.Locale
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import com.tangem.domain.pay.model.SetPinResult
|
|||
import com.tangem.domain.pay.model.TangemPayCardBalance
|
||||
import com.tangem.domain.pay.model.TangemPayCardDetails
|
||||
import com.tangem.domain.pay.model.TangemPayOrderInfo
|
||||
import com.tangem.domain.visa.model.TangemPayCardFrozenState
|
||||
import com.tangem.domain.models.pay.TangemPayCardFrozenState
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface TangemPayCardDetailsRepository {
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package com.tangem.domain.pay.usecase
|
|||
import arrow.core.Either
|
||||
import arrow.core.raise.either
|
||||
import com.tangem.core.error.UniversalError
|
||||
import com.tangem.domain.models.pay.TangemPayCardFrozenState
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.pay.repository.TangemPayCardDetailsRepository
|
||||
import com.tangem.domain.visa.error.VisaApiError
|
||||
import com.tangem.domain.visa.model.TangemPayCardFrozenState
|
||||
import com.tangem.utils.coroutines.AppCoroutineScope
|
||||
import kotlinx.coroutines.async
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import arrow.core.left
|
|||
import arrow.core.right
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import com.tangem.common.test.TestAppCoroutineScope
|
||||
import com.tangem.domain.models.pay.TangemPayCardFrozenState
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.pay.model.OrderStatus
|
||||
import com.tangem.domain.pay.model.TangemPayOrderInfo
|
||||
import com.tangem.domain.pay.repository.TangemPayCardDetailsRepository
|
||||
import com.tangem.domain.visa.error.VisaApiError
|
||||
import com.tangem.domain.visa.model.TangemPayCardFrozenState
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.coVerify
|
||||
import io.mockk.coVerifyOrder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue