Feature/developer bank account#11
Open
woshilixiaohao wants to merge 3 commits into
Open
Conversation
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).
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.
No description provided.