mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Fix crash if impossible to get the network of a payment
This commit is contained in:
@@ -144,6 +144,7 @@ namespace BTCPayServer.Controllers
|
|||||||
.Select(o => new PaymentMethodId(o, PaymentTypes.BTCLike))
|
.Select(o => new PaymentMethodId(o, PaymentTypes.BTCLike))
|
||||||
.ToList();
|
.ToList();
|
||||||
var defaultRefund = invoice.Payments.Select(p => p.GetBlob(_NetworkProvider))
|
var defaultRefund = invoice.Payments.Select(p => p.GetBlob(_NetworkProvider))
|
||||||
|
.Where(p => p != null)
|
||||||
.Select(p => p.GetPaymentMethodId().CryptoCode)
|
.Select(p => p.GetPaymentMethodId().CryptoCode)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
// TODO: What if no option?
|
// TODO: What if no option?
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace BTCPayServer.Data
|
|||||||
PaymentEntity paymentEntity = null;
|
PaymentEntity paymentEntity = null;
|
||||||
if (network == null)
|
if (network == null)
|
||||||
{
|
{
|
||||||
paymentEntity = NBitcoin.JsonConverters.Serializer.ToObject<PaymentEntity>(unziped, null);
|
return null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -484,6 +484,8 @@ retry:
|
|||||||
entity.Payments = invoice.Payments.Select(p =>
|
entity.Payments = invoice.Payments.Select(p =>
|
||||||
{
|
{
|
||||||
var paymentEntity = p.GetBlob(_Networks);
|
var paymentEntity = p.GetBlob(_Networks);
|
||||||
|
if (paymentEntity is null)
|
||||||
|
return null;
|
||||||
// PaymentEntity on version 0 does not have their own fee, because it was assumed that the payment method have fixed fee.
|
// PaymentEntity on version 0 does not have their own fee, because it was assumed that the payment method have fixed fee.
|
||||||
// We want to hide this legacy detail in InvoiceRepository, so we fetch the fee from the PaymentMethod and assign it to the PaymentEntity.
|
// We want to hide this legacy detail in InvoiceRepository, so we fetch the fee from the PaymentMethod and assign it to the PaymentEntity.
|
||||||
if (paymentEntity.Version == 0)
|
if (paymentEntity.Version == 0)
|
||||||
@@ -497,6 +499,7 @@ retry:
|
|||||||
|
|
||||||
return paymentEntity;
|
return paymentEntity;
|
||||||
})
|
})
|
||||||
|
.Where(p => p != null)
|
||||||
.OrderBy(a => a.ReceivedTime).ToList();
|
.OrderBy(a => a.ReceivedTime).ToList();
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
var state = invoice.GetInvoiceState();
|
var state = invoice.GetInvoiceState();
|
||||||
|
|||||||
Reference in New Issue
Block a user