mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Archive Invoice
This commit is contained in:
@@ -158,7 +158,8 @@ retry:
|
||||
Status = invoice.StatusString,
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
ItemCode = invoice.ProductInformation.ItemCode,
|
||||
CustomerEmail = invoice.RefundMail
|
||||
CustomerEmail = invoice.RefundMail,
|
||||
Archived = false
|
||||
});
|
||||
|
||||
foreach (var paymentMethod in invoice.GetPaymentMethods())
|
||||
@@ -396,6 +397,17 @@ retry:
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ToggleInvoiceArchival(string invoiceId, bool archived)
|
||||
{
|
||||
using (var context = _ContextFactory.CreateContext())
|
||||
{
|
||||
var invoiceData = await context.FindAsync<InvoiceData>(invoiceId).ConfigureAwait(false);
|
||||
if (invoiceData == null || invoiceData.Archived == archived )
|
||||
return;
|
||||
invoiceData.Archived = archived;
|
||||
await context.SaveChangesAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
public async Task UpdatePaidInvoiceToInvalid(string invoiceId)
|
||||
{
|
||||
using (var context = _ContextFactory.CreateContext())
|
||||
@@ -499,6 +511,7 @@ retry:
|
||||
{
|
||||
entity.BuyerInformation.BuyerEmail = entity.RefundMail;
|
||||
}
|
||||
entity.Archived = invoice.Archived;
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -513,6 +526,11 @@ retry:
|
||||
{
|
||||
IQueryable<Data.InvoiceData> query = context.Invoices;
|
||||
|
||||
if (!queryObject.IncludeArchived)
|
||||
{
|
||||
query = query.Where(i => !i.Archived);
|
||||
}
|
||||
|
||||
if (queryObject.InvoiceId != null && queryObject.InvoiceId.Length > 0)
|
||||
{
|
||||
var statusSet = queryObject.InvoiceId.ToHashSet().ToArray();
|
||||
@@ -838,5 +856,6 @@ retry:
|
||||
public bool IncludeAddresses { get; set; }
|
||||
|
||||
public bool IncludeEvents { get; set; }
|
||||
public bool IncludeArchived { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user