-
Notifications
You must be signed in to change notification settings - Fork 665
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
Move CustomerState.Permissions to PaymentMethodsMetadata.CustomerMetadata #10483
base: master
Are you sure you want to change the base?
Conversation
Diffuse output:
APK
|
@@ -165,7 +169,7 @@ internal class SavedPaymentMethodMutator( | |||
customerSessionClientSecret = currentCustomer.customerSessionClientSecret, | |||
), | |||
paymentMethodId = paymentMethodId, | |||
canRemoveDuplicates = currentCustomer.permissions.canRemoveDuplicates, | |||
canRemoveDuplicates = canRemoveDuplicates.value ?: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have default values for these permissions defined somewhere instead of hardcoding false
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For SavedPaymentMethodMutator, canRemoveDuplicates is true if using customerSessions and false if using legacy keys. I will check that here by checking if customerSessionClientSecret is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this case, I'm going to set it based on whether currentCustomer.customerSessionClientSecret
is null
For paymentSheet, canRemoveDuplicates is true for customer session and false for legacy ephemeral key.
When I port those over I'll add an exception like already exists on line 145.
...a/com/stripe/android/lpmfoundations/paymentmethod/definitions/CardUiDefinitionFactoryTest.kt
Outdated
Show resolved
Hide resolved
...tsheet/src/test/java/com/stripe/android/paymentelement/embedded/manage/ManageActivityTest.kt
Outdated
Show resolved
Hide resolved
paymentsheet/src/main/java/com/stripe/android/paymentsheet/CustomerStateHolder.kt
Outdated
Show resolved
Hide resolved
I passed in canRemoveDuplicates = true to the paymentMethodMetadata permissions It was false before. By setting it to true the test was calling CustomerRepository.detachPaymentMethodAndDuplicates Which had the get call.
4459867
to
0ba1e3a
Compare
Summary
Moved permissions from customerState to PaymentMethodMetadata
Fixed tests that broke.
Moved tests from CustomerStateTests to CustomerMetadataTests
Motivation
Moving immutable parts of customerState to PaymentMethodMetadata.
During defaultPaymentMethods, to move immutable parts of customerState to PaymentMethodMetadata which is immutable.
That work was descoped for defaultPaymentMethods
https://jira.corp.stripe.com/browse/MOBILESDK-3324
Testing
Screenshots
N.A.
Changelog
N.A.