mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-03 14:14:28 +01:00
* LNURL Payment Method Support * Merge recent Lightning controller related changes * Fix build * Create separate payment settings section for stores * Improve LNURL configuration * Prevent duplicate array entries when merging Swagger JSON * Fix CanSetPaymentMethodLimitsLightning * Fix CanUsePayjoinViaUI * Adapt test for new cancel bolt invoice feature * rebase fixes * Fixes after rebase * Test fixes * Do not turn LNURL on by default, Off-Chain payment criteria should affects both BOLT11 and LNURL, Payment criteria of unset payment method shouldn't be shown * Send better error if payment method not found * Revert "Prevent duplicate array entries when merging Swagger JSON" This reverts commit 5783db9eda17c29908a60fdef2c3ebe130a8b059. * Fix LNUrl doc * Fix some warnings Co-authored-by: Dennis Reimann <mail@dennisreimann.de> Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using BTCPayServer.Client.Models;
|
|
using BTCPayServer.Lightning;
|
|
using BTCPayServer.Lightning.JsonConverters;
|
|
using BTCPayServer.Services.Invoices;
|
|
using NBitcoin;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace BTCPayServer.Payments.Lightning
|
|
{
|
|
public class LightningLikePaymentData : CryptoPaymentData
|
|
{
|
|
[JsonIgnore]
|
|
public BTCPayNetworkBase Network { get; set; }
|
|
[JsonConverter(typeof(LightMoneyJsonConverter))]
|
|
public LightMoney Amount { get; set; }
|
|
public string BOLT11 { get; set; }
|
|
[JsonConverter(typeof(NBitcoin.JsonConverters.UInt256JsonConverter))]
|
|
public uint256 PaymentHash { get; set; }
|
|
public string PaymentType { get; set; }
|
|
|
|
public string GetDestination()
|
|
{
|
|
return BOLT11;
|
|
}
|
|
|
|
public decimal NetworkFee { get; set; }
|
|
|
|
|
|
public string GetPaymentId()
|
|
{
|
|
// Legacy, some old payments don't have the PaymentHash set
|
|
return PaymentHash?.ToString() ?? BOLT11;
|
|
}
|
|
|
|
public PaymentType GetPaymentType()
|
|
{
|
|
return string.IsNullOrEmpty(PaymentType) ? PaymentTypes.LightningLike : PaymentTypes.Parse(PaymentType);
|
|
}
|
|
|
|
public string[] GetSearchTerms()
|
|
{
|
|
return new[] { BOLT11 };
|
|
}
|
|
|
|
public decimal GetValue()
|
|
{
|
|
return Amount.ToDecimal(LightMoneyUnit.BTC);
|
|
}
|
|
|
|
public bool PaymentCompleted(PaymentEntity entity)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public bool PaymentConfirmed(PaymentEntity entity, SpeedPolicy speedPolicy)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|