-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1830 from Adyen/feature/analytics_error_events_base
Analytics - Add support for error events
- Loading branch information
Showing
16 changed files
with
374 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ts-core/src/main/java/com/adyen/checkout/components/core/internal/analytics/ErrorEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2024 Adyen N.V. | ||
* | ||
* This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
* | ||
* Created by ararat on 14/10/2024. | ||
*/ | ||
|
||
package com.adyen.checkout.components.core.internal.analytics | ||
|
||
import androidx.annotation.RestrictTo | ||
import com.adyen.checkout.components.core.internal.analytics.AnalyticsEvent.Error.Type | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
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"), | ||
|
||
// Third party | ||
THIRD_PARTY(Type.THIRD_PARTY, "611"), | ||
|
||
// API | ||
API_PAYMENTS(Type.API_ERROR, "620"), | ||
API_PAYMENTS_DETAILS(Type.API_ERROR, "621"), | ||
API_THREEDS2(Type.API_ERROR, "622"), | ||
API_ORDER(Type.API_ERROR, "623"), | ||
API_PUBLIC_KEY(Type.API_ERROR, "624"), | ||
API_NATIVE_REDIRECT(Type.API_ERROR, "625"), | ||
|
||
// 3DS2 | ||
THREEDS2_TOKEN_DECODING(Type.THREEDS2, "704"), | ||
THREEDS2_FINGERPRINT_CREATION(Type.THREEDS2, "705"), | ||
THREEDS2_TRANSACTION_CREATION(Type.THREEDS2, "706"), | ||
THREEDS2_TRANSACTION_MISSING(Type.THREEDS2, "707"), | ||
THREEDS2_FINGERPRINT_HANDLING(Type.THREEDS2, "708"), | ||
THREEDS2_CHALLENGE_HANDLING(Type.THREEDS2, "709"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...en/checkout/components/core/internal/analytics/data/local/ErrorAnalyticsLocalDataStore.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024 Adyen N.V. | ||
* | ||
* This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
* | ||
* Created by ararat on 15/10/2024. | ||
*/ | ||
|
||
package com.adyen.checkout.components.core.internal.analytics.data.local | ||
|
||
import com.adyen.checkout.components.core.internal.analytics.AnalyticsEvent | ||
import kotlinx.coroutines.sync.Mutex | ||
import kotlinx.coroutines.sync.withLock | ||
import java.util.LinkedList | ||
|
||
internal class ErrorAnalyticsLocalDataStore : AnalyticsLocalDataStore<AnalyticsEvent.Error> { | ||
|
||
private val list = LinkedList<AnalyticsEvent.Error>() | ||
|
||
private val mutex = Mutex() | ||
|
||
override suspend fun storeEvent(event: AnalyticsEvent.Error) { | ||
mutex.withLock { | ||
list.add(event) | ||
} | ||
} | ||
|
||
override suspend fun fetchEvents(size: Int) = mutex.withLock { | ||
list.takeLast(size) | ||
} | ||
|
||
override suspend fun removeEvents(events: List<AnalyticsEvent.Error>) { | ||
mutex.withLock { | ||
list.removeAll(events.toSet()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.