mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 11:35:51 +01:00
Allow email notifications when creating invoices from Web UI (#2959)
Currently invoice email notifications are only sent when the invoice is created via the API. This commit adds an option to set an email address for notifications when an invoice is created from the Web UI.
This commit is contained in:
parent
86956c1e7b
commit
a7c093a0eb
4 changed files with 15 additions and 1 deletions
|
@ -868,6 +868,8 @@ namespace BTCPayServer.Controllers
|
|||
Enabled = true
|
||||
}),
|
||||
DefaultPaymentMethod = model.DefaultPaymentMethod,
|
||||
NotificationEmail = model.NotificationEmail,
|
||||
ExtendedNotifications = model.NotificationEmail != null
|
||||
}, store, HttpContext.Request.GetAbsoluteRoot(), cancellationToken: cancellationToken);
|
||||
|
||||
TempData[WellKnownTempData.SuccessMessage] = $"Invoice {result.Data.Id} just created!";
|
||||
|
|
|
@ -121,7 +121,7 @@ namespace BTCPayServer.HostedServices
|
|||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
if (invoiceEvent.Name != InvoiceEvent.Expired && !String.IsNullOrEmpty(invoice.NotificationEmail))
|
||||
if ((invoice.ExtendedNotifications || invoiceEvent.Name != InvoiceEvent.Expired) && !String.IsNullOrEmpty(invoice.NotificationEmail))
|
||||
{
|
||||
var json = NBitcoin.JsonConverters.Serializer.ToString(notification);
|
||||
var store = await _StoreRepository.FindStore(invoice.StoreId);
|
||||
|
|
|
@ -86,5 +86,12 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[EmailAddress]
|
||||
[DisplayName("Notification Email")]
|
||||
public string NotificationEmail
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,11 @@
|
|||
<select asp-for="DefaultPaymentMethod" asp-items="Model.AvailablePaymentMethods" class="form-select"></select>
|
||||
<span asp-validation-for="DefaultPaymentMethod" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="NotificationEmail" class="form-label"></label>
|
||||
<input asp-for="NotificationEmail" class="form-control" />
|
||||
<span asp-validation-for="NotificationEmail" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" id="Create" />
|
||||
<a asp-action="ListInvoices" class="text-muted ms-3">Back to list</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue