Bank Account Wizard Controller
bank_account/controllers/bank_account_controller.dart · Notifier<BankAccountState>
Overview
Drives the 3-step Stripe Connect onboarding. On boot, loads the existing account and computes which step the user lands on. Three submit methods chain Stripe direct calls and backend calls, with mapped error messages for the common Stripe failure modes.
User Flow
- build() → loadPayoutAccount which advances currentStep based on account flags.
- submitPersonalInfo: getStripeAccountToken → createPayoutAccount on backend → step → bankDetails.
- submitBankDetails: getStripeBankToken → addBankAccount on backend → step → identityVerification.
- submitIdentityVerification: uploadFileToStripe → verifyIdentity on backend → refresh account.
- _friendlyError remaps known Stripe error substrings into product-friendly messages.
Cases & Edge Cases
- Auto-step-advance: an already-verified seller lands directly on completedSteps=3 and the screen shows a 'Done' state.
- duplicate_error → 'A payment account already exists for this profile.' — Stripe's exact wording is unsuitable.
- Network / timeout → 'Network connection error.' instead of leaking the underlying exception.
- Identity verification requires a clear photo — the controller does not pre-validate image quality.
Code References
- lib/src/features/seller/bank_account/controllers/bank_account_controller.dart:72 // BankAccountController
- lib/src/features/seller/bank_account/controllers/bank_account_controller.dart:85 // loadPayoutAccount (auto step)
- lib/src/features/seller/bank_account/controllers/bank_account_controller.dart:149 // submitPersonalInfo
- lib/src/features/seller/bank_account/controllers/bank_account_controller.dart:206 // submitBankDetails
- lib/src/features/seller/bank_account/controllers/bank_account_controller.dart:275 // submitIdentityVerification
- lib/src/features/seller/bank_account/controllers/bank_account_controller.dart:326 // _friendlyError
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
Three completedSteps states matter for the progress bar — the screen reads completedSteps, not currentStep, to decide which checkmarks to draw.