Skip to content

Commit

Permalink
Remove the session id from payment sheet event reporting (#3888)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelleb-stripe committed Jul 2, 2021
1 parent 59f44fd commit b478c85
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 94 deletions.
20 changes: 6 additions & 14 deletions payments-core/api/payments-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -5651,11 +5651,11 @@ public abstract interface class com/stripe/android/paymentsheet/PaymentSheetResu
}

public final class com/stripe/android/paymentsheet/flowcontroller/DefaultFlowController_Factory : dagger/internal/Factory {
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController_Factory;
public fun <init> (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController_Factory;
public fun get ()Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController;
public synthetic fun get ()Ljava/lang/Object;
public static fun newInstance (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lcom/stripe/android/paymentsheet/model/PaymentOptionFactory;Lcom/stripe/android/paymentsheet/PaymentOptionCallback;Lcom/stripe/android/paymentsheet/PaymentSheetResultCallback;Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerInitializer;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Lcom/stripe/android/paymentsheet/analytics/SessionId;Landroidx/activity/result/ActivityResultLauncher;Landroidx/activity/result/ActivityResultLauncher;Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerViewModel;Lcom/stripe/android/networking/StripeApiRepository;Lcom/stripe/android/PaymentController;Ldagger/Lazy;Ldagger/Lazy;)Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController;
public static fun newInstance (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lcom/stripe/android/paymentsheet/model/PaymentOptionFactory;Lcom/stripe/android/paymentsheet/PaymentOptionCallback;Lcom/stripe/android/paymentsheet/PaymentSheetResultCallback;Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerInitializer;Lcom/stripe/android/paymentsheet/analytics/EventReporter;Landroidx/activity/result/ActivityResultLauncher;Landroidx/activity/result/ActivityResultLauncher;Lcom/stripe/android/paymentsheet/flowcontroller/FlowControllerViewModel;Lcom/stripe/android/networking/StripeApiRepository;Lcom/stripe/android/PaymentController;Ldagger/Lazy;Ldagger/Lazy;)Lcom/stripe/android/paymentsheet/flowcontroller/DefaultFlowController;
}

public final class com/stripe/android/paymentsheet/injection/DaggerFlowControllerComponent : com/stripe/android/paymentsheet/injection/FlowControllerComponent {
Expand All @@ -5664,11 +5664,11 @@ public final class com/stripe/android/paymentsheet/injection/DaggerFlowControlle
}

public final class com/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideEventReporterFactory : dagger/internal/Factory {
public fun <init> (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Ljavax/inject/Provider;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideEventReporterFactory;
public fun <init> (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideEventReporterFactory;
public fun get ()Lcom/stripe/android/paymentsheet/analytics/EventReporter;
public synthetic fun get ()Ljava/lang/Object;
public static fun provideEventReporter (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Lcom/stripe/android/paymentsheet/analytics/SessionId;Landroid/content/Context;Ldagger/Lazy;)Lcom/stripe/android/paymentsheet/analytics/EventReporter;
public static fun provideEventReporter (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Landroid/content/Context;Ldagger/Lazy;)Lcom/stripe/android/paymentsheet/analytics/EventReporter;
}

public final class com/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideFlowControllerInitializerFactory : dagger/internal/Factory {
Expand Down Expand Up @@ -5711,14 +5711,6 @@ public final class com/stripe/android/paymentsheet/injection/FlowControllerModul
public static fun providePaymentOptionActivityLauncher (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Lcom/stripe/android/paymentsheet/flowcontroller/ActivityLauncherFactory;Ldagger/Lazy;)Landroidx/activity/result/ActivityResultLauncher;
}

public final class com/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideSessionIdFactory : dagger/internal/Factory {
public fun <init> (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;)V
public static fun create (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;)Lcom/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideSessionIdFactory;
public fun get ()Lcom/stripe/android/paymentsheet/analytics/SessionId;
public synthetic fun get ()Ljava/lang/Object;
public static fun provideSessionId (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;)Lcom/stripe/android/paymentsheet/analytics/SessionId;
}

public final class com/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideStripeApiRepositoryFactory : dagger/internal/Factory {
public fun <init> (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Ljavax/inject/Provider;Ljavax/inject/Provider;)V
public static fun create (Lcom/stripe/android/paymentsheet/injection/FlowControllerModule;Ljavax/inject/Provider;Ljavax/inject/Provider;)Lcom/stripe/android/paymentsheet/injection/FlowControllerModule_ProvideStripeApiRepositoryFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.stripe.android.model.Source
import com.stripe.android.model.Token
import com.stripe.android.paymentsheet.analytics.DeviceId
import com.stripe.android.paymentsheet.analytics.PaymentSheetEvent
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.utils.ContextUtils.packageInfo
import javax.inject.Provider

Expand Down Expand Up @@ -154,18 +153,13 @@ internal class AnalyticsRequestFactory @VisibleForTesting internal constructor(
@JvmSynthetic
internal fun createRequest(
event: PaymentSheetEvent,
sessionId: SessionId?,
deviceId: DeviceId
): AnalyticsRequest {
return AnalyticsRequest(
createParams(
event.toString()
).plus(
FIELD_DEVICE_ID to deviceId.value
).plus(
sessionId?.let {
mapOf(FIELD_SESSION_ID to sessionId.value)
}.orEmpty()
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.activity.ComponentActivity
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.ActivityResultRegistry
import androidx.fragment.app.Fragment
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.model.PaymentIntentClientSecret
import com.stripe.android.paymentsheet.model.SetupIntentClientSecret
import org.jetbrains.annotations.TestOnly
Expand All @@ -14,7 +13,6 @@ internal class DefaultPaymentSheetLauncher(
private val activityResultLauncher: ActivityResultLauncher<PaymentSheetContract.Args>,
private val statusBarColor: () -> Int?
) : PaymentSheetLauncher {
private val sessionId: SessionId = SessionId()

constructor(
activity: ComponentActivity,
Expand Down Expand Up @@ -70,7 +68,6 @@ internal class DefaultPaymentSheetLauncher(
) = present(
PaymentSheetContract.Args(
PaymentIntentClientSecret(paymentIntentClientSecret),
sessionId,
statusBarColor(),
configuration
)
Expand All @@ -82,7 +79,6 @@ internal class DefaultPaymentSheetLauncher(
) = present(
PaymentSheetContract.Args(
SetupIntentClientSecret(setupIntentClientSecret),
sessionId,
statusBarColor(),
configuration
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.activity.result.contract.ActivityResultContract
import androidx.annotation.ColorInt
import com.stripe.android.model.PaymentMethod
import com.stripe.android.model.StripeIntent
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.model.PaymentSelection
import com.stripe.android.view.ActivityStarter
import kotlinx.parcelize.Parcelize
Expand All @@ -32,7 +31,6 @@ internal class PaymentOptionContract :
internal data class Args(
val stripeIntent: StripeIntent,
val paymentMethods: List<PaymentMethod>,
val sessionId: SessionId,
val config: PaymentSheet.Configuration?,
val isGooglePayReady: Boolean,
val newCard: PaymentSelection.New.Card?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ internal class PaymentOptionsActivity : BaseSheetActivity<PaymentOptionResult>()
override val eventReporter: EventReporter by lazy {
DefaultEventReporter(
mode = EventReporter.Mode.Custom,
starterArgs?.sessionId,
application
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ internal class PaymentOptionsViewModel(
prefsRepository,
DefaultEventReporter(
mode = EventReporter.Mode.Custom,
starterArgs.sessionId,
application
),
workContext = Dispatchers.IO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ internal class PaymentSheetActivity : BaseSheetActivity<PaymentSheetResult>() {
override val eventReporter: EventReporter by lazy {
DefaultEventReporter(
mode = EventReporter.Mode.Complete,
starterArgs?.sessionId,
application
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.os.Bundle
import androidx.activity.result.contract.ActivityResultContract
import androidx.annotation.ColorInt
import androidx.core.os.bundleOf
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.model.ClientSecret
import com.stripe.android.paymentsheet.model.PaymentIntentClientSecret
import com.stripe.android.view.ActivityStarter
Expand Down Expand Up @@ -35,7 +34,6 @@ internal class PaymentSheetContract :
@Parcelize
internal data class Args(
val clientSecret: ClientSecret,
val sessionId: SessionId,
@ColorInt val statusBarColor: Int?,
val config: PaymentSheet.Configuration?
) : ActivityStarter.Args {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ internal class PaymentSheetViewModel internal constructor(
prefsRepository,
DefaultEventReporter(
mode = EventReporter.Mode.Complete,
starterArgs.sessionId,
application
),
starterArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import kotlin.coroutines.CoroutineContext

internal class DefaultEventReporter internal constructor(
private val mode: EventReporter.Mode,
private val sessionId: SessionId?,
private val deviceIdRepository: DeviceIdRepository,
private val analyticsRequestExecutor: AnalyticsRequestExecutor,
private val analyticsRequestFactory: AnalyticsRequestFactory,
Expand All @@ -22,12 +21,10 @@ internal class DefaultEventReporter internal constructor(

internal constructor(
mode: EventReporter.Mode,
sessionId: SessionId?,
context: Context,
workContext: CoroutineContext = Dispatchers.IO
) : this(
mode,
sessionId,
DefaultDeviceIdRepository(context, workContext),
AnalyticsRequestExecutor.Default(),
AnalyticsRequestFactory(
Expand Down Expand Up @@ -104,7 +101,6 @@ internal class DefaultEventReporter internal constructor(
analyticsRequestExecutor.executeAsync(
analyticsRequestFactory.createRequest(
event,
sessionId,
deviceId
)
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.stripe.android.paymentsheet.PaymentSheet
import com.stripe.android.paymentsheet.PaymentSheetResult
import com.stripe.android.paymentsheet.PaymentSheetResultCallback
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.injection.DaggerFlowControllerComponent
import com.stripe.android.paymentsheet.model.ClientSecret
import com.stripe.android.paymentsheet.model.ConfirmStripeIntentParamsFactory
Expand Down Expand Up @@ -60,7 +59,6 @@ internal class DefaultFlowController @Inject internal constructor(
// Properties provided through injection
private val flowControllerInitializer: FlowControllerInitializer,
private val eventReporter: EventReporter,
private val sessionId: SessionId,
private val paymentOptionActivityLauncher: ActivityResultLauncher<PaymentOptionContract.Args>,
private val googlePayActivityLauncher: ActivityResultLauncher<StripeGooglePayContract.Args>,
private val viewModel: FlowControllerViewModel,
Expand Down Expand Up @@ -159,7 +157,6 @@ internal class DefaultFlowController @Inject internal constructor(
PaymentOptionContract.Args(
stripeIntent = initData.stripeIntent,
paymentMethods = initData.paymentMethods,
sessionId = sessionId,
config = initData.config,
isGooglePayReady = initData.isGooglePayReady,
newCard = viewModel.paymentSelection as? PaymentSelection.New.Card,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.stripe.android.paymentsheet.PaymentOptionContract
import com.stripe.android.paymentsheet.analytics.DefaultDeviceIdRepository
import com.stripe.android.paymentsheet.analytics.DefaultEventReporter
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.flowcontroller.ActivityLauncherFactory
import com.stripe.android.paymentsheet.flowcontroller.DefaultFlowController
import com.stripe.android.paymentsheet.flowcontroller.DefaultFlowControllerInitializer
Expand Down Expand Up @@ -93,13 +92,11 @@ internal class FlowControllerModule {
@Provides
@Singleton
fun provideEventReporter(
sessionId: SessionId,
appContext: Context,
lazyPaymentConfiguration: Lazy<PaymentConfiguration>
): EventReporter {
return DefaultEventReporter(
mode = EventReporter.Mode.Custom,
sessionId,
DefaultDeviceIdRepository(appContext, Dispatchers.IO),
AnalyticsRequestExecutor.Default(),
AnalyticsRequestFactory(
Expand All @@ -109,10 +106,6 @@ internal class FlowControllerModule {
)
}

@Provides
@Singleton
fun provideSessionId() = SessionId()

/**
* Provides the paymentOptionActivityLauncher instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import com.stripe.android.model.PaymentIntentFixtures
import com.stripe.android.model.PaymentMethodFixtures
import com.stripe.android.paymentsheet.PaymentOptionsViewModel.TransitionTarget
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.model.PaymentSelection
import com.stripe.android.paymentsheet.viewmodels.BaseSheetViewModel
import com.stripe.android.utils.InjectableActivityScenario
Expand Down Expand Up @@ -300,7 +299,6 @@ class PaymentOptionsActivityTest {
private val PAYMENT_OPTIONS_CONTRACT_ARGS = PaymentOptionContract.Args(
stripeIntent = PaymentIntentFixtures.PI_REQUIRES_PAYMENT_METHOD,
paymentMethods = emptyList(),
sessionId = SessionId(),
config = PaymentSheetFixtures.CONFIG_GOOGLEPAY,
isGooglePayReady = false,
newCard = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.stripe.android.R
import com.stripe.android.databinding.FragmentPaymentsheetAddPaymentMethodBinding
import com.stripe.android.model.PaymentIntentFixtures
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.model.FragmentConfig
import com.stripe.android.paymentsheet.model.FragmentConfigFixtures
import com.stripe.android.paymentsheet.ui.PaymentSheetFragmentFactory
Expand Down Expand Up @@ -45,7 +44,6 @@ class PaymentOptionsAddPaymentMethodFragmentTest {
args: PaymentOptionContract.Args = PaymentOptionContract.Args(
stripeIntent = PaymentIntentFixtures.PI_REQUIRES_PAYMENT_METHOD,
paymentMethods = emptyList(),
sessionId = SessionId(),
config = PaymentSheetFixtures.CONFIG_GOOGLEPAY,
isGooglePayReady = false,
newCard = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.stripe.android.model.PaymentMethodCreateParamsFixtures.DEFAULT_CARD
import com.stripe.android.model.PaymentMethodFixtures
import com.stripe.android.paymentsheet.PaymentOptionsViewModel.TransitionTarget
import com.stripe.android.paymentsheet.analytics.EventReporter
import com.stripe.android.paymentsheet.analytics.SessionId
import com.stripe.android.paymentsheet.model.FragmentConfigFixtures
import com.stripe.android.paymentsheet.model.PaymentSelection
import com.stripe.android.paymentsheet.model.SavedSelection
Expand Down Expand Up @@ -225,7 +224,6 @@ internal class PaymentOptionsViewModelTest {
private val PAYMENT_OPTION_CONTRACT_ARGS = PaymentOptionContract.Args(
stripeIntent = PaymentIntentFixtures.PI_REQUIRES_PAYMENT_METHOD,
paymentMethods = emptyList(),
sessionId = SessionId(),
config = PaymentSheetFixtures.CONFIG_CUSTOMER_WITH_GOOGLEPAY,
isGooglePayReady = true,
newCard = null,
Expand Down
Loading

0 comments on commit b478c85

Please sign in to comment.