mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-15 12:20:16 +01:00
Properly aggregate contributions amount
This commit is contained in:
parent
3bbf4de5d2
commit
119f82fd4e
3 changed files with 11 additions and 6 deletions
|
@ -285,11 +285,12 @@ namespace BTCPayServer.Tests
|
||||||
Assert.Equal(0m, model.Info.CurrentPendingAmount);
|
Assert.Equal(0m, model.Info.CurrentPendingAmount);
|
||||||
invoiceAddress = BitcoinAddress.Create(invoice.CryptoInfo[0].Address, tester.ExplorerNode.Network);
|
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.5m));
|
||||||
|
tester.ExplorerNode.SendToAddress(invoiceAddress, Money.Coins(0.2m));
|
||||||
TestUtils.Eventually(() =>
|
TestUtils.Eventually(() =>
|
||||||
{
|
{
|
||||||
model = Assert.IsType<ViewCrowdfundViewModel>(Assert
|
model = Assert.IsType<ViewCrowdfundViewModel>(Assert
|
||||||
.IsType<ViewResult>(publicApps.ViewCrowdfund(appId, String.Empty).Result).Model);
|
.IsType<ViewResult>(publicApps.ViewCrowdfund(appId, String.Empty).Result).Model);
|
||||||
Assert.Equal(0.5m, model.Info.CurrentPendingAmount);
|
Assert.Equal(0.7m, model.Info.CurrentPendingAmount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,10 @@ namespace BTCPayServer.Controllers
|
||||||
public string AppId { get; set; }
|
public string AppId { get; set; }
|
||||||
public object Settings { get; set; }
|
public object Settings { get; set; }
|
||||||
public string StoreId { get; set; }
|
public string StoreId { get; set; }
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -346,11 +346,11 @@ namespace BTCPayServer.Services.Apps
|
||||||
|
|
||||||
// Else, we just sum the payments
|
// Else, we just sum the payments
|
||||||
return payments
|
return payments
|
||||||
.GroupBy(pay => pay.GetPaymentMethodId())
|
.Select(pay => (Key: pay.GetPaymentMethodId().ToString(), Value: pay.GetCryptoPaymentData().GetValue()))
|
||||||
.Select(payGroup => (Key: payGroup.Key.ToString(),
|
.ToArray();
|
||||||
Value: payGroup.Select(pay => pay.GetCryptoPaymentData().GetValue()).Sum())).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
|
private class PosHolder
|
||||||
|
|
Loading…
Add table
Reference in a new issue