fix: remove incorrect cents-to-dollars conversion in notification email renderer#34
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
…erer The FormatCurrency method was dividing the amount by 100, assuming the OrderPlacedEvent.TotalAmount was in cents. However, the TotalAmount field in the OrderPlacedEvent contract is a decimal representing standard currency units (dollars), not minor units (cents). This caused a 49.99 order to display as .50 in notification emails.
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 incorrect amounts — a $149.99 order showed as $1.50.
Root cause:
NotificationRenderer.FormatCurrency()was dividing the amount by 100, assumingOrderPlacedEvent.TotalAmountwas in cents (minor currency units). However, theTotalAmountfield in the sharedOrderPlacedEventcontract is adecimalrepresenting standard currency units (dollars), not cents. The erroneous division (149.99 / 100 = 1.4999) was then formatted to$1.50.Fix: Removed the
/ 100mdivision inFormatCurrency()and corrected the misleading comment. The amount is now formatted directly as received.Before fix
After fix
Review & Testing Checklist for Human
POST /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"}— verify the preview shows $149.99FormatCurrencyorOrderPlacedEvent.TotalAmountrely on cents-based semanticsTotalAmountin dollars (not cents) when integrated via RabbitMQ in productionNotes
The sibling EventFlow services (
app_eventflow-order-service,app_eventflow-payment-service) use integer minor units (cents) internally, but the .NETOrderPlacedEventcontract in this repo definesTotalAmountasdecimal— a standard currency representation. The cents-based comment in the original code was incorrect and likely carried over from a different service's convention during the microservice decomposition.Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/aa1a9129638d4a5ab5d4312577c79ad1