diff --git a/src/PowderCoating.Application/Services/PdfService.cs b/src/PowderCoating.Application/Services/PdfService.cs index 6767218..074bfbb 100644 --- a/src/PowderCoating.Application/Services/PdfService.cs +++ b/src/PowderCoating.Application/Services/PdfService.cs @@ -175,16 +175,15 @@ public class PdfService : IPdfService container .AlignCenter() .AlignMiddle() - .Opacity(0.35f) .Rotate(-45f) - .Border(3) - .BorderColor(Colors.Green.Darken2) + .Border(2) + .BorderColor(Colors.Green.Lighten2) .PaddingVertical(10) .PaddingHorizontal(20) .Text("PAID") .FontSize(52) .Bold() - .FontColor(Colors.Green.Darken2); + .FontColor(Colors.Green.Lighten2); } /// diff --git a/src/PowderCoating.Infrastructure/Services/EmailService.cs b/src/PowderCoating.Infrastructure/Services/EmailService.cs index c3e03ed..7f24a9f 100644 --- a/src/PowderCoating.Infrastructure/Services/EmailService.cs +++ b/src/PowderCoating.Infrastructure/Services/EmailService.cs @@ -47,6 +47,8 @@ public class EmailService : IEmailService if (!_hostEnvironment.IsProduction()) subject = $"[{_hostEnvironment.EnvironmentName}] {subject}"; + (toEmail, toName) = RedirectIfNonProd(toEmail, toName); + var fromEmail = _configuration["SendGrid:FromEmail"] ?? "noreply@example.com"; var fromName = _configuration["SendGrid:FromName"] ?? "Powder Coating"; @@ -104,6 +106,8 @@ public class EmailService : IEmailService if (!_hostEnvironment.IsProduction()) subject = $"[{_hostEnvironment.EnvironmentName}] {subject}"; + (toEmail, toName) = RedirectIfNonProd(toEmail, toName); + var fromEmail = _configuration["SendGrid:FromEmail"] ?? "noreply@example.com"; var fromName = _configuration["SendGrid:FromName"] ?? "Powder Coating"; @@ -138,6 +142,20 @@ public class EmailService : IEmailService } } + /// + /// In non-production environments, redirects outbound email to SendGrid:DevRedirectEmail + /// so real customers are never contacted outside of production. Double-gated on environment + /// name AND the config value so a misconfigured prod deploy can't accidentally redirect. + /// + private (string email, string name) RedirectIfNonProd(string toEmail, string toName) + { + if (_hostEnvironment.IsProduction()) return (toEmail, toName); + var devEmail = _configuration["SendGrid:DevRedirectEmail"]; + if (string.IsNullOrWhiteSpace(devEmail)) return (toEmail, toName); + _logger.LogWarning("Non-production environment: redirecting email from {Original} to dev address {Dev}", toEmail, devEmail); + return (devEmail, $"[DEV → {toName} <{toEmail}>]"); + } + /// /// Sends the built SendGrid message and interprets the HTTP response. Extracted so both /// send methods share identical dispatch and logging logic. diff --git a/src/PowderCoating.Web/appsettings.json b/src/PowderCoating.Web/appsettings.json index 9eab6c6..c864a97 100644 --- a/src/PowderCoating.Web/appsettings.json +++ b/src/PowderCoating.Web/appsettings.json @@ -45,7 +45,8 @@ "SendGrid": { "ApiKey": "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", "FromEmail": "spouliot@scppowdercoating.com", - "FromName": "Powder Coating App Staff" + "FromName": "Powder Coating App Staff", + "DevRedirectEmail": "spouliot@scppowdercoating.com" }, "Twilio": { "AccountSid": "your-twilio-account-sid",