Refactor PaymentConfiguration for per-instance use in EmbeddedPayment…#13331
Draft
tjclawson-stripe wants to merge 1 commit into
Draft
Conversation
…Element - Remove @RestrictTo from PaymentConfiguration constructor so users can construct it directly for per-instance use. Add KDoc explaining that direct construction does not write to SharedPreferences or affect the global singleton returned by getInstance(). - Add PaymentConfigurationHolder: a mutable, @Singleton-scoped holder that owns a nullable PaymentConfiguration override. When the override is null (the default), get() falls back to PaymentConfiguration.getInstance(context), preserving existing behavior for all non-embedded components. - Update PaymentConfigurationModule.providePaymentConfiguration to delegate to PaymentConfigurationHolder.get() instead of calling getInstance(context) directly. Remove unused Context import. - Wire PaymentConfiguration through EmbeddedPaymentElement.Configuration: add an optional paymentConfiguration field (default null) to the data class and Builder, and set the holder in both configure() overloads so per-instance overrides take effect before loading begins. - Add TODO comment in EmbeddedConfigurationHandler noting that the cache key (Arguments) does not include paymentConfiguration, so calling configure() twice with the same intent/config but a different PaymentConfiguration returns the cached result. Committed-By-Agent: goose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…Element
Remove @RestrictTo from PaymentConfiguration constructor so users can construct it directly for per-instance use. Add KDoc explaining that direct construction does not write to SharedPreferences or affect the global singleton returned by getInstance().
Add PaymentConfigurationHolder: a mutable, @Singleton-scoped holder that owns a nullable PaymentConfiguration override. When the override is null (the default), get() falls back to PaymentConfiguration.getInstance(context), preserving existing behavior for all non-embedded components.
Update PaymentConfigurationModule.providePaymentConfiguration to delegate to PaymentConfigurationHolder.get() instead of calling getInstance(context) directly. Remove unused Context import.
Wire PaymentConfiguration through EmbeddedPaymentElement.Configuration: add an optional paymentConfiguration field (default null) to the data class and Builder, and set the holder in both configure() overloads so per-instance overrides take effect before loading begins.
Add TODO comment in EmbeddedConfigurationHandler noting that the cache key (Arguments) does not include paymentConfiguration, so calling configure() twice with the same intent/config but a different PaymentConfiguration returns the cached result.
Committed-By-Agent: goose
Summary
Motivation
Testing
Screenshots
Changelog