Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-05 16:49:02 +04:00
parent a5389365f4
commit 5346881a57
17 changed files with 158 additions and 55 deletions

View file

@ -51,9 +51,9 @@ internal interface TangemPayIntents {
fun onIssuingCardClicked()
fun onIssuingFailedClicked()
fun onIssuingFailedClicked(customerId: String)
fun onPaySupportClick()
fun onPaySupportClick(customerId: String)
fun onOnboardingBannerClick(userWalletId: UserWalletId)
@ -203,7 +203,7 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
uiMessageSender.send(issuingBottomSheet)
}
override fun onIssuingFailedClicked() {
override fun onIssuingFailedClicked(customerId: String) {
val issuingBottomSheet = bottomSheetMessage {
infoBlock {
icon(com.tangem.core.ui.R.drawable.ic_alert_24) {
@ -216,7 +216,7 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
secondaryButton {
text = resourceReference(R.string.tangempay_go_to_support)
onClick {
onPaySupportClick()
onPaySupportClick(customerId)
closeBs()
}
}
@ -225,7 +225,7 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
uiMessageSender.send(issuingBottomSheet)
}
override fun onPaySupportClick() {
override fun onPaySupportClick(customerId: String) {
modelScope.launch {
val cardInfo = getWalletMetainfoUseCase.invoke(
userWalletId = stateHolder.getSelectedWalletId(),
@ -234,6 +234,7 @@ internal class TangemPayClickIntentsImplementor @Inject constructor(
sendFeedbackEmailUseCase(
FeedbackEmailType.Visa.FailedIssueCard(
walletMetaInfo = cardInfo,
customerId = customerId,
),
)
}

View file

@ -45,37 +45,42 @@ internal class TangemPayUpdateInfoStateTransformer(
private fun createInitialState(): TangemPayState {
val cardInfo = value.info.cardInfo
val productInstance = value.info.productInstance
val customerId = value.info.customerId
val customerId = value.info.customerId ?: "Unknown"
// when statement copied to WalletTangemPayAnalyticsEventSender. Be careful when editing.
return when {
value.orderStatus == OrderStatus.CANCELED -> createCancelledState()
value.info.kycStatus != APPROVED && !customerId.isNullOrEmpty() ->
value.orderStatus == OrderStatus.CANCELED -> createCancelledState(customerId)
value.info.kycStatus != APPROVED && !value.info.customerId.isNullOrEmpty() ->
createKycInProgressState(kycStatus = value.info.kycStatus, customerId = customerId)
cardInfo != null && productInstance != null -> getCardInfoState(cardInfo, productInstance)
cardInfo != null && productInstance != null ->
getCardInfoState(customerId, cardInfo, productInstance)
else -> createIssueProgressState()
}
}
private fun getCardInfoState(cardInfo: CardInfo, productInstance: ProductInstance): TangemPayState =
TangemPayState.Card(
lastFourDigits = TextReference.Str("*${cardInfo.lastFourDigits}"),
balanceText = TextReference.Str(getBalanceText(cardInfo)),
balanceSymbol = stringReference("USDC"), // TODO hardcode for now
onClick = {
tangemPayClickIntents.openDetails(
userWalletId,
TangemPayDetailsConfig(
cardId = productInstance.cardId,
isPinSet = cardInfo.isPinSet,
cardFrozenState = cardFrozenState,
customerWalletAddress = cardInfo.customerWalletAddress,
cardNumberEnd = cardInfo.lastFourDigits,
chainId = POLYGON_CHAIN_ID,
),
)
},
)
private fun getCardInfoState(
customerId: String,
cardInfo: CardInfo,
productInstance: ProductInstance,
): TangemPayState = TangemPayState.Card(
lastFourDigits = TextReference.Str("*${cardInfo.lastFourDigits}"),
balanceText = TextReference.Str(getBalanceText(cardInfo)),
balanceSymbol = stringReference("USDC"), // TODO hardcode for now
onClick = {
tangemPayClickIntents.openDetails(
userWalletId,
TangemPayDetailsConfig(
customerId = customerId,
cardId = productInstance.cardId,
isPinSet = cardInfo.isPinSet,
cardFrozenState = cardFrozenState,
customerWalletAddress = cardInfo.customerWalletAddress,
cardNumberEnd = cardInfo.lastFourDigits,
chainId = POLYGON_CHAIN_ID,
),
)
},
)
private fun getBalanceText(cardInfo: CardInfo): String {
val currency = Currency.getInstance(cardInfo.currencyCode)
@ -113,10 +118,10 @@ internal class TangemPayUpdateInfoStateTransformer(
showProgress = true,
)
private fun createCancelledState(): TangemPayState = TangemPayState.FailedIssue(
private fun createCancelledState(customerId: String): TangemPayState = TangemPayState.FailedIssue(
title = TextReference.Res(R.string.tangempay_payment_account),
description = TextReference.Res(R.string.tangempay_failed_to_issue_card),
iconRes = R.drawable.ic_alert_24,
onButtonClick = tangemPayClickIntents::onIssuingFailedClicked,
onButtonClick = { tangemPayClickIntents.onIssuingFailedClicked(customerId) },
)
}