diff --git a/core/deep-links/src/main/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverter.kt b/core/deep-links/src/main/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverter.kt index 88319526cc..586bc9b593 100644 --- a/core/deep-links/src/main/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverter.kt +++ b/core/deep-links/src/main/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverter.kt @@ -51,7 +51,9 @@ object PayloadToDeeplinkConverter : Converter, String?> { addQueryParam(TOKEN_ID_KEY, tokenId) addQueryParam(TYPE_KEY, type) addQueryParam(WALLET_ID_KEY, walletId) - addQueryParam(DERIVATION_PATH_KEY, derivationPath) + if (derivationPath.isNotBlank()) { + addQueryParam(DERIVATION_PATH_KEY, derivationPath) + } transactionId?.let { addQueryParam(TRANSACTION_ID_KEY, it) } name?.let { addQueryParam(NAME_KEY, it) } @@ -62,7 +64,6 @@ object PayloadToDeeplinkConverter : Converter, String?> { return payload.containsKey(TYPE_KEY) && payload.containsKey(NETWORK_ID_KEY) && payload.containsKey(TOKEN_ID_KEY) && - payload.containsKey(WALLET_ID_KEY) && - payload.containsKey(DERIVATION_PATH_KEY) + payload.containsKey(WALLET_ID_KEY) } } \ No newline at end of file diff --git a/core/deep-links/src/test/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverterTest.kt b/core/deep-links/src/test/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverterTest.kt index f3887c86e9..0158e98655 100644 --- a/core/deep-links/src/test/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverterTest.kt +++ b/core/deep-links/src/test/kotlin/com/tangem/core/deeplink/converter/PayloadToDeeplinkConverterTest.kt @@ -48,6 +48,25 @@ internal class PayloadToDeeplinkConverterTest { ) } + @Test + fun `GIVEN push notification payload without derivationPath WHEN convert THEN should return correct deeplink without derivation_path`() { + // GIVEN + val payload = mapOf( + TYPE_KEY to "token", + NETWORK_ID_KEY to "ethereum", + TOKEN_ID_KEY to "0x123", + WALLET_ID_KEY to "wallet123", + ) + + // WHEN + val result = PayloadToDeeplinkConverter.convert(payload) + + // THEN + assertThat(result).isEqualTo( + "tangem://token?network_id=ethereum&token_id=0x123&type=token&user_wallet_id=wallet123", + ) + } + @Test fun `GIVEN push notification payload with missing type WHEN convert THEN should return null`() { // GIVEN