From 6e3c00bf10b751d26e304e4a4354105c0494bafb Mon Sep 17 00:00:00 2001 From: Ararat Mnatsakanyan Date: Tue, 26 Nov 2024 13:09:40 +0100 Subject: [PATCH] Remove tracking redirect error event when user closes redirect COAND-1006 --- .../core/internal/analytics/ErrorEvent.kt | 1 - .../internal/ui/DefaultRedirectDelegate.kt | 13 ++----------- .../ui/DefaultRedirectDelegateTest.kt | 19 ------------------- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/components-core/src/main/java/com/adyen/checkout/components/core/internal/analytics/ErrorEvent.kt b/components-core/src/main/java/com/adyen/checkout/components/core/internal/analytics/ErrorEvent.kt index 646ed5f37c..8832aa083c 100644 --- a/components-core/src/main/java/com/adyen/checkout/components/core/internal/analytics/ErrorEvent.kt +++ b/components-core/src/main/java/com/adyen/checkout/components/core/internal/analytics/ErrorEvent.kt @@ -17,7 +17,6 @@ enum class ErrorEvent(val errorType: Type, val errorCode: String) { // Redirect REDIRECT_FAILED(Type.REDIRECT, "600"), REDIRECT_PARSE_FAILED(Type.REDIRECT, "601"), - REDIRECT_CANCELLED(Type.REDIRECT, "602"), // Encryption ENCRYPTION(Type.INTERNAL, "610"), diff --git a/redirect/src/main/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegate.kt b/redirect/src/main/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegate.kt index 061b4b2ef0..cbb0ace41b 100644 --- a/redirect/src/main/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegate.kt +++ b/redirect/src/main/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegate.kt @@ -28,7 +28,6 @@ import com.adyen.checkout.components.core.internal.analytics.GenericEvents import com.adyen.checkout.components.core.internal.ui.model.GenericComponentParams import com.adyen.checkout.components.core.internal.util.bufferedChannel import com.adyen.checkout.core.AdyenLogLevel -import com.adyen.checkout.core.exception.CancellationException import com.adyen.checkout.core.exception.CheckoutException import com.adyen.checkout.core.exception.ComponentException import com.adyen.checkout.core.exception.HttpException @@ -143,7 +142,7 @@ constructor( } catch (ex: CheckoutException) { val event = GenericEvents.error( component = action?.paymentMethodType.orEmpty(), - event = ErrorEvent.REDIRECT_FAILED + event = ErrorEvent.REDIRECT_FAILED, ) analyticsManager?.trackEvent(event) @@ -167,7 +166,7 @@ constructor( } catch (ex: CheckoutException) { val event = GenericEvents.error( component = action?.paymentMethodType.orEmpty(), - event = ErrorEvent.REDIRECT_PARSE_FAILED + event = ErrorEvent.REDIRECT_PARSE_FAILED, ) analyticsManager?.trackEvent(event) @@ -201,14 +200,6 @@ constructor( } override fun onError(e: CheckoutException) { - if (e is CancellationException) { - val event = GenericEvents.error( - component = action?.paymentMethodType.orEmpty(), - event = ErrorEvent.REDIRECT_CANCELLED - ) - analyticsManager?.trackEvent(event) - } - emitError(e) } diff --git a/redirect/src/test/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegateTest.kt b/redirect/src/test/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegateTest.kt index d57fa4bede..8643e3c165 100644 --- a/redirect/src/test/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegateTest.kt +++ b/redirect/src/test/java/com/adyen/checkout/redirect/internal/ui/DefaultRedirectDelegateTest.kt @@ -23,7 +23,6 @@ import com.adyen.checkout.components.core.internal.analytics.TestAnalyticsManage import com.adyen.checkout.components.core.internal.ui.model.CommonComponentParamsMapper import com.adyen.checkout.components.core.internal.ui.model.GenericComponentParamsMapper import com.adyen.checkout.core.Environment -import com.adyen.checkout.core.exception.CancellationException import com.adyen.checkout.core.exception.ComponentException import com.adyen.checkout.core.exception.HttpException import com.adyen.checkout.core.exception.ModelSerializationException @@ -237,24 +236,6 @@ internal class DefaultRedirectDelegateTest( ) analyticsManager.assertLastEventEquals(expectedEvent) } - - @Test - fun `when redirect is cancelled with CancellationException, then an event is tracked`() = runTest { - val action = RedirectAction( - paymentMethodType = TEST_PAYMENT_METHOD_TYPE, - type = TEST_ACTION_TYPE, - ) - delegate.handleAction(action, Activity()) - - val exception = CancellationException("Redirect flow cancelled.") - delegate.onError(exception) - - val expectedEvent = GenericEvents.error( - component = TEST_PAYMENT_METHOD_TYPE, - event = ErrorEvent.REDIRECT_CANCELLED, - ) - analyticsManager.assertLastEventEquals(expectedEvent) - } } @Test