feat(accounts): support balance drain on forced account deletion#534
Open
feat(accounts): support balance drain on forced account deletion#534
Conversation
…r and payment flows - Add skipChecks option to AccountValidator to bypass status validation - Rename cancelIfPositiveBalance to skipChecks in markAccountForDeletion - Propagate skipChecks through intraledgerPaymentSendWalletId and withSpendingLimits - Keep bypassMaxDeletions as a separate param for deletion count checks - Add unit tests for skipChecks behavior in AccountValidator and spending limits
- Resolve destination account (provided or bankowner fallback) before the wallet loop; build currency-to-walletId map to match wallets correctly, falling back to defaultWalletId when no currency match exists - Block deletion with AccountHasPositiveBalanceError when skipChecks=false; sweep via intraledgerPaymentSendWalletId (admin args) when skipChecks=true - Wrap sweep failures in InvalidAccountForDeletionError with full context - Remove skipChecks from IntraLedgerPaymentSendWalletIdArgs; introduce IntraLedgerPaymentSendWalletIdAdminArgs for internal/privileged use; ForBtcWallet/ForUsdWallet wrappers now explicitly pass skipChecks:false - Guard withSpendingLimits early-return so skipChecks=true with an apiKeyId still runs the lock/settle path - Default GraphQL skipChecks to false in account-force-delete mutation - Add code comments documenting skipChecks as admin-only privileged flag - Update/rewrite unit tests to match new behaviour
…d retry idempotency docs - Return InvalidAccountForDeletionError when destinationAccountId equals the account being deleted, preventing a no-op intra-account sweep that would leave funds in a closed account - Emit addAttributesToCurrentSpan with privilegedBypass, accountId, and updatedByPrivilegedClientId when skipChecks=true for audit visibility - Add JSDoc documenting retry/idempotency semantics on partial sweep failure - Rename IntraLedgerPaymentSendWalletIdAdminArgs to IntraLedgerPaymentSendWalletIdInternalArgs - Add unit tests covering self-transfer guard and span attribute emission
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.
Support safe closure of accounts with positive balances by sweeping funds to a destination account before deletion. Guards against self-transfer, emits audit span attributes on privileged bypass, and consolidates validation bypass under a single
skipChecksflag.