Updated on 2026-08-14

This commit is contained in:
Tangem 2023-04-24 14:39:54 +03:00
parent 6e40671419
commit 22e6daa5d6
2 changed files with 11 additions and 6 deletions

View file

@ -15,16 +15,17 @@ import com.tangem.common.extensions.hexToBytes
import com.tangem.common.extensions.toByteArray import com.tangem.common.extensions.toByteArray
import com.tangem.common.extensions.toHexString import com.tangem.common.extensions.toHexString
import com.tangem.common.extensions.toMapKey import com.tangem.common.extensions.toMapKey
import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.common.tlv.Tlv import com.tangem.common.tlv.Tlv
import com.tangem.common.tlv.TlvDecoder import com.tangem.common.tlv.TlvDecoder
import com.tangem.crypto.CryptoUtils import com.tangem.crypto.CryptoUtils
import com.tangem.crypto.hdWallet.DerivationPath
import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.models.scan.CardDTO
import com.tangem.domain.models.scan.ProductType import com.tangem.domain.models.scan.ProductType
import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.common.TapWorkarounds.isExcluded import com.tangem.domain.common.TapWorkarounds.isExcluded
import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease import com.tangem.domain.common.TapWorkarounds.isNotSupportedInThatRelease
import com.tangem.domain.common.TapWorkarounds.isSaltPay import com.tangem.domain.common.TapWorkarounds.isSaltPay
import com.tangem.domain.common.TapWorkarounds.isStart2Coin
import com.tangem.domain.common.TapWorkarounds.isTangemTwins import com.tangem.domain.common.TapWorkarounds.isTangemTwins
import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation import com.tangem.domain.common.TapWorkarounds.useOldStyleDerivation
import com.tangem.domain.common.TwinsHelper import com.tangem.domain.common.TwinsHelper
@ -155,7 +156,7 @@ private class ScanWalletProcessor(
CompletionResult.Success( CompletionResult.Success(
ScanResponse( ScanResponse(
card = card, card = card,
productType = ProductType.Note, productType = determineProductTypeForSingleCurrencyWallet(card),
walletData = walletData, walletData = walletData,
), ),
), ),
@ -176,6 +177,14 @@ private class ScanWalletProcessor(
} }
} }
private fun determineProductTypeForSingleCurrencyWallet(card: CardDTO): ProductType {
return if (card.isStart2Coin) {
ProductType.Start2Coin
} else {
ProductType.Note
}
}
private fun createMissingWalletsIfNeeded( private fun createMissingWalletsIfNeeded(
card: CardDTO, card: CardDTO,
session: CardSession, session: CardSession,

View file

@ -17,10 +17,6 @@ object TapWorkarounds {
val CardDTO.isTangemTwins: Boolean val CardDTO.isTangemTwins: Boolean
get() = TwinsHelper.getTwinCardNumber(cardId) != null get() = TwinsHelper.getTwinCardNumber(cardId) != null
// TODO: replace by reading files from a card
val CardDTO.isTangemNote: Boolean
get() = tangemNoteBatches.contains(batchId)
val CardDTO.isStart2Coin: Boolean val CardDTO.isStart2Coin: Boolean
get() = isStart2CoinIssuer(issuer.name) get() = isStart2CoinIssuer(issuer.name)