mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Added filter for status when getting invoices (#4866)
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Bit.Api.Billing.Models.Responses;
|
||||
#nullable enable
|
||||
using Bit.Api.Billing.Models.Responses;
|
||||
using Bit.Core.Billing.Services;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Utilities;
|
||||
@ -43,7 +44,7 @@ public class AccountsBillingController(
|
||||
}
|
||||
|
||||
[HttpGet("invoices")]
|
||||
public async Task<IResult> GetInvoicesAsync([FromQuery] string startAfter = null)
|
||||
public async Task<IResult> GetInvoicesAsync([FromQuery] string? status = null, [FromQuery] string? startAfter = null)
|
||||
{
|
||||
var user = await userService.GetUserByPrincipalAsync(User);
|
||||
if (user == null)
|
||||
@ -54,6 +55,7 @@ public class AccountsBillingController(
|
||||
var invoices = await paymentHistoryService.GetInvoiceHistoryAsync(
|
||||
user,
|
||||
5,
|
||||
status,
|
||||
startAfter);
|
||||
|
||||
return TypedResults.Ok(invoices);
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Bit.Api.Billing.Models.Requests;
|
||||
#nullable enable
|
||||
using Bit.Api.Billing.Models.Requests;
|
||||
using Bit.Api.Billing.Models.Responses;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Billing.Services;
|
||||
@ -63,7 +64,7 @@ public class OrganizationBillingController(
|
||||
}
|
||||
|
||||
[HttpGet("invoices")]
|
||||
public async Task<IResult> GetInvoicesAsync([FromRoute] Guid organizationId, [FromQuery] string startAfter = null)
|
||||
public async Task<IResult> GetInvoicesAsync([FromRoute] Guid organizationId, [FromQuery] string? status = null, [FromQuery] string? startAfter = null)
|
||||
{
|
||||
if (!await currentContext.ViewBillingHistory(organizationId))
|
||||
{
|
||||
@ -80,6 +81,7 @@ public class OrganizationBillingController(
|
||||
var invoices = await paymentHistoryService.GetInvoiceHistoryAsync(
|
||||
organization,
|
||||
5,
|
||||
status,
|
||||
startAfter);
|
||||
|
||||
return TypedResults.Ok(invoices);
|
||||
|
Reference in New Issue
Block a user