Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new card button doesn't work the second time. #3453

Closed
GiuFio opened this issue Mar 11, 2021 · 1 comment · Fixed by #3476
Closed

Add new card button doesn't work the second time. #3453

GiuFio opened this issue Mar 11, 2021 · 1 comment · Fixed by #3476
Assignees
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@GiuFio
Copy link

GiuFio commented Mar 11, 2021

Summary

Add new card... doesn't work the second time.
To reproduce:

  • Open PaymentMethodsActivity
  • Click on Add new card...
  • Click on back button
  • Click again on Add new card...
stripe-issue.mp4

Code to reproduce

Code used to start the PaymentSession

   PaymentConfiguration.init(activity.applicationContext, keyProvider.getStripePublicKey())
        CustomerSession.initCustomerSession(activity.applicationContext, ephemeralKeyProvider)
        paymentSession = PaymentSession(
                activity,
                PaymentSessionConfig.Builder()
                        .setShippingMethodsRequired(false)
                        .setShippingInfoRequired(false)
                        .setBillingAddressFields(BillingAddressFields.None)
                        .build()
        ).apply {
            init(paymentSessionListener)
            presentPaymentMethodSelection()
        }

SDK version

implementation('com.stripe:stripe-android:16.3.0')

Other information

I think the cause of the problem is this distinctUntilChanged. The second time the value is filtered because it's equal to the previous one

internal val addPaymentMethodArgs = _addPaymentMethodArgs.distinctUntilChanged()

@GiuFio GiuFio changed the title Add new card... doesn't work the second time. Add new card... doesn't work the second time. Mar 11, 2021
@GiuFio GiuFio changed the title Add new card... doesn't work the second time. Add new card button doesn't work the second time. Mar 11, 2021
@mshafrir-stripe mshafrir-stripe self-assigned this Mar 17, 2021
@mshafrir-stripe mshafrir-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Mar 17, 2021
@mshafrir-stripe
Copy link
Collaborator

@GiuFio thanks for filing this issue. I can reproduce it. I'll prepare a fix.

mshafrir-stripe added a commit that referenced this issue Mar 17, 2021
Currently, tapping on "Add new card", tapping back, then tapping
"Add new card" again results in the second tap on "Add new card" not
triggering `AddPaymentMethodActivity` to be started.

Remove `distinctUntilChanged()` operator on `_addPaymentMethodArgs`
to fix this.

Fixes #3453
mshafrir-stripe added a commit that referenced this issue Mar 17, 2021
Currently, tapping on "Add new card", tapping back, then tapping
"Add new card" again results in the second tap on "Add new card" not
triggering `AddPaymentMethodActivity` to be started.

Remove `distinctUntilChanged()` operator on `_addPaymentMethodArgs`
to fix this.

Fixes #3453
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants