Restructure store and payment settings (#2995)

Co-authored-by: Kukks <evilkukka@gmail.com>
This commit is contained in:
d11n
2021-10-29 08:25:43 +02:00
committed by GitHub
parent eee8008bb2
commit 2d4aa52fa5
47 changed files with 953 additions and 835 deletions

View File

@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace BTCPayServer.Models.StoreViewModels
{
public class CheckoutExperienceViewModel
public class CheckoutAppearanceViewModel
{
public class Format
{

View File

@@ -1,18 +1,10 @@
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 StoreViewModel
public class GeneralSettingsViewModel
{
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; }
@@ -27,5 +19,7 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Store Website")]
[MaxLength(500)]
public string StoreWebsite { get; set; }
public bool CanDelete { get; set; }
}
}

View File

@@ -10,28 +10,14 @@ 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; } = true;
[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 StoreId { get; set; }
public string CryptoCode { get; set; }
public bool CanUseInternalNode { get; set; }
public bool SkipPortTest { get; set; }
public bool Enabled { get; set; } = true;
public string StoreId { get; set; }
[Display(Name = "Connection string")]
public string ConnectionString { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations;
namespace BTCPayServer.Models.StoreViewModels
{
public class LightningSettingsViewModel : LightningNodeViewModel
{
// Payment
[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 = "Description template of the lightning invoice")]
public string LightningDescriptionTemplate { get; set; }
// LNURL
[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; } = true;
[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; }
}
}

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using BTCPayServer.Client.Models;
namespace BTCPayServer.Models.StoreViewModels
{
public class PaymentMethodsViewModel
{
public string Id { get; set; }
public List<StoreDerivationScheme> DerivationSchemes { get; set; }
public List<StoreLightningNode> LightningNodes { get; set; }
public bool HintWallet { get; set; }
public bool HintLightning { 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 = "Add additional fee (network fee) to invoice …")]
public NetworkFeeMode NetworkFeeMode { 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; }
}
}

View File

@@ -1,64 +0,0 @@
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; }
}
}

View File

@@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using BTCPayServer.Client.Models;
namespace BTCPayServer.Models.StoreViewModels
{
public class WalletSettingsViewModel : DerivationSchemeViewModel
{
public string StoreId { get; set; }
public bool IsHotWallet { get; set; }
public bool CanUsePayJoin { 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 = "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; }
}
}