From d802333b6d45a0e17a2280f5ef7316f053c6cf46 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 06:01:12 +0000 Subject: [PATCH] fix: remove incorrect cents-to-dollars conversion in notification email formatting Root cause: NotificationRenderer.FormatCurrency() was dividing the amount by 100, assuming TotalAmount was in cents. However, the OrderPlacedEvent contract and all producers send TotalAmount as a decimal in dollars (e.g. 149.99). The division caused 149.99 to display as $1.50 in order confirmation emails. Fix: Remove the / 100m division and format the amount directly, since it is already in dollars. --- .../Notification.API/Services/NotificationRenderer.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs b/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs index ac8d79e..465a371 100644 --- a/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs +++ b/src/Services/Notification/Notification.API/Services/NotificationRenderer.cs @@ -11,16 +11,12 @@ public class NotificationRenderer { /// /// Formats a monetary amount for display in notification emails. - /// Converts the raw amount from the OrderPlacedEvent into a - /// user-friendly currency string. + /// The amount is already in dollars (decimal) as defined in the + /// OrderPlacedEvent contract. /// 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"); + return amount.ToString("C2"); } public string RenderOrderConfirmation(OrderNotification notification)