Add "Don't notify customer" option to Record Payment modal
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1029,6 +1029,12 @@
|
||||
<label class="form-label">Notes</label>
|
||||
<textarea name="Notes" class="form-control" rows="2" placeholder="Optional"></textarea>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="SuppressNotification" value="true" id="suppressNotificationCheck" />
|
||||
<label class="form-check-label text-muted small" for="suppressNotificationCheck">
|
||||
Don’t notify customer
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
|
||||
Reference in New Issue
Block a user