Skip to content

fix(groups): importes, estado y porcentajes de los pagos coherentes - #16

Merged
bpstack merged 1 commit into
claude/compassionate-planck-gh6aoffrom
opencode/fix-group-payments
Oct 12, 2026
Merged

bpstack merged 1 commit into
claude/compassionate-planck-gh6aoffrom
opencode/fix-group-payments

Conversation

@bpstack

@bpstack bpstack commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Cambios

  • Lo pagado nunca supera lo debido (400 GROUP_PAYMENT_OVERPAID); marcar un pago como pagado rellena lo pagado.
  • El estado sigue a los importes ("solicitado" se mantiene hasta que llega dinero).
  • Los porcentajes de un grupo suman como mucho 100 (400 GROUP_PAYMENT_PERCENTAGE_OVER_100).
  • Códigos nuevos con su texto en es y en.

Por qué

Se aceptaba pagar de más y un pago podía marcarse como pagado sin importe, con estados que no cuadraban con las cantidades. Decidido el 2026-10-11.

- payment-rules.ts: statusFor, reconcilePayment and checkPercentages, the
  rules decided on 2026-10-11: what was paid never exceeds what is owed,
  marking a payment paid fills in what was paid, the status follows the
  amounts ("requested" stays until money arrives), and a group's
  percentages add up to 100 at most.
- group-payment-controller.ts: create, update, status and amount-paid
  apply them; a broken rule answers 400 with GROUP_PAYMENT_OVERPAID or
  GROUP_PAYMENT_PERCENTAGE_OVER_100.
- group-payment-repository.ts: the total recalculation also sets the
  status from the new amount; updateAmountPaid goes, it had no other user.
- error-codes.ts, errors.json (es, en), errorCodeMessage.ts: the two codes.
- payment-rules.test.ts: the rules and the four endpoints.

Why: more paid than owed was accepted, a payment could be paid with
nothing paid, a new group total left statuses behind, and percentages
could exceed 100. Checked in the browser and with curl against the local
database: an overpayment is refused with its text, marking paid fills in
5000, a 120 % total is refused, and lowering and restoring the group total
moves the statuses and puts them back.
@bpstack
bpstack merged commit 5c65167 into claude/compassionate-planck-gh6aof Oct 12, 2026
4 checks passed
@vercel

vercel Bot commented Oct 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
four-points Ready Ready Preview Oct 12, 2026 6:34pm UTC

@bpstack
bpstack deleted the opencode/fix-group-payments branch October 12, 2026 19:02

This branch was successfully deployed

1 active deployment
Preview — aadcc410 Deployed Oct 12, 2026 by vercel[bot]
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