Updated on 2026-08-14
This commit is contained in:
commit
8bba8e1afa
825 changed files with 9837 additions and 22210 deletions
|
|
@ -1,15 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.request
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
data class CheckRegistrationRequests(
|
||||
@Json(name = "requests") val requests: List<Item>,
|
||||
) {
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Item(
|
||||
@Json(name = "CID") val cardId: String = "",
|
||||
@Json(name = "publicKey") val publicKey: String = "",
|
||||
)
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.request
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.tangem.common.extensions.calculateHashCode
|
||||
|
||||
data class RegisterKYCRequest(
|
||||
@Json(name = "CID") val cardId: String,
|
||||
@Json(name = "publicKey") val publicKey: ByteArray,
|
||||
@Json(name = "kycProvider") val kycProvider: String,
|
||||
@Json(name = "kycRefId") val kycRefId: String,
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as RegisterKYCRequest
|
||||
|
||||
if (cardId != other.cardId) return false
|
||||
if (!publicKey.contentEquals(other.publicKey)) return false
|
||||
if (kycProvider != other.kycProvider) return false
|
||||
if (kycRefId != other.kycRefId) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = calculateHashCode(
|
||||
cardId.hashCode(),
|
||||
publicKey.contentHashCode(),
|
||||
kycProvider.hashCode(),
|
||||
kycRefId.hashCode(),
|
||||
)
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.request
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.tangem.common.extensions.calculateHashCode
|
||||
|
||||
data class RegisterWalletRequest(
|
||||
@Json(name = "CID") val cardId: String,
|
||||
@Json(name = "publicKey") val publicKey: ByteArray,
|
||||
@Json(name = "walletPublicKey") val walletPublicKey: ByteArray,
|
||||
@Json(name = "walletSalt") val walletSalt: ByteArray,
|
||||
@Json(name = "walletSignature") val walletSignature: ByteArray,
|
||||
@Json(name = "cardSalt") val cardSalt: ByteArray,
|
||||
@Json(name = "cardSignature") val cardSignature: ByteArray,
|
||||
@Json(name = "PIN") val pin: String,
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as RegisterWalletRequest
|
||||
|
||||
if (cardId != other.cardId) return false
|
||||
if (!publicKey.contentEquals(other.publicKey)) return false
|
||||
if (!walletPublicKey.contentEquals(other.walletPublicKey)) return false
|
||||
if (!walletSalt.contentEquals(other.walletSalt)) return false
|
||||
if (!walletSignature.contentEquals(other.walletSignature)) return false
|
||||
if (!cardSalt.contentEquals(other.cardSalt)) return false
|
||||
if (!cardSignature.contentEquals(other.cardSignature)) return false
|
||||
if (pin != other.pin) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = calculateHashCode(
|
||||
cardId.hashCode(),
|
||||
publicKey.contentHashCode(),
|
||||
walletPublicKey.contentHashCode(),
|
||||
walletSalt.contentHashCode(),
|
||||
walletSignature.contentHashCode(),
|
||||
cardSalt.contentHashCode(),
|
||||
cardSignature.contentHashCode(),
|
||||
pin.hashCode(),
|
||||
)
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.tangem.common.extensions.calculateHashCode
|
||||
|
||||
data class AttestationResponse(
|
||||
@Json(name = "challenge") val challenge: ByteArray?,
|
||||
@Json(name = "success") override val success: Boolean,
|
||||
@Json(name = "error") override val error: String?,
|
||||
@Json(name = "errorCode") override val errorCode: Int?,
|
||||
) : ResponseError {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as AttestationResponse
|
||||
|
||||
if (!challenge.contentEquals(other.challenge)) return false
|
||||
if (success != other.success) return false
|
||||
if (error != other.error) return false
|
||||
if (errorCode != other.errorCode) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = calculateHashCode(
|
||||
challenge.contentHashCode(),
|
||||
success.hashCode(),
|
||||
error.hashCode(),
|
||||
errorCode.hashCode(),
|
||||
)
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.response
|
||||
|
||||
enum class KYCStatus {
|
||||
NOT_STARTED,
|
||||
STARTED,
|
||||
WAITING_FOR_APPROVAL,
|
||||
CORRECTION_REQUESTED,
|
||||
REJECTED,
|
||||
APPROVED,
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
data class RegisterWalletResponse(
|
||||
@Json(name = "success") override val success: Boolean,
|
||||
@Json(name = "error") override val error: String?,
|
||||
@Json(name = "errorCode") override val errorCode: Int?,
|
||||
) : ResponseError
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.response
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
|
||||
data class RegistrationResponse(
|
||||
@Json(name = "results") val results: List<Item> = listOf(),
|
||||
@Json(name = "success") override val success: Boolean,
|
||||
@Json(name = "error") override val error: String?,
|
||||
@Json(name = "errorCode") override val errorCode: Int?,
|
||||
) : ResponseError {
|
||||
|
||||
data class Item(
|
||||
@Json(name = "CID") val cardId: String,
|
||||
@Json(name = "passed") val passed: Boolean?,
|
||||
@Json(name = "active") val active: Boolean?,
|
||||
@Json(name = "pin_set") val pinSet: Boolean?,
|
||||
@Json(name = "blockchain_init") val blockchainInit: Boolean?,
|
||||
@Json(name = "kyc_passed") val kycPassed: Boolean?,
|
||||
@Json(name = "kyc_provider") val kycProvider: String?,
|
||||
@Json(name = "kyc_date") val kycDate: String?,
|
||||
@Json(name = "kyc_status") val kycStatus: KYCStatus?,
|
||||
@Json(name = "disabled_by_admin") val disabledByAdmin: Boolean?,
|
||||
@Json(name = "error") val error: String?,
|
||||
)
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.tangem.datasource.api.paymentology.models.response
|
||||
|
||||
import com.tangem.common.services.Result
|
||||
|
||||
interface ResponseError {
|
||||
val success: Boolean
|
||||
val error: String?
|
||||
val errorCode: Int?
|
||||
|
||||
fun makeErrorMessage(): String = error ?: "unknown error"
|
||||
}
|
||||
|
||||
inline fun <reified T> ResponseError.tryExtractError(): Result<T> = when (success) {
|
||||
true -> Result.Success(this as T)
|
||||
else -> Result.Failure(Throwable(makeErrorMessage()))
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ interface TangemTechApi {
|
|||
@Query("searchText") searchText: String? = null,
|
||||
@Query("offset") offset: Int? = null,
|
||||
@Query("limit") limit: Int? = null,
|
||||
): CoinsResponse
|
||||
): ApiResponse<CoinsResponse>
|
||||
|
||||
@GET("rates")
|
||||
suspend fun getRates(@Query("currencyId") currencyId: String, @Query("coinIds") coinIds: String): RatesResponse
|
||||
|
|
@ -35,7 +35,10 @@ interface TangemTechApi {
|
|||
suspend fun getUserTokens(@Path(value = "user-id") userId: String): ApiResponse<UserTokensResponse>
|
||||
|
||||
@PUT("user-tokens/{user-id}")
|
||||
suspend fun saveUserTokens(@Path(value = "user-id") userId: String, @Body userTokens: UserTokensResponse)
|
||||
suspend fun saveUserTokens(
|
||||
@Path(value = "user-id") userId: String,
|
||||
@Body userTokens: UserTokensResponse,
|
||||
): ApiResponse<Unit>
|
||||
|
||||
/** Returns referral status by [walletId] */
|
||||
@GET("referral/{walletId}")
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
package com.tangem.datasource.local.datastore.core
|
||||
|
||||
internal abstract class KeylessDataStoreDecorator<Value : Any>(
|
||||
wrappedDataStore: StringKeyDataStore<Value>,
|
||||
private val key: String = DEFAULT_STRING_KEY,
|
||||
) : StringKeyDataStoreDecorator<String, Value>(wrappedDataStore) {
|
||||
|
||||
override fun provideStringKey(key: String) = key
|
||||
|
||||
open fun get() = get(key)
|
||||
|
||||
open suspend fun getSyncOrNull() = getSyncOrNull(key)
|
||||
|
||||
open suspend fun store(item: Value) = store(key, item)
|
||||
|
||||
override suspend fun isEmpty(): Boolean = getSyncOrNull() == null
|
||||
|
||||
private companion object {
|
||||
const val DEFAULT_STRING_KEY = "key"
|
||||
}
|
||||
}
|
||||
|
|
@ -8,4 +8,7 @@ interface UserWalletsStore {
|
|||
val selectedUserWalletOrNull: UserWallet?
|
||||
|
||||
suspend fun getSyncOrNull(key: UserWalletId): UserWallet?
|
||||
|
||||
@Throws
|
||||
suspend fun update(userWalletId: UserWalletId, update: suspend (UserWallet) -> UserWallet)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue