Repository navigation
fix(upgrade): handle Level 2 accounts upgraded on Bridge KYC - #757
Merged
Merged
Conversation
frappe-flash-admin#80 upgrades Bridge-KYC-approved accounts to Level 2 by filing and approving an upgrade request the customer never filled in: no address, no bank account. Three app fixes for those accounts: - Bank cash-out row: for an account already at Level 2 it opens Bank accounts. With lnflash/flash#517 an L2 with no bank account reports bankPayout false, and the upgrade form would end in "already at requested level". The older-backend fallback stops implying bankPayout at L2 too. - Loading the latest request into the form keeps only values the request has. The slice reducers spread their payload, so the request's empty country ("") wiped the form's "Jamaica" default, and Next on the Business form stayed disabled with no message. - An APPROVED request only updates the status card. Loading it into the form overwrote a flow the customer was part-way through (request type, personal, business and bank details) whenever an automatic upgrade landed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
useAccountStatus's older-backend fallback goes through capabilitiesFromLevel, which stopped implying bankPayout at Level 2 in the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
frappe-flash-admin#80 upgrades Bridge-KYC-approved accounts to Level 2 by filing and approving an upgrade request the customer never filled in, with no address and no bank account. This PR is three app fixes for those accounts.
1. Bank cash-out row → Bank accounts for Level 2. With lnflash/flash#517, an L2 account with no bank account reports
capabilities.bankPayout: false, which makes the hub row tappable. It used to start the L2 upgrade form, which for an account already at L2 ends in "already at requested level". ForcurrentLevel === TWOit now opens Bank accounts, where adding one works because the upgrade created the ERP party. The older-backend fallback (capabilitiesFromLevel) stops implyingbankPayoutat L2, matching flash#517.2. Empty request values no longer blank the form. Loading the latest request into the form copied every address field, and the slice reducers spread their payload. So the request's empty country (
"") overwrote the form's"Jamaica"default. On the Business form the Country field then looked filled (its placeholder is "Jamaica") while Next stayed disabled with no message. Now only values the request actually has are copied.3. An approved request no longer overwrites a flow in progress. The hook reloaded the whole form (request type, personal, business and bank details) whenever the request's status changed. When an automatic upgrade landed mid-flow, that reset what the customer was entering. An
APPROVEDrequest now only updates the status card; there's nothing left in it to edit.Tests
use-account-upgrade-hydration.spec.tsxruns the hook's dispatched actions through the real slice reducer:country: "Jamaica";account-type-status.spec.tsx: an L2 account's Bank cash-out row opensBankAccounts.account-status-derivation.spec.ts: L2 no longer impliesbankPayout.use-account-status.spec.ts: the older-backend fallback for L2 no longer impliesbankPayout.tsc -p .is clean. eslint shows 0 errors; the 2 warnings inuseAccountUpgrade.tsxare already onmain.Deploy order
Ships with lnflash/flash#517, the server half of fix 1. This app change is safe to release before it: on the current backend every L2 still reports
bankPayout: true, so the L2 row doesn't change.🤖 Generated with Claude Code