Updated on 2026-08-14

This commit is contained in:
Tangem 2022-10-17 23:18:30 +05:00
parent a13f995517
commit ce58ab2489
4 changed files with 15 additions and 13 deletions

View file

@ -37,7 +37,7 @@ internal class SaltPayRegistrationErrorConverter(
}
else -> ConvertedDialogMessage(
title = context.getString(R.string.common_error),
message = saltPayError::class.java.simpleName,
message = saltPayError.message,
)
}

View file

@ -60,7 +60,7 @@ class SaltPayRegistrationManager(
return try {
if (!registrationResponse.success || registrationResponse.results.isEmpty()) {
throw SaltPayRegistrationError.EmptyResponse
throw SaltPayRegistrationError.EmptyResponse(registrationResponse.error)
}
Result.Success(registrationResponse.results[0])
} catch (ex: SaltPayRegistrationError) {

View file

@ -30,16 +30,18 @@ sealed class SaltPayRegistrationError(
) {
object Unknown : SaltPayRegistrationError(4)
object Empty : SaltPayRegistrationError(4)
// gnosis
object FailedToMakeTxData : SaltPayRegistrationError(1)
object FailedToSendTx : SaltPayRegistrationError(2)
object NeedPin : SaltPayRegistrationError(3)
object NoGas : SaltPayRegistrationError(5)
object EmptyResponse : SaltPayRegistrationError(6)
object Card : SaltPayRegistrationError(7)
object CardNotFound : SaltPayRegistrationError(8)
object CardDisabled : SaltPayRegistrationError(9)
object CardNotPassed : SaltPayRegistrationError(10)
object NoGas : SaltPayRegistrationError(5) //
class EmptyResponse(message: String?) : SaltPayRegistrationError(6, message)
class CardNotFound(message: String?) : SaltPayRegistrationError(8, message)
class CardDisabled(message: String?) : SaltPayRegistrationError(9, message)
class CardNotPassed(message: String?) : SaltPayRegistrationError(10, message)
object EmptyDynamicAttestResponse : SaltPayRegistrationError(11)
object EmptyBackupCardScanned : SaltPayRegistrationError(12)
object WeakPin : SaltPayRegistrationError(13)
object EmptyBackupCardScanned : SaltPayRegistrationError(12) //
object WeakPin : SaltPayRegistrationError(13) //
}

View file

@ -79,7 +79,7 @@ private fun handleOnboardingSaltPayAction(anyAction: Action, appState: () -> App
}
if (!attestationResponse.success) {
onError(SaltPayRegistrationError.CardNotFound)
onError(SaltPayRegistrationError.CardNotFound(attestationResponse.error))
return@launch
}
@ -256,8 +256,8 @@ private suspend fun checkRegistration(
@Throws(SaltPayRegistrationError::class)
fun RegistrationResponse.Item.toSaltPayStep(): SaltPayRegistrationStep {
return when {
passed != true -> throw SaltPayRegistrationError.CardNotPassed
disabledByAdmin == true -> throw SaltPayRegistrationError.CardDisabled
passed != true -> throw SaltPayRegistrationError.CardNotPassed(this.error)
disabledByAdmin == true -> throw SaltPayRegistrationError.CardDisabled(this.error)
// go to success screen
active == true -> SaltPayRegistrationStep.Finished