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 @@ +