mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
GreenField: Add properties to Store API (#1573)
* GreenField: Add properties to Store API * Update StoreBaseData.cs * fix api * fix swagger
This commit is contained in:
parent
bfba105aec
commit
79b034b505
20 changed files with 279 additions and 44 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
using BTCPayServer.Client.JsonConverters;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
namespace BTCPayServer.Client.Models
|
namespace BTCPayServer.Client.Models
|
||||||
{
|
{
|
||||||
public abstract class StoreBaseData
|
public abstract class StoreBaseData
|
||||||
|
@ -6,5 +10,55 @@ namespace BTCPayServer.Client.Models
|
||||||
/// the name of the store
|
/// the name of the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string Website { get; set; }
|
||||||
|
public int InvoiceExpiration { get; set; } = 15;
|
||||||
|
public int MonitoringExpiration { get; set; } = 60;
|
||||||
|
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public SpeedPolicy SpeedPolicy { get; set; }
|
||||||
|
public string LightningDescriptionTemplate { get; set; }
|
||||||
|
public double PaymentTolerance { get; set; } = 0;
|
||||||
|
public bool AnyoneCanCreateInvoice { get; set; }
|
||||||
|
|
||||||
|
public bool ShowRecommendedFee { get; set; }
|
||||||
|
|
||||||
|
public int RecommendedFeeBlockTarget { get; set; }
|
||||||
|
|
||||||
|
public string DefaultLang { get; set; }
|
||||||
|
public bool LightningAmountInSatoshi { get; set; }
|
||||||
|
|
||||||
|
public string CustomLogo { get; set; }
|
||||||
|
|
||||||
|
public string CustomCSS { get; set; }
|
||||||
|
|
||||||
|
public string HtmlTitle { get; set; }
|
||||||
|
|
||||||
|
public bool AnyoneCanInvoice { get; set; }
|
||||||
|
|
||||||
|
public bool RedirectAutomatically { get; set; }
|
||||||
|
|
||||||
|
public bool RequiresRefundEmail { get; set; }
|
||||||
|
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public NetworkFeeMode NetworkFeeMode { get; set; }
|
||||||
|
|
||||||
|
public bool PayJoinEnabled { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum NetworkFeeMode
|
||||||
|
{
|
||||||
|
MultiplePaymentsOnly,
|
||||||
|
Always,
|
||||||
|
Never
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SpeedPolicy
|
||||||
|
{
|
||||||
|
HighSpeed = 0,
|
||||||
|
MediumSpeed = 1,
|
||||||
|
LowSpeed = 2,
|
||||||
|
LowMediumSpeed = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
|
|
||||||
namespace BTCPayServer.Data
|
namespace BTCPayServer.Data
|
||||||
{
|
{
|
||||||
public enum SpeedPolicy
|
|
||||||
{
|
|
||||||
HighSpeed = 0,
|
|
||||||
MediumSpeed = 1,
|
|
||||||
LowSpeed = 2,
|
|
||||||
LowMediumSpeed = 3
|
|
||||||
}
|
|
||||||
|
|
||||||
public class StoreData
|
public class StoreData
|
||||||
{
|
{
|
||||||
|
@ -48,10 +42,5 @@ namespace BTCPayServer.Data
|
||||||
public IEnumerable<APIKeyData> APIKeys { get; set; }
|
public IEnumerable<APIKeyData> APIKeys { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NetworkFeeMode
|
|
||||||
{
|
|
||||||
MultiplePaymentsOnly,
|
|
||||||
Always,
|
|
||||||
Never
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Controllers;
|
using BTCPayServer.Controllers;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Events;
|
using BTCPayServer.Events;
|
||||||
|
|
|
@ -23,6 +23,7 @@ using BTCPayServer.Data;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using NBXplorer.Models;
|
using NBXplorer.Models;
|
||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Events;
|
using BTCPayServer.Events;
|
||||||
using BTCPayServer.Services;
|
using BTCPayServer.Services;
|
||||||
using BTCPayServer.Services.Stores;
|
using BTCPayServer.Services.Stores;
|
||||||
|
|
|
@ -63,6 +63,7 @@ using BTCPayServer.Security.Bitpay;
|
||||||
using MemoryCache = Microsoft.Extensions.Caching.Memory.MemoryCache;
|
using MemoryCache = Microsoft.Extensions.Caching.Memory.MemoryCache;
|
||||||
using Newtonsoft.Json.Schema;
|
using Newtonsoft.Json.Schema;
|
||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
|
|
||||||
namespace BTCPayServer.Tests
|
namespace BTCPayServer.Tests
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -101,22 +102,97 @@ namespace BTCPayServer.Controllers.GreenField
|
||||||
|
|
||||||
private static Client.Models.StoreData FromModel(Data.StoreData data)
|
private static Client.Models.StoreData FromModel(Data.StoreData data)
|
||||||
{
|
{
|
||||||
|
var storeBlob = data.GetStoreBlob();
|
||||||
return new Client.Models.StoreData()
|
return new Client.Models.StoreData()
|
||||||
{
|
{
|
||||||
Id = data.Id,
|
Id = data.Id,
|
||||||
Name = data.StoreName
|
Name = data.StoreName,
|
||||||
|
Website = data.StoreWebsite,
|
||||||
|
SpeedPolicy = data.SpeedPolicy,
|
||||||
|
//we do not include the default payment method in this model and instead opt to set it in the stores/storeid/payment-methods endpoints
|
||||||
|
//blob
|
||||||
|
//we do not include DefaultCurrencyPairs,Spread, PreferredExchange, RateScripting, RateScript in this model and instead opt to set it in stores/storeid/rates endpoints
|
||||||
|
//we do not include ChangellySettings in this model and instead opt to set it in stores/storeid/changelly endpoints
|
||||||
|
//we do not include CoinSwitchSettings in this model and instead opt to set it in stores/storeid/coinswitch endpoints
|
||||||
|
//we do not include ExcludedPaymentMethods in this model and instead opt to set it in stores/storeid/payment-methods endpoints
|
||||||
|
//we do not include EmailSettings in this model and instead opt to set it in stores/storeid/email endpoints
|
||||||
|
//we do not include OnChainMinValue and LightningMaxValue because moving the CurrencyValueJsonConverter to the Client csproj is hard and requires a refactor (#1571 & #1572)
|
||||||
|
NetworkFeeMode = storeBlob.NetworkFeeMode,
|
||||||
|
RequiresRefundEmail = storeBlob.RequiresRefundEmail,
|
||||||
|
ShowRecommendedFee = storeBlob.ShowRecommendedFee,
|
||||||
|
RecommendedFeeBlockTarget = storeBlob.RecommendedFeeBlockTarget,
|
||||||
|
DefaultLang = storeBlob.DefaultLang,
|
||||||
|
MonitoringExpiration = storeBlob.MonitoringExpiration,
|
||||||
|
InvoiceExpiration = storeBlob.InvoiceExpiration,
|
||||||
|
LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi,
|
||||||
|
CustomLogo = storeBlob.CustomLogo,
|
||||||
|
CustomCSS = storeBlob.CustomCSS,
|
||||||
|
HtmlTitle = storeBlob.HtmlTitle,
|
||||||
|
AnyoneCanInvoice = storeBlob.AnyoneCanInvoice,
|
||||||
|
LightningDescriptionTemplate = storeBlob.LightningDescriptionTemplate,
|
||||||
|
PaymentTolerance = storeBlob.PaymentTolerance,
|
||||||
|
RedirectAutomatically = storeBlob.RedirectAutomatically,
|
||||||
|
PayJoinEnabled = storeBlob.PayJoinEnabled
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ToModel(StoreBaseData restModel, Data.StoreData model)
|
private static void ToModel(StoreBaseData restModel, Data.StoreData model)
|
||||||
{
|
{
|
||||||
|
var blob = model.GetStoreBlob();
|
||||||
|
|
||||||
model.StoreName = restModel.Name;
|
model.StoreName = restModel.Name;
|
||||||
|
model.StoreName = restModel.Name;
|
||||||
|
model.StoreWebsite = restModel.Website;
|
||||||
|
model.SpeedPolicy = restModel.SpeedPolicy;
|
||||||
|
//we do not include the default payment method in this model and instead opt to set it in the stores/storeid/payment-methods endpoints
|
||||||
|
//blob
|
||||||
|
//we do not include DefaultCurrencyPairs;Spread; PreferredExchange; RateScripting; RateScript in this model and instead opt to set it in stores/storeid/rates endpoints
|
||||||
|
//we do not include ChangellySettings in this model and instead opt to set it in stores/storeid/changelly endpoints
|
||||||
|
//we do not include CoinSwitchSettings in this model and instead opt to set it in stores/storeid/coinswitch endpoints
|
||||||
|
//we do not include ExcludedPaymentMethods in this model and instead opt to set it in stores/storeid/payment-methods endpoints
|
||||||
|
//we do not include EmailSettings in this model and instead opt to set it in stores/storeid/email endpoints
|
||||||
|
//we do not include OnChainMinValue and LightningMaxValue because moving the CurrencyValueJsonConverter to the Client csproj is hard and requires a refactor (#1571 & #1572)
|
||||||
|
blob.NetworkFeeMode = restModel.NetworkFeeMode;
|
||||||
|
blob.RequiresRefundEmail = restModel.RequiresRefundEmail;
|
||||||
|
blob.ShowRecommendedFee = restModel.ShowRecommendedFee;
|
||||||
|
blob.RecommendedFeeBlockTarget = restModel.RecommendedFeeBlockTarget;
|
||||||
|
blob.DefaultLang = restModel.DefaultLang;
|
||||||
|
blob.MonitoringExpiration = restModel.MonitoringExpiration;
|
||||||
|
blob.InvoiceExpiration = restModel.InvoiceExpiration;
|
||||||
|
blob.LightningAmountInSatoshi = restModel.LightningAmountInSatoshi;
|
||||||
|
blob.CustomLogo = restModel.CustomLogo;
|
||||||
|
blob.CustomCSS = restModel.CustomCSS;
|
||||||
|
blob.HtmlTitle = restModel.HtmlTitle;
|
||||||
|
blob.AnyoneCanInvoice = restModel.AnyoneCanInvoice;
|
||||||
|
blob.LightningDescriptionTemplate = restModel.LightningDescriptionTemplate;
|
||||||
|
blob.PaymentTolerance = restModel.PaymentTolerance;
|
||||||
|
blob.RedirectAutomatically = restModel.RedirectAutomatically;
|
||||||
|
blob.PayJoinEnabled = restModel.PayJoinEnabled;
|
||||||
|
model.SetStoreBlob(blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IActionResult Validate(StoreBaseData request)
|
private IActionResult Validate(StoreBaseData request)
|
||||||
{
|
{
|
||||||
if (request?.Name is null)
|
if (request is null)
|
||||||
|
{
|
||||||
|
return BadRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(request.Name))
|
||||||
ModelState.AddModelError(nameof(request.Name), "Name is missing");
|
ModelState.AddModelError(nameof(request.Name), "Name is missing");
|
||||||
|
else if(request.Name.Length < 1 || request.Name.Length > 50)
|
||||||
|
ModelState.AddModelError(nameof(request.Name), "Name can only be between 1 and 50 characters");
|
||||||
|
if (!string.IsNullOrEmpty(request.Website) && !Uri.TryCreate(request.Website, UriKind.Absolute, out _))
|
||||||
|
{
|
||||||
|
ModelState.AddModelError(nameof(request.Website), "Website is not a valid url");
|
||||||
|
}
|
||||||
|
if(request.InvoiceExpiration < 1 && request.InvoiceExpiration > 60 * 24 * 24)
|
||||||
|
ModelState.AddModelError(nameof(request.InvoiceExpiration), "InvoiceExpiration can only be between 1 and 34560 mins");
|
||||||
|
if(request.MonitoringExpiration < 10 && request.MonitoringExpiration > 60 * 24 * 24)
|
||||||
|
ModelState.AddModelError(nameof(request.MonitoringExpiration), "InvoiceExpiration can only be between 10 and 34560 mins");
|
||||||
|
if(request.PaymentTolerance < 0 && request.PaymentTolerance > 100)
|
||||||
|
ModelState.AddModelError(nameof(request.PaymentTolerance), "PaymentTolerance can only be between 0 and 100 percent");
|
||||||
|
|
||||||
return !ModelState.IsValid ? BadRequest(new ValidationProblemDetails(ModelState)) : null;
|
return !ModelState.IsValid ? BadRequest(new ValidationProblemDetails(ModelState)) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Net.WebSockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Events;
|
using BTCPayServer.Events;
|
||||||
using BTCPayServer.Filters;
|
using BTCPayServer.Filters;
|
||||||
|
@ -26,6 +27,7 @@ using NBitcoin;
|
||||||
using NBitpayClient;
|
using NBitpayClient;
|
||||||
using NBXplorer;
|
using NBXplorer;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using StoreData = BTCPayServer.Data.StoreData;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Events;
|
using BTCPayServer.Events;
|
||||||
using BTCPayServer.Logging;
|
using BTCPayServer.Logging;
|
||||||
|
@ -23,6 +24,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using NBitpayClient;
|
using NBitpayClient;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using StoreData = BTCPayServer.Data.StoreData;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Client;
|
using BTCPayServer.Client;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Configuration;
|
using BTCPayServer.Configuration;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.HostedServices;
|
using BTCPayServer.HostedServices;
|
||||||
|
@ -31,6 +32,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using NBitcoin.DataEncoders;
|
using NBitcoin.DataEncoders;
|
||||||
using NBXplorer;
|
using NBXplorer;
|
||||||
|
using StoreData = BTCPayServer.Data.StoreData;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@ using BTCPayServer.Rating;
|
||||||
using BTCPayServer.Services.Mails;
|
using BTCPayServer.Services.Mails;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Services.Rates;
|
using BTCPayServer.Services.Rates;
|
||||||
|
|
||||||
namespace BTCPayServer.Data
|
namespace BTCPayServer.Data
|
||||||
|
|
|
@ -9,6 +9,7 @@ using BTCPayServer.Services;
|
||||||
using BTCPayServer.Services.Stores;
|
using BTCPayServer.Services.Stores;
|
||||||
using BTCPayServer.Logging;
|
using BTCPayServer.Logging;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using BTCPayServer.Validation;
|
using BTCPayServer.Validation;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
|
|
||||||
namespace BTCPayServer.Models.StoreViewModels
|
namespace BTCPayServer.Models.StoreViewModels
|
||||||
|
@ -79,7 +80,7 @@ namespace BTCPayServer.Models.StoreViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
[Display(Name = "Add additional fee (network fee) to invoice...")]
|
[Display(Name = "Add additional fee (network fee) to invoice...")]
|
||||||
public Data.NetworkFeeMode NetworkFeeMode
|
public NetworkFeeMode NetworkFeeMode
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Services.Invoices;
|
using BTCPayServer.Services.Invoices;
|
||||||
using BTCPayServer.Services.Wallets;
|
using BTCPayServer.Services.Wallets;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
|
@ -33,7 +34,7 @@ namespace BTCPayServer.Payments.Bitcoin
|
||||||
{
|
{
|
||||||
DepositAddress = newPaymentDestination;
|
DepositAddress = newPaymentDestination;
|
||||||
}
|
}
|
||||||
public Data.NetworkFeeMode NetworkFeeMode { get; set; }
|
public NetworkFeeMode NetworkFeeMode { get; set; }
|
||||||
|
|
||||||
FeeRate _NetworkFeeRate;
|
FeeRate _NetworkFeeRate;
|
||||||
[JsonConverter(typeof(NBitcoin.JsonConverters.FeeRateJsonConverter))]
|
[JsonConverter(typeof(NBitcoin.JsonConverters.FeeRateJsonConverter))]
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Services.Invoices;
|
using BTCPayServer.Services.Invoices;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.HostedServices;
|
using BTCPayServer.HostedServices;
|
||||||
using BTCPayServer.Logging;
|
using BTCPayServer.Logging;
|
||||||
|
@ -13,6 +14,7 @@ using BTCPayServer.Services.Invoices;
|
||||||
using BTCPayServer.Services.Rates;
|
using BTCPayServer.Services.Rates;
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using NBXplorer.Models;
|
using NBXplorer.Models;
|
||||||
|
using StoreData = BTCPayServer.Data.StoreData;
|
||||||
|
|
||||||
namespace BTCPayServer.Payments.Bitcoin
|
namespace BTCPayServer.Payments.Bitcoin
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.JsonConverters;
|
using BTCPayServer.JsonConverters;
|
||||||
using BTCPayServer.Lightning;
|
using BTCPayServer.Lightning;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using BTCPayServer.Services.Altcoins.Monero.Utils;
|
using BTCPayServer.Services.Altcoins.Monero.Utils;
|
||||||
using BTCPayServer.Payments;
|
using BTCPayServer.Payments;
|
||||||
|
|
|
@ -16,6 +16,7 @@ using BTCPayServer.Payments;
|
||||||
using NBitpayClient;
|
using NBitpayClient;
|
||||||
using BTCPayServer.Payments.Bitcoin;
|
using BTCPayServer.Payments.Bitcoin;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.JsonConverters;
|
using BTCPayServer.JsonConverters;
|
||||||
|
|
||||||
namespace BTCPayServer.Services.Invoices
|
namespace BTCPayServer.Services.Invoices
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using BTCPayServer.Client.Models;
|
||||||
using BTCPayServer.Models.InvoicingModels;
|
using BTCPayServer.Models.InvoicingModels;
|
||||||
using BTCPayServer.Logging;
|
using BTCPayServer.Logging;
|
||||||
using BTCPayServer.Payments;
|
using BTCPayServer.Payments;
|
||||||
|
|
|
@ -40,15 +40,7 @@
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"$ref": "#/components/schemas/StoreBaseData"
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The name of the new store",
|
|
||||||
"nullable": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -158,15 +150,7 @@
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"$ref": "#/components/schemas/StoreData"
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The name of the store",
|
|
||||||
"nullable": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -269,20 +253,132 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"StoreData": {
|
"StoreData": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"$ref": "#/definitions/StoreBaseData"
|
||||||
|
},
|
||||||
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The id of the store",
|
"description": "The id of the store",
|
||||||
"nullable": false
|
"nullable": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
"StoreBaseData": {
|
||||||
|
"type": "object",
|
||||||
|
"x-abstract": true,
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the store",
|
"description": "The name of the store",
|
||||||
"nullable": false
|
"nullable": true
|
||||||
|
},
|
||||||
|
"website": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The absolute url of the store",
|
||||||
|
"format": "url",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"invoiceExpiration": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"monitoringExpiration": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"speedPolicy": {
|
||||||
|
"$ref": "#/components/schemas/SpeedPolicy"
|
||||||
|
},
|
||||||
|
"lightningDescriptionTemplate": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"paymentTolerance": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
},
|
||||||
|
"anyoneCanCreateInvoice": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"showRecommendedFee": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"recommendedFeeBlockTarget": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"defaultLang": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"lightningAmountInSatoshi": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"customLogo": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"customCSS": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"htmlTitle": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"anyoneCanInvoice": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"redirectAutomatically": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"requiresRefundEmail": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"networkFeeMode": {
|
||||||
|
"$ref": "#/components/schemas/NetworkFeeMode"
|
||||||
|
},
|
||||||
|
"payJoinEnabled": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SpeedPolicy": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "",
|
||||||
|
"x-enumNames": [
|
||||||
|
"HighSpeed",
|
||||||
|
"MediumSpeed",
|
||||||
|
"LowSpeed",
|
||||||
|
"LowMediumSpeed"
|
||||||
|
],
|
||||||
|
"enum": [
|
||||||
|
"HighSpeed",
|
||||||
|
"MediumSpeed",
|
||||||
|
"LowSpeed",
|
||||||
|
"LowMediumSpeed"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"NetworkFeeMode": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "",
|
||||||
|
"x-enumNames": [
|
||||||
|
"MultiplePaymentsOnly",
|
||||||
|
"Always",
|
||||||
|
"Never"
|
||||||
|
],
|
||||||
|
"enum": [
|
||||||
|
"MultiplePaymentsOnly",
|
||||||
|
"Always",
|
||||||
|
"Never"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue