Fix invoice search not working on transaction id

This commit is contained in:
nicolas.dorier
2018-11-02 14:26:13 +09:00
parent 1d7081d8b8
commit 05b0f6d0f7
2 changed files with 16 additions and 7 deletions

View File

@@ -596,7 +596,7 @@ namespace BTCPayServer.Tests
acc.RegisterDerivationScheme("BTC");
var btcDerivationScheme = acc.DerivationScheme;
acc.RegisterDerivationScheme("LTC");
var walletController = tester.PayTester.GetController<WalletsController>(acc.UserId);
WalletId walletId = new WalletId(acc.StoreId, "LTC");
var rescan = Assert.IsType<RescanWalletModel>(Assert.IsType<ViewResult>(walletController.WalletRescan(walletId).Result).Model);
@@ -624,10 +624,10 @@ namespace BTCPayServer.Tests
Assert.IsType<RedirectToActionResult>(walletController.WalletRescan(walletId, rescan).Result);
while(true)
while (true)
{
rescan = Assert.IsType<RescanWalletModel>(Assert.IsType<ViewResult>(walletController.WalletRescan(walletId).Result).Model);
if(rescan.Progress == null && rescan.LastSuccess != null)
if (rescan.Progress == null && rescan.LastSuccess != null)
{
if (rescan.LastSuccess.Found == 0)
continue;
@@ -790,7 +790,7 @@ namespace BTCPayServer.Tests
output.Value = payment2;
output.ScriptPubKey = invoiceAddress.ScriptPubKey;
using(var cts = new CancellationTokenSource(10000))
using (var cts = new CancellationTokenSource(10000))
using (var listener = tester.ExplorerClient.CreateNotificationSession())
{
listener.ListenAllDerivationSchemes();
@@ -1513,7 +1513,7 @@ namespace BTCPayServer.Tests
var ctx = tester.PayTester.GetService<ApplicationDbContextFactory>().CreateContext();
Assert.Equal(0, invoice.CryptoInfo[0].TxCount);
Assert.True(invoice.MinerFees.ContainsKey("BTC"));
Assert.Equal(100m, invoice.MinerFees["BTC"].SatoshiPerBytes);
Assert.Contains(invoice.MinerFees["BTC"].SatoshiPerBytes, new[] { 100.0m, 20.0m });
Eventually(() =>
{
var textSearchResult = tester.PayTester.InvoiceRepository.GetInvoices(new InvoiceQuery()
@@ -1625,7 +1625,7 @@ namespace BTCPayServer.Tests
}, Facade.Merchant);
invoiceAddress = BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network);
cashCow.SendToAddress(invoiceAddress, invoice.BtcDue + Money.Coins(1));
var txId = cashCow.SendToAddress(invoiceAddress, invoice.BtcDue + Money.Coins(1));
Eventually(() =>
{
@@ -1633,6 +1633,13 @@ namespace BTCPayServer.Tests
Assert.Equal("paid", localInvoice.Status);
Assert.Equal(Money.Zero, localInvoice.BtcDue);
Assert.Equal("paidOver", (string)((JValue)localInvoice.ExceptionStatus).Value);
var textSearchResult = tester.PayTester.InvoiceRepository.GetInvoices(new InvoiceQuery()
{
StoreId = new[] { user.StoreId },
TextSearch = txId.ToString()
}).GetAwaiter().GetResult();
Assert.Single(textSearchResult);
});
cashCow.Generate(1);
@@ -1714,7 +1721,7 @@ namespace BTCPayServer.Tests
}
}
public static RateProviderFactory CreateBTCPayRateFactory()
public static RateProviderFactory CreateBTCPayRateFactory()
{
return new RateProviderFactory(CreateMemoryCache(), null, new CoinAverageSettings());
}