Skip to content

Commit

Permalink
Rename analytics param level from None to Initial
Browse files Browse the repository at this point in the history
COAND-1029
  • Loading branch information
araratthehero committed Oct 31, 2024
1 parent ec1db9b commit 405bde3
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "CAD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ internal class ACHDirectDebitComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "EUR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ internal class BcmcComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "CAD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ internal class BoletoComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "EUR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal class CardComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "EUR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ internal class CashAppPayComponentParamsMapperTest {
environment = Environment.EUROPE,
cashAppPayEnvironment = CashAppPayEnvironment.PRODUCTION,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "EUR",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ internal class DefaultAnalyticsManager(
CheckoutAttemptIdState.NotAvailable -> CHECKOUT_ATTEMPT_ID_NOT_FETCHED
}

private fun cannotSendEvents() = analyticsParams.level.priority <= AnalyticsParamsLevel.NONE.priority
private fun cannotSendEvents() = analyticsParams.level.priority <= AnalyticsParamsLevel.INITIAL.priority

override fun clear(owner: Any) {
if (ownerReference != owner::class.qualifiedName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ data class AnalyticsParams(

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
enum class AnalyticsParamsLevel(val priority: Int) {
NONE(1),
INITIAL(1),
ALL(2),
}

private fun getLevel(analyticsConfiguration: AnalyticsConfiguration?): AnalyticsParamsLevel {
return when (analyticsConfiguration?.level) {
null -> AnalyticsParamsLevel.ALL // default is ALL
AnalyticsLevel.ALL -> AnalyticsParamsLevel.ALL
AnalyticsLevel.NONE -> AnalyticsParamsLevel.NONE
AnalyticsLevel.NONE -> AnalyticsParamsLevel.INITIAL
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ internal class DefaultAnalyticsManagerTest(
}

@Test
fun `sending events is disabled, then checkoutAttemptId is still set`() = runTest {
analyticsManager = createAnalyticsManager(AnalyticsParamsLevel.NONE)
fun `analytics level is initial, then checkoutAttemptId is still set`() = runTest {
analyticsManager = createAnalyticsManager(AnalyticsParamsLevel.INITIAL)
whenever(analyticsRepository.fetchCheckoutAttemptId()) doReturn "test value"

analyticsManager.initialize(this@InitializeTest, this)
Expand Down Expand Up @@ -95,8 +95,8 @@ internal class DefaultAnalyticsManagerTest(
inner class TrackEventTest {

@Test
fun `sending events is disabled, then events should not be stored`() = runTest {
analyticsManager = createAnalyticsManager(AnalyticsParamsLevel.NONE)
fun `analytics level is initial, then events should not be stored`() = runTest {
analyticsManager = createAnalyticsManager(AnalyticsParamsLevel.INITIAL)
analyticsManager.initialize(this@TrackEventTest, this)

analyticsManager.trackEvent(GenericEvents.rendered("dropin", false))
Expand Down Expand Up @@ -140,8 +140,8 @@ internal class DefaultAnalyticsManagerTest(
inner class SendEventTest {

@Test
fun `sending events is disabled, then events are not sent`() = runTest {
analyticsManager = createAnalyticsManager(AnalyticsParamsLevel.NONE)
fun `analytics level is initial, then events are not sent`() = runTest {
analyticsManager = createAnalyticsManager(AnalyticsParamsLevel.INITIAL)
analyticsManager.initialize(this@SendEventTest, this)
val event = AnalyticsEvent.Info(
component = "test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class ButtonComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "USD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class GenericComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "CAD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ internal class DropInParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
amount = Amount(
currency = "EUR",
value = 49_00L,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal class GiftCardComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "CAD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ internal class GooglePayComponentParamsMapperTest {
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
googlePayEnvironment = WalletConstants.ENVIRONMENT_PRODUCTION,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "CAD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ internal class GooglePayUtilsTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = "CLIENT_KEY_CUSTOM",
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, "CLIENT_KEY_CUSTOM"),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, "CLIENT_KEY_CUSTOM"),
isCreatedByDropIn = true,
amount = Amount("EUR", 13_37),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ internal class IssuerListComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
viewType = IssuerListViewType.SPINNER_VIEW,
hideIssuerLogos = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal class MealVoucherFRComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "DKK",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ internal class TwintComponentParamsMapperTest {
shopperLocale = Locale.GERMAN,
environment = Environment.EUROPE,
clientKey = TEST_CLIENT_KEY_2,
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.NONE, TEST_CLIENT_KEY_2),
analyticsParams = AnalyticsParams(AnalyticsParamsLevel.INITIAL, TEST_CLIENT_KEY_2),
isCreatedByDropIn = true,
amount = Amount(
currency = "EUR",
Expand Down

0 comments on commit 405bde3

Please sign in to comment.