NWP-101: add export options - #163
Open
Shalinparikh wants to merge 1 commit into
Open
Conversation
Ops can now choose which columns to include (card last-four off by default) and whether to export the current filter or all payments. The filename reflects the scope and date. Column names from the client are validated server-side against an allowlist; an empty selection returns 400 rather than an empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
Closes NWP-101
What changed
The export button on
/paymentsnow opens a slide-over dialog instead of downloading immediately. Ops can choose which columns to include — card last-four is unchecked by default so merchant-facing files never need manual cleanup. They can also choose scope (current filter or all payments) and see the row count for each option before clicking Download. Selecting zero columns disables the Download button rather than producing an empty file. The filename now reflects the scope and date (e.g.payments-disputed-2026-08-13.csv). Column names sent by the client are validated server-side against an allowlist; unknown names are silently dropped and an empty selection returns HTTP 400.How I verified it
npm testpassesnpm testsummary: 33 passed across 3 test files (14 incsv.test.ts, up from 9).npx tsc --noEmitclean.Browser (dev server on
:3000): clicked Export on/payments— drawer opened with column checkboxes (last-four unchecked) and scope radios showing current-filter and all-payments row counts. Unchecking all columns disabled the Download button. Downloading with a status filter active producedpayments-disputed-<date>.csvwith only the selected columns. Switching scope to "All payments" produced a larger row count and the filename changed topayments-all-<date>.csv.Tamper check:
?columns=id,evil,amountdroppedevil;?columns=returned 400.Acceptance criteria
payments-disputed-2026-08-13.csv).Bugs fixed along the way
None found.
Notes for the reviewer
exportFilenamesignature changed from(date?)to(scopeSlug?, date?)— the existing test was updated to passundefinedas the first arg so the date-stamping contract is still pinned. Thepackage-lock.jsonchange normalises the package name fromtemplate-plannertomerchant-console(matchingpackage.json); no dependencies changed.