Updated on 2026-08-14
This commit is contained in:
parent
82a2266d04
commit
7bed9c04d1
6 changed files with 19 additions and 19 deletions
|
|
@ -19,10 +19,10 @@ import androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.lifecycle.flowWithLifecycle
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tangem.common.routing.deeplink
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import com.tangem.common.routing.deeplink.DeeplinkConst.DEEPLINK_KEY
|
||||
import com.tangem.common.routing.deeplink.DeeplinkConst.CUSTOMER_WALLET_ID_KEY
|
||||
import com.tangem.common.routing.deeplink.DeeplinkConst.DEEPLINK_KEY
|
||||
import com.tangem.common.routing.deeplink.DeeplinkConst.DERIVATION_PATH_KEY
|
||||
import com.tangem.common.routing.deeplink.DeeplinkConst.NETWORK_ID_KEY
|
||||
import com.tangem.common.routing.deeplink.DeeplinkConst.TOKEN_ID_KEY
|
||||
|
|
@ -188,7 +188,7 @@ internal class PayloadToDeeplinkConverterTest {
|
|||
fun `GIVEN tangem pay top_up push payload WHEN convert THEN should return pay-app-main deeplink`() {
|
||||
// GIVEN
|
||||
val payload = mapOf(
|
||||
TYPE_KEY to TangemPayPushNotificationType.TOP_UP.value,
|
||||
TYPE_KEY to TangemPayPushNotificationType.DECLINED_TOP_UP.value,
|
||||
CUSTOMER_WALLET_ID_KEY to "wallet123",
|
||||
TRANSACTION_ID_KEY to "test456",
|
||||
)
|
||||
|
|
@ -206,7 +206,7 @@ internal class PayloadToDeeplinkConverterTest {
|
|||
fun `GIVEN tangem pay collateral push payload WHEN convert THEN should return pay-app-main deeplink`() {
|
||||
// GIVEN
|
||||
val payload = mapOf(
|
||||
TYPE_KEY to TangemPayPushNotificationType.COLLATERAL.value,
|
||||
TYPE_KEY to TangemPayPushNotificationType.COLLATERAL_DEPOSIT.value,
|
||||
CUSTOMER_WALLET_ID_KEY to "wallet123",
|
||||
)
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ internal class PayloadToDeeplinkConverterTest {
|
|||
|
||||
// THEN
|
||||
assertThat(result).isEqualTo(
|
||||
"tangem://pay-app-main?type=collateral&customer_wallet_id=wallet123",
|
||||
"tangem://pay-app-main?type=collateral_deposit&customer_wallet_id=wallet123",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.tangem.domain.visa.model
|
|||
enum class TangemPayPushNotificationType(val value: String) {
|
||||
CARD_READY("card_ready"),
|
||||
TRANSACTION_SPEND("transaction_spend"),
|
||||
TOP_UP("declined_top_up"),
|
||||
COLLATERAL("collateral"),
|
||||
DECLINED_TOP_UP("declined_top_up"),
|
||||
COLLATERAL_WITHDRAW("collateral_withdraw"),
|
||||
COLLATERAL_DEPOSIT("collateral_deposit"),
|
||||
TRANSACTION_SPEND_REFUND("transaction_spend_refund"),
|
||||
;
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ internal object TangemPayTxHistoryDetailsConverter :
|
|||
is TangemPayTxHistoryItem.Payment -> ImageReference.Res(R.drawable.ic_arrow_up_24)
|
||||
is TangemPayTxHistoryItem.Spend -> {
|
||||
val merchantIcon = this.enrichedMerchantIconUrl
|
||||
if (merchantIcon != null) {
|
||||
if (!merchantIcon.isNullOrEmpty()) {
|
||||
ImageReference.Url(merchantIcon)
|
||||
} else {
|
||||
ImageReference.Res(R.drawable.ic_category_24)
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ internal class DefaultTangemPayMainDeepLinkHandler @AssistedInject constructor(
|
|||
onComplete = {
|
||||
walletDeepLinkActionTrigger.selectWallet(userWalletId)
|
||||
when (pushAction) {
|
||||
is TangemPayPushAction.CardReady,
|
||||
is TangemPayPushAction.TopUp,
|
||||
-> navigateToTangemPayDetails(userWalletId)
|
||||
is TangemPayPushAction.CardReady -> navigateToTangemPayDetails(userWalletId)
|
||||
is TangemPayPushAction.TransactionSpend -> {
|
||||
walletDeepLinkActionTrigger.showTangemPayTransaction(
|
||||
transaction = pushAction.transaction,
|
||||
|
|
@ -89,12 +87,14 @@ internal class DefaultTangemPayMainDeepLinkHandler @AssistedInject constructor(
|
|||
|
||||
return when (type) {
|
||||
TangemPayPushNotificationType.CARD_READY -> TangemPayPushAction.CardReady
|
||||
TangemPayPushNotificationType.TRANSACTION_SPEND -> {
|
||||
TangemPayPushNotificationType.TRANSACTION_SPEND,
|
||||
TangemPayPushNotificationType.TRANSACTION_SPEND_REFUND,
|
||||
TangemPayPushNotificationType.DECLINED_TOP_UP,
|
||||
-> {
|
||||
val transaction = TangemPayPushPayloadToTxHistoryItemConverter.convertSpend(payload)
|
||||
if (transaction != null) TangemPayPushAction.TransactionSpend(transaction, customerId) else null
|
||||
}
|
||||
TangemPayPushNotificationType.TOP_UP -> TangemPayPushAction.TopUp
|
||||
TangemPayPushNotificationType.COLLATERAL -> {
|
||||
TangemPayPushNotificationType.COLLATERAL_DEPOSIT, TangemPayPushNotificationType.COLLATERAL_WITHDRAW -> {
|
||||
val transaction = TangemPayPushPayloadToTxHistoryItemConverter.convertCollateral(payload)
|
||||
if (transaction != null) TangemPayPushAction.CollateralTransaction(transaction, customerId) else null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,12 @@ internal sealed class TangemPayPushAction {
|
|||
data object CardReady : TangemPayPushAction()
|
||||
|
||||
data class TransactionSpend(
|
||||
val transaction: TangemPayTxHistoryItem,
|
||||
val transaction: TangemPayTxHistoryItem.Spend,
|
||||
val customerId: String,
|
||||
) : TangemPayPushAction()
|
||||
|
||||
data object TopUp : TangemPayPushAction()
|
||||
|
||||
data class CollateralTransaction(
|
||||
val transaction: TangemPayTxHistoryItem,
|
||||
val transaction: TangemPayTxHistoryItem.Collateral,
|
||||
val customerId: String,
|
||||
) : TangemPayPushAction()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue