mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-19 06:54:19 +01:00
Fix invoice search not working on transaction id
This commit is contained in:
@@ -596,7 +596,7 @@ namespace BTCPayServer.Tests
|
|||||||
acc.RegisterDerivationScheme("BTC");
|
acc.RegisterDerivationScheme("BTC");
|
||||||
var btcDerivationScheme = acc.DerivationScheme;
|
var btcDerivationScheme = acc.DerivationScheme;
|
||||||
acc.RegisterDerivationScheme("LTC");
|
acc.RegisterDerivationScheme("LTC");
|
||||||
|
|
||||||
var walletController = tester.PayTester.GetController<WalletsController>(acc.UserId);
|
var walletController = tester.PayTester.GetController<WalletsController>(acc.UserId);
|
||||||
WalletId walletId = new WalletId(acc.StoreId, "LTC");
|
WalletId walletId = new WalletId(acc.StoreId, "LTC");
|
||||||
var rescan = Assert.IsType<RescanWalletModel>(Assert.IsType<ViewResult>(walletController.WalletRescan(walletId).Result).Model);
|
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);
|
Assert.IsType<RedirectToActionResult>(walletController.WalletRescan(walletId, rescan).Result);
|
||||||
|
|
||||||
while(true)
|
while (true)
|
||||||
{
|
{
|
||||||
rescan = Assert.IsType<RescanWalletModel>(Assert.IsType<ViewResult>(walletController.WalletRescan(walletId).Result).Model);
|
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)
|
if (rescan.LastSuccess.Found == 0)
|
||||||
continue;
|
continue;
|
||||||
@@ -790,7 +790,7 @@ namespace BTCPayServer.Tests
|
|||||||
output.Value = payment2;
|
output.Value = payment2;
|
||||||
output.ScriptPubKey = invoiceAddress.ScriptPubKey;
|
output.ScriptPubKey = invoiceAddress.ScriptPubKey;
|
||||||
|
|
||||||
using(var cts = new CancellationTokenSource(10000))
|
using (var cts = new CancellationTokenSource(10000))
|
||||||
using (var listener = tester.ExplorerClient.CreateNotificationSession())
|
using (var listener = tester.ExplorerClient.CreateNotificationSession())
|
||||||
{
|
{
|
||||||
listener.ListenAllDerivationSchemes();
|
listener.ListenAllDerivationSchemes();
|
||||||
@@ -1513,7 +1513,7 @@ namespace BTCPayServer.Tests
|
|||||||
var ctx = tester.PayTester.GetService<ApplicationDbContextFactory>().CreateContext();
|
var ctx = tester.PayTester.GetService<ApplicationDbContextFactory>().CreateContext();
|
||||||
Assert.Equal(0, invoice.CryptoInfo[0].TxCount);
|
Assert.Equal(0, invoice.CryptoInfo[0].TxCount);
|
||||||
Assert.True(invoice.MinerFees.ContainsKey("BTC"));
|
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(() =>
|
Eventually(() =>
|
||||||
{
|
{
|
||||||
var textSearchResult = tester.PayTester.InvoiceRepository.GetInvoices(new InvoiceQuery()
|
var textSearchResult = tester.PayTester.InvoiceRepository.GetInvoices(new InvoiceQuery()
|
||||||
@@ -1625,7 +1625,7 @@ namespace BTCPayServer.Tests
|
|||||||
}, Facade.Merchant);
|
}, Facade.Merchant);
|
||||||
invoiceAddress = BitcoinAddress.Create(invoice.BitcoinAddress, cashCow.Network);
|
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(() =>
|
Eventually(() =>
|
||||||
{
|
{
|
||||||
@@ -1633,6 +1633,13 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Equal("paid", localInvoice.Status);
|
Assert.Equal("paid", localInvoice.Status);
|
||||||
Assert.Equal(Money.Zero, localInvoice.BtcDue);
|
Assert.Equal(Money.Zero, localInvoice.BtcDue);
|
||||||
Assert.Equal("paidOver", (string)((JValue)localInvoice.ExceptionStatus).Value);
|
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);
|
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());
|
return new RateProviderFactory(CreateMemoryCache(), null, new CoinAverageSettings());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,6 +295,8 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
{
|
{
|
||||||
using (var tx = _Engine.GetTransaction())
|
using (var tx = _Engine.GetTransaction())
|
||||||
{
|
{
|
||||||
|
var terms = searchTerms.Split(null);
|
||||||
|
searchTerms = string.Join(' ', terms.Select(t => t.Length > 50 ? t.Substring(0, 50) : t).ToArray());
|
||||||
return tx.TextSearch("InvoiceSearch").Block(searchTerms)
|
return tx.TextSearch("InvoiceSearch").Block(searchTerms)
|
||||||
.GetDocumentIDs()
|
.GetDocumentIDs()
|
||||||
.Select(id => Encoders.Base58.EncodeData(id))
|
.Select(id => Encoders.Base58.EncodeData(id))
|
||||||
|
|||||||
Reference in New Issue
Block a user