Updated on 2026-08-14

This commit is contained in:
Tangem 2021-11-11 12:07:25 +03:00
parent 560bf8c98d
commit 1bff5f5bd2
2 changed files with 10 additions and 2 deletions

View file

@ -6,12 +6,13 @@ import com.tangem.common.KeyPair
import com.tangem.common.card.EllipticCurve
import com.tangem.common.core.CardSession
import com.tangem.common.core.CardSessionRunnable
import com.tangem.common.core.TangemSdkError
import com.tangem.common.core.TangemError
import com.tangem.common.extensions.hexToBytes
import com.tangem.operations.wallet.CreateWalletCommand
import com.tangem.operations.wallet.CreateWalletResponse
import com.tangem.operations.wallet.PurgeWalletCommand
import com.tangem.tap.domain.extensions.getSingleWallet
import com.tangem.wallet.R
class CreateSecondTwinWalletTask(
private val firstPublicKey: String,
@ -25,7 +26,7 @@ class CreateSecondTwinWalletTask(
val publicKey = card?.getSingleWallet()?.publicKey
if (publicKey != null) {
if (!card.cardId.startsWith(TwinsHelper.getPairCardSeries(firstCardId) ?: "")) {
callback(CompletionResult.Failure(TangemSdkError.WrongCardType()))
callback(CompletionResult.Failure(WrongTwinCard()))
return
}
@ -65,4 +66,10 @@ class CreateSecondTwinWalletTask(
}
}
}
private class WrongTwinCard : TangemError {
override val code: Int = 50005
override var customMessage: String = code.toString()
override val messageResId = R.string.twins_wrong_card_error
}
}