mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-1943] Implement provider client invoice report (#4178)
* Update ProviderInvoiceItem SQL configuration * Implement provider client invoice export * Add tests * Run dotnet format * Fixed SPROC backwards compatibility issue
This commit is contained in:
@ -42,6 +42,28 @@ public class ProviderBillingController(
|
||||
return TypedResults.Ok(response);
|
||||
}
|
||||
|
||||
[HttpGet("invoices/{invoiceId}")]
|
||||
public async Task<IResult> GenerateClientInvoiceReportAsync([FromRoute] Guid providerId, string invoiceId)
|
||||
{
|
||||
var (provider, result) = await GetAuthorizedBillableProviderOrResultAsync(providerId);
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var reportContent = await providerBillingService.GenerateClientInvoiceReport(invoiceId);
|
||||
|
||||
if (reportContent == null)
|
||||
{
|
||||
return TypedResults.NotFound();
|
||||
}
|
||||
|
||||
return TypedResults.File(
|
||||
reportContent,
|
||||
"text/csv");
|
||||
}
|
||||
|
||||
[HttpGet("payment-information")]
|
||||
public async Task<IResult> GetPaymentInformationAsync([FromRoute] Guid providerId)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ public record InvoicesResponse(
|
||||
}
|
||||
|
||||
public record InvoiceDTO(
|
||||
string Id,
|
||||
DateTime Date,
|
||||
string Number,
|
||||
decimal Total,
|
||||
@ -21,6 +22,7 @@ public record InvoiceDTO(
|
||||
string PdfUrl)
|
||||
{
|
||||
public static InvoiceDTO From(Invoice invoice) => new(
|
||||
invoice.Id,
|
||||
invoice.Created,
|
||||
invoice.Number,
|
||||
invoice.Total / 100M,
|
||||
|
Reference in New Issue
Block a user