1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Create ProviderInvoiceItems for empty invoices (#5021)

This commit is contained in:
Alex Morask 2024-11-11 10:02:21 -05:00 committed by GitHub
parent 89be2f495a
commit 2e635c9505
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,20 +94,17 @@ public class ProviderEventService(
var unassignedEnterpriseSeats = enterpriseProviderPlan.SeatMinimum - enterpriseClientSeats ?? 0; var unassignedEnterpriseSeats = enterpriseProviderPlan.SeatMinimum - enterpriseClientSeats ?? 0;
if (unassignedEnterpriseSeats > 0) invoiceItems.Add(new ProviderInvoiceItem
{ {
invoiceItems.Add(new ProviderInvoiceItem ProviderId = parsedProviderId,
{ InvoiceId = invoice.Id,
ProviderId = parsedProviderId, InvoiceNumber = invoice.Number,
InvoiceId = invoice.Id, ClientName = "Unassigned seats",
InvoiceNumber = invoice.Number, PlanName = enterprisePlan.Name,
ClientName = "Unassigned seats", AssignedSeats = unassignedEnterpriseSeats,
PlanName = enterprisePlan.Name, UsedSeats = 0,
AssignedSeats = unassignedEnterpriseSeats, Total = unassignedEnterpriseSeats * discountedEnterpriseSeatPrice
UsedSeats = 0, });
Total = unassignedEnterpriseSeats * discountedEnterpriseSeatPrice
});
}
} }
if (teamsProviderPlan.PurchasedSeats is null or 0) if (teamsProviderPlan.PurchasedSeats is null or 0)
@ -118,20 +115,17 @@ public class ProviderEventService(
var unassignedTeamsSeats = teamsProviderPlan.SeatMinimum - teamsClientSeats ?? 0; var unassignedTeamsSeats = teamsProviderPlan.SeatMinimum - teamsClientSeats ?? 0;
if (unassignedTeamsSeats > 0) invoiceItems.Add(new ProviderInvoiceItem
{ {
invoiceItems.Add(new ProviderInvoiceItem ProviderId = parsedProviderId,
{ InvoiceId = invoice.Id,
ProviderId = parsedProviderId, InvoiceNumber = invoice.Number,
InvoiceId = invoice.Id, ClientName = "Unassigned seats",
InvoiceNumber = invoice.Number, PlanName = teamsPlan.Name,
ClientName = "Unassigned seats", AssignedSeats = unassignedTeamsSeats,
PlanName = teamsPlan.Name, UsedSeats = 0,
AssignedSeats = unassignedTeamsSeats, Total = unassignedTeamsSeats * discountedTeamsSeatPrice
UsedSeats = 0, });
Total = unassignedTeamsSeats * discountedTeamsSeatPrice
});
}
} }
await Task.WhenAll(invoiceItems.Select(providerInvoiceItemRepository.CreateAsync)); await Task.WhenAll(invoiceItems.Select(providerInvoiceItemRepository.CreateAsync));