Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-12 19:55:51 +07:00
commit e2f9535a05
7 changed files with 27 additions and 4 deletions

View file

@ -7,4 +7,6 @@ interface WalletsPromoRepository {
suspend fun bindRefcodeWithWallets(conversionData: AppsFlyerConversionData)
suspend fun retryBindRefcodeWithWallets()
suspend fun getReferralCodeIfExists(): String?
}

View file

@ -1,18 +1,23 @@
package com.tangem.domain.wallets.usecase
import com.tangem.common.TangemSiteUrlBuilder
import com.tangem.domain.wallets.repository.WalletsPromoRepository
import java.util.Locale
class GenerateBuyTangemCardLinkUseCase {
class GenerateBuyTangemCardLinkUseCase(
private val walletsPromoRepository: WalletsPromoRepository,
) {
suspend operator fun invoke(source: Source): String {
return invoke(source.utmCampaign)
}
suspend operator fun invoke(utmCampaign: String?): String {
val refCode = walletsPromoRepository.getReferralCodeIfExists()
val refCodeTag = TangemSiteUrlBuilder.getRefCodeTag(refCode)
val langCode = Locale.getDefault().language
val utmTags = TangemSiteUrlBuilder.getUtmTags(utmCampaign)
return "https://buy.tangem.com/$langCode?$utmTags"
return "https://buy.tangem.com/$langCode?$utmTags&$refCodeTag"
}
enum class Source(val utmCampaign: String) {