Skip to content

feat: show leased-bed payments in member payment history#30

Merged
fordprefect480 merged 2 commits into
mainfrom
feat/show-bed-payments-in-history
Jun 25, 2026
Merged

feat: show leased-bed payments in member payment history#30
fordprefect480 merged 2 commits into
mainfrom
feat/show-bed-payments-in-history

Conversation

@fordprefect480

Copy link
Copy Markdown
Owner

Background

Reported: "I made a payment for a leased bed, but it didn't get inserted into the membershippayments table."

Verified — and that's expected: leased-bed payments are stored in BedLeasePayments, a separate table from MembershipPayments (the Stripe webhook routes on a kind=bed-lease metadata tag). The payment is recorded correctly. The real gap is that neither payment-history view ever showed it — both queried only MembershipPayments:

  • Member receipts — GET /account/me/payments
  • Admin per-member list — GET /members/{id}/payments

What this does

Both endpoints now merge membership and leased-bed payments, newest first (same status filters as before — members see Paid; admins see Paid + Failed).

  • MembershipPaymentDtoPaymentDto, gaining a Kind discriminator (Membership / LeasedBed), keeping the membership period (membership only) and adding the bed label (leased-bed only). Two ToDto mappings, one per entity.
  • Frontend PaymentHistoryTable: the Membership period column becomes a For column that describes each row — Membership · 1 Jul 2025 – 30 Jun 2026 or Leased bed A3. Row keys are namespaced by kind so ids can't collide across the two tables.

Testing

  • Server builds; all 77 server tests pass.
  • Changed frontend files type-check clean.

Note

This surfaces existing data; it doesn't change how payments are recorded. If a specific bed payment is missing, that's a separate runtime question (whether the Stripe webhook fired to flip it Paid) — happy to check the live DB.

Leased-bed payments are stored in BedLeasePayments, separate from
MembershipPayments, so they never appeared in either payment-history
view. Both the member's own receipts (/account/me/payments) and the
admin per-member list (/members/{id}/payments) now merge membership
and leased-bed payments, newest first.

- Replace MembershipPaymentDto with a PaymentDto that carries a Kind
  discriminator ("Membership" / "LeasedBed"), the membership period
  (membership only), and the bed label (leased-bed only).
- The history table's "Membership period" column becomes a "For"
  column describing each row ("Membership · <period>" or
  "Leased bed <label>").
…d bed

- Move the duplicated membership+leased-bed query/merge/sort out of both
  payment-history endpoints into PaymentHistory.LoadAsync(db, userId,
  includeFailed, ct); each endpoint is now a one-line call.
- Ignore the Bed soft-delete query filter when reading the bed label, so a
  payment whose bed was later deleted still appears in the member's history.
@fordprefect480 fordprefect480 merged commit 92ba2f1 into main Jun 25, 2026
2 checks passed
@fordprefect480 fordprefect480 deleted the feat/show-bed-payments-in-history branch June 25, 2026 13:10
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