Skip to content

fix: correct currency formatting in notification emails#74

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

fix: correct currency formatting in notification emails#74
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782585451-fix-currency-formatting

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Order confirmation notification emails display incorrect monetary amounts. A $149.99 order renders as $1.50 (or ¤1.50 on non-US locales).

Root cause: NotificationRenderer.FormatCurrency divides the amount by 100, assuming OrderPlacedEvent.TotalAmount is in cents. In reality, TotalAmount is a decimal already representing dollars — the shared contract (Shared.Contracts.Events.OrderPlacedEvent) and the HTTP DTO both transmit dollar values, not cent integers.

// Before — incorrect: treats dollars as cents
- var dollars = amount / 100m;
- return dollars.ToString("C2");
// After — amount is already in dollars; use en-US culture for $ symbol
+ return amount.ToString("C2", CultureInfo.GetCultureInfo("en-US"));

The explicit en-US culture also fixes a secondary issue where Linux environments without a US locale rendered the generic currency symbol ¤ instead of $.

Also fixed: All five service .csproj files had broken ProjectReference paths to Shared.Contracts and Shared.Infrastructure — they used ..\..\Shared\ (resolves to src/Services/Shared/) instead of the correct ..\..\..\Shared\ (resolves to src/Shared/), preventing builds.

Before / After:

Before After
before after

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/c3de1ff27f2d42e8b4fa96d629e36bc9
Requested by: @sumitshatwara

Remove erroneous divide-by-100 in FormatCurrency — TotalAmount is already
in dollars, not cents.  Use explicit en-US culture so the $ symbol renders
correctly in all environments.

Also fix broken Shared project references in all service .csproj files
(..\..\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, CI, and merge conflict 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.

0 participants