Skip to content

Commit

Permalink
Remove tracking redirect error event when user closes redirect
Browse files Browse the repository at this point in the history
COAND-1006
  • Loading branch information
araratthehero committed Nov 26, 2024
1 parent c60a98f commit 48db48d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 48db48d

Please sign in to comment.