diff --git a/tangem-core/src/main/java/com/tangem/CardSession.kt b/tangem-core/src/main/java/com/tangem/CardSession.kt index 34f243fc4f..1a2505240e 100644 --- a/tangem-core/src/main/java/com/tangem/CardSession.kt +++ b/tangem-core/src/main/java/com/tangem/CardSession.kt @@ -37,7 +37,7 @@ interface CardSessionRunnable { * @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 diff --git a/tangem-core/src/main/java/com/tangem/TangemSdk.kt b/tangem-core/src/main/java/com/tangem/TangemSdk.kt index 880796d9e7..ce0c0e8a47 100644 --- a/tangem-core/src/main/java/com/tangem/TangemSdk.kt +++ b/tangem-core/src/main/java/com/tangem/TangemSdk.kt @@ -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, diff --git a/tangem-core/src/main/java/com/tangem/TangemSdkError.kt b/tangem-core/src/main/java/com/tangem/TangemSdkError.kt index 4ea2612c51..bf0e5842a8 100644 --- a/tangem-core/src/main/java/com/tangem/TangemSdkError.kt +++ b/tangem-core/src/main/java/com/tangem/TangemSdkError.kt @@ -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) }