Skip to content

Route Checkout shipping Address Element through CheckoutSessionTaxRegionUpdater - #14357

Draft
cttsai-stripe wants to merge 9 commits into
masterfrom
cttsai/checkout-sae-tax-updater
Draft

Route Checkout shipping Address Element through CheckoutSessionTaxRegionUpdater#14357
cttsai-stripe wants to merge 9 commits into
masterfrom
cttsai/checkout-sae-tax-updater

Conversation

@cttsai-stripe

Copy link
Copy Markdown
Contributor

Summary

Checkout shipping Address Element saves now update the Checkout Session tax region through CheckoutSessionTaxRegionUpdater. This is a direct comparison alternative to the live CheckoutController registry design in #14353.

Motivation

The Checkout shipping flow needs to carry the current CheckoutSessionResponse through the Address Activity, return the tax-updated response with the collected address, persist both in the parent, and refresh controller-visible state before confirmation. This keeps shipping ownership local to the Checkout flow without adding a global registry or shipping callbacks to PaymentElementCallbacks.

What changed

  • LaunchMode.CheckoutShipping captures the current CheckoutSessionResponse when the Address Activity is presented.
  • The Address Activity calls CheckoutSessionTaxRegionUpdater with TaxAddressSource.SHIPPING. Its internal result envelope returns the normal AddressLauncherResult together with the updated response.
  • The parent stores shippingName and shippingAddress in CheckoutCollectedDetails, commits through CheckoutOperationCoordinator, and reloads through CheckoutStateLoader.reload so controller session, Payment Element state, and confirmation inputs observe the saved shipping details.
  • Confirmation uses refreshed shipping values for both new-payment and saved-payment paths.
  • The global CheckoutController shipping callback registry is removed. ShippingAddressElementStateHolder retains only isPresenting.
flowchart TB
    P["CheckoutController"] --> L["Checkout shipping AddressLauncher"]
    L --> A["AddressElementActivity"]
    A --> U["CheckoutSessionTaxRegionUpdater<br/>source SHIPPING"]
    U --> E["Activity result envelope<br/>AddressLauncherResult + CheckoutSessionResponse"]
    E --> S["CheckoutController parent commit"]
    S --> R["CheckoutStateLoader.reload"]
    R --> P
Loading

What stays the same

  • Activity-local duplicate-save blocking, processing state, inline retryable errors, cancellation, recreation, and result handling remain intact.
  • Standalone AddressLauncher behavior and its public result shape remain unchanged.
  • There is no versioning, refetching, or mutation blocking added for this comparison.

Coverage

  • Tax gating and TaxAddressSource.SHIPPING request construction.
  • Address conversion, updated-response propagation, local shipping persistence, controller refresh timing, and confirmation shipping propagation.
  • Failure and retry, Activity recreation, cancellation, missing Checkout state, duplicate presentation, and standalone AddressLauncher behavior.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Focused Paymentsheet tests passed, along with :paymentsheet:detekt, :paymentsheet:apiCheck, the repository pre-push hook, and git diff --check.

Screenshots

Not applicable. There are no UI appearance changes.

Notes

The child tax request uses the response captured at presentation and runs outside the parent operation lock, matching the existing Checkout Sheet billing handoff. The parent commit is serialized, but applies that returned response to the latest local state. A merchant controller mutation can therefore race with the server-update-to-parent-commit window, and the local response can be temporarily stale. This alternative intentionally does not add versioning, refetching, or mutation blocking.

Changelog

[CHANGED] Checkout shipping Address Element saves now propagate the updated Checkout Session tax region.

Committed and created by Codex.

cttsai-stripe and others added 9 commits September 2, 2026 16:29
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
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