mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Can configure invoice expiration
This commit is contained in:
@@ -78,7 +78,7 @@ namespace BTCPayServer.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal async Task<DataWrapper<InvoiceResponse>> CreateInvoiceCore(Invoice invoice, StoreData store, string serverUrl, double expiryMinutes = 15)
|
internal async Task<DataWrapper<InvoiceResponse>> CreateInvoiceCore(Invoice invoice, StoreData store, string serverUrl)
|
||||||
{
|
{
|
||||||
var derivationStrategies = store.GetDerivationStrategies(_NetworkProvider).ToList();
|
var derivationStrategies = store.GetDerivationStrategies(_NetworkProvider).ToList();
|
||||||
if (derivationStrategies.Count == 0)
|
if (derivationStrategies.Count == 0)
|
||||||
@@ -94,7 +94,7 @@ namespace BTCPayServer.Controllers
|
|||||||
if (notificationUri == null || (notificationUri.Scheme != "http" && notificationUri.Scheme != "https")) //TODO: Filer non routable addresses ?
|
if (notificationUri == null || (notificationUri.Scheme != "http" && notificationUri.Scheme != "https")) //TODO: Filer non routable addresses ?
|
||||||
notificationUri = null;
|
notificationUri = null;
|
||||||
EmailAddressAttribute emailValidator = new EmailAddressAttribute();
|
EmailAddressAttribute emailValidator = new EmailAddressAttribute();
|
||||||
entity.ExpirationTime = entity.InvoiceTime.AddMinutes(expiryMinutes);
|
entity.ExpirationTime = entity.InvoiceTime.AddMinutes(storeBlob.InvoiceExpiration);
|
||||||
entity.MonitoringExpiration = entity.ExpirationTime + TimeSpan.FromMinutes(storeBlob.MonitoringExpiration);
|
entity.MonitoringExpiration = entity.ExpirationTime + TimeSpan.FromMinutes(storeBlob.MonitoringExpiration);
|
||||||
entity.OrderId = invoice.OrderId;
|
entity.OrderId = invoice.OrderId;
|
||||||
entity.ServerUrl = serverUrl;
|
entity.ServerUrl = serverUrl;
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ namespace BTCPayServer.Controllers
|
|||||||
AddDerivationSchemes(store, vm);
|
AddDerivationSchemes(store, vm);
|
||||||
vm.StatusMessage = StatusMessage;
|
vm.StatusMessage = StatusMessage;
|
||||||
vm.MonitoringExpiration = storeBlob.MonitoringExpiration;
|
vm.MonitoringExpiration = storeBlob.MonitoringExpiration;
|
||||||
|
vm.InvoiceExpiration = storeBlob.InvoiceExpiration;
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ namespace BTCPayServer.Data
|
|||||||
{
|
{
|
||||||
public StoreBlob()
|
public StoreBlob()
|
||||||
{
|
{
|
||||||
|
InvoiceExpiration = 15;
|
||||||
MonitoringExpiration = 60;
|
MonitoringExpiration = 60;
|
||||||
}
|
}
|
||||||
public bool NetworkFeeDisabled
|
public bool NetworkFeeDisabled
|
||||||
@@ -190,5 +191,14 @@ namespace BTCPayServer.Data
|
|||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DefaultValue(15)]
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
public int InvoiceExpiration
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,15 @@ namespace BTCPayServer.Models.StoreViewModels
|
|||||||
|
|
||||||
public List<StoreViewModel.DerivationScheme> DerivationSchemes { get; set; } = new List<StoreViewModel.DerivationScheme>();
|
public List<StoreViewModel.DerivationScheme> DerivationSchemes { get; set; } = new List<StoreViewModel.DerivationScheme>();
|
||||||
|
|
||||||
[Display(Name = "Payment invalid if transactions fails to confirm after ... minutes")]
|
[Display(Name = "Invoice expires if the full amount has not been paid after ... minutes")]
|
||||||
|
[Range(1, 60 * 24 * 31)]
|
||||||
|
public int InvoiceExpiration
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Display(Name = "Payment invalid if transactions fails to confirm ... minutes after invoice expiration")]
|
||||||
[Range(10, 60 * 24 * 31)]
|
[Range(10, 60 * 24 * 31)]
|
||||||
public int MonitoringExpiration
|
public int MonitoringExpiration
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,11 @@
|
|||||||
<label asp-for="NetworkFee"></label>
|
<label asp-for="NetworkFee"></label>
|
||||||
<input asp-for="NetworkFee" type="checkbox" class="form-check" />
|
<input asp-for="NetworkFee" type="checkbox" class="form-check" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="InvoiceExpiration"></label>
|
||||||
|
<input asp-for="InvoiceExpiration" class="form-control" />
|
||||||
|
<span asp-validation-for="InvoiceExpiration" class="text-danger"></span>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="MonitoringExpiration"></label>
|
<label asp-for="MonitoringExpiration"></label>
|
||||||
<input asp-for="MonitoringExpiration" class="form-control" />
|
<input asp-for="MonitoringExpiration" class="form-control" />
|
||||||
|
|||||||
Reference in New Issue
Block a user