Skip to content

Feature/developer bank account#11

Open
woshilixiaohao wants to merge 3 commits into
mainfrom
feature/developer-bank-account
Open

Feature/developer bank account#11
woshilixiaohao wants to merge 3 commits into
mainfrom
feature/developer-bank-account

Conversation

@woshilixiaohao

Copy link
Copy Markdown
Collaborator

No description provided.

Every developer now needs a payout bank account regardless of
--billing-mode. New --bank-* flag group on 'developers create'
(mandatory, prompts interactively when omitted, fails PARAM_INVALID
under --yes if incomplete) and 'developers update' (optional; supplying
any --bank-* flag replaces the account wholesale).

- New src/developers/bank-account.ts: BankAccountInfo type, SWIFT/country
  format validation, resolveBankAccount / resolveOptionalBankAccount,
  addBankAccountOptions flag registrar.
- create.ts / update.ts: wire bank_account into the request body.
- get.ts / list.ts: surface masked bank_account in output.
- types/api.ts: BankAccountView + Developer.bank_account.
- doc/admin-cli.md: documented the new flags and wholesale-replace
  semantics on update.
- tests/commands/developers.test.ts: updated existing create/update
  tests for the new mandatory field; added coverage for --yes without
  bank flags, and wholesale bank-account replacement on update.

Verified: tsc --noEmit clean, full vitest suite 583 passed (0 new
failures), manual smoke test of built binary (--help, --yes rejection
path).
Fills a coverage gap: developers.test.ts only exercised bank_account
through the create/update commands end-to-end. This adds 15 direct
unit tests for src/developers/bank-account.ts:

- resolveBankAccount: resolves + normalizes (case, trim) all fields
  under --yes; includes/omits optional bank_address/routing_number;
  throws ValidationError naming the specific missing --bank-* flag;
  rejects malformed SWIFT code / country code; accepts both 8-char and
  11-char SWIFT/BIC forms.
- resolveOptionalBankAccount: returns undefined when no --bank-* flags
  given; resolves full account when any flag given; rejects partial
  flag sets under --yes (no partial replace).
- addBankAccountOptions: registers all 7 --bank-* flags.

Verified: tsc --noEmit clean, full vitest suite 598 passed (0
failures, 15 new).
…ng_number

account_number only had a non-blank check — values with spaces,
hyphens, or other punctuation passed straight through to the backend
(which itself only had a max_length cap until this same fix landed
there). routing_number had no validation at all. Adds client-side
checks matching the backend BankAccountInfo schema:

- account_number: alphanumeric only, 4-34 chars; normalized to
  uppercase on output (mirrors bank_country/swift_code, which were
  already uppercased).
- routing_number: digits only when supplied.

Catching these earlier means the CLI fails fast (PARAM_INVALID, exit
1) with a specific message instead of round-tripping to the backend
first.

Tests: 10 new cases in bank-account.test.ts (malformed/valid account
numbers, malformed/valid routing numbers, uppercase normalization).
tsc --noEmit clean, full vitest suite 608 passed. Manually verified
via built binary: '--bank-account-number 12-34' is now rejected
locally with 'Account number must be 4-34 alphanumeric characters,
no spaces or punctuation' (exit 1).
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