mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 22:46:49 +01:00
* Refactor and decouple Payout logic So that we can support lightning + external payout payments Fixes & refactoring almost there final Remove uneeded payment method checks Refactor payouts to handle custom payment method specific actions External onchain payments to approved payouts will now require "confirmation" from the merchant that it was sent by them. add pill tabs for payout status * Improve some UX around feature * add test and some fixes * Only listen to address tracked source and determine based on wallet get tx call from nbx * Simplify isInternal for Payout detection * fix test * Fix Noreferrer test * Make EnsureNewLightningInvoiceOnPartialPayment more resilient * Make notifications section test more resilient in CanUsePullPaymentsViaUI
55 lines
2 KiB
C#
55 lines
2 KiB
C#
using BTCPayServer.Abstractions.Contracts;
|
|
using BTCPayServer.Client.Models;
|
|
using BTCPayServer.Configuration;
|
|
using BTCPayServer.Controllers;
|
|
using Microsoft.AspNetCore.Routing;
|
|
|
|
namespace BTCPayServer.Services.Notifications.Blobs
|
|
{
|
|
public class ExternalPayoutTransactionNotification : BaseNotification
|
|
{
|
|
private const string TYPE = "external-payout-transaction";
|
|
|
|
internal class Handler : NotificationHandler<ExternalPayoutTransactionNotification>
|
|
{
|
|
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, "External payout approval")};
|
|
}
|
|
}
|
|
|
|
protected override void FillViewModel(ExternalPayoutTransactionNotification notification,
|
|
NotificationViewModel vm)
|
|
{
|
|
vm.Body =
|
|
"A payment that was made to an approved payout by an external wallet is waiting for your confirmation.";
|
|
vm.ActionLink = _linkGenerator.GetPathByAction(nameof(WalletsController.Payouts),
|
|
"Wallets",
|
|
new
|
|
{
|
|
walletId = new WalletId(notification.StoreId, notification.PaymentMethod),
|
|
payoutState = PayoutState.AwaitingPayment
|
|
}, _options.RootPath);
|
|
}
|
|
}
|
|
|
|
public string PayoutId { get; set; }
|
|
public string StoreId { get; set; }
|
|
public string PaymentMethod { get; set; }
|
|
public override string Identifier => TYPE;
|
|
public override string NotificationType => TYPE;
|
|
}
|
|
}
|