Skip to content

Extract BillingAddressElement configuration - #13782

Draft
cttsai-stripe wants to merge 1 commit into
cttsai/mobilesdk-4667-form-factory-base-elementsfrom
cttsai/mobilesdk-4667-billing-address-configuration
Draft

Extract BillingAddressElement configuration#13782
cttsai-stripe wants to merge 1 commit into
cttsai/mobilesdk-4667-form-factory-base-elementsfrom
cttsai/mobilesdk-4667-billing-address-configuration

Conversation

@cttsai-stripe

Copy link
Copy Markdown
Contributor

Summary

Extracts BillingAddressElement.Configuration, an immutable value holder for the static inputs used to construct a billing-address element.

  • Migrate the card, standalone billing-details, and CountrySpec callers without changing their inputs.
  • Keep DropdownFieldController and SameAsShippingElement as constructor inputs because they own live form state.
  • Leave automatic-tax policy and field widening out of this change.

Motivation

#13713 needs to replace a billing-address element when automatic tax widens a country-only form. A copyable configuration makes that replacement explicit without mutating an element whose nested address and section controllers have already captured live state.

BillingAddressElement(
    configuration = BillingAddressElement.Configuration(/* static construction policy */),
    countryDropdownFieldController = /* live country state */,
    sameAsShippingElement = /* live checkbox state */,
)

The CountrySpec path continues to initialize its controller from initialValues[spec.apiPath]. Card and standalone billing-details paths continue to use IdentifierSpec.Country.

This is behavior-neutral prework between #13737 and #13713. It intentionally does not add withAdditionalFields(), automatic-tax constants, gates, or finalization.

Path Approve only if Evidence
CountrySpec The custom API path and initial country remain on the same controller. TransformSpecToElementsTest
Card The country controller uses the allowed countries and IdentifierSpec.Country initial value. CardDefinitionTest
Standalone billing details Initial values and Automatic/Never visibility stay unchanged. BillingDetailsFormTest
Scope No finalizer, widening method, or automatic-tax decision is introduced. Diff review

Testing

  • Added tests
  • Modified tests
  • Manually verified

Passed:

  • ./gradlew :payments-ui-core:testDebugUnitTest --tests com.stripe.android.ui.core.elements.CardBillingAddressElementTest
  • ./gradlew :paymentsheet:testDebugUnitTest --tests com.stripe.android.lpmfoundations.luxe.TransformSpecToElementsTest --tests com.stripe.android.lpmfoundations.paymentmethod.definitions.CardDefinitionTest --tests com.stripe.android.paymentsheet.ui.BillingDetailsFormTest
  • ./gradlew :payments-ui-core:lintRelease :payments-ui-core:detekt :payments-ui-core:apiCheck :paymentsheet:detekt :paymentsheet:apiCheck

Screenshots

Not applicable. The rendered form behavior is unchanged.

Changelog

Not applicable. This is an internal behavior-neutral refactor.

@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-form-factory-base-elements branch from f2d9933 to f816960 Compare August 6, 2026 18:17
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-billing-address-configuration branch from 37c2556 to 7d9a4ea Compare August 6, 2026 18:17
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-form-factory-base-elements branch from f816960 to c67b48e Compare August 6, 2026 20:22
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-billing-address-configuration branch from 7d9a4ea to 8b2e4ec Compare August 6, 2026 20:22
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-form-factory-base-elements branch from c67b48e to 5e52aaa Compare August 6, 2026 22:38
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/mobilesdk-4667-billing-address-configuration branch from 8b2e4ec to 7bc9901 Compare August 6, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant