Updated on 2026-08-14
This commit is contained in:
parent
c3850e7991
commit
195ffd4391
4 changed files with 53 additions and 2 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue