Skip to content

fix(billing): let JPY subscribers change plans safely - #23591

Merged
aryanorastar merged 9 commits into
mainfrom
fix/jpy-plan-change-currency
Oct 25, 2026
Merged

aryanorastar merged 9 commits into
mainfrom
fix/jpy-plan-change-currency

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

An existing JPY subscriber selecting Unlimited in the mobile sheet received a USD price that Stripe rejected. #20804 recognized JPY prices for entitlements but explicitly excluded in-app plan changes. The sheet now shows the approved JPY offer, preserves its formatted total through the generated DTO, and confirms the exact displayed price instead of looking it up in a separate USD catalog.

The canonical catalog explicitly admits the four existing JPY Plus/Unlimited IDs for managing an existing JPY subscription. Resolution checks currency, active state, interval, mode and entitlement version. Stale USD, retired/unbound and nonrecurring targets are rejected before releasing schedules or changing entitlements. Retained prices cannot open new Checkout; the exact current JPY price can reactivate its own pending cancellation, after promotion-code validation. Existing cancellation indicators and desktop/legacy/ladder boundaries remain guarded. No amounts are imported and no production Stripe prices are created or changed.

Old sheets must update before receiving non-USD offers because their annual summary hardcodes USD. The currency capability header and additive response fields are reflected in the generated Dart, Swift and TypeScript clients.

Closes #23584. Related recognition-only work: #20804. Parallel submissions #23592 (@PINYOPATTANAWASANPORN) and #23597 (@khoap1220-hue) were reviewed for consolidation; their useful boundary behaviors are already covered here. No commits were imported from either submission. Coordination and attribution record.

Product invariants affected

none

How it was verified

  • 524 backend tests passed in 12 isolated files, using BACKEND_UNIT_TEST_FILE_LIST with backend/test.sh: currency management, JPY recognition, catalog/compiler and immutable entitlements, pricing resilience, proration/decline/cancellation/promotion guards, subscription ingestion, BYOK payment access and v1 storefront-flag independence.
  • Six real Stripe sandbox flows passed: catalog → paid immediate JPY upgrade; JPY annual schedule plus stale-USD rejection preserving it; declined payment preserves the paid plan; reactivation leaves exactly one subscription; a real one-time JPY price is excluded/rejected; an invalid promotion leaves cancellation unchanged. Only synthetic identity bindings and DB/cache seams are substituted, not Stripe requests. Opt-in command from backend/: python -m pytest --confcutdir=tests/integration/billing tests/integration/billing/test_jpy_plan_changes_stripe.py -v with an explicitly supplied standard test key.
  • 36 focused Flutter tests, 23 mobile-verify checks, targeted analysis and the three-run mobile performance gate passed.
  • CI follow-up: refreshed 52 backend/mobile storefront goldens and the mobile revision assertion for catalog revision 11. Reviewed every fixture diff: the revision is the only changed field. The formerly failing storefront file now passes 343 backend tests with the normal timing guard; 70 mobile fixture-consumer tests also pass. Existing simulator and Stripe evidence remains applicable because this follow-up changes only test metadata.
  • Fresh iPhone 16 Pro / iOS 26.5 simulator, Flutter 3.44.5, Japanese Flutter locale: selected Unlimited and Monthly, verified the exact JPY confirmation, then cancelled back to the sheet through agent-flutter. This tests the production PlansSheet and generated DTO with synthetic offers; payment mutations are exercised separately by the real sandbox route tests. Replay fixture and commands accompany the screenshots.
  • Repository preflight and the final bounded push gate passed, including full backend type checking, OpenAPI compatibility, all generated clients, desktop Swift compilation and formatting. Current-head CI is green at a37882a71bc9e40e4e7c025bf6f8744a5211b25e (41 passed, 23 skipped, no pending or failed checks). Aryan supplied a final review finding no merge-blocking code issues at this head and reported another 371 backend tests and 29 Flutter tests passing; those reruns were reported by the reviewer rather than repeated by this implementation session.

UI evidence

Japanese annual JPY offers

Monthly Unlimited selection

Exact JPY confirmation before payment

Release and remaining verification

Current-head CI and the supplied final code review have passed. Before production release, an Omi Stripe owner must verify the production JPY prices are active with the expected currency, recurrence, mode and entitlement bindings; personal-sandbox results do not establish the production catalog or this customer's account state. Merge and deploy the backend before releasing the currency-aware mobile app. No production subscriptions/customer data, deployment or app release were changed by this work. Keep the support case open until the customer verifies the displayed JPY price and successful plan change on the released build.

Failure-Class: none

Line-Count-Exception: backend/routers/payment.py | 1846 -> 1934 | Keep currency admission beside existing authenticated subscription and schedule mutations; reusable currency resolution is extracted to utils/billing_currency.py. A broader payment-router split is outside this safety fix and the exception needs maintainer review.

@mintlify

mintlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Oct 25, 2026, 12:16 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T15:09:29.597470Z a37882a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@aryanorastar
aryanorastar merged commit b1557e3 into main Oct 25, 2026
69 checks passed
@aryanorastar
aryanorastar deleted the fix/jpy-plan-change-currency branch October 25, 2026 15:09
khoap1220-hue added a commit to khoap1220-hue/omi that referenced this pull request Oct 26, 2026
…price IDs

Reconcile with BasedHardware#23591 multi-currency Stripe pricing while preserving ledger-derived legacy JPY unlimited price IDs (price_1RtJPm1F8wnoWYvwhVJ38kLb, price_1RtJQ71F8wnoWYvwKMPaGlGY) and strict same-currency upgrade validation.
khoap1220-hue added a commit to khoap1220-hue/omi that referenced this pull request Oct 26, 2026
…lan changes (BasedHardware#23584)

Rebase onto main after BasedHardware#23591 while preserving ledger-derived legacy JPY unlimited price IDs (price_1RtJPm1F8wnoWYvwhVJ38kLb, price_1RtJQ71F8wnoWYvwKMPaGlGY), explicit currency-boundary helpers, and unit tests.
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.

bug(billing): JPY subscribers cannot change plans in the iOS sheet

1 participant