Skip to content

feat: implement multi-currency support for donation notifications, summaries, and analytics#120

Closed
GBOYEE wants to merge 1 commit into
aid-linkk:masterfrom
GBOYEE:feat/multi-currency-donations
Closed

feat: implement multi-currency support for donation notifications, summaries, and analytics#120
GBOYEE wants to merge 1 commit into
aid-linkk:masterfrom
GBOYEE:feat/multi-currency-donations

Conversation

@GBOYEE

@GBOYEE GBOYEE commented Jun 23, 2026

Copy link
Copy Markdown

Closes #115

Summary

Implements full multi-currency support across the donation workflow. All changes are minimal and focused.

What changed

Prisma Schema (prisma/schema.prisma):

  • Added conversion metadata fields to Donation model: baseCurrency, exchangeRate, convertedAmount, conversionTimestamp
  • Added @@index([currency]) for efficient currency-based filtering

Notifications (src/services/notification.service.ts):

  • sendDonationReceivedNotification now accepts currency param (defaults to XLM for backward compatibility) — displays e.g. "50 USDC" instead of always "XLM"
  • sendDistributionSentNotification — same treatment
  • Donation notifications include { amount, currency, campaignTitle } in metadata
  • Updated tests to verify correct currency display

Notification Controller (src/controllers/notification.controller.ts):

  • Passes currency from request body through to notification service

Email Worker (src/workers/email.worker.ts):

  • Passes currency through job data for DONATION_RECEIVED and DISTRIBUTION_SENT jobs

Donation Service (src/services/donation.service.ts):

  • Stores conversion metadata (baseCurrency, exchangeRate, convertedAmount, conversionTimestamp) when creating donations
  • Supports currency filter in getDonationFilters

Donation Controller (src/controllers/donation.controller.ts):

  • currency query parameter supported on all donation list endpoints (list, my-donations, campaign-donations)

Analytics Service (src/services/analytics.service.ts):

  • Campaign analytics: donations and distributions grouped by currency → new byCurrency field
  • Donor analytics: donations grouped by currency → new byCurrency field
  • Organization analytics: funds grouped by currency → new byCurrency field

Types (src/types/index.ts):

  • DonationFilters now includes optional currency field
  • DonationInput now includes optional conversion metadata fields

Acceptance Criteria

  • All hardcoded XLM assumptions removed from donation notification logic
  • Notifications display the correct donation currency
  • Donation summaries correctly handle multiple currencies (grouped by currency)
  • Analytics support multi-currency reporting without mixing raw values
  • Conversion metadata is stored at donation creation time
  • Existing tests updated and new tests cover multi-currency scenarios
  • No regression for existing XLM donation flows (backward compatible defaults)

@GBOYEE

GBOYEE commented Jun 23, 2026

Copy link
Copy Markdown
Author

I'd like to work on this issue. I have background in devops and will submit a PR ASAP.

1 similar comment
@GBOYEE

GBOYEE commented Jun 24, 2026

Copy link
Copy Markdown
Author

I'd like to work on this issue. I have background in devops and will submit a PR ASAP.

@BarryArinze

Copy link
Copy Markdown
Collaborator

Resolve conflict

…mmaries, and analytics

- Add conversion metadata fields (baseCurrency, exchangeRate, convertedAmount, conversionTimestamp) to Donation model
- Add currency index on Donation model for efficient filtering
- Update notification service to accept and display correct currency (removes hardcoded XLM)
- Update notification controller to pass currency from request body
- Update email worker to pass currency through job data
- Add currency filtering to donation queries (DonationFilters, donation controller, donation service)
- Update analytics service to group donation/distribution totals by currency (byCurrency field)
- Add currency to donation metadata in notifications
- Update DonationInput type with optional conversion metadata fields
- Add multi-currency test coverage for notification templates
@GBOYEE GBOYEE force-pushed the feat/multi-currency-donations branch from 2a40603 to ef7b5bf Compare June 25, 2026 20:37
@GBOYEE

GBOYEE commented Jun 25, 2026

Copy link
Copy Markdown
Author

Done — rebased on top of upstream/master and resolved the conflict. The branch is now clean and mergeable. Ready for review!

@GBOYEE

GBOYEE commented Jun 26, 2026

Copy link
Copy Markdown
Author

Closing — issue assigned to another contributor

@GBOYEE GBOYEE closed this Jun 26, 2026
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.

Implement Multi-Currency Support for Donation Notifications, Summaries, and Analytics

2 participants