mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Grerenfield: Add availableStatusesForManualMarking to Invoice Data (#2934)
closes ##2933
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Globalization;
|
||||
@@ -387,6 +388,17 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
}
|
||||
private InvoiceData ToModel(InvoiceEntity entity)
|
||||
{
|
||||
var statuses = new List<InvoiceStatus>();
|
||||
var state = entity.GetInvoiceState();
|
||||
if (state.CanMarkComplete())
|
||||
{
|
||||
statuses.Add(InvoiceStatus.Settled);
|
||||
}
|
||||
|
||||
if (state.CanMarkInvalid())
|
||||
{
|
||||
statuses.Add(InvoiceStatus.Invalid);
|
||||
}
|
||||
return new InvoiceData()
|
||||
{
|
||||
StoreId = entity.StoreId,
|
||||
@@ -401,6 +413,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
AdditionalStatus = entity.ExceptionStatus,
|
||||
Currency = entity.Currency,
|
||||
Metadata = entity.Metadata.ToJObject(),
|
||||
AvailableStatusesForManualMarking = statuses.ToArray(),
|
||||
Checkout = new CreateInvoiceRequest.CheckoutOptions()
|
||||
{
|
||||
Expiration = entity.ExpirationTime - entity.InvoiceTime,
|
||||
|
||||
Reference in New Issue
Block a user