Updated on 2026-08-14
This commit is contained in:
parent
64efc8af01
commit
e11e2d953d
9 changed files with 40 additions and 18 deletions
|
|
@ -123,7 +123,7 @@ internal class DefaultTangemPayCardDetailsRepository @Inject constructor(
|
|||
val publicKeyBase64 = getPublicKeyBase64()
|
||||
val (secretKeyBytes, sessionId) = rainCryptoUtil.generateSecretKeyAndSessionId(publicKeyBase64)
|
||||
val response = requestHelper.performRequest(userWalletId = userWalletId) { authHeader ->
|
||||
tangemPayApi.getPin(authHeader = authHeader, sessionId = sessionId)
|
||||
tangemPayApi.getPin(authHeader = authHeader, cardId = cardId, sessionId = sessionId)
|
||||
}.getOrNull()
|
||||
val result = requireNotNull(response?.result)
|
||||
|
||||
|
|
@ -140,7 +140,11 @@ internal class DefaultTangemPayCardDetailsRepository @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
override suspend fun setPin(userWalletId: UserWalletId, pin: String): Either<UniversalError, SetPinResult> {
|
||||
override suspend fun setPin(
|
||||
userWalletId: UserWalletId,
|
||||
cardId: String,
|
||||
pin: String,
|
||||
): Either<UniversalError, SetPinResult> {
|
||||
return catch(
|
||||
block = {
|
||||
val publicKeyBase64 = getPublicKeyBase64()
|
||||
|
|
@ -151,6 +155,7 @@ internal class DefaultTangemPayCardDetailsRepository @Inject constructor(
|
|||
val response = requestHelper.performRequest(userWalletId) { authHeader ->
|
||||
tangemPayApi.setPin(
|
||||
authHeader = authHeader,
|
||||
cardId = cardId,
|
||||
body = SetPinRequest(
|
||||
sessionId = sessionId,
|
||||
pin = encryptedData.encryptedBase64,
|
||||
|
|
|
|||
|
|
@ -53,9 +53,13 @@ internal class MockAwareTangemPayCardDetailsRepository @Inject constructor(
|
|||
return real.getPin(userWalletId, cardId)
|
||||
}
|
||||
|
||||
override suspend fun setPin(userWalletId: UserWalletId, pin: String): Either<UniversalError, SetPinResult> {
|
||||
override suspend fun setPin(
|
||||
userWalletId: UserWalletId,
|
||||
cardId: String,
|
||||
pin: String,
|
||||
): Either<UniversalError, SetPinResult> {
|
||||
if (isMockMode) return SetPinResult.SUCCESS.right()
|
||||
return real.setPin(userWalletId, pin)
|
||||
return real.setPin(userWalletId, cardId, pin)
|
||||
}
|
||||
|
||||
override suspend fun isAddToWalletDone(userWalletId: UserWalletId): Either<UniversalError, Boolean> =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue