Updated on 2026-08-14
This commit is contained in:
parent
e5d93deb3b
commit
69f3fa4c0f
7 changed files with 38 additions and 25 deletions
|
|
@ -71,7 +71,7 @@ internal class DefaultOnboardingRepository @Inject constructor(
|
|||
ifRight = { it },
|
||||
)
|
||||
// should storeCheckCustomerWalletResult because we already know this
|
||||
tangemPayStorage.storeCheckCustomerWalletResult(userWalletId)
|
||||
tangemPayStorage.storeCheckCustomerWalletResult(userWalletId, true)
|
||||
tangemPayStorage.storeCustomerWalletAddress(
|
||||
userWalletId = userWalletId,
|
||||
customerWalletAddress = initialCredentials.customerWalletAddress,
|
||||
|
|
@ -172,8 +172,8 @@ internal class DefaultOnboardingRepository @Inject constructor(
|
|||
|
||||
override suspend fun checkCustomerWallet(userWalletId: UserWalletId): Either<VisaApiError, Boolean> {
|
||||
val hasTangemPay = tangemPayStorage.checkCustomerWalletResult(userWalletId)
|
||||
if (hasTangemPay == true) {
|
||||
return Either.Right(true)
|
||||
if (hasTangemPay != null) {
|
||||
return Either.Right(hasTangemPay)
|
||||
}
|
||||
|
||||
return requestHelper.performWithStaticToken { staticToken ->
|
||||
|
|
@ -183,12 +183,14 @@ internal class DefaultOnboardingRepository @Inject constructor(
|
|||
)
|
||||
}.map { response ->
|
||||
val id = response.id
|
||||
if (!id.isNullOrEmpty()) {
|
||||
tangemPayStorage.storeCheckCustomerWalletResult(userWalletId = userWalletId)
|
||||
true
|
||||
} else {
|
||||
false
|
||||
val isPaeraCustomer = !id.isNullOrEmpty()
|
||||
tangemPayStorage.storeCheckCustomerWalletResult(userWalletId = userWalletId, isPaeraCustomer)
|
||||
isPaeraCustomer
|
||||
}.mapLeft { error ->
|
||||
if (error is VisaApiError.NotPaeraCustomer) {
|
||||
tangemPayStorage.storeCheckCustomerWalletResult(userWalletId = userWalletId, false)
|
||||
}
|
||||
error
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue