Updated on 2026-08-14

This commit is contained in:
Tangem 2022-12-09 10:28:08 +03:00
parent 2413e9a3b7
commit 6fb8e4e2ea
197 changed files with 39 additions and 75 deletions

@ -1 +1 @@
Subproject commit a1658496e777b611fc990ef2bc1a1a1fd48bc1e6
Subproject commit 897f0f7c402fd53c5ee1fa4ab601ecd4e43ff389

View file

@ -85,7 +85,7 @@ class TwinCardsManager(
}
private fun getAdapter(): JsonAdapter<List<Issuer>> {
return com.tangem.datasource.api.common.MoshiConverter.defaultMoshi().adapter(
return MoshiConverter.defaultMoshi().adapter(
Types.newParameterizedType(List::class.java, Issuer::class.java),
)
}

View file

@ -1,7 +1,7 @@
package com.tangem.tap.domain.walletStores.repository.di
import com.tangem.blockchain.common.WalletManagerFactory
import com.tangem.network.api.tangemTech.TangemTechService
import com.tangem.datasource.api.tangemTech.TangemTechService
import com.tangem.tap.domain.walletStores.repository.WalletAmountsRepository
import com.tangem.tap.domain.walletStores.repository.WalletManagersRepository
import com.tangem.tap.domain.walletStores.repository.WalletStoresRepository

View file

@ -14,9 +14,9 @@ import com.tangem.common.flatMap
import com.tangem.common.flatMapOnFailure
import com.tangem.common.map
import com.tangem.common.services.Result
import com.tangem.datasource.api.tangemTech.TangemTechService
import com.tangem.domain.common.ScanResponse
import com.tangem.domain.common.util.UserWalletId
import com.tangem.network.api.tangemTech.TangemTechService
import com.tangem.tap.common.entities.FiatCurrency
import com.tangem.tap.common.extensions.replaceByOrAdd
import com.tangem.tap.domain.model.UserWallet

View file

@ -79,7 +79,7 @@ class SaltPayActivationManager(
}
}
suspend fun requestAttestationChallenge(): Result<com.tangem.datasource.api.paymentology.AttestationResponse> {
suspend fun requestAttestationChallenge(): Result<AttestationResponse> {
return paymentologyService.requestAttestationChallenge(cardId, cardPublicKey)
.successOr { return it }
.tryExtractError()
@ -94,8 +94,8 @@ class SaltPayActivationManager(
suspend fun registerWallet(
attestResponse: AttestWalletKeyResponse,
pinCode: String,
): Result<com.tangem.datasource.api.paymentology.RegisterWalletResponse> {
val request = com.tangem.datasource.api.paymentology.RegisterWalletRequest(
): Result<RegisterWalletResponse> {
val request = RegisterWalletRequest(
cardId = cardId,
publicKey = cardPublicKey,
walletPublicKey = walletPublicKey,
@ -152,8 +152,8 @@ class SaltPayActivationManager(
)
}
private fun makeRegisterKYCRequest(): com.tangem.datasource.api.paymentology.RegisterKYCRequest =
com.tangem.datasource.api.paymentology.RegisterKYCRequest(
private fun makeRegisterKYCRequest(): RegisterKYCRequest =
RegisterKYCRequest(
cardId = cardId,
publicKey = cardPublicKey,
kycProvider = "UTORG",

View file

@ -295,7 +295,7 @@ suspend fun SaltPayActivationManager.update(
private fun determineStep(
currentStep: SaltPayActivationStep,
amountToClaim: Amount?,
response: com.tangem.datasource.api.paymentology.RegistrationResponse.Item,
response: RegistrationResponse.Item,
): SaltPayActivationStep {
fun getStepBaseOnAmountToClaim(amount: Amount?): SaltPayActivationStep = when (amount) {
null -> SaltPayActivationStep.Success
@ -315,25 +315,25 @@ private fun determineStep(
response.kycStatus != null -> {
when (currentStep) {
SaltPayActivationStep.KycWaiting -> when (response.kycStatus) {
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED, com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
else -> SaltPayActivationStep.KycIntro
}
SaltPayActivationStep.KycReject -> when (response.kycStatus) {
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycStart
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED -> SaltPayActivationStep.KycStart
com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycStart
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycStart
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED -> SaltPayActivationStep.KycStart
KYCStatus.REJECTED -> SaltPayActivationStep.KycStart
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
else -> SaltPayActivationStep.KycIntro
}
else -> when (response.kycStatus) {
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED, com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
else -> SaltPayActivationStep.KycIntro
}
}
@ -413,7 +413,7 @@ private suspend fun checkGasIfNeeded(
}
@Throws(SaltPayActivationError::class)
fun com.tangem.datasource.api.paymentology.RegistrationResponse.Item.toSaltPayStep(currentStep: SaltPayActivationStep): SaltPayActivationStep {
fun RegistrationResponse.Item.toSaltPayStep(currentStep: SaltPayActivationStep): SaltPayActivationStep {
return when {
passed != true -> throw SaltPayActivationError.CardNotPassed(this.error)
disabledByAdmin == true -> throw SaltPayActivationError.CardDisabled(this.error)
@ -426,10 +426,10 @@ fun com.tangem.datasource.api.paymentology.RegistrationResponse.Item.toSaltPaySt
kycStatus != null -> {
when (kycStatus) {
com.tangem.datasource.api.paymentology.KYCStatus.NOT_STARTED, com.tangem.datasource.api.paymentology.KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
com.tangem.datasource.api.paymentology.KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
com.tangem.datasource.api.paymentology.KYCStatus.CORRECTION_REQUESTED, com.tangem.datasource.api.paymentology.KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
com.tangem.datasource.api.paymentology.KYCStatus.APPROVED -> SaltPayActivationStep.Claim
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
KYCStatus.APPROVED -> SaltPayActivationStep.Claim
null -> throw UnsupportedOperationException()
}
}

View file

@ -7,7 +7,7 @@ import okhttp3.Response
[REDACTED_AUTHOR]
*/
open class AddHeaderInterceptor(
private val headers: Map<String, String>
private val headers: Map<String, String>,
) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
@ -21,10 +21,10 @@ open class AddHeaderInterceptor(
}
}
class CacheControlHttpInterceptor(maxAgeSeconds: Int) : AddHeaderInterceptor(mapOf(
"Cache-Control" to "max-age=$maxAgeSeconds",
))
class CacheControlHttpInterceptor(maxAgeSeconds: Int) : AddHeaderInterceptor(
mapOf("Cache-Control" to "max-age=$maxAgeSeconds"),
)
class CardPublicKeyHttpInterceptor(cardPublicKeyHex: String) : AddHeaderInterceptor(mapOf(
"card_public_key" to cardPublicKeyHex,
))
class CardPublicKeyHttpInterceptor(cardPublicKeyHex: String) : AddHeaderInterceptor(
mapOf("card_public_key" to cardPublicKeyHex),
)

View file

@ -1,19 +0,0 @@
package com.tangem.datasource.api.common
/**
[REDACTED_AUTHOR]
*/
// sealed interface NetworkModuleMessage : ModuleMessage
//
// sealed class NetworkError(
// subCode: Int,
// override val message: String,
// override val data: Any?,
// ) : NetworkModuleMessage, ModuleError() {
// override val code: Int = ModuleErrorCode.NETWORK + subCode
//
// companion object {
// // base code used for all error in the module
// // const val CODE_ANY_OTHER = 100..199, 200..299
// }
// }

View file

@ -342,7 +342,7 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
private suspend fun requestInfoAboutToken(
contractAddress: String,
): List<com.tangem.datasource.api.tangemTech.CoinsResponse.Coin> {
): List<CoinsResponse.Coin> {
val tangemTechServiceManager = requireNotNull(hubState.tangemTechServiceManager)
dispatchOnMain(Screen.UpdateTokenFields(listOf(ContractAddress to ViewStates.TokenField(isLoading = true))))
@ -432,8 +432,8 @@ internal class AddCustomTokenHub : BaseStoreHub<AddCustomTokenState>("AddCustomT
)
private suspend fun fillTokenFields(
token: com.tangem.datasource.api.tangemTech.CoinsResponse.Coin,
coinNetwork: com.tangem.datasource.api.tangemTech.CoinsResponse.Coin.Network,
token: CoinsResponse.Coin,
coinNetwork: CoinsResponse.Coin.Network,
) {
val blockchain = Blockchain.fromNetworkId(coinNetwork.networkId) ?: Blockchain.Unknown
Network.setFieldValue(Field.Data(blockchain, false))

View file

@ -48,7 +48,7 @@ data class AddCustomTokenState(
val form: Form = Form(listOf()),
val formValidators: Map<CustomTokenFieldId, CustomTokenValidator<out Any>> = createFormValidators(),
val formErrors: Map<CustomTokenFieldId, AddCustomTokenError> = emptyMap(),
val foundToken: com.tangem.datasource.api.tangemTech.CoinsResponse.Coin? = null,
val foundToken: CoinsResponse.Coin? = null,
val warnings: Set<AddCustomTokenError.Warning> = emptySet(),
val screenState: ScreenState = createInitialScreenState(),
val tangemTechServiceManager: AddCustomTokenService? = null,

View file

@ -1 +0,0 @@
o/jetified-network.jar

View file

@ -1 +0,0 @@
o/jetified-network

View file

@ -1 +0,0 @@
o/jetified-network

View file

@ -1 +0,0 @@
o/jetified-network.jar

View file

@ -1 +0,0 @@
o/jetified-network.jar

View file

@ -1 +0,0 @@
o/jetified-network.jar

Some files were not shown because too many files have changed in this diff Show more