2020-06-24 10:34:09 +09:00
|
|
|
using BTCPayServer.Configuration;
|
2020-10-15 14:28:09 +02:00
|
|
|
using BTCPayServer.Contracts;
|
2020-06-24 10:34:09 +09:00
|
|
|
using BTCPayServer.Controllers;
|
|
|
|
using BTCPayServer.Models.NotificationViewModels;
|
|
|
|
using Microsoft.AspNetCore.Routing;
|
|
|
|
|
|
|
|
namespace BTCPayServer.Services.Notifications.Blobs
|
|
|
|
{
|
2020-10-20 13:09:09 +02:00
|
|
|
public class PayoutNotification : BaseNotification
|
2020-06-24 10:34:09 +09:00
|
|
|
{
|
2020-10-20 13:09:09 +02:00
|
|
|
private const string TYPE = "payout";
|
|
|
|
|
2020-06-24 10:34:09 +09:00
|
|
|
internal class Handler : NotificationHandler<PayoutNotification>
|
|
|
|
{
|
|
|
|
private readonly LinkGenerator _linkGenerator;
|
|
|
|
private readonly BTCPayServerOptions _options;
|
|
|
|
|
|
|
|
public Handler(LinkGenerator linkGenerator, BTCPayServerOptions options)
|
|
|
|
{
|
|
|
|
_linkGenerator = linkGenerator;
|
|
|
|
_options = options;
|
|
|
|
}
|
2020-10-20 13:09:09 +02:00
|
|
|
|
|
|
|
public override string NotificationType => TYPE;
|
|
|
|
public override (string identifier, string name)[] Meta
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return new (string identifier, string name)[] {(TYPE, "Payouts")};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-24 10:34:09 +09:00
|
|
|
protected override void FillViewModel(PayoutNotification notification, NotificationViewModel vm)
|
|
|
|
{
|
2020-08-08 12:50:55 +02:00
|
|
|
vm.Body = "A new payout is awaiting for approval";
|
2020-06-24 10:34:09 +09:00
|
|
|
vm.ActionLink = _linkGenerator.GetPathByAction(nameof(WalletsController.Payouts),
|
|
|
|
"Wallets",
|
2020-10-20 13:09:09 +02:00
|
|
|
new {walletId = new WalletId(notification.StoreId, notification.PaymentMethod)}, _options.RootPath);
|
2020-06-24 10:34:09 +09:00
|
|
|
}
|
|
|
|
}
|
2020-10-20 13:09:09 +02:00
|
|
|
|
2020-06-24 10:34:09 +09:00
|
|
|
public string PayoutId { get; set; }
|
|
|
|
public string StoreId { get; set; }
|
|
|
|
public string PaymentMethod { get; set; }
|
|
|
|
public string Currency { get; set; }
|
2020-10-20 13:09:09 +02:00
|
|
|
public override string Identifier => TYPE;
|
|
|
|
public override string NotificationType => TYPE;
|
2020-06-24 10:34:09 +09:00
|
|
|
}
|
|
|
|
}
|