From deb248b2a6accd6473f4dc9f7a59687d9b312e8f Mon Sep 17 00:00:00 2001 From: Scott Pouliot Date: Tue, 16 Jun 2026 18:12:25 -0400 Subject: [PATCH] Add "Don't notify customer" option to Record Payment modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds SuppressNotification to RecordPaymentDto and a checkbox to the modal. When checked, the payment is fully recorded but NotifyPaymentReceivedAsync is skipped — useful for historical imports or cases where the customer should not receive an email. Co-Authored-By: Claude Sonnet 4.6 --- .../DTOs/Invoice/PaymentDtos.cs | 1 + .../Controllers/InvoicesController.cs | 17 ++++++++++------- .../Views/Invoices/Details.cshtml | 6 ++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/PowderCoating.Application/DTOs/Invoice/PaymentDtos.cs b/src/PowderCoating.Application/DTOs/Invoice/PaymentDtos.cs index 51393e5..9a11bb9 100644 --- a/src/PowderCoating.Application/DTOs/Invoice/PaymentDtos.cs +++ b/src/PowderCoating.Application/DTOs/Invoice/PaymentDtos.cs @@ -37,6 +37,7 @@ public class PaymentDtos public string? Reference { get; set; } public string? Notes { get; set; } public int? DepositAccountId { get; set; } + public bool SuppressNotification { get; set; } } public class EditPaymentDto diff --git a/src/PowderCoating.Web/Controllers/InvoicesController.cs b/src/PowderCoating.Web/Controllers/InvoicesController.cs index e808ccd..1e3c9d5 100644 --- a/src/PowderCoating.Web/Controllers/InvoicesController.cs +++ b/src/PowderCoating.Web/Controllers/InvoicesController.cs @@ -1335,14 +1335,17 @@ public class InvoicesController : Controller }); // end ExecuteInTransactionAsync - // Notify (non-blocking) - try + // Notify (non-blocking) — skipped if user explicitly suppressed it + if (!dto.SuppressNotification) { - await _notificationService.NotifyPaymentReceivedAsync(invoice, payment); - } - catch (Exception notifyEx) - { - _logger.LogWarning(notifyEx, "Payment recorded but notification failed"); + try + { + await _notificationService.NotifyPaymentReceivedAsync(invoice, payment); + } + catch (Exception notifyEx) + { + _logger.LogWarning(notifyEx, "Payment recorded but notification failed"); + } } diff --git a/src/PowderCoating.Web/Views/Invoices/Details.cshtml b/src/PowderCoating.Web/Views/Invoices/Details.cshtml index 1ebf99e..fdc7e2e 100644 --- a/src/PowderCoating.Web/Views/Invoices/Details.cshtml +++ b/src/PowderCoating.Web/Views/Invoices/Details.cshtml @@ -1029,6 +1029,12 @@ +
+ + +