mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-12 02:08:32 +01:00
expand list invoices search
This commit is contained in:
parent
2ccf007b9a
commit
7e321d4016
5 changed files with 23 additions and 16 deletions
|
@ -66,17 +66,17 @@ namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
if (dateEnd != null)
|
if (dateEnd != null)
|
||||||
dateEnd = dateEnd.Value + TimeSpan.FromDays(1); //Should include the end day
|
dateEnd = dateEnd.Value + TimeSpan.FromDays(1); //Should include the end day
|
||||||
|
|
||||||
var query = new InvoiceQuery()
|
var query = new InvoiceQuery()
|
||||||
{
|
{
|
||||||
Count = limit,
|
Count = limit,
|
||||||
Skip = offset,
|
Skip = offset,
|
||||||
EndDate = dateEnd,
|
EndDate = dateEnd,
|
||||||
StartDate = dateStart,
|
StartDate = dateStart,
|
||||||
OrderId = orderId,
|
OrderId = orderId == null ? null : new[] {orderId},
|
||||||
ItemCode = itemCode,
|
ItemCode = itemCode == null ? null : new[] {itemCode},
|
||||||
Status = status == null ? null : new[] { status },
|
Status = status == null ? null : new[] {status},
|
||||||
StoreId = new[] { this.HttpContext.GetStoreData().Id }
|
StoreId = new[] {this.HttpContext.GetStoreData().Id}
|
||||||
};
|
};
|
||||||
|
|
||||||
var entities = (await _InvoiceRepository.GetInvoices(query))
|
var entities = (await _InvoiceRepository.GetInvoices(query))
|
||||||
|
|
|
@ -473,7 +473,9 @@ namespace BTCPayServer.Controllers
|
||||||
: r,
|
: r,
|
||||||
Status = filterString.Filters.ContainsKey("status") ? filterString.Filters["status"].ToArray() : null,
|
Status = filterString.Filters.ContainsKey("status") ? filterString.Filters["status"].ToArray() : null,
|
||||||
ExceptionStatus = filterString.Filters.ContainsKey("exceptionstatus") ? filterString.Filters["exceptionstatus"].ToArray() : null,
|
ExceptionStatus = filterString.Filters.ContainsKey("exceptionstatus") ? filterString.Filters["exceptionstatus"].ToArray() : null,
|
||||||
StoreId = filterString.Filters.ContainsKey("storeid") ? filterString.Filters["storeid"].ToArray() : null
|
StoreId = filterString.Filters.ContainsKey("storeid") ? filterString.Filters["storeid"].ToArray() : null,
|
||||||
|
ItemCode = filterString.Filters.ContainsKey("itemcode") ? filterString.Filters["itemcode"].ToArray() : null,
|
||||||
|
OrderId = filterString.Filters.ContainsKey("orderid") ? filterString.Filters["orderid"].ToArray() : null
|
||||||
});
|
});
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -272,7 +272,7 @@ namespace BTCPayServer.Hubs
|
||||||
{
|
{
|
||||||
return await _InvoiceRepository.GetInvoices(new InvoiceQuery()
|
return await _InvoiceRepository.GetInvoices(new InvoiceQuery()
|
||||||
{
|
{
|
||||||
OrderId = appId == null? null :$"{CrowdfundInvoiceOrderIdPrefix}{appId}",
|
OrderId = appId == null? null : new []{$"{CrowdfundInvoiceOrderIdPrefix}{appId}"},
|
||||||
Status = new string[]{
|
Status = new string[]{
|
||||||
InvoiceState.ToString(InvoiceStatus.New),
|
InvoiceState.ToString(InvoiceStatus.New),
|
||||||
InvoiceState.ToString(InvoiceStatus.Paid),
|
InvoiceState.ToString(InvoiceStatus.Paid),
|
||||||
|
@ -281,7 +281,5 @@ namespace BTCPayServer.Hubs
|
||||||
StartDate = startDate
|
StartDate = startDate
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,11 +451,16 @@ retry:
|
||||||
if (queryObject.EndDate != null)
|
if (queryObject.EndDate != null)
|
||||||
query = query.Where(i => i.Created <= queryObject.EndDate.Value);
|
query = query.Where(i => i.Created <= queryObject.EndDate.Value);
|
||||||
|
|
||||||
if (queryObject.ItemCode != null)
|
if (queryObject.OrderId != null && queryObject.OrderId.Length > 0)
|
||||||
query = query.Where(i => i.ItemCode == queryObject.ItemCode);
|
{
|
||||||
|
var statusSet = queryObject.OrderId.ToHashSet();
|
||||||
if (queryObject.OrderId != null)
|
query = query.Where(i => statusSet.Contains(i.OrderId));
|
||||||
query = query.Where(i => i.OrderId == queryObject.OrderId);
|
}
|
||||||
|
if (queryObject.ItemCode != null && queryObject.ItemCode.Length > 0)
|
||||||
|
{
|
||||||
|
var statusSet = queryObject.ItemCode.ToHashSet();
|
||||||
|
query = query.Where(i => statusSet.Contains(i.ItemCode));
|
||||||
|
}
|
||||||
|
|
||||||
if (queryObject.Status != null && queryObject.Status.Length > 0)
|
if (queryObject.Status != null && queryObject.Status.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -666,12 +671,12 @@ retry:
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string OrderId
|
public string[] OrderId
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ItemCode
|
public string[] ItemCode
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>storeid:id</code> for filtering a specific store</li>
|
<li><code>storeid:id</code> for filtering a specific store</li>
|
||||||
|
<li><code>orderid:id</code> for filtering a specific order</li>
|
||||||
|
<li><code>itemcode:code</code> for filtering a specific type of item purchased through the pos or crowdfund apps</li>
|
||||||
<li><code>status:(expired|invalid|complete|confirmed|paid|new)</code> for filtering a specific status</li>
|
<li><code>status:(expired|invalid|complete|confirmed|paid|new)</code> for filtering a specific status</li>
|
||||||
<li><code>exceptionstatus:(paidover|paidlate|paidpartial)</code> for filtering a specific exception state</li>
|
<li><code>exceptionstatus:(paidover|paidlate|paidpartial)</code> for filtering a specific exception state</li>
|
||||||
<li><code>unusual:(true|false)</code> for filtering invoices which might requires merchant attention (those invalid or with an exceptionstatus)</li>
|
<li><code>unusual:(true|false)</code> for filtering invoices which might requires merchant attention (those invalid or with an exceptionstatus)</li>
|
||||||
|
|
Loading…
Add table
Reference in a new issue