@Test public void init_withSavedStateBundle_doesNotClearLoggingTokens() { EphemeralKey firstKey = EphemeralKey.fromString(FIRST_SAMPLE_KEY_RAW); assertNotNull(firstKey); mEphemeralKeyProvider.setNextRawEphemeralKey(FIRST_SAMPLE_KEY_RAW); CustomerSession.initCustomerSession( mEphemeralKeyProvider, mStripeApiProxy, null); CustomerSession.getInstance().addProductUsageTokenIfValid("PaymentMethodsActivity"); assertEquals(1, CustomerSession.getInstance().getProductUsageTokens().size()); PaymentSession.PaymentSessionListener mockListener = mock(PaymentSession.PaymentSessionListener.class); PaymentSession paymentSession = new PaymentSession(mActivityController.get()); paymentSession.init(mockListener, new PaymentSessionConfig.Builder().build(), new Bundle()); Set<String> loggingTokens = CustomerSession.getInstance().getProductUsageTokens(); assertEquals(2, loggingTokens.size()); assertTrue(loggingTokens.contains("PaymentMethodsActivity")); assertTrue(loggingTokens.contains("PaymentSession")); }
public boolean init(@NonNull PaymentSessionListener listener, @NonNull PaymentSessionConfig paymentSessionConfig) { return init(listener, paymentSessionConfig, null); }
PaymentSession { public boolean init(@NonNull PaymentSessionListener listener, @NonNull PaymentSessionConfig paymentSessionConfig) { return init(listener, paymentSessionConfig, null); } }
PaymentSession { public boolean init(@NonNull PaymentSessionListener listener, @NonNull PaymentSessionConfig paymentSessionConfig) { return init(listener, paymentSessionConfig, null); } PaymentSession(@NonNull Activity hostActivity); }
PaymentSession { public boolean init(@NonNull PaymentSessionListener listener, @NonNull PaymentSessionConfig paymentSessionConfig) { return init(listener, paymentSessionConfig, null); } PaymentSession(@NonNull Activity hostActivity); void completePayment(@NonNull PaymentCompletionProvider provider); boolean handlePaymentData(int requestCode, int resultCode, @NonNull Intent data); boolean updateIsPaymentReadyToCharge(PaymentSessionConfig paymentSessionConfig, PaymentSessionData paymentSessionData); boolean init(@NonNull PaymentSessionListener listener,
                        @NonNull PaymentSessionConfig paymentSessionConfig); boolean init(
            @NonNull PaymentSessionListener listener,
            @NonNull PaymentSessionConfig paymentSessionConfig,
            @Nullable Bundle savedInstanceState); void presentPaymentMethodSelection(); void savePaymentSessionInstanceState(@NonNull Bundle outState); void setCartTotal(@IntRange(from = 0) long cartTotal); void presentShippingFlow(); PaymentSessionData getPaymentSessionData(); void onDestroy(); }
PaymentSession { public boolean init(@NonNull PaymentSessionListener listener, @NonNull PaymentSessionConfig paymentSessionConfig) { return init(listener, paymentSessionConfig, null); } PaymentSession(@NonNull Activity hostActivity); void completePayment(@NonNull PaymentCompletionProvider provider); boolean handlePaymentData(int requestCode, int resultCode, @NonNull Intent data); boolean updateIsPaymentReadyToCharge(PaymentSessionConfig paymentSessionConfig, PaymentSessionData paymentSessionData); boolean init(@NonNull PaymentSessionListener listener,
                        @NonNull PaymentSessionConfig paymentSessionConfig); boolean init(
            @NonNull PaymentSessionListener listener,
            @NonNull PaymentSessionConfig paymentSessionConfig,
            @Nullable Bundle savedInstanceState); void presentPaymentMethodSelection(); void savePaymentSessionInstanceState(@NonNull Bundle outState); void setCartTotal(@IntRange(from = 0) long cartTotal); void presentShippingFlow(); PaymentSessionData getPaymentSessionData(); void onDestroy(); static final String TOKEN_PAYMENT_SESSION; static final String EXTRA_PAYMENT_SESSION_ACTIVE; static final String PAYMENT_SESSION_DATA_KEY; static final String PAYMENT_SESSION_CONFIG; }