Skip to content

Unify donation flows#92

Closed
petehayes wants to merge 2 commits into
feature/unify-donation-flowsfrom
main
Closed

Unify donation flows#92
petehayes wants to merge 2 commits into
feature/unify-donation-flowsfrom
main

Conversation

@petehayes

Copy link
Copy Markdown
Contributor

No description provided.

petehayes and others added 2 commits March 3, 2026 17:12
* feat: add EVENT campaign type with line items

New campaign type supporting multiple purchasable items grouped by
category (e.g., dinner plates, gifts). Each item has its own price,
capacity limit, and can be marked as required.

Data model:
- CampaignItem: items with price, category, capacity, required flag
- DonationLineItem: snapshot of purchased items per donation

Backend:
- Campaign CRUD extended for EVENT type with item management
- Validation: item capacity, per-order limits, required items, amount matching
- Donation creation creates line item records
- Stripe checkout supports multi-line-item sessions
- Webhook recreates line items from metadata
- Auto-complete when all capped items are sold out

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: add EVENT campaign UI — form, donor item selector, public page, tests

- CampaignForm: EVENT type option with item editor (name, category, price, capacity, required flag)
- NewPledgeFormClient: EVENT item selector with quantity controls, category grouping, running total
- PublicCampaignPage: EVENT items display with category grouping and pricing
- Campaign API: EVENT type in Zod schema, items passthrough to service, items in list response
- Donate page: serialize campaign items for public display
- Tests: 14 new tests for EVENT validation, capacity, auto-complete, API contract (42 total)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: add @Map annotations for DonationLineItem columns

unitPrice and subtotal columns were missing @Map('unit_price') and
@Map('subtotal') annotations, causing Prisma to look for camelCase
column names instead of the snake_case columns in the database.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: enable campaign type-specific editing for TIERED tiers and EVENT items

- Show campaign type as read-only label when editing (type cannot be changed)
- Remove isEditing gate from TIERED tiers and EVENT items sections
- Include tiers/items in PATCH body when editing campaigns
- Add tiers and items to campaign update API schema with upsert logic
- TIERED: upsert tiers by id, delete removed tiers (only if no donations reference them)
- EVENT: upsert items by id, soft-delete removed items (preserve FK references)
- Return tiers and items in PATCH response
- Include items in GET single campaign response
- Add items to CampaignList Campaign interface

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: add EVENT campaign type with line items

New campaign type supporting multiple purchasable items grouped by
category (e.g., dinner plates, gifts). Each item has its own price,
capacity limit, and can be marked as required.

Data model:
- CampaignItem: items with price, category, capacity, required flag
- DonationLineItem: snapshot of purchased items per donation

Backend:
- Campaign CRUD extended for EVENT type with item management
- Validation: item capacity, per-order limits, required items, amount matching
- Donation creation creates line item records
- Stripe checkout supports multi-line-item sessions
- Webhook recreates line items from metadata
- Auto-complete when all capped items are sold out

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: add EVENT campaign UI — form, donor item selector, public page, tests

- CampaignForm: EVENT type option with item editor (name, category, price, capacity, required flag)
- NewPledgeFormClient: EVENT item selector with quantity controls, category grouping, running total
- PublicCampaignPage: EVENT items display with category grouping and pricing
- Campaign API: EVENT type in Zod schema, items passthrough to service, items in list response
- Donate page: serialize campaign items for public display
- Tests: 14 new tests for EVENT validation, capacity, auto-complete, API contract (42 total)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: add @Map annotations for DonationLineItem columns

unitPrice and subtotal columns were missing @Map('unit_price') and
@Map('subtotal') annotations, causing Prisma to look for camelCase
column names instead of the snake_case columns in the database.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: enable campaign type-specific editing for TIERED tiers and EVENT items

- Show campaign type as read-only label when editing (type cannot be changed)
- Remove isEditing gate from TIERED tiers and EVENT items sections
- Include tiers/items in PATCH body when editing campaigns
- Add tiers and items to campaign update API schema with upsert logic
- TIERED: upsert tiers by id, delete removed tiers (only if no donations reference them)
- EVENT: upsert items by id, soft-delete removed items (preserve FK references)
- Return tiers and items in PATCH response
- Include items in GET single campaign response
- Add items to CampaignList Campaign interface

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: public donation flow - support campaign types and unauthenticated donors

Problem 1: Non-logged-in users get 'no payment methods' error because
Clerk middleware blocks /api/organizations/[slug]/payment-methods for
unauthenticated requests.

Fix: Add payment-methods, donations/checkout, campaigns, and campaigns/[id]
API routes to the public routes list in middleware.ts.

Problem 2: Clicking 'Donate' from a campaign page shows generic donation
form instead of campaign-type-specific UI (FIXED_UNIT, TIERED, EVENT).

Fix: Enhance DonationFlow to accept full campaign data and render
type-specific amount selection:
- FIXED_UNIT: quantity selector with unit price
- TIERED: tier picker with named levels and prices
- EVENT: item selector with categories, quantities, required items
- OPEN: original free-form amount input (unchanged)

Pass full campaign data (type, tiers, items) from the donate page server
component to DonationFlow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Mar 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
transparency Ready Ready Preview, Comment Mar 4, 2026 11:49am

@petehayes petehayes closed this Mar 4, 2026
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