Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-26 21:35:53 +07:00
parent d349739524
commit 1806ddc31d
18 changed files with 55 additions and 11 deletions

View file

@ -11,10 +11,12 @@ interface ScanCardProcessor {
cardId: String? = null,
allowsRequestAccessCodeFromRepository: Boolean = false,
analyticsSource: AnalyticsParam.ScreensSources,
shouldCheckIsAlreadyActivated: Boolean,
): CompletionResult<ScanResponse>
suspend fun scan(
analyticsSource: AnalyticsParam.ScreensSources,
shouldCheckIsAlreadyActivated: Boolean,
cardId: String? = null,
onProgressStateChange: suspend (showProgress: Boolean) -> Unit = {},
onWalletNotCreated: suspend () -> Unit = {},

View file

@ -49,9 +49,14 @@ class ScanCardUseCase(
cardId: String?,
allowRequestAccessCodeFromStorage: Boolean,
): Either<ScanCardException, ScanResponse> {
return Either.catch { scanCardRepository.scanCard(cardId, allowRequestAccessCodeFromStorage) }
.mapLeft { e ->
e as? ScanCardException ?: ScanCardException.UnknownException(e)
}
return Either.catch {
scanCardRepository.scanCard(
cardId = cardId,
allowRequestAccessCodeFromStorage = allowRequestAccessCodeFromStorage,
shouldCheckIsAlreadyActivated = true, // TODO use correct when enable NEW_CARD_SCANNING_ENABLED
)
}.mapLeft { e ->
e as? ScanCardException ?: ScanCardException.UnknownException(e)
}
}
}

View file

@ -17,5 +17,9 @@ interface ScanCardRepository {
* @return a [ScanResponse] object with the result of the scan.
* @throws [ScanCardException] if the scan process fails.
*/
suspend fun scanCard(cardId: String?, allowRequestAccessCodeFromStorage: Boolean): ScanResponse
suspend fun scanCard(
cardId: String?,
allowRequestAccessCodeFromStorage: Boolean,
shouldCheckIsAlreadyActivated: Boolean,
): ScanResponse
}