Skip to content

fix: remove erroneous cents-to-dollars conversion in notification email renderer#76

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782998527-fix-notification-amount
Open

fix: remove erroneous cents-to-dollars conversion in notification email renderer#76
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782998527-fix-notification-amount

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Root cause: NotificationRenderer.FormatCurrency() divided amount by 100, assuming OrderPlacedEvent.TotalAmount was in cents. It is actually already in dollars (decimal), so 149.99 / 100 = 1.4999 → displayed as $1.50.

 private static string FormatCurrency(decimal amount)
 {
-    var dollars = amount / 100m;
-    return dollars.ToString("C2");
+    return amount.ToString("C2");
 }

Also fixes Notification.API.csproj — the Shared project references used ../../Shared/... (two levels up) instead of ../../../Shared/... (three levels up from Services/Notification/Notification.API/), which prevented the service from building.

Before / After

Before (bug) After (fix)
before after

Reproduced by POSTing {"totalAmount": 149.99} to /api/notification/events/order-placed and checking the /preview endpoint.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/ee5f8a81c78f4994b32fd0b8cd6f306a
Requested by: @bsmitches

…derer

NotificationRenderer.FormatCurrency() incorrectly divided TotalAmount by 100,
assuming it was in cents. The OrderPlacedEvent.TotalAmount is already in dollars
(decimal), so dividing by 100 turned $149.99 into $1.50. Removed the division.

Also fixes Notification.API.csproj Shared project references (../../ → ../../../)
so the service actually builds.
@bsmitches bsmitches self-assigned this Jul 2, 2026
@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, CI, and merge conflict monitoring

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.

1 participant