fix: remove incorrect cents-to-dollars conversion in notification currency formatting#21
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
…rency formatting Root cause: NotificationRenderer.FormatCurrency() was dividing the amount by 100, assuming TotalAmount was in cents. However, the OrderPlacedEvent contract and the entire pipeline (DTO -> Event -> OrderNotification) transmit TotalAmount in dollars as a decimal. The erroneous division turned $149.99 into $1.50. Fix: Remove the / 100m division and format the dollar amount directly. Also fixes broken project references in Notification.API.csproj where the relative paths to Shared projects were missing one directory level (../../ instead of ../../../).
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
Order confirmation notification emails were displaying wrong amounts (e.g. a $149.99 order showed as $1.50).
Root cause:
NotificationRenderer.FormatCurrency()divided the amount by 100, assumingTotalAmountwas transmitted in cents. In reality, theOrderPlacedEventcontract and the entire pipeline (OrderPlacedEventDto→OrderPlacedEvent→OrderNotification.OrderTotal) pass the amount in dollars as adecimal. The erroneous/ 100mturned149.99into1.4999, which rounded to$1.50.Fix: Remove the
/100mdivision and format the dollar amount directly.Also fixes broken
ProjectReferencepaths inNotification.API.csproj— the relative paths toShared.ContractsandShared.Infrastructurewere one level short (../../instead of../../../), preventing the project from building locally.Before / After
Review & Testing Checklist for Human
TotalAmountin cents. The fix assumes all publishers ofOrderPlacedEventuse dollars. If any upstream service (e.g. Order service) actually converts to cents before publishing, this fix would be wrong for that flow. Check the Order service's event publishing code./api/notification/events/order-placedwith{"orderId":"11111111-1111-1111-1111-111111111111","customerId":"22222222-2222-2222-2222-222222222222","totalAmount":149.99,"placedAt":"2026-03-17T12:00:00Z"}and open the preview URL — total should read $149.99.FormatCurrency/RenderNotificationto prevent regression.Notes
ToString("C2")formatting is locale-dependent (pre-existing, not introduced here). On non-US locales the currency symbol may differ. If consistent$formatting is needed, consider usingCultureInfo.InvariantCultureor a US culture explicitly..csprojpath fix is a pre-existing build issue unrelated to the currency bug but was necessary to build and test locally.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/5c6f1dc44e6b4a1a92276d817d9c5d9c