mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
* Allow disabling notifications per user and disabling specific notifications per use closes #1974 * Add disable notifs for all users * fix term generator for notifications * sow checkboxes instead of multiselect when js is enabled * remove js dependency * fix notif conditions
49 lines
1.8 KiB
C#
49 lines
1.8 KiB
C#
using BTCPayServer.Configuration;
|
|
using BTCPayServer.Contracts;
|
|
using BTCPayServer.Controllers;
|
|
using BTCPayServer.Models.NotificationViewModels;
|
|
using Microsoft.AspNetCore.Routing;
|
|
|
|
namespace BTCPayServer.Services.Notifications.Blobs
|
|
{
|
|
public class PayoutNotification : BaseNotification
|
|
{
|
|
private const string TYPE = "payout";
|
|
|
|
internal class Handler : NotificationHandler<PayoutNotification>
|
|
{
|
|
private readonly LinkGenerator _linkGenerator;
|
|
private readonly BTCPayServerOptions _options;
|
|
|
|
public Handler(LinkGenerator linkGenerator, BTCPayServerOptions options)
|
|
{
|
|
_linkGenerator = linkGenerator;
|
|
_options = options;
|
|
}
|
|
|
|
public override string NotificationType => TYPE;
|
|
public override (string identifier, string name)[] Meta
|
|
{
|
|
get
|
|
{
|
|
return new (string identifier, string name)[] {(TYPE, "Payouts")};
|
|
}
|
|
}
|
|
|
|
protected override void FillViewModel(PayoutNotification notification, NotificationViewModel vm)
|
|
{
|
|
vm.Body = "A new payout is awaiting for approval";
|
|
vm.ActionLink = _linkGenerator.GetPathByAction(nameof(WalletsController.Payouts),
|
|
"Wallets",
|
|
new {walletId = new WalletId(notification.StoreId, notification.PaymentMethod)}, _options.RootPath);
|
|
}
|
|
}
|
|
|
|
public string PayoutId { get; set; }
|
|
public string StoreId { get; set; }
|
|
public string PaymentMethod { get; set; }
|
|
public string Currency { get; set; }
|
|
public override string Identifier => TYPE;
|
|
public override string NotificationType => TYPE;
|
|
}
|
|
}
|