btcpayserver/BTCPayServer/Data/Payouts/LightningLike/BoltInvoiceClaimDestination.cs
Andrew Camilleri 95a0614ae1
Support accepting 0 amount bolt 11 invoices for payouts (#4014)
* Support accepting 0 amount bolt 11 invoices for payouts

* add test

* handle validation better

* fix case when we just want pp to provide amt

* Update BTCPayServer/HostedServices/PullPaymentHostedService.cs

* Update BTCPayServer/HostedServices/PullPaymentHostedService.cs

* Update BTCPayServer/Data/Payouts/LightningLike/UILightningLikePayoutController.cs

* Update UILightningLikePayoutController.cs

* fix null

* fix payments of payouts on cln

* add comment

* bump lightning lib

---------

Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
2023-07-24 20:40:26 +09:00

28 lines
954 B
C#

using System;
using BTCPayServer.Lightning;
using NBitcoin;
namespace BTCPayServer.Data.Payouts.LightningLike
{
public class BoltInvoiceClaimDestination : ILightningLikeLikeClaimDestination
{
public BoltInvoiceClaimDestination(string bolt11, BOLT11PaymentRequest paymentRequest)
{
Bolt11 = bolt11 ?? throw new ArgumentNullException(nameof(bolt11));
PaymentRequest = paymentRequest;
PaymentHash = paymentRequest.Hash;
Amount = paymentRequest.MinimumAmount.ToDecimal(LightMoneyUnit.BTC);
}
public override string ToString()
{
return Bolt11;
}
public string Bolt11 { get; }
public BOLT11PaymentRequest PaymentRequest { get; }
public uint256 PaymentHash { get; }
public string Id => PaymentHash.ToString();
public decimal? Amount { get; }
public bool IsExplicitAmountMinimum => true;
}
}