Replaces the (never-launched) ad business direction with a freiwilliger Beitrag/Community-Abo model: owners can support PawFeed via Stripe with a one-time payment or a monthly SEPA/card subscription (2 EUR minimum), declared as Sponsoring/Community-Abo, not a tax-deductible donation. The Sponsor badge (only perk, no feature unlocks) is Owner-scoped and shows on every post of every one of their pets, plus their profile. - Schema: Owner.stripeCustomerId/sponsorSince/sponsorPeriodEnd/ sponsorSubscriptionId/sponsorSubscriptionStatus, new SponsorContribution model (payment history) - src/lib/stripe.ts (singleton client, mux.ts pattern) + src/lib/sponsor.ts (isActiveSponsor: one-time givers keep the badge permanently, subscribers through sponsorPeriodEnd even after cancelling -- no mid-period cliff) - src/trpc/routers/sponsor.ts: getStatus, createCheckoutSession (SEPA + card for subscriptions, card for one-time, price_data since amounts are user-chosen), cancelSubscription (cancel_at_period_end, no hard stop) - src/app/api/webhooks/stripe: checkout.session.completed, invoice.paid, customer.subscription.updated/deleted (mux webhook route pattern) - src/app/(app)/unterstuetzen: amount chips (3/5/10 EUR) prefilling an editable field, one-time/subscription toggle, status + contribution history, in-app cancel button (no Stripe-hosted portal, per requirement) - Badge surfaced in feed/explore postInclude + PostCard, and on the pet profile page next to the existing isVerified badge - Nutzungsbedingungen Sec. 12 (draft, needs sign-off before launch) + Stripe added to the Datenschutzerklaerung's Auftragsverarbeiter list - src/__tests__/sponsor.test.ts (7 tests), Stripe client fully mocked STRIPE_WEBHOOK_SECRET intentionally not yet configured -- the webhook endpoint can only be registered in the Stripe dashboard once this is deployed and reachable at https://pawfeed.org/api/webhooks/stripe. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { router } from "@/trpc/init";
|
|
import { petsRouter } from "@/trpc/routers/pets";
|
|
import { mediaRouter } from "@/trpc/routers/media";
|
|
import { postsRouter } from "@/trpc/routers/posts";
|
|
import { storiesRouter } from "@/trpc/routers/stories";
|
|
import { milestonesRouter } from "@/trpc/routers/milestones";
|
|
import { followsRouter } from "@/trpc/routers/follows";
|
|
import { blocksRouter } from "@/trpc/routers/blocks";
|
|
import { reportsRouter } from "@/trpc/routers/reports";
|
|
import { feedRouter } from "@/trpc/routers/feed";
|
|
import { reactionsRouter } from "@/trpc/routers/reactions";
|
|
import { commentsRouter } from "@/trpc/routers/comments";
|
|
import { repostsRouter } from "@/trpc/routers/reposts";
|
|
import { exploreRouter } from "@/trpc/routers/explore";
|
|
import { searchRouter } from "@/trpc/routers/search";
|
|
import { notificationsRouter } from "@/trpc/routers/notifications";
|
|
import { videosRouter } from "@/trpc/routers/videos";
|
|
import { conversationsRouter, messagesRouter } from "@/trpc/routers/messages";
|
|
import { healthRouter } from "@/trpc/routers/health";
|
|
import { adminRouter } from "@/trpc/routers/admin";
|
|
import { invitesRouter } from "@/trpc/routers/invites";
|
|
import { adsRouter } from "@/trpc/routers/ads";
|
|
import { legalRouter } from "@/trpc/routers/legal";
|
|
import { ownerRouter } from "@/trpc/routers/owner";
|
|
import { sponsorRouter } from "@/trpc/routers/sponsor";
|
|
|
|
export const appRouter = router({
|
|
pets: petsRouter,
|
|
media: mediaRouter,
|
|
posts: postsRouter,
|
|
stories: storiesRouter,
|
|
milestones: milestonesRouter,
|
|
follows: followsRouter,
|
|
blocks: blocksRouter,
|
|
reports: reportsRouter,
|
|
feed: feedRouter,
|
|
reactions: reactionsRouter,
|
|
comments: commentsRouter,
|
|
reposts: repostsRouter,
|
|
explore: exploreRouter,
|
|
search: searchRouter,
|
|
notifications: notificationsRouter,
|
|
videos: videosRouter,
|
|
conversations: conversationsRouter,
|
|
messages: messagesRouter,
|
|
health: healthRouter,
|
|
admin: adminRouter,
|
|
invites: invitesRouter,
|
|
ads: adsRouter,
|
|
legal: legalRouter,
|
|
owner: ownerRouter,
|
|
sponsor: sponsorRouter,
|
|
});
|
|
|
|
// Export the type for use in the client
|
|
export type AppRouter = typeof appRouter;
|