feat: show leased-bed payments in member payment history#30
Merged
Conversation
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.
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.
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 fromMembershipPayments(the Stripe webhook routes on akind=bed-leasemetadata tag). The payment is recorded correctly. The real gap is that neither payment-history view ever showed it — both queried onlyMembershipPayments:GET /account/me/paymentsGET /members/{id}/paymentsWhat 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).
MembershipPaymentDto→PaymentDto, gaining aKinddiscriminator (Membership/LeasedBed), keeping the membership period (membership only) and adding the bed label (leased-bed only). TwoToDtomappings, one per entity.PaymentHistoryTable: the Membership period column becomes a For column that describes each row —Membership · 1 Jul 2025 – 30 Jun 2026orLeased bed A3. Row keys are namespaced by kind so ids can't collide across the two tables.Testing
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.