Skip to content

fix(upgrade): handle Level 2 accounts upgraded on Bridge KYC - #757

Merged
islandbitcoin merged 2 commits into
mainfrom
fix/upgrade-hub-after-bridge-l2
Oct 6, 2026
Merged

islandbitcoin merged 2 commits into
mainfrom
fix/upgrade-hub-after-bridge-l2

Conversation

@islandbitcoin

@islandbitcoin islandbitcoin commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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". For currentLevel === TWO it now opens Bank accounts, where adding one works because the upgrade created the ERP party. The older-backend fallback (capabilitiesFromLevel) stops implying bankPayout at 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 APPROVED request now only updates the status card; there's nothing left in it to edit.

Tests

  • New use-account-upgrade-hydration.spec.tsx runs the hook's dispatched actions through the real slice reducer:
    • an approved request leaves an in-progress Business flow untouched;
    • an empty address keeps country: "Jamaica";
    • a submitted address and bank account still load.
  • account-type-status.spec.tsx: an L2 account's Bank cash-out row opens BankAccounts.
  • account-status-derivation.spec.ts: L2 no longer implies bankPayout.
  • Mutation-checked: reverting each fix turns its test red.
  • use-account-status.spec.ts: the older-backend fallback for L2 no longer implies bankPayout.
  • Full suite: 162 suites, 1,900 passed. tsc -p . is clean. eslint shows 0 errors; the 2 warnings in useAccountUpgrade.tsx are already on main.

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

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>
@islandbitcoin
islandbitcoin merged commit 0f36c21 into main Oct 6, 2026
9 checks passed
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