mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
Merge remote-tracking branch 'btcpayserver/master' into feature/crowdfund
This commit is contained in:
commit
20a6b3fc33
6 changed files with 21 additions and 23 deletions
|
@ -99,10 +99,6 @@ namespace BTCPayServer.Tests
|
||||||
var store = parent.PayTester.GetController<StoresController>(UserId, StoreId);
|
var store = parent.PayTester.GetController<StoresController>(UserId, StoreId);
|
||||||
ExtKey = new ExtKey().GetWif(SupportedNetwork.NBitcoinNetwork);
|
ExtKey = new ExtKey().GetWif(SupportedNetwork.NBitcoinNetwork);
|
||||||
DerivationScheme = new DerivationStrategyFactory(SupportedNetwork.NBitcoinNetwork).Parse(ExtKey.Neuter().ToString() + (segwit ? "" : "-[legacy]"));
|
DerivationScheme = new DerivationStrategyFactory(SupportedNetwork.NBitcoinNetwork).Parse(ExtKey.Neuter().ToString() + (segwit ? "" : "-[legacy]"));
|
||||||
var vm = (StoreViewModel)((ViewResult)store.UpdateStore()).Model;
|
|
||||||
vm.SpeedPolicy = SpeedPolicy.MediumSpeed;
|
|
||||||
await store.UpdateStore(vm);
|
|
||||||
|
|
||||||
await store.AddDerivationScheme(StoreId, new DerivationSchemeViewModel()
|
await store.AddDerivationScheme(StoreId, new DerivationSchemeViewModel()
|
||||||
{
|
{
|
||||||
DerivationScheme = DerivationScheme.ToString(),
|
DerivationScheme = DerivationScheme.ToString(),
|
||||||
|
|
|
@ -51,6 +51,7 @@ using RatesViewModel = BTCPayServer.Models.StoreViewModels.RatesViewModel;
|
||||||
using NBitpayClient.Extensions;
|
using NBitpayClient.Extensions;
|
||||||
using BTCPayServer.Services;
|
using BTCPayServer.Services;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using BTCPayServer.Events;
|
||||||
|
|
||||||
namespace BTCPayServer.Tests
|
namespace BTCPayServer.Tests
|
||||||
{
|
{
|
||||||
|
@ -521,22 +522,22 @@ namespace BTCPayServer.Tests
|
||||||
var evtName = request["event"]["name"].Value<string>();
|
var evtName = request["event"]["name"].Value<string>();
|
||||||
switch (evtName)
|
switch (evtName)
|
||||||
{
|
{
|
||||||
case "invoice_created":
|
case InvoiceEvent.Created:
|
||||||
tester.ExplorerNode.SendToAddress(url.Address, url.Amount);
|
tester.ExplorerNode.SendToAddress(url.Address, url.Amount);
|
||||||
break;
|
break;
|
||||||
case "invoice_receivedPayment":
|
case InvoiceEvent.ReceivedPayment:
|
||||||
receivedPayment = true;
|
receivedPayment = true;
|
||||||
break;
|
break;
|
||||||
case "invoice_paidInFull":
|
case InvoiceEvent.PaidInFull:
|
||||||
Assert.True(receivedPayment);
|
Assert.True(receivedPayment);
|
||||||
tester.ExplorerNode.Generate(6);
|
tester.ExplorerNode.Generate(6);
|
||||||
paid = true;
|
paid = true;
|
||||||
break;
|
break;
|
||||||
case "invoice_confirmed":
|
case InvoiceEvent.Confirmed:
|
||||||
Assert.True(paid);
|
Assert.True(paid);
|
||||||
confirmed = true;
|
confirmed = true;
|
||||||
break;
|
break;
|
||||||
case "invoice_completed":
|
case InvoiceEvent.Completed:
|
||||||
Assert.True(paid); //TODO: Fix, out of order event mean we can receive invoice_confirmed after invoice_complete
|
Assert.True(paid); //TODO: Fix, out of order event mean we can receive invoice_confirmed after invoice_complete
|
||||||
completed = true;
|
completed = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -73,10 +73,10 @@ namespace BTCPayServer.Controllers
|
||||||
Skip = offset,
|
Skip = offset,
|
||||||
EndDate = dateEnd,
|
EndDate = dateEnd,
|
||||||
StartDate = dateStart,
|
StartDate = dateStart,
|
||||||
OrderId = orderId == null ? null : new[] {orderId},
|
OrderId = orderId == null ? null : new[] { orderId },
|
||||||
ItemCode = itemCode == null ? null : new[] {itemCode},
|
ItemCode = itemCode == null ? null : new[] { itemCode },
|
||||||
Status = status == null ? null : new[] {status},
|
Status = status == null ? null : new[] { status },
|
||||||
StoreId = new[] {this.HttpContext.GetStoreData().Id}
|
StoreId = new[] { this.HttpContext.GetStoreData().Id }
|
||||||
};
|
};
|
||||||
|
|
||||||
var entities = (await _InvoiceRepository.GetInvoices(query))
|
var entities = (await _InvoiceRepository.GetInvoices(query))
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
|
using BTCPayServer.Events;
|
||||||
using BTCPayServer.Logging;
|
using BTCPayServer.Logging;
|
||||||
using BTCPayServer.Models;
|
using BTCPayServer.Models;
|
||||||
using BTCPayServer.Payments;
|
using BTCPayServer.Payments;
|
||||||
|
@ -159,7 +160,7 @@ namespace BTCPayServer.Controllers
|
||||||
entity.PosData = invoice.PosData;
|
entity.PosData = invoice.PosData;
|
||||||
entity = await _InvoiceRepository.CreateInvoiceAsync(store.Id, entity, logs, _NetworkProvider);
|
entity = await _InvoiceRepository.CreateInvoiceAsync(store.Id, entity, logs, _NetworkProvider);
|
||||||
await fetchingAll;
|
await fetchingAll;
|
||||||
_EventAggregator.Publish(new Events.InvoiceEvent(entity.EntityToDTO(_NetworkProvider), 1001, "invoice_created"));
|
_EventAggregator.Publish(new Events.InvoiceEvent(entity.EntityToDTO(_NetworkProvider), 1001, InvoiceEvent.Created));
|
||||||
var resp = entity.EntityToDTO(_NetworkProvider);
|
var resp = entity.EntityToDTO(_NetworkProvider);
|
||||||
return new DataWrapper<InvoiceResponse>(resp) { Facade = "pos/invoice" };
|
return new DataWrapper<InvoiceResponse>(resp) { Facade = "pos/invoice" };
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,14 +341,14 @@ namespace BTCPayServer.HostedServices
|
||||||
// we need to use the status in the event and not in the invoice. The invoice might now be in another status.
|
// we need to use the status in the event and not in the invoice. The invoice might now be in another status.
|
||||||
if (invoice.FullNotifications)
|
if (invoice.FullNotifications)
|
||||||
{
|
{
|
||||||
if (e.Name == "invoice_expired" ||
|
if (e.Name == InvoiceEvent.Expired ||
|
||||||
e.Name == "invoice_paidInFull" ||
|
e.Name == InvoiceEvent.PaidInFull ||
|
||||||
e.Name == "invoice_failedToConfirm" ||
|
e.Name == InvoiceEvent.FailedToConfirm ||
|
||||||
e.Name == "invoice_markedInvalid" ||
|
e.Name == InvoiceEvent.MarkedInvalid ||
|
||||||
e.Name == "invoice_markedComplete" ||
|
e.Name == InvoiceEvent.MarkedCompleted ||
|
||||||
e.Name == "invoice_failedToConfirm" ||
|
e.Name == InvoiceEvent.FailedToConfirm ||
|
||||||
e.Name == "invoice_completed" ||
|
e.Name == InvoiceEvent.Completed ||
|
||||||
e.Name == "invoice_expiredPaidPartial"
|
e.Name == InvoiceEvent.ExpiredPaidPartial
|
||||||
)
|
)
|
||||||
tasks.Add(Notify(invoice));
|
tasks.Add(Notify(invoice));
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,7 +467,7 @@ retry:
|
||||||
{
|
{
|
||||||
var statusSet = queryObject.OrderId.ToHashSet();
|
var statusSet = queryObject.OrderId.ToHashSet();
|
||||||
query = query.Where(i => statusSet.Contains(i.OrderId));
|
query = query.Where(i => statusSet.Contains(i.OrderId));
|
||||||
}
|
}
|
||||||
if (queryObject.ItemCode != null && queryObject.ItemCode.Length > 0)
|
if (queryObject.ItemCode != null && queryObject.ItemCode.Length > 0)
|
||||||
{
|
{
|
||||||
var statusSet = queryObject.ItemCode.ToHashSet();
|
var statusSet = queryObject.ItemCode.ToHashSet();
|
||||||
|
|
Loading…
Add table
Reference in a new issue