Repository navigation
FE-3056 fix(billing-web): re-quote a stale subscribe quote the way the app does - #19126
Conversation
…resolved A checkout entry named a plan but its return_to did not resolve through buildReturnUrl, so the form rendered with a Back and Close that led nowhere. readEntry now records UNKNOWN_RETURN_TARGET for that entry, the same path a plan-less link takes.
…stem The cva recipe behind Button.vue lived in the app, so a workspace package could not render a button with the app's classes. It now ships from @comfyorg/design-system/button.variants and every importer reads it there. apps/website keeps its own copy.
…ants' into jaewon/account-ui-checkout-surfaces
…stem The saved-method picker moves into @comfyorg/account-ui next, and it has to render the app's select classes. The recipe now ships from @comfyorg/design-system/select.variants and its three importers read it there.
…form and success The cloud app's embedded checkout steps, as components billing-web can render too: the new-subscription confirm (price breakdown, promo code, saved methods, card form, 3DS and parked-checkout recovery), the plan-change confirm with its reactivation disclosure, the terms notice and the success screen. Hosts pass translated copy, the plan they resolved and the quote. The class recipes and cn() are bundled into the published build, reka-ui is a peer.
…unt-ui The new-subscription confirm, the plan-change confirm and the success step now render @comfyorg/account-ui's checkout components. The app components keep their props and events and bind the app's catalog, translations, Stripe key, theme, subscription status and journey telemetry. The copies they replace (the card-form wrapper, the terms note and the quote formatting helpers) are deleted; their tests move to the package or to the binding.
…ace-adopt-account-ui-checkout
billing-web resolves the plan it checks out from the quote, but the quote does not carry the monthly credit grant the confirm shows. The tiers' prices and grants move here so the app and billing-web read one table.
…ace-adopt-account-ui-checkout
CheckoutView now renders the cloud app's checkout steps from @comfyorg/account-ui in the app's dialog frame: the new-subscription confirm with its saved-method picker, promo code and card form, the plan-change confirm with its reactivation disclosure, and the success step. A plan change still confirms without a card form (#18684). EmbeddedCheckout, CheckoutPayment and CheckoutSubmit are deleted, with the billing-web-only copy they carried.
…atalog its own entry Both confirm templates exceeded the complexity gate. The new-subscription confirm now composes a summary and a pay-actions component, and picks one pay action in script; the plan-change confirm moves its reactivation banner and plan block into components. Rendered markup is unchanged. The tier catalog moves to @comfyorg/account-ui/billing/catalog, a TS-only entry, so importing it does not pull Vue components into non-Vue consumers such as the Playwright runner.
…ace-adopt-account-ui-checkout
…/billing-web-shared-checkout # Conflicts: # packages/account-ui/src/billing/checkout/index.ts
… outcomes Checked step by step against the cloud app with the checkout parity harness (same fixtures on both surfaces): - A payment in flight keeps the confirm on screen with the pay action busy, and shows the app's processing or verify toast. - A verification that fails in the tab shows the app's inline notice; a decline or timeout shows the app's error toast with its detail copy and leaves the confirm usable. The CheckoutSteps panel is gone. - The frame reproduces what the app's page applies around the dialog: its dark palette stroke, dark colour scheme, and browser defaults for inputs, the select trigger and links (the app has no Tailwind preflight). - Tailwind now sources all of account-ui's billing components, so the Stripe form's layout classes are generated.
…f CheckoutView The plan resolution and the subscribe request move into pure, tested helpers (both were over the complexity gate inline). CheckoutFrame renders its close button from the design-system recipe, so account-ui no longer exports its internal button, whose declarations named an unpublished type.
The team invite on billing-web's success step renders the app's email tags, so the tag recipe ships from @comfyorg/design-system/tag.variants and its four importers read it there.
listPendingInvites and createInvite for the workspace the transport's token names, parsed against the generated contract, so a host that checks out a team plan can invite the team without a second client.
A multi-seat subscribe on billing-web now ends on the app's success step with its team invite: the same copy, email tags, pending-invite and seat-cap hints, and one invite per address through the account-core invite commands, sent to the workspace the entry link bound. The invite UI lives in @comfyorg/account-ui (CheckoutTeamSuccess), and the app's invite email rules move there with it. Inside the checkout frame the browser defaults the app shows for inputs and links now sit in the base layer, so utilities such as the tags input's text size still apply.
…e toasts Red first: a decline the server reports after this tab's challenge failed is toasted as a card decline, and the error toasts of earlier attempts stay over the success step.
…n success After a challenge failed in the tab, the server settles the payment as a generic card decline, and both checkouts toasted "Your bank declined this payment" over the verification failure they had just shown. The lifecycle (account-core, used by billing-web and the app's SDK rail) and the app's legacy poller now report that settle as the failed verification; a specific server reason still stands. A refused attempt's error toast was sticky, so after declines and a successful retry it stayed over the success step. The checkout now removes its attempt toasts when it reaches success.
Red first: Back/Close on billing-web navigate the billing tab to the product instead of closing it, and the app leaves billing_result/billing_ref in the address bar.
Back, Close and "Return to ComfyUI" navigated the billing tab to the product, so the customer ended with two product tabs and billing_result in the URL. The product opens billing in its own tab, so billing-web now closes itself and falls back to the product's URL only for a tab it could not close (one opened directly). The product already refreshes billing on return, and now also strips billing_result/billing_ref from its URL on load.
The backend now records authentication_failed for a failed 3DS, so the client-side override that re-derived it is gone. authentication_failed and authentication_required keep mapping to the verification copy.
…eb-return-close-tab
christian-byrne
left a comment
There was a problem hiding this comment.
Approved. The stale-quote regression now proves the distinct replacement amount is displayed and the retry submits the replacement quote rather than the invalidated original.
|
|
|
Backports opened after the bot's cherry-pick conflicts: |
…ribe quote the way the app does (#19481) ## Why When the server refuses a subscribe because the quote went stale (400 `SUBSCRIPTION_QUOTE_STALE`), billing-web shows "We couldn't reach the billing service" and keeps the old quote, so every retry is refused the same way. The embedded checkout already re-quotes. ## Root cause `issueSubscribe` in `packages/account-core/src/core/billing/subscriptionCommands.ts` did not map the stale-quote code, and `CheckoutView.pay` had no branch for it. ## How The SDK maps a 4xx `SUBSCRIPTION_QUOTE_STALE` to `QUOTE_STALE`. `CheckoutView.pay` clears `quoteIsCurrent`, re-quotes, and shows "Your quote changed" or "couldn't be refreshed" copy. ## AS IS / TO BE Same as #19126, which carries the AS IS description and the TO BE test evidence. This backport does not change behavior relative to main. Backport of #19126 to `core/1.55`. Cherry-picked with `-x` from e352169. ## Conflicts One file, `apps/billing-web/src/views/CheckoutView.vue`, two hunks. Both took the #19126 side. - `useHostedCopy()` destructure: 1.55 had `{ refusal }` (FE-2642, backported in #19305). #19126 needs `coded` back for the stale-quote copy, so it is `{ coded, refusal }`. - `pay()`: 1.55 ends with `submitFailure.value = refusal(result)`. The `QUOTE_STALE` branch (clear `quoteIsCurrent`, re-quote, show "Your quote changed" or "couldn't be refreshed") is inserted before it, as on main. The FE-2642 parts of the squash (`useHostedCopy.refusal`, its call sites in the panels and `InvoicesView`, and the "shows the reason the server gave for a refused quote" test) were already on `core/1.55` and applied as no-ops. The SDK mapping in `subscriptionCommands.ts` (`refusedWith` for a 4xx `SUBSCRIPTION_QUOTE_STALE`, `refusedWhilePending` otherwise), the two locale strings, and the new tests applied cleanly. ## Verification - `pnpm typecheck` (all five stages) passes. - billing-web vitest: 23 files, 280 tests pass, including "re-quotes a stale quote and pays against the replacement" and "keeps Confirm closed on the stale quote when its refresh fails". - account-core vitest: 68 files, 1235 tests pass, including the 400 → `QUOTE_STALE` / 503 → `REQUEST_FAILED` table. - eslint, oxlint, and oxfmt clean on the changed files. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…cribe quote the way the app does (#19482) ## Why When the server refuses a subscribe because the quote went stale (400 `SUBSCRIPTION_QUOTE_STALE`), billing-web shows "We couldn't reach the billing service" and keeps the old quote, so every retry is refused the same way. The embedded checkout already re-quotes. ## Root cause `issueSubscribe` in `packages/account-core/src/core/billing/subscriptionCommands.ts` did not map the stale-quote code, and `CheckoutView.pay` had no branch for it. ## How The SDK maps a 4xx `SUBSCRIPTION_QUOTE_STALE` to `QUOTE_STALE`. `CheckoutView.pay` clears `quoteIsCurrent`, re-quotes, and shows "Your quote changed" or "couldn't be refreshed" copy. ## AS IS / TO BE Same as #19126, which carries the AS IS description and the TO BE test evidence. This backport does not change behavior relative to main. Backport of #19126 to `cloud/1.55`. Cherry-picked with `-x` from e352169. ## Conflicts One file, `apps/billing-web/src/views/CheckoutView.vue`, two hunks. Both took the #19126 side. - `useHostedCopy()` destructure: 1.55 had `{ refusal }` (FE-2642, backported in #19304). #19126 needs `coded` back for the stale-quote copy, so it is `{ coded, refusal }`. - `pay()`: 1.55 ends with `submitFailure.value = refusal(result)`. The `QUOTE_STALE` branch (clear `quoteIsCurrent`, re-quote, show "Your quote changed" or "couldn't be refreshed") is inserted before it, as on main. The FE-2642 parts of the squash (`useHostedCopy.refusal`, its call sites in the panels and `InvoicesView`, and the "shows the reason the server gave for a refused quote" test) were already on `cloud/1.55` and applied as no-ops. The SDK mapping in `subscriptionCommands.ts` (`refusedWith` for a 4xx `SUBSCRIPTION_QUOTE_STALE`, `refusedWhilePending` otherwise), the two locale strings, and the new tests applied cleanly. ## Verification - `pnpm typecheck` (all five stages) passes. - billing-web vitest: 23 files, 280 tests pass, including "re-quotes a stale quote and pays against the replacement" and "keeps Confirm closed on the stale quote when its refresh fails". - account-core vitest: 68 files, 1234 tests pass, including the 400 → `QUOTE_STALE` / 503 → `REQUEST_FAILED` table. - eslint, oxlint, and oxfmt clean on the changed files. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…omfy-Org#19499) ## Summary Fixes the `full-page-promo.spec.ts` "a code that lapses before Pay" failure that has been red on main since Comfy-Org#19126. The full-page checkout now re-quotes when a subscribe comes back as `QUOTE_STALE`. ## Changes - **What**: Comfy-Org#19253 made `payVerdictOf` re-quote only when a raw `SUBSCRIPTION_QUOTE_STALE` `serverCode` came back. Comfy-Org#19126 then changed account-core to turn a 4xx with that code into `{ code: 'QUOTE_STALE' }` with no `serverCode`. The two PRs were written in parallel and merged about 40 minutes apart. Since then, `payVerdictOf` falls through to `failure`. The page shows "Your quote changed…" instead of re-pricing and showing the expired-promo card. `payVerdictOf` now maps `QUOTE_STALE` to `requote`. - The `payVerdict` and `FullPageCheckoutView` unit tests built the pre-Comfy-Org#19126 result shape by hand, so they missed this. They now use the shape account-core actually returns. ## Review Focus `SUBSCRIPTION_QUOTE_STALE` is gone from `STALE_QUOTE_SERVER_CODES`. Only `subscribe` emits it, and account-core now maps it for 4xx responses. A 5xx that echoes the code arrives as `REQUEST_FAILED`, which account-core treats as an upstream failure, not a stale quote. With this change, that 5xx no longer triggers a re-quote. Red/green: both updated unit tests fail without the `payVerdict.ts` change and pass with it. `pnpm test:e2e:local e2e/full-page-promo.spec.ts` passes 6/6.
…19499) ## Summary Fixes the `full-page-promo.spec.ts` "a code that lapses before Pay" failure that has been red on main since #19126. The full-page checkout now re-quotes when a subscribe comes back as `QUOTE_STALE`. ## Changes - **What**: #19253 made `payVerdictOf` re-quote only when a raw `SUBSCRIPTION_QUOTE_STALE` `serverCode` came back. #19126 then changed account-core to turn a 4xx with that code into `{ code: 'QUOTE_STALE' }` with no `serverCode`. The two PRs were written in parallel and merged about 40 minutes apart. Since then, `payVerdictOf` falls through to `failure`. The page shows "Your quote changed…" instead of re-pricing and showing the expired-promo card. `payVerdictOf` now maps `QUOTE_STALE` to `requote`. - The `payVerdict` and `FullPageCheckoutView` unit tests built the pre-#19126 result shape by hand, so they missed this. They now use the shape account-core actually returns. ## Review Focus `SUBSCRIPTION_QUOTE_STALE` is gone from `STALE_QUOTE_SERVER_CODES`. Only `subscribe` emits it, and account-core now maps it for 4xx responses. A 5xx that echoes the code arrives as `REQUEST_FAILED`, which account-core treats as an upstream failure, not a stale quote. With this change, that 5xx no longer triggers a re-quote. Red/green: both updated unit tests fail without the `payVerdict.ts` change and pass with it. `pnpm test:e2e:local e2e/full-page-promo.spec.ts` passes 6/6.
…19499) ## Summary Fixes the `full-page-promo.spec.ts` "a code that lapses before Pay" failure that has been red on main since #19126. The full-page checkout now re-quotes when a subscribe comes back as `QUOTE_STALE`. ## Changes - **What**: #19253 made `payVerdictOf` re-quote only when a raw `SUBSCRIPTION_QUOTE_STALE` `serverCode` came back. #19126 then changed account-core to turn a 4xx with that code into `{ code: 'QUOTE_STALE' }` with no `serverCode`. The two PRs were written in parallel and merged about 40 minutes apart. Since then, `payVerdictOf` falls through to `failure`. The page shows "Your quote changed…" instead of re-pricing and showing the expired-promo card. `payVerdictOf` now maps `QUOTE_STALE` to `requote`. - The `payVerdict` and `FullPageCheckoutView` unit tests built the pre-#19126 result shape by hand, so they missed this. They now use the shape account-core actually returns. ## Review Focus `SUBSCRIPTION_QUOTE_STALE` is gone from `STALE_QUOTE_SERVER_CODES`. Only `subscribe` emits it, and account-core now maps it for 4xx responses. A 5xx that echoes the code arrives as `REQUEST_FAILED`, which account-core treats as an upstream failure, not a stale quote. With this change, that 5xx no longer triggers a re-quote. Red/green: both updated unit tests fail without the `payVerdict.ts` change and pass with it. `pnpm test:e2e:local e2e/full-page-promo.spec.ts` passes 6/6.
…19499) ## Summary Fixes the `full-page-promo.spec.ts` "a code that lapses before Pay" failure that has been red on main since #19126. The full-page checkout now re-quotes when a subscribe comes back as `QUOTE_STALE`. ## Changes - **What**: #19253 made `payVerdictOf` re-quote only when a raw `SUBSCRIPTION_QUOTE_STALE` `serverCode` came back. #19126 then changed account-core to turn a 4xx with that code into `{ code: 'QUOTE_STALE' }` with no `serverCode`. The two PRs were written in parallel and merged about 40 minutes apart. Since then, `payVerdictOf` falls through to `failure`. The page shows "Your quote changed…" instead of re-pricing and showing the expired-promo card. `payVerdictOf` now maps `QUOTE_STALE` to `requote`. - The `payVerdict` and `FullPageCheckoutView` unit tests built the pre-#19126 result shape by hand, so they missed this. They now use the shape account-core actually returns. ## Review Focus `SUBSCRIPTION_QUOTE_STALE` is gone from `STALE_QUOTE_SERVER_CODES`. Only `subscribe` emits it, and account-core now maps it for 4xx responses. A 5xx that echoes the code arrives as `REQUEST_FAILED`, which account-core treats as an upstream failure, not a stale quote. With this change, that 5xx no longer triggers a re-quote. Red/green: both updated unit tests fail without the `payVerdict.ts` change and pass with it. `pnpm test:e2e:local e2e/full-page-promo.spec.ts` passes 6/6.
…19499) ## Summary Fixes the `full-page-promo.spec.ts` "a code that lapses before Pay" failure that has been red on main since #19126. The full-page checkout now re-quotes when a subscribe comes back as `QUOTE_STALE`. ## Changes - **What**: #19253 made `payVerdictOf` re-quote only when a raw `SUBSCRIPTION_QUOTE_STALE` `serverCode` came back. #19126 then changed account-core to turn a 4xx with that code into `{ code: 'QUOTE_STALE' }` with no `serverCode`. The two PRs were written in parallel and merged about 40 minutes apart. Since then, `payVerdictOf` falls through to `failure`. The page shows "Your quote changed…" instead of re-pricing and showing the expired-promo card. `payVerdictOf` now maps `QUOTE_STALE` to `requote`. - The `payVerdict` and `FullPageCheckoutView` unit tests built the pre-#19126 result shape by hand, so they missed this. They now use the shape account-core actually returns. ## Review Focus `SUBSCRIPTION_QUOTE_STALE` is gone from `STALE_QUOTE_SERVER_CODES`. Only `subscribe` emits it, and account-core now maps it for 4xx responses. A 5xx that echoes the code arrives as `REQUEST_FAILED`, which account-core treats as an upstream failure, not a stale quote. With this change, that 5xx no longer triggers a re-quote. Red/green: both updated unit tests fail without the `payVerdict.ts` change and pass with it. `pnpm test:e2e:local e2e/full-page-promo.spec.ts` passes 6/6.
Why
When the server refuses a subscribe because the quote went stale, the embedded checkout re-quotes and tells the customer "Your quote changed. Review the updated amount and try again." billing-web instead shows "We couldn't reach the billing service. Please try again." and keeps the old quote, so every retry is refused the same way. Seen live on testcloud with a Team monthly → annual change (
POST /api/billing/subscribe→ 400SUBSCRIPTION_QUOTE_STALE).Root cause
issueSubscribeinpackages/account-core/src/core/billing/subscriptionCommands.tsmaps onlyREACTIVATION_CONFIRMATION_REQUIRED; any other coded 4xx reaches the host as a generic failure.CheckoutView.payin billing-web has no branch for a stale quote, so the failure copy is the transport one. The app's legacy rail handles the code inuseSubscriptionCheckout.recoverStaleQuote.How
SUBSCRIPTION_QUOTE_STALEbecomes the command codeQUOTE_STALE, the same way the reactivation code is mapped.QUOTE_STALE, re-quote the plan and show the app's copy ("Your quote changed. Review the updated amount and try again."); if the re-quote itself fails, show the app's "quote refresh failed" copy.The stale quotes themselves come from the server (non-deterministic
renewal_aton preview for a monthly → annual change); that was reported to backend separately.AS IS / TO BE
AS IS: billing-web monthly → annual shows "We couldn't reach the billing service" (server 400
SUBSCRIPTION_QUOTE_STALE); the same change in the embedded checkout then goes through.m2-live-yearly-stale-quote-then-embedded-success.mp4
TO BE: Unit and view tests (CheckoutView re-quotes and shows "Your quote changed. Review the updated amount and try again."). The stale quote is intermittent server-side, so a live TO BE capture is pending the backend fix.
Stack