Updated on 2026-08-14
This commit is contained in:
commit
74a9b2a7f7
3 changed files with 19 additions and 21 deletions
|
|
@ -37,7 +37,7 @@ interface CardSessionRunnable<T : CommandResponse> {
|
|||
* @property viewDelegate is an interface that allows interaction with users and shows relevant UI.
|
||||
* @property cardId ID, Unique Tangem card ID number. If not null, the SDK will check that you the card
|
||||
* with which you tapped a phone has this [cardId] and SDK will return
|
||||
* the [TangemSdkError.WrongCard] otherwise.
|
||||
* the [TangemSdkError.WrongCardNumber] otherwise.
|
||||
* @property initialMessage A custom description that will be shown at the beginning of the NFC session.
|
||||
* If null, a default header and text body will be used.
|
||||
*/
|
||||
|
|
@ -133,8 +133,8 @@ class CardSession(
|
|||
is CompletionResult.Success -> {
|
||||
val receivedCardId = result.data.cardId
|
||||
if (cardId != null && receivedCardId != cardId) {
|
||||
stopWithError(TangemSdkError.WrongCard())
|
||||
callback(CompletionResult.Failure(TangemSdkError.WrongCard()))
|
||||
stopWithError(TangemSdkError.WrongCardNumber())
|
||||
callback(CompletionResult.Failure(TangemSdkError.WrongCardNumber()))
|
||||
return@run
|
||||
}
|
||||
val allowedCardTypes = environment.cardFilter.allowedCardTypes
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ class TangemSdk(
|
|||
* @runnable: A custom task, adopting [CardSessionRunnable] protocol
|
||||
* @cardId: CID, Unique Tangem card ID number. If not null, the SDK will check that you the card
|
||||
* with which you tapped a phone has this [cardId] and SDK will return
|
||||
* the [TangemSdkError.WrongCard] otherwise.
|
||||
* the [TangemSdkError.WrongCardNumber] otherwise.
|
||||
* @initialMessage: A custom description that shows at the beginning of the NFC session.
|
||||
* If null, default message will be used.
|
||||
* @callback: Standard [TangemSdk] callback.
|
||||
|
|
@ -365,7 +365,7 @@ class TangemSdk(
|
|||
|
||||
* @cardId: CID, Unique Tangem card ID number. If not null, the SDK will check that you the card
|
||||
* with which you tapped a phone has this [cardId] and SDK will return
|
||||
* the [TangemSdkError.WrongCard] otherwise.
|
||||
* the [TangemSdkError.WrongCardNumber] otherwise.
|
||||
* @initialMessage: A custom description that shows at the beginning of the NFC session.
|
||||
* If null, default message will be used.
|
||||
* @callback: At first, you should check that the [TangemSdkError] is not null,
|
||||
|
|
|
|||
|
|
@ -67,16 +67,6 @@ sealed class TangemSdkError(val code: Int) : Exception(code.toString()) {
|
|||
|
||||
//Read Errors
|
||||
class Pin1Required : TangemSdkError(40401)
|
||||
/**
|
||||
* This error is returned when a [Task] expects a user to use a particular card,
|
||||
* but the user tries to use a different card.
|
||||
*/
|
||||
class WrongCard : TangemSdkError(40403)
|
||||
/**
|
||||
* This error is returned when a user scans a card of a [com.tangem.common.extensions.CardType]
|
||||
* that is not specified in [Config.cardFilter].
|
||||
*/
|
||||
class WrongCardType : TangemSdkError(40404)
|
||||
|
||||
//CreateWallet Errors
|
||||
class AlreadyCreated : TangemSdkError(40501)
|
||||
|
|
@ -128,11 +118,6 @@ sealed class TangemSdkError(val code: Int) : Exception(code.toString()) {
|
|||
class OverwritingDataIsProhibited : TangemSdkError(40008)
|
||||
class DataCannotBeWritten : TangemSdkError(40009)
|
||||
class MissingIssuerPubicKey : TangemSdkError(40010)
|
||||
/**
|
||||
* This error is returned when a [ScanTask] returns a [Card] without some of the essential fields.
|
||||
*/
|
||||
class CardError : TangemSdkError(40011)
|
||||
|
||||
|
||||
//SDK Errors
|
||||
class UnknownError: TangemSdkError(50001)
|
||||
|
|
@ -150,7 +135,20 @@ sealed class TangemSdkError(val code: Int) : Exception(code.toString()) {
|
|||
* is executed before performing other commands.
|
||||
*/
|
||||
class MissingPreflightRead : TangemSdkError(50004)
|
||||
|
||||
/**
|
||||
* This error is returned when a [Task] expects a user to use a particular card,
|
||||
* but the user tries to use a different card.
|
||||
*/
|
||||
class WrongCardNumber : TangemSdkError(50005)
|
||||
/**
|
||||
* This error is returned when a user scans a card of a [com.tangem.common.extensions.CardType]
|
||||
* that is not specified in [Config.cardFilter].
|
||||
*/
|
||||
class WrongCardType : TangemSdkError(50006)
|
||||
/**
|
||||
* This error is returned when a [ScanTask] returns a [Card] without some of the essential fields.
|
||||
*/
|
||||
class CardError : TangemSdkError(50007)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue