1
0
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:
Alex Morask
2024-06-14 12:26:49 -04:00
committed by GitHub
parent b392cc962d
commit 83604cceb1
28 changed files with 1247 additions and 32 deletions

View File

@ -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)
{

View File

@ -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,