Skip to content

fix: remove incorrect /100 division in notification email currency formatting#19

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1775544952-fix-notification-currency-formatting
Open

fix: remove incorrect /100 division in notification email currency formatting#19
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1775544952-fix-notification-currency-formatting

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 7, 2026

Summary

NotificationRenderer.FormatCurrency divided the incoming amount by 100, based on a comment claiming OrderPlacedEvent.TotalAmount is transmitted in cents. However, the OrderPlacedEvent contract (Shared.Contracts) defines TotalAmount as a decimal representing dollars, and the HTTP ingestion endpoint passes the value through without conversion. This caused a $149.99 order to display as $1.50 in email previews.

The fix removes the /100m division and the misleading comment, so the amount is formatted directly.

Before → After:

Before fix — total shows $1.50
After fix — total shows $149.99

Review & Testing Checklist for Human

  • Verify no other event producer sends amounts in cents. The removed comment explicitly claimed cents encoding. If any RabbitMQ producer (not just the HTTP test endpoint) actually sends cents, this fix will over-report amounts by 100×. Check any existing or in-development Order service integration that publishes OrderPlacedEvent.
  • Reproduce manually: POST {"orderId":"11111111-1111-1111-1111-111111111111","customerId":"22222222-2222-2222-2222-222222222222","totalAmount":149.99,"placedAt":"2026-03-17T12:00:00Z"} to /api/notification/events/order-placed and confirm the preview shows $149.99.
  • Check edge cases: Verify formatting for zero, small amounts (e.g. 0.01), and large amounts (e.g. 99999.99).

Notes

  • ToString("C2") uses the server's current culture for the currency symbol. In containers with invariant culture this renders as ¤ rather than $. This is pre-existing behavior, not introduced by this PR.
  • There are no unit tests covering FormatCurrency. Consider adding tests to prevent regressions.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/b345b1d1ea4b44ad8079221c41661d6b
Requested by: @akihiro-yamaguchi_dxc


Open with Devin

The NotificationRenderer.FormatCurrency method incorrectly divided the
amount by 100, assuming TotalAmount was transmitted in cents. However,
the OrderPlacedEvent.TotalAmount is already in dollars (decimal), so
the division produced wrong values (e.g., $149.99 became $1.50).

Removed the erroneous division and the misleading comment.
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

0 participants