Skip to content

feat: implement Stripe transaction history and refund functionality f…#104

Merged
martin0024 merged 7 commits into
developfrom
feature/89-user-transactions
Jun 23, 2026
Merged

feat: implement Stripe transaction history and refund functionality f…#104
martin0024 merged 7 commits into
developfrom
feature/89-user-transactions

Conversation

@Berny-ft

@Berny-ft Berny-ft commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Closes #89

Overview

Admins can view a customer’s Stripe charge history and issue full or partial refunds directly from the Users table, without leaving the app.

Backend (actions.ts, schema.ts)

getUserTransactions — lists charges for a Stripe customer with cursor pagination (starting_after / ending_before), expanded refunds and payment intents, and mapped descriptions from charge / PI / metadata.
createTransactionRefund — creates refunds via Stripe with idempotency keys, admin auth, server-side refundable balance checks, and returns the updated charge for the UI.
Zod schemas for list params and refund payloads.
UI (user-transactions-modals.tsx, user-actions-cell.tsx)

Receipt icon on each user row (when they have a stripeCustomerId) opens a transactions modal.
Paginated table: date, description, amount, refund status.
Row click opens a refund dialog with refund history, partial amount input, and confirm-before-submit for full/partial refunds.
Toast feedback for success, pending, and error states.

Testing

Unit tests (actions.test.ts)

getUserTransactions: admin guard, charge mapping from Stripe list response.
createTransactionRefund: unauthorized, fully refunded charge, over-cap partial, successful full refund with updated transaction.

Screenshots / Screencasts

image image image image image image

Checklist

  • Code is neat, readable, and works
  • Code is commented where appropriate and well-documented
  • Commit messages follow our guidelines
  • Issue number is linked
  • Branch is linked
  • Reviewers are assigned (one of your tech leads)

Notes

Copilot AI review requested due to automatic review settings June 14, 2026 04:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Berny-ft Berny-ft changed the base branch from main to develop June 14, 2026 04:18
@martin0024 martin0024 marked this pull request as draft June 16, 2026 07:59
@Berny-ft Berny-ft marked this pull request as ready for review June 19, 2026 23:53
@Berny-ft Berny-ft force-pushed the feature/89-user-transactions branch from e750c45 to 79866bb Compare June 20, 2026 00:05

@martin0024 martin0024 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good pr berny

Comment thread app/(authenticated)/users/actions.ts
Comment thread app/(authenticated)/users/_components/components/user-transactions-modals.tsx Outdated
Comment thread app/(authenticated)/users/_components/components/user-transactions-modals.tsx Outdated
@martin0024 martin0024 merged commit 33cb81d into develop Jun 23, 2026
1 check passed
@martin0024 martin0024 deleted the feature/89-user-transactions branch June 23, 2026 13:08
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.

3 participants