mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
LNURL Payment Method Support (#2897)
* 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>
This commit is contained in:
@@ -10,7 +10,22 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||
|
||||
public class LightningNodeViewModel
|
||||
{
|
||||
[Display(Name = "Enable LNURL")]
|
||||
public bool LNURLEnabled { get; set; }
|
||||
|
||||
[Display(Name = "LNURL Classic Mode")]
|
||||
public bool LNURLBech32Mode { get; set; } = true;
|
||||
|
||||
[Display(Name = "LNURL enabled for standard invoices")]
|
||||
public bool LNURLStandardInvoiceEnabled { get; set; }
|
||||
|
||||
[Display(Name = "Allow payee to pass a comment")]
|
||||
public bool LUD12Enabled { get; set; }
|
||||
|
||||
[Display(Name = "Do not offer BOLT11 for standard invoices")]
|
||||
public bool DisableBolt11PaymentMethod { get; set; }
|
||||
public LightningNodeType LightningNodeType { get; set; }
|
||||
|
||||
[Display(Name = "Connection string")]
|
||||
public string ConnectionString { get; set; }
|
||||
public string CryptoCode { get; set; }
|
||||
|
||||
64
BTCPayServer/Models/StoreViewModels/PaymentViewModel.cs
Normal file
64
BTCPayServer/Models/StoreViewModels/PaymentViewModel.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using BTCPayServer.Client.Models;
|
||||
using BTCPayServer.Validation;
|
||||
using static BTCPayServer.Data.StoreBlob;
|
||||
|
||||
namespace BTCPayServer.Models.StoreViewModels
|
||||
{
|
||||
public class PaymentViewModel
|
||||
{
|
||||
public List<StoreDerivationScheme> DerivationSchemes { get; set; }
|
||||
public List<StoreLightningNode> LightningNodes { get; set; }
|
||||
public bool IsOnchainSetup { get; set; }
|
||||
public bool IsLightningSetup { get; set; }
|
||||
public bool CanUsePayJoin { get; set; }
|
||||
|
||||
[Display(Name = "Allow anyone to create invoice")]
|
||||
public bool AnyoneCanCreateInvoice { get; set; }
|
||||
|
||||
[Display(Name = "Invoice expires if the full amount has not been paid after …")]
|
||||
[Range(1, 60 * 24 * 24)]
|
||||
public int InvoiceExpiration { get; set; }
|
||||
|
||||
[Display(Name = "Payment invalid if transactions fails to confirm … after invoice expiration")]
|
||||
[Range(10, 60 * 24 * 24)]
|
||||
public int MonitoringExpiration { get; set; }
|
||||
|
||||
[Display(Name = "Consider the invoice confirmed when the payment transaction …")]
|
||||
public SpeedPolicy SpeedPolicy { get; set; }
|
||||
|
||||
[Display(Name = "Add additional fee (network fee) to invoice …")]
|
||||
public NetworkFeeMode NetworkFeeMode { get; set; }
|
||||
|
||||
[Display(Name = "Description template of the lightning invoice")]
|
||||
public string LightningDescriptionTemplate { get; set; }
|
||||
|
||||
[Display(Name = "Enable Payjoin/P2EP")]
|
||||
public bool PayJoinEnabled { get; set; }
|
||||
|
||||
[Display(Name = "Show recommended fee")]
|
||||
public bool ShowRecommendedFee { get; set; }
|
||||
|
||||
[Display(Name = "Recommended fee confirmation target blocks")]
|
||||
[Range(1, double.PositiveInfinity)]
|
||||
public int RecommendedFeeBlockTarget { get; set; }
|
||||
|
||||
[Display(Name = "Display Lightning payment amounts in Satoshis")]
|
||||
public bool LightningAmountInSatoshi { get; set; }
|
||||
|
||||
[Display(Name = "Add hop hints for private channels to the Lightning invoice")]
|
||||
public bool LightningPrivateRouteHints { get; set; }
|
||||
|
||||
[Display(Name = "Include Lightning invoice fallback to on-chain BIP21 payment URL")]
|
||||
public bool OnChainWithLnInvoiceFallback { get; set; }
|
||||
|
||||
[Display(Name = "Consider the invoice paid even if the paid amount is ... % less than expected")]
|
||||
[Range(0, 100)]
|
||||
public double PaymentTolerance { get; set; }
|
||||
|
||||
[Display(Name = "Default currency")]
|
||||
[MaxLength(10)]
|
||||
public string DefaultCurrency { get; set; }
|
||||
}
|
||||
}
|
||||
12
BTCPayServer/Models/StoreViewModels/StoreDerivationScheme.cs
Normal file
12
BTCPayServer/Models/StoreViewModels/StoreDerivationScheme.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace BTCPayServer.Models.StoreViewModels
|
||||
{
|
||||
public class StoreDerivationScheme
|
||||
{
|
||||
public string Crypto { get; set; }
|
||||
public string Value { get; set; }
|
||||
public WalletId WalletId { get; set; }
|
||||
public bool WalletSupported { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool Collapsed { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace BTCPayServer.Models.StoreViewModels
|
||||
{
|
||||
public class StoreLightningNode
|
||||
{
|
||||
public string CryptoCode { get; set; }
|
||||
public string Address { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,130 +8,24 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||
{
|
||||
public class StoreViewModel
|
||||
{
|
||||
public class DerivationScheme
|
||||
{
|
||||
public string Crypto { get; set; }
|
||||
public string Value { get; set; }
|
||||
public WalletId WalletId { get; set; }
|
||||
public bool WalletSupported { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public bool Collapsed { get; set; }
|
||||
}
|
||||
|
||||
public class AdditionalPaymentMethod
|
||||
{
|
||||
public string Provider { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string Action { get; set; }
|
||||
}
|
||||
public StoreViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public List<StoreDerivationScheme> DerivationSchemes { get; set; }
|
||||
public List<StoreLightningNode> LightningNodes { get; set; }
|
||||
public bool HintWallet { get; set; }
|
||||
public bool HintLightning { get; set; }
|
||||
public bool CanDelete { get; set; }
|
||||
|
||||
[Display(Name = "Store ID")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[Display(Name = "Store Name")]
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
[MinLength(1)]
|
||||
public string StoreName
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string StoreName { get; set; }
|
||||
|
||||
[Uri]
|
||||
[Display(Name = "Store Website")]
|
||||
[MaxLength(500)]
|
||||
public string StoreWebsite
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Display(Name = "Default currency")]
|
||||
[MaxLength(10)]
|
||||
public string DefaultCurrency { get; set; }
|
||||
|
||||
[Display(Name = "Allow anyone to create invoice")]
|
||||
public bool AnyoneCanCreateInvoice { get; set; }
|
||||
|
||||
public List<StoreViewModel.DerivationScheme> DerivationSchemes { get; set; } = new List<StoreViewModel.DerivationScheme>();
|
||||
|
||||
[Display(Name = "Invoice expires if the full amount has not been paid after …")]
|
||||
[Range(1, 60 * 24 * 24)]
|
||||
public int InvoiceExpiration
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Display(Name = "Payment invalid if transactions fails to confirm … after invoice expiration")]
|
||||
[Range(10, 60 * 24 * 24)]
|
||||
public int MonitoringExpiration
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Display(Name = "Consider the invoice confirmed when the payment transaction …")]
|
||||
public SpeedPolicy SpeedPolicy
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Display(Name = "Add additional fee (network fee) to invoice …")]
|
||||
public NetworkFeeMode NetworkFeeMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Display(Name = "Description template of the lightning invoice")]
|
||||
public string LightningDescriptionTemplate { get; set; }
|
||||
|
||||
[Display(Name = "Enable Payjoin/P2EP")]
|
||||
public bool PayJoinEnabled { get; set; }
|
||||
public bool CanUsePayJoin { get; set; }
|
||||
public bool IsOnchainSetup { get; set; }
|
||||
public bool IsLightningSetup { get; set; }
|
||||
|
||||
public bool HintWallet { get; set; }
|
||||
public bool HintLightning { get; set; }
|
||||
|
||||
[Display(Name = "Show recommended fee")]
|
||||
public bool ShowRecommendedFee { get; set; }
|
||||
|
||||
[Display(Name = "Recommended fee confirmation target blocks")]
|
||||
[Range(1, double.PositiveInfinity)]
|
||||
public int RecommendedFeeBlockTarget { get; set; }
|
||||
|
||||
[Display(Name = "Display Lightning payment amounts in Satoshis")]
|
||||
public bool LightningAmountInSatoshi { get; set; }
|
||||
|
||||
[Display(Name = "Add hop hints for private channels to the Lightning invoice")]
|
||||
public bool LightningPrivateRouteHints { get; set; }
|
||||
|
||||
[Display(Name = "Include Lightning invoice fallback to on-chain BIP21 payment URL")]
|
||||
public bool OnChainWithLnInvoiceFallback { get; set; }
|
||||
|
||||
public class LightningNode
|
||||
{
|
||||
public string CryptoCode { get; set; }
|
||||
public string Address { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
public List<LightningNode> LightningNodes
|
||||
{
|
||||
get; set;
|
||||
} = new List<LightningNode>();
|
||||
|
||||
[Display(Name = "Consider the invoice paid even if the paid amount is ... % less than expected")]
|
||||
[Range(0, 100)]
|
||||
public double PaymentTolerance
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string StoreWebsite { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user