mirror of
https://github.com/bitwarden/server.git
synced 2025-07-17 15:40:59 -05:00
[AC-2567] Billing Performance Improvements (#4143)
* Moved AccountsBilling controller to be owned by Billing * Added org billing history endpoint * Updated GetBillingInvoicesAsync to only retrieve paid, open, and uncollectible invoices, and added option to limit results * Removed invoices and transactions from GetBillingAsync * Limiting the number of invoices and transactions returned * Moved Billing models to Billing namespace * Split billing info and billing history objects * Removed billing method GetBillingBalanceAndSourceAsync * Removed unused using * Cleaned up BillingInfo a bit * Update migration scripts to use `CREATE OR ALTER` instead of checking for the `OBJECT_ID` * Applying limit to aggregated invoices after they return from Stripe
This commit is contained in:
@ -3,10 +3,10 @@
|
||||
@model BillingInformationModel
|
||||
|
||||
@{
|
||||
var canManageTransactions = Model.Entity == "User" ? AccessControlService.UserHasPermission(Permission.User_BillingInformation_CreateEditTransaction)
|
||||
var canManageTransactions = Model.Entity == "User" ? AccessControlService.UserHasPermission(Permission.User_BillingInformation_CreateEditTransaction)
|
||||
: AccessControlService.UserHasPermission(Permission.Org_BillingInformation_CreateEditTransaction);
|
||||
|
||||
var canDownloadInvoice = Model.Entity == "User" ? AccessControlService.UserHasPermission(Permission.User_BillingInformation_DownloadInvoice)
|
||||
var canDownloadInvoice = Model.Entity == "User" ? AccessControlService.UserHasPermission(Permission.User_BillingInformation_DownloadInvoice)
|
||||
: AccessControlService.UserHasPermission(Permission.Org_BillingInformation_DownloadInvoice);
|
||||
}
|
||||
|
||||
@ -16,11 +16,11 @@
|
||||
|
||||
<dt class="col-sm-4 col-lg-3">Invoices</dt>
|
||||
<dd class="col-sm-8 col-lg-9">
|
||||
@if(Model.BillingInfo.Invoices?.Any() ?? false)
|
||||
@if(Model.BillingHistoryInfo.Invoices?.Any() ?? false)
|
||||
{
|
||||
<table class="table">
|
||||
<tbody>
|
||||
@foreach(var invoice in Model.BillingInfo.Invoices)
|
||||
@foreach(var invoice in Model.BillingHistoryInfo.Invoices)
|
||||
{
|
||||
<tr>
|
||||
<td>@invoice.Date</td>
|
||||
@ -28,7 +28,7 @@
|
||||
</td>
|
||||
<td>@invoice.Amount.ToString("C")</td>
|
||||
<td>@(invoice.Paid ? "Paid" : "Unpaid")</td>
|
||||
@if (canDownloadInvoice)
|
||||
@if (canDownloadInvoice)
|
||||
{
|
||||
<td>
|
||||
<a target="_blank" rel="noreferrer" href="@invoice.PdfUrl" title="Download Invoice">
|
||||
@ -49,11 +49,11 @@
|
||||
|
||||
<dt class="col-sm-4 col-lg-3">Transactions</dt>
|
||||
<dd class="col-sm-8 col-lg-9">
|
||||
@if(Model.BillingInfo.Transactions?.Any() ?? false)
|
||||
@if(Model.BillingHistoryInfo.Transactions?.Any() ?? false)
|
||||
{
|
||||
<table class="table">
|
||||
<tbody>
|
||||
@foreach(var transaction in Model.BillingInfo.Transactions)
|
||||
@foreach(var transaction in Model.BillingHistoryInfo.Transactions)
|
||||
{
|
||||
<tr>
|
||||
<td>@transaction.CreatedDate</td>
|
||||
|
Reference in New Issue
Block a user