diff --git a/BTCPayServer.Tests/CrowdfundTests.cs b/BTCPayServer.Tests/CrowdfundTests.cs index 0de3705e1..a80fa8869 100644 --- a/BTCPayServer.Tests/CrowdfundTests.cs +++ b/BTCPayServer.Tests/CrowdfundTests.cs @@ -285,11 +285,12 @@ namespace BTCPayServer.Tests Assert.Equal(0m, model.Info.CurrentPendingAmount); invoiceAddress = BitcoinAddress.Create(invoice.CryptoInfo[0].Address, tester.ExplorerNode.Network); tester.ExplorerNode.SendToAddress(invoiceAddress, Money.Coins(0.5m)); + tester.ExplorerNode.SendToAddress(invoiceAddress, Money.Coins(0.2m)); TestUtils.Eventually(() => { model = Assert.IsType(Assert .IsType(publicApps.ViewCrowdfund(appId, String.Empty).Result).Model); - Assert.Equal(0.5m, model.Info.CurrentPendingAmount); + Assert.Equal(0.7m, model.Info.CurrentPendingAmount); }); } diff --git a/BTCPayServer/Controllers/AppsController.Crowdfund.cs b/BTCPayServer/Controllers/AppsController.Crowdfund.cs index 761539232..90894e755 100644 --- a/BTCPayServer/Controllers/AppsController.Crowdfund.cs +++ b/BTCPayServer/Controllers/AppsController.Crowdfund.cs @@ -15,6 +15,10 @@ namespace BTCPayServer.Controllers public string AppId { get; set; } public object Settings { get; set; } public string StoreId { get; set; } + public override string ToString() + { + return String.Empty; + } } diff --git a/BTCPayServer/Services/Apps/AppService.cs b/BTCPayServer/Services/Apps/AppService.cs index 179372f1a..e0a66bb20 100644 --- a/BTCPayServer/Services/Apps/AppService.cs +++ b/BTCPayServer/Services/Apps/AppService.cs @@ -334,7 +334,7 @@ namespace BTCPayServer.Services.Apps // If the user get a donation via other mean, he can register an invoice manually for such amount // then mark the invoice as complete var payments = p.GetPayments(); - if (payments.Count == 0 && + if (payments.Count == 0 && p.ExceptionStatus == InvoiceExceptionStatus.Marked && p.Status == InvoiceStatus.Complete) return new[] { (Key: p.ProductInformation.Currency, Value: p.ProductInformation.Price) }; @@ -346,11 +346,11 @@ namespace BTCPayServer.Services.Apps // Else, we just sum the payments return payments - .GroupBy(pay => pay.GetPaymentMethodId()) - .Select(payGroup => (Key: payGroup.Key.ToString(), - Value: payGroup.Select(pay => pay.GetCryptoPaymentData().GetValue()).Sum())).ToArray(); + .Select(pay => (Key: pay.GetPaymentMethodId().ToString(), Value: pay.GetCryptoPaymentData().GetValue())) + .ToArray(); }) - .ToDictionary(p => p.Key, p => p.Value); + .GroupBy(p => p.Key) + .ToDictionary(p => p.Key, p => p.Select(v => v.Value).Sum()); } private class PosHolder