Skip to content

Fix notification email showing wrong order amount ($149.99 displayed as $1.50)#14

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

Fix notification email showing wrong order amount ($149.99 displayed as $1.50)#14
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1775541635-fix-notification-amount-display

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Order confirmation notification emails were displaying incorrect amounts — a $149.99 order appeared as $1.50 in the email preview.

Root cause: NotificationRenderer.FormatCurrency() divided the TotalAmount by 100, assuming the value was transmitted in cents. However, the OrderPlacedEvent shared contract defines TotalAmount as a decimal in dollars, not cents. The division produced 149.99 / 100 = 1.4999, which rounded to $1.50.

Fix: Removed the erroneous /100m division so the dollar amount is formatted directly.

Review & Testing Checklist for Human

  • Verify the TotalAmount contract: Confirm that all current and planned producers of OrderPlacedEvent send TotalAmount in dollars (not cents). The Order service is currently scaffolded, so check with the team that the intended contract is dollars. If any producer sends cents, this fix would be wrong and the contract needs to be clarified.
  • Reproduce end-to-end: Run the notification service locally, 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, then open the preview URL and confirm the total shows $149.99.
  • Edge cases: Test with amounts like 0.01 (one cent), 1000.00, and 0.10 to verify formatting across different magnitudes.

Notes

  • The full solution could not be built locally due to a pre-existing issue with the Shared.Contracts project reference path in the .csproj (relative path ../../Shared/... doesn't resolve when building the project standalone). This is unrelated to this change.
  • No unit tests exist for FormatCurrency; consider adding them to prevent regressions.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/4b31c83c48bb4bbe84d3dba130d00fe7

Root cause: NotificationRenderer.FormatCurrency() incorrectly divided the
TotalAmount by 100, assuming it was in cents. The OrderPlacedEvent contract
(Shared.Contracts) uses decimal TotalAmount in dollars. A $149.99 order was
displayed as $1.50 (149.99 / 100 = 1.4999, rounded to $1.50).

Fix: Remove the erroneous division by 100 and format the dollar amount directly.
@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

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