Skip to content

Admin Subscription & Subscription Payment Endpoints #46

Description

@codebestia

Background

Listing/detail for individual subscriptions, plus a view over subscription payment history. The payments endpoint has a real dependency worth calling out explicitly rather than silently assuming it's satisfied: it reads Transaction rows where transactionType = SUBSCRIPTION_CHARGE, which only exist once a SubscriptionChargedEvent handler is writing them.

Proposed Steps

  1. GET /admin/subscriptions — paginated, filterable by status, planId, merchantAddress (via Subscription.merchantIdMerchant.address, no join through the plan needed since merchantId is direct), customer (address, exact match), sortable by sortBy in [createdAt, lastCharged] / sortDir.
  2. GET /admin/subscriptions/:id — subscription detail, including the related plan's description/amount/interval inlined (one query, include: { plan: true }) so the admin doesn't need a second request.
  3. GET /admin/subscriptions/payments — lists Transaction rows where transactionType = 'SUBSCRIPTION_CHARGE', paginated, filterable by merchantAddress and date range, mirroring the filter shape already established for invoices.

Acceptance Criteria

  • GET /admin/subscriptions supports all listed filters, sort options, and pagination
  • GET /admin/subscriptions/:id includes plan details inline; 404 for unknown id
  • GET /admin/subscriptions/payments returns only SUBSCRIPTION_CHARGE transactions, correctly filtered and paginated
  • The dependency on SubscriptionChargedEvent handler is documented in code (comment on the payments endpoint) so an empty result set is understood as "no charges indexed yet" rather than assumed broken
  • No new Prisma models or fields required

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions