low-medium speed policy

This commit is contained in:
nicolas.dorier 2018-05-11 22:12:45 +09:00
parent 9b3bd8343d
commit 8e4943df65
5 changed files with 12 additions and 2 deletions

View File

@ -51,7 +51,10 @@ namespace BTCPayServer.Controllers
StoreLink = Url.Action(nameof(StoresController.UpdateStore), "Stores", new { storeId = store.Id }),
Id = invoice.Id,
Status = invoice.Status,
TransactionSpeed = invoice.SpeedPolicy == SpeedPolicy.HighSpeed ? "high" : invoice.SpeedPolicy == SpeedPolicy.MediumSpeed ? "medium" : "low",
TransactionSpeed = invoice.SpeedPolicy == SpeedPolicy.HighSpeed ? "high" :
invoice.SpeedPolicy == SpeedPolicy.MediumSpeed ? "medium" :
invoice.SpeedPolicy == SpeedPolicy.LowMediumSpeed ? "low-medium" :
"low",
RefundEmail = invoice.RefundMail,
CreatedDate = invoice.InvoiceTime,
ExpirationDate = invoice.ExpirationTime,

View File

@ -277,6 +277,7 @@ namespace BTCPayServer.Controllers
return defaultPolicy;
var mappings = new Dictionary<string, SpeedPolicy>();
mappings.Add("low", SpeedPolicy.LowSpeed);
mappings.Add("low-medium", SpeedPolicy.LowMediumSpeed);
mappings.Add("medium", SpeedPolicy.MediumSpeed);
mappings.Add("high", SpeedPolicy.HighSpeed);
if (!mappings.TryGetValue(transactionSpeed, out SpeedPolicy policy))

View File

@ -68,6 +68,10 @@ namespace BTCPayServer.Payments.Bitcoin
{
return ConfirmationCount >= 1;
}
else if (speedPolicy == SpeedPolicy.LowMediumSpeed)
{
return ConfirmationCount >= 2;
}
else if (speedPolicy == SpeedPolicy.LowSpeed)
{
return ConfirmationCount >= 6;

View File

@ -100,7 +100,8 @@ namespace BTCPayServer.Services.Invoices
{
HighSpeed = 0,
MediumSpeed = 1,
LowSpeed = 2
LowSpeed = 2,
LowMediumSpeed = 3
}
public class InvoiceEntity
{

View File

@ -54,6 +54,7 @@
<select asp-for="SpeedPolicy" class="form-control">
<option value="0">Is unconfirmed</option>
<option value="1">Has at least 1 confirmation</option>
<option value="3">Has at least 2 confirmations</option>
<option value="2">Has at least 6 confirmations</option>
</select>
<span asp-validation-for="SpeedPolicy" class="text-danger"></span>