Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-19 20:31:57 +05:00
parent c3850e7991
commit 195ffd4391
4 changed files with 53 additions and 2 deletions

View file

@ -159,10 +159,11 @@ internal class TangemPayRequestPerformer @Inject constructor(
refreshToken = response.refreshToken,
refreshExpiresAt = response.refreshExpiresAt,
)
}.mapLeft { error ->
Timber.tag(TAG).e("Can not refresh auth tokens: $error")
if (error is VisaApiError.ServerUnavailable) error else VisaApiError.RefreshTokenExpired
}.onRight { tokens ->
tangemPayStorage.storeAuthTokens(customerWalletAddress = customerWalletAddress, tokens = tokens)
}.onLeft {
Timber.tag(TAG).e("Can not refresh auth tokens: $it")
}
}
}

View file

@ -18,6 +18,7 @@ internal class TangemPayErrorConverter @Inject constructor(
override fun convert(value: Throwable): VisaApiError {
return if (value is ApiResponseError.HttpException) {
if (value.isServerError()) return VisaApiError.ServerUnavailable
if (value.code == ApiResponseError.HttpException.Code.NOT_FOUND) return VisaApiError.NotPaeraCustomer
if (value.code == ApiResponseError.HttpException.Code.UNAUTHORIZED) return VisaApiError.RefreshTokenExpired