Updated on 2026-08-14
This commit is contained in:
commit
d0b35bc331
680 changed files with 26556 additions and 2709 deletions
|
|
@ -11,8 +11,9 @@ 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.
|
||||
* @property state current lifecycle state of the card.
|
||||
*/
|
||||
@Serializable
|
||||
data class TangemPayCard(
|
||||
|
|
@ -20,7 +21,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,
|
||||
)
|
||||
@SerialName("state") val state: TangemPayCardState,
|
||||
)
|
||||
|
||||
val TangemPayCard.isFrozen
|
||||
get() = frozenState == TangemPayCardFrozenState.Frozen
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.tangem.domain.models.pay
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import java.util.Locale
|
||||
|
||||
@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.lowercase(Locale.US)) {
|
||||
"frozen" -> Frozen
|
||||
"unfrozen" -> Unfrozen
|
||||
else -> Pending
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.tangem.domain.models.pay
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Lifecycle state of a Tangem Pay card.
|
||||
*/
|
||||
@Serializable
|
||||
enum class TangemPayCardState {
|
||||
/** Card is operational and ready to use. */
|
||||
@SerialName("Active")
|
||||
Active,
|
||||
|
||||
/** A reissue order is in progress; the card is being replaced. */
|
||||
@SerialName("Reissuing")
|
||||
Reissuing,
|
||||
|
||||
/** A close order is in progress; the card is being closed. */
|
||||
@SerialName("Closing")
|
||||
Closing,
|
||||
;
|
||||
|
||||
override fun toString() = when (this) {
|
||||
Active -> "Active"
|
||||
Reissuing -> "Reissuing"
|
||||
Closing -> "Closing"
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun fromString(value: String) = when (value.lowercase(Locale.US)) {
|
||||
"reissuing" -> Reissuing
|
||||
"closing" -> Closing
|
||||
else -> Active
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue