From 429a2a52492acd0799d222e2ff437eafbcd76e27 Mon Sep 17 00:00:00 2001
From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Mon, 13 Apr 2026 14:00:43 +0000
Subject: [PATCH] fix: remove incorrect cents-to-dollars conversion in
notification currency 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 ../../../).
---
.../Notification/Notification.API/Notification.API.csproj | 4 ++--
.../Notification.API/Services/NotificationRenderer.cs | 8 +++-----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/Services/Notification/Notification.API/Notification.API.csproj b/src/Services/Notification/Notification.API/Notification.API.csproj
index 25b5fb0..1518ca2 100644
--- a/src/Services/Notification/Notification.API/Notification.API.csproj
+++ b/src/Services/Notification/Notification.API/Notification.API.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs b/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs
index ac8d79e..95f3bb2 100644
--- a/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs
+++ b/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs
@@ -16,11 +16,9 @@ public class NotificationRenderer
///
private static string FormatCurrency(decimal amount)
{
- // The OrderPlacedEvent.TotalAmount is transmitted in cents (integer
- // representation) to avoid floating-point precision issues across
- // service boundaries. Convert back to dollars for display.
- var dollars = amount / 100m;
- return dollars.ToString("C2");
+ // The OrderPlacedEvent.TotalAmount is already in dollars (decimal).
+ // Format directly as currency for display.
+ return amount.ToString("C2");
}
public string RenderOrderConfirmation(OrderNotification notification)