Updated on 2026-08-14
This commit is contained in:
parent
17066df741
commit
c4241a2ee4
5 changed files with 14 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit feec2950551a1dbabbb018b446b25e17442db21f
|
||||
Subproject commit 59ee0bff06ee54f3202421c28f7fb6e3d421dad8
|
||||
|
|
@ -91,7 +91,7 @@ private fun handleAction(action: Action, appState: () -> AppState?, dispatch: Di
|
|||
config?.moonPayApiSecretKey,
|
||||
) { mercuryoWidgetId, moonPayKey, moonPaySecretKey ->
|
||||
scope.launch {
|
||||
val buyService = MercuryoService(MercuryoApi.API_VERSION, mercuryoWidgetId)
|
||||
val buyService = MercuryoService(MercuryoApi.API_VERSION, mercuryoWidgetId, "")
|
||||
val sellService = MoonPayService(moonPayKey, moonPaySecretKey)
|
||||
val exchangeManager = CurrencyExchangeManager(buyService, sellService)
|
||||
store.dispatchOnMain(GlobalAction.ExchangeManager.Init.Success(exchangeManager))
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ data class Config(
|
|||
val moonPayApiKey: String = "pk_test_kc90oYTANy7UQdBavDKGfL4K9l6VEPE",
|
||||
val moonPayApiSecretKey: String = "sk_test_V8w4M19LbDjjYOt170s0tGuvXAgyEb1C",
|
||||
val mercuryoWidgetId: String = "",
|
||||
val mercuryoSecret: String = "",
|
||||
val appsFlyerDevKey: String = "",
|
||||
val blockchainSdkConfig: BlockchainSdkConfig = BlockchainSdkConfig(),
|
||||
val isSendingToPayIdEnabled: Boolean = true,
|
||||
|
|
@ -98,6 +99,7 @@ class ConfigManager(
|
|||
moonPayApiKey = values.moonPayApiKey,
|
||||
moonPayApiSecretKey = values.moonPayApiSecretKey,
|
||||
mercuryoWidgetId = values.mercuryoWidgetId,
|
||||
mercuryoSecret = values.mercuryoSecret,
|
||||
blockchainSdkConfig = BlockchainSdkConfig(
|
||||
blockchairApiKey = values.blockchairApiKey,
|
||||
blockchairAuthorizationToken = values.blockchairAuthorizationToken,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class FeatureModel(
|
|||
class ConfigValueModel(
|
||||
val coinMarketCapKey: String,
|
||||
val mercuryoWidgetId: String,
|
||||
val mercuryoSecret: String,
|
||||
val moonPayApiKey: String,
|
||||
val moonPayApiSecretKey: String,
|
||||
val blockchairApiKey: String?,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.tangem.tap.network.exchangeServices.mercuryo
|
|||
|
||||
import android.net.Uri
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.common.extensions.calculateSha512
|
||||
import com.tangem.common.extensions.toHexString
|
||||
import com.tangem.common.services.Result
|
||||
import com.tangem.common.services.performRequest
|
||||
import com.tangem.network.common.createRetrofitInstance
|
||||
|
|
@ -18,6 +20,7 @@ import com.tangem.tap.network.exchangeServices.ExchangeUrlBuilder
|
|||
class MercuryoService(
|
||||
private val apiVersion: String,
|
||||
private val mercuryoWidgetId: String,
|
||||
private val secret: String,
|
||||
) : ExchangeService, ExchangeUrlBuilder {
|
||||
|
||||
private val api: MercuryoApi = createRetrofitInstance(MercuryoApi.BASE_URL)
|
||||
|
|
@ -107,6 +110,7 @@ class MercuryoService(
|
|||
.appendQueryParameter("type", action.name.lowercase())
|
||||
.appendQueryParameter("currency", cryptoCurrencyName)
|
||||
.appendQueryParameter("address", walletAddress.urlEncode())
|
||||
.appendQueryParameter("signature", signature(walletAddress).urlEncode())
|
||||
.appendQueryParameter("fix_currency", "true")
|
||||
.appendQueryParameter("return_url", ExchangeUrlBuilder.SUCCESS_URL)
|
||||
|
||||
|
|
@ -114,6 +118,11 @@ class MercuryoService(
|
|||
return url
|
||||
}
|
||||
|
||||
private fun signature(address: String): String {
|
||||
return (address + secret).calculateSha512().toHexString().lowercase()
|
||||
}
|
||||
|
||||
|
||||
override fun getSellCryptoReceiptUrl(
|
||||
action: CurrencyExchangeManager.Action,
|
||||
transactionId: String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue