Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-12 14:31:11 +05:00
commit 3dd8b879ee
4 changed files with 17 additions and 17 deletions

View file

@ -16,27 +16,27 @@ interface TangemExpressApi {
@POST("assets")
suspend fun getAssets(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Body body: AssetsRequestBody,
): ApiResponse<List<Asset>>
@POST("pairs")
suspend fun getPairs(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Body body: PairsRequestBody,
): ApiResponse<List<SwapPair>>
@GET("providers")
suspend fun getProviders(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
): ApiResponse<List<ExchangeProvider>>
@GET("exchange-quote")
suspend fun getExchangeQuote(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Query("fromContractAddress") fromContractAddress: String,
@Query("fromNetwork") fromNetwork: String,
@Query("toContractAddress") toContractAddress: String,
@ -51,7 +51,7 @@ interface TangemExpressApi {
@GET("exchange-data")
suspend fun getExchangeData(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Query("fromContractAddress") fromContractAddress: String,
@Query("fromNetwork") fromNetwork: String,
@Query("toContractAddress") toContractAddress: String,
@ -71,14 +71,14 @@ interface TangemExpressApi {
@GET("exchange-status")
suspend fun getExchangeStatus(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Query("txId") txId: String,
): ApiResponse<ExchangeStatusResponse>
@POST("exchange-sent")
suspend fun exchangeSent(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Body body: ExchangeSentRequestBody,
): ApiResponse<ExchangeSentResponseBody>
}

View file

@ -17,38 +17,38 @@ interface OnrampApi {
@GET("currencies")
suspend fun getCurrencies(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
): ApiResponse<List<OnrampCurrencyDTO>>
@GET("countries")
suspend fun getCountries(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
): ApiResponse<List<OnrampCountryDTO>>
@GET("country-by-ip")
suspend fun getCountryByIp(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
): ApiResponse<OnrampCountryDTO>
@GET("payment-methods")
suspend fun getPaymentMethods(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
): ApiResponse<List<PaymentMethodDTO>>
@POST("onramp-pairs")
suspend fun getPairs(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Body body: OnrampPairsRequest,
): ApiResponse<List<OnrampPairDTO>>
@GET("onramp-quote")
suspend fun getQuote(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Query("fromCurrencyCode") fromCurrencyCode: String,
@Query("fromPrecision") fromPrecision: Int,
@Query("toContractAddress") toContractAddress: String,
@ -83,7 +83,7 @@ interface OnrampApi {
@GET("onramp-status")
suspend fun getStatus(
@Header("user-id") userWalletId: String,
@Header("refcode") refCode: String,
@Header("refcode") refCode: String?,
@Query("txId") txId: String,
): ApiResponse<OnrampStatusResponse>
}

View file

@ -11,12 +11,12 @@ object ExpressUtils {
private const val BATCH_ID_CHANGENOW = "BB000013"
private const val BATCH_ID_PARTNER = "AF990015"
fun getRefCode(userWallet: UserWallet, appPreferencesStore: AppPreferencesStore): String {
fun getRefCode(userWallet: UserWallet, appPreferencesStore: AppPreferencesStore): String? {
return when {
isRing(userWallet, appPreferencesStore) -> "ring"
isChangeNow(userWallet) -> "ChangeNow"
isPartner(userWallet) -> "partner"
else -> ""
else -> null
}
}

View file

@ -372,7 +372,7 @@ internal class DefaultOnrampRepository(
refCode = ExpressUtils.getRefCode(
userWallet = userWallet,
appPreferencesStore = appPreferencesStore,
).takeUnless { it.isEmpty() },
),
).bind()
},
onError = { e ->