Skip to content

fix: remove incorrect cents-to-dollars conversion in notification email renderer#34

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778600127-fix-notification-currency-formatting
Open

fix: remove incorrect cents-to-dollars conversion in notification email renderer#34
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778600127-fix-notification-currency-formatting

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 12, 2026

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, assuming OrderPlacedEvent.TotalAmount was in cents (minor currency units). However, the TotalAmount field in the shared OrderPlacedEvent contract is a decimal representing standard currency units (dollars), not cents. The erroneous division (149.99 / 100 = 1.4999) was then formatted to $1.50.

Fix: Removed the / 100m division in FormatCurrency() and corrected the misleading comment. The amount is now formatted directly as received.

Before fix

Before fix — Total shows $1.50

After fix

After fix — Total shows $149.99

Review & Testing Checklist for Human

  • Run the notification service locally and POST the repro payload to POST /api/notification/events/order-placed with {"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.99
  • Verify no other callers of FormatCurrency or OrderPlacedEvent.TotalAmount rely on cents-based semantics
  • Confirm the Order service publishes TotalAmount in dollars (not cents) when integrated via RabbitMQ in production

Notes

The sibling EventFlow services (app_eventflow-order-service, app_eventflow-payment-service) use integer minor units (cents) internally, but the .NET OrderPlacedEvent contract in this repo defines TotalAmount as decimal — 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


Open in Devin Review

…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.
@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

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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