fix(payments): categorize binance_enabled under Payment settings, not general (#479) - #490
Merged
Merged
Conversation
… general (#479) getAllSettingsByCategory()'s categoryMap had no entry for binance_enabled, so it fell through to 'general' instead of 'payment'. The admin Settings > Payment page reads settings.payment.binance_enabled to set the Binance Pay switch's initial state, so the toggle always rendered unchecked on reload regardless of the saved value — an admin who enabled it would see it off on next visit, and re-saving from that state would silently disable it in the DB. getEnabledPaymentProviders() (used by checkout/product forms) queries the key directly and was unaffected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UYWqTKnHDLQC1hbithnsb3
Merged
4 tasks
Owner
Author
guillermoscript
marked this pull request as ready for review
July 23, 2026 19:54
30 tasks
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.


What & why
Closes part of #479 (credentialed-QA follow-up to #466 / PR #478). While setting up the live PayPal sandbox portion of that QA, a survey of
app/actions/admin/settings.tsandcomponents/admin/payment-settings-form.tsx— needed to enable PayPal for a test tenant — turned up a second, credential-independent bug in the same admin Settings > Payment surface #479's "UI polish check" covers. The live PayPal/Binance sandbox runs are tracked separately; see the QA record comment on #479.The bug
getAllSettingsByCategory()hardcodes acategoryMapthat assigns eachtenant_settingsrow to a tab (general/email/payment/enrollment) for the admin Settings page. It listedstripe_enabled,paypal_enabled,lemonsqueezy_enabled, andsolana_enabledunder'payment'— but notbinance_enabled. Any key missing from the map falls through to'general'.PaymentSettingsFormreadssettings.binance_enabled?.value?.enabled ?? falsefrom thepaymentbucket to set the Binance Pay switch's initial state. Since the row never landed there, the Binance Pay toggle always rendered unchecked on page load, regardless of the saved DB value. An admin who enabled it, navigated away, and came back would see it off — and because the form resubmits every field from its current checkbox state, hitting Save from that stale view would silently flipbinance_enabledback tofalsein the database.This is a display/round-trip bug only:
getEnabledPaymentProviders()(used by checkout, product creation, and plan creation to decide which providers to show) queriesbinance_enableddirectly and was unaffected — actual provider gating elsewhere in the app kept working correctly throughout.Verified live in a local Code Academy Pro tenant: enabling the toggle persisted
binance_enabled: {"enabled": true}totenant_settings, but reloading the Payment tab with the bug present showed the switch unchecked; with the fix, it correctly shows checked after reload.The fix
Add
binance_enabled: 'payment'to thecategoryMapingetAllSettingsByCategory(), andbinance_to the equivalent prefix list in the siblinggetSettings(category)helper (same root cause, same file — currently unused elsewhere in the app, but left consistent rather than leaving an identical latent bug behind).Test plan
tests/unit/admin-settings-category-map.test.ts— asserts abinance_enabledrow lands underpayment, notgeneral, and stays grouped alongside the other payment toggles.npx vitest run tests/unit/admin-settings-category-map.test.ts tests/unit/admin-enabled-providers.test.ts tests/unit/admin-provider-actions.test.ts tests/unit/paypal-binance-providers.test.ts→ 33/33 pass.npx tsc --noEmit→ clean.npx eslinton changed files → only the 8 pre-existingno-explicit-anyerrors already present onapp/actions/admin/settings.tsbefore this change (same lines, unrelated to this diff) — no new errors introduced.binance_enabled: truein the DB), applied the fix, confirmed the toggle now shows checked after reload. Screenshots attached below.Screenshots
Before (bug): Binance Pay switch unchecked after reload, despite
tenant_settings.binance_enabled = {"enabled": true}in the DB.After (fixed): Binance Pay switch correctly shows checked after reload.
(attached as a PR comment)