fix: correct currency formatting in notification email previews#31
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
fix: correct currency formatting in notification email previews#31devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
The NotificationRenderer.FormatCurrency method incorrectly divided the order total by 100, assuming TotalAmount was in cents. However, the OrderPlacedEvent contract transmits TotalAmount in dollars (decimal). This caused a $149.99 order to display as $1.50 in email previews. Also fixes broken project references to Shared libraries (wrong relative path depth prevented the service from building).
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where order confirmation notification emails displayed incorrect amounts after the microservice decomposition. A $149.99 order was showing as $1.50 in the email preview.
Root Cause
The
NotificationRenderer.FormatCurrencymethod in the notification-service incorrectly divided the order total by 100, based on an erroneous comment claiming thatOrderPlacedEvent.TotalAmountis "transmitted in cents." In reality, the sharedOrderPlacedEventcontract (Shared.Contracts/Events/OrderPlacedEvent.cs) definesTotalAmountas adecimalrepresenting dollars, not cents.This also fixes broken project references to the
Shared.ContractsandShared.Infrastructurelibraries (incorrect relative path depth prevented the notification-service from building independently).Before / After
Review & Testing Checklist for Human
http://localhost:5005/api/notification/events/order-placedwith{\"totalAmount\": 149.99, ...}— verify the preview shows $149.99OrderPlacedEvent.TotalAmountcontract is consistently used as dollars (not cents) across all producing servicesdotnet buildto succeed from the Notification.API directoryNotes
en-USlocale, it will render as$149.99...\\..\\Shared\\→..\\..\\..\\Shared\\) were a pre-existing issue from the decomposition scaffolding that prevented local builds.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/7fd8885c2b024624835c9f4d1ec825d5
Requested by: @DhrovS