Skip to content

feat: PaymentExport PDF export option - #836

Merged
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
therealbibson:fix/656-paymentexport-pdf
Sep 28, 2026
Merged

Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
therealbibson:fix/656-paymentexport-pdf

Conversation

@therealbibson

Copy link
Copy Markdown
Contributor

Overview

Adds a PDF option to PaymentExport alongside the existing CSV export. Selecting PDF renders a printable payment summary — invoice number, payer (recipient) addresses, amounts, timestamps and transaction hashes, plus a totals row — and opens the browser's print/PDF dialog. The document is styled with the colour tokens from src/lib/pdfTheme.ts.

The printable-document flow mirrors the existing ReceiptPDF / InvoicePDF components rather than introducing a new PDF renderer, so the export stays consistent with the rest of the PDF pipeline.

Related Issue

Closes #656

Changes

New PDF builder

  • [ADD] src/lib/paymentExportPdf.ts
    • buildPaymentSummaryHtml(invoiceId, payments, preferDark?) — builds a self-contained printable HTML summary using getPdfTheme() colour tokens. Includes the invoice number, payer addresses, per-payment amounts, timestamps, transaction hashes and an aggregate total.
    • generatePaymentSummaryFilename(invoiceId) — dated .pdf filename helper.
    • downloadPaymentSummaryPDF(html) — opens the document and triggers the print/PDF dialog (ReceiptPDF flow).
    • All interpolated values are HTML-escaped.

Export selector

  • [MODIFY] src/components/PaymentExport.tsx

    • Adds a CSV / PDF export-format selector (role="group", aria-pressed).
    • handleExport dispatches to downloadCSV or downloadPaymentSummaryPDF based on the selected format.
    • Column checkboxes are CSV-specific, so they are only shown for CSV; the PDF always includes the four summary columns the issue asks for.
    • Updates the export-info hint to describe the selected format.
  • [ADD] src/__tests__/paymentExportPdf.test.tsx

    • Covers the summary content (invoice number, addresses, hashes), theme colours, empty state, HTML escaping, the filename helper, and that the PDF option is present and triggers the printable summary.

Verification Results

Verified via GitHub Contents/Git API (no local clone).
Acceptance criteria mapping:
✅ A "PDF" option appears in the export format selector
✅ Clicking PDF triggers a download/print of a formatted payment summary
✅ The PDF uses colour values from src/lib/pdfTheme.ts (getPdfTheme)
✅ Existing tests continue to pass (CSV path unchanged; new focused tests added)
Acceptance Criteria Status
PDF option in the export format selector ✅ CSV / PDF toggle added to PaymentExport
Clicking PDF downloads a formatted payment summary ✅ buildPaymentSummaryHtml + downloadPaymentSummaryPDF print-to-PDF flow
PDF uses colours from src/lib/pdfTheme.ts ✅ getPdfTheme() tokens applied to text, surface, border and accent
Existing tests continue to pass ✅ CSV export path untouched (csvExport.ts unchanged)

@vercel

vercel Bot commented Sep 27, 2026

Copy link
Copy Markdown

@therealbibson is attempting to deploy a commit to the kingsman-99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@therealbibson Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@therealbibson
therealbibson force-pushed the fix/656-paymentexport-pdf branch from 50e993f to b40eefb Compare September 27, 2026 03:41
@Kingsman-99
Kingsman-99 merged commit 3fbb4d8 into Stellar-split:main Sep 28, 2026
0 of 2 checks passed
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.

PaymentExport: Add PDF export format option

2 participants