Skip to content

fix: correct order total currency formatting in notification email#5

Open
devin-ai-integration[bot] wants to merge 1 commit intoworkshop-260317from
devin/1773838249-fix-notification-currency-amount
Open

fix: correct order total currency formatting in notification email#5
devin-ai-integration[bot] wants to merge 1 commit intoworkshop-260317from
devin/1773838249-fix-notification-currency-amount

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where order confirmation emails showed the wrong total amount (e.g. $149.99 displayed as $1.50).

Root cause: NotificationRenderer.FormatCurrency was dividing amount by 100m, treating OrderPlacedEvent.TotalAmount as an integer cent value. The shared contract defines TotalAmount as decimal (already in dollars), so the division was wrong.

Also fixes a pre-existing broken project reference path in Notification.API.csproj — the Shared.Contracts and Shared.Infrastructure references pointed one directory level too shallow (..\..\Shared\ instead of ..\..\..\Shared\), preventing the service from building standalone.

Before / After:

Before After
Before: $1.50 After: $149.99

Review & Testing Checklist for Human

  • Verify the contract: Confirm OrderPlacedEvent.TotalAmount (Shared.Contracts/Events/OrderPlacedEvent.cs) is indeed decimal dollars and not cents — this is the core assumption of the fix.
  • Check other services with the same csproj path bug: Identity.API, Customer.API, and Product.API have the same ..\..\Shared\ pattern and likely also fail to build standalone. This PR only fixes Notification.API.
  • End-to-end test: POST to /api/notification/events/order-placed with "totalAmount": 149.99 and verify the /preview endpoint shows $149.99.
  • No tests exist for the notification service — consider adding a unit test for FormatCurrency / RenderOrderConfirmation to prevent regression.

Notes

  • The / 100m logic had a misleading comment claiming the event uses a cents representation — this was incorrect and has been removed.
  • No behavior changes other than the currency display fix.

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

The FormatCurrency method in NotificationRenderer was incorrectly
dividing the amount by 100, treating OrderPlacedEvent.TotalAmount
as cents. The shared contract defines TotalAmount as decimal (dollars),
so the division caused a $149.99 order to display as $1.50.

Also fix incorrect relative path for Shared project references in
Notification.API.csproj (..\..\Shared -> ..\..\..\Shared).
@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.

1 participant