Updated on 2026-08-14

This commit is contained in:
Tangem 2025-04-01 09:06:11 +03:00
parent ded577faff
commit aea7f5f415
21 changed files with 220 additions and 136 deletions

View file

@ -10,4 +10,5 @@ dependencies {
ksp(deps.moshi.kotlin.codegen)
implementation(deps.moshi.adapters)
implementation(deps.kotlin.serialization)
implementation(projects.core.error)
}

View file

@ -0,0 +1,51 @@
@file:Suppress("MagicNumber")
package com.tangem.domain.visa.error
import com.tangem.core.error.UniversalError
/**
* Each error code must follow this format: xxxyyyzzz where
* xxx - Feature code
* yyy - Subsystem code
* zzz - Specific error code
* If you need to add new subsystem add it to list below incrementing last code.
* `Subsystems`:
* `001` - Common API
* `002` - First card scan error
* `003` - Activation
* `004` - Authorization API
*/
object VisaError : UniversalError {
override val errorCode: Int = 104000000
}
object VisaAPIError : UniversalError {
override val errorCode: Int = 104001000
}
enum class VisaCardScanError(
override val errorCode: Int,
) : UniversalError {
FailedToCreateDerivationPath(104002001),
FailedToFindWallet(104002002),
FailedToFindDerivedWalletKey(104002003),
}
enum class VisaActivationError(
override val errorCode: Int,
) : UniversalError {
BlockedForActivation(104003001),
InvalidActivationState(104003002),
WrongCard(104003003),
WrongRemoteState(104003004),
MissingWallet(104003005),
MissingRootOTP(104003006),
FailedToCreateAddress(104003007),
AddressNotMatched(104003008),
InconsistentRemoteState(104003009),
}
object VisaAuthorizationAPIError : UniversalError {
override val errorCode: Int = 104004000
}

View file

@ -1,10 +0,0 @@
package com.tangem.domain.visa.model
enum class VisaActivationError(val message: String) {
BlockedForActivation("Card is blocked for activation"),
InvalidActivationState("Invalid activation state"),
WrongCard("Wrong card tapped"),
WrongRemoteState("Wrong remote state"),
MissingWallet("Missing wallet"),
MissingRootOTP("Missing root OTP"),
}