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