Skip to content

feat: add directed monthly fee settlement - #22

Draft
cofob wants to merge 1 commit into
mainfrom
direct-monthly-fees
Draft

feat: add directed monthly fee settlement#22
cofob wants to merge 1 commit into
mainfrom
direct-monthly-fees

Conversation

@cofob

@cofob cofob commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add directed monthly fee invoices with fixed safety/common/base components and selectable budget targets.
  • Settle directed fee invoices as direct payer-to-destination component transactions with draft and completed flows.
  • Add UI pages, Telegram selection notifications, random fallback task, and regression coverage.

Problem

  • Refinance needed to support the accepted monthly contribution system without routing money through F0 twice, because the extra hop distorted stats and made contribution targets unclear.
  • The UI also needed a clear target-selection and settlement workflow so users can choose a budget target, create settlement transactions, and complete them without repeated no-op actions.

Changes

  • Added fee policy/allocation models, config defaults, seed targets, selection endpoint, fallback task, and balance reminder selection links.
  • Converted invoice payment linkage to support multiple invoice-linked component transactions while keeping backward-compatible transaction_id/transaction_ids behavior.
  • Added direct fee settlement for base, safety cushion, common consumables, and directed target components, including split-target progress under the payer entity.
  • Added UI selection, invoice detail/pay, bulk fee invoice, entity fee display, and settlement-completion behavior.
  • Added compatibility handling for existing Postgres constraints and Docker dev service setup.

Testing

  • uv run isort --check-only . - passed
  • uv run black --check . - passed
  • uv run mypy --ignore-missing-imports --follow-imports=skip api/app/schemas/fee.py api/app/routes/fee.py ui/app/controllers/invoice.py - passed
  • docker compose -f docker-compose.yml -f docker-compose.dev.yml exec -T api pytest tests - passed, 125 tests

Risks

  • Medium: fee settlement changes invoice and transaction accounting paths; compatibility shims preserve existing invoice transaction reads, but production data should be reviewed after deploy.

Rollback

  • Revert this PR to restore the previous single-transaction invoice behavior and remove directed fee allocation flows. Existing historical transactions are not migrated by this change.

Links

  • Issue: N/A
  • Related: N/A

Checklist

  • Scope is focused and backwards compatibility reviewed
  • Tests added/updated where needed
  • Local checks passed
  • Docs/config updated if behavior changed

Add monthly fee allocation policies, directed contribution selection, random fallback task, direct component settlement transactions, UI selection and settlement flows, and related tests.
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