Skip to content

fix(exports): drop misleading USD Equivalent column from donation CSVs#29

Merged
Alqku merged 1 commit into
OrbitChainLabs:mainfrom
iyanumajekodunmi756:fix/csv-usd-equivalent-column
Jun 20, 2026
Merged

fix(exports): drop misleading USD Equivalent column from donation CSVs#29
Alqku merged 1 commit into
OrbitChainLabs:mainfrom
iyanumajekodunmi756:fix/csv-usd-equivalent-column

Conversation

@iyanumajekodunmi756

Copy link
Copy Markdown
Contributor

Summary

Closes #15

The USD Equivalent column in all donation CSV exports was hardcoded to 0.00 (later patched to N/A with a pending label), but the fundamental risk remained: downstream consumers — tax tools, accounting software, and partner integrations — could silently trust an incorrect value.

This PR fully resolves the issue with a production-quality fix.


Changes

src/common/csv-export.helper.ts (new)

  • Single source of truth for the donation CSV schema.
  • buildDonationCsv(rows) builds the CSV string from typed DonationCsvRow objects.
  • CSV_HEADERS constant defines the 5-column schema — USD Equivalent is intentionally absent until a price oracle (Stellar Horizon order-book, CoinGecko, or self-hosted) is integrated.
  • Inline JSDoc explains the deliberate omission and links to this issue.

src/users/users.service.ts

  • exportUserDonationsAsCSV — inline CSV builder replaced with buildDonationCsv().

src/users/export.processor.ts

  • handleDonationExport — inline CSV builder replaced with buildDonationCsv().

src/donations/donations.service.ts

  • exportUserDonationsAsCSV — inline CSV builder replaced with buildDonationCsv().

Unit tests (new, 24 tests — all passing)

File Tests
src/common/csv-export.helper.spec.ts 9 — helper contract, column count, escaping, empty set
src/users/users.service.csv.spec.ts 6 — sync/async path, headers, no 0.00/N/A, empty export
src/users/export.processor.spec.ts 5 — rowCount, headers, no placeholders, empty export

README.md

  • New CSV Donation Exports section documents the column schema and explains why USD Equivalent is absent, so external integrators are not surprised.

Verification

Check Result
npm run build
npm run test (24 tests)
Prettier check (new files)
ESLint (new files, 0 errors)
No new lint regressions vs baseline

Security note

The column is removed entirely rather than patched with a placeholder. Once a verified price oracle is integrated, it can be reinstated by adding it to CSV_HEADERS and buildDonationCsv() in the single shared helper — no hunting across three service files.

The 'USD Equivalent' column was hardcoded to 0.00 (later renamed
to N/A with a pending label) across three independent export paths.
Downstream consumers — tax tools, accounting software, and partner
integrations — could silently trust an incorrect value (issue OrbitChainLabs#15).

Changes:
- Add src/common/csv-export.helper.ts: shared buildDonationCsv()
  utility that owns the CSV schema; USD Equivalent column is
  intentionally absent until a price oracle is wired up.
- Refactor all three export locations to use the shared helper:
    src/users/users.service.ts (sync export path)
    src/users/export.processor.ts (async Bull-queue path)
    src/donations/donations.service.ts (admin export path)
- Add comprehensive unit tests (24 tests, all passing):
    src/common/csv-export.helper.spec.ts
    src/users/users.service.csv.spec.ts
    src/users/export.processor.spec.ts
- Document the absent column and the path to reinstatement in README.md

Closes OrbitChainLabs#15
@Alqku

Alqku commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@iyanumajekodunmi756 please fix the CI.

Alqku commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Solid catch on the misleading USD Equivalent column, and pulling CSV building into a shared helper is a nice bonus. Thanks!

@Alqku Alqku merged commit a3e26cf into OrbitChainLabs:main Jun 20, 2026
0 of 6 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.

[MEDIUM] — CSV donation export hardcodes "USD Equivalent" = 0.00; downstream consumers may trust the column for tax / accounting workflows

2 participants