From b8caa36c0e464c0c5c9d2f8a1d63245886205915 Mon Sep 17 00:00:00 2001 From: Jonas Hendrickx Date: Mon, 4 Nov 2024 16:43:48 +0100 Subject: [PATCH] [PM-14443] Cannot view pending MOE provider page (#4970) --- src/Admin/AdminConsole/Models/ProviderEditModel.cs | 7 ++++--- src/Core/Billing/Extensions/BillingExtensions.cs | 9 ++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Admin/AdminConsole/Models/ProviderEditModel.cs b/src/Admin/AdminConsole/Models/ProviderEditModel.cs index 58221589f..7fd5c765c 100644 --- a/src/Admin/AdminConsole/Models/ProviderEditModel.cs +++ b/src/Admin/AdminConsole/Models/ProviderEditModel.cs @@ -33,11 +33,12 @@ public class ProviderEditModel : ProviderViewModel, IValidatableObject GatewayCustomerUrl = gatewayCustomerUrl; GatewaySubscriptionUrl = gatewaySubscriptionUrl; Type = provider.Type; + if (Type == ProviderType.MultiOrganizationEnterprise) { - var plan = providerPlans.Single(); - EnterpriseMinimumSeats = plan.SeatMinimum; - Plan = plan.PlanType; + var plan = providerPlans.SingleOrDefault(); + EnterpriseMinimumSeats = plan?.SeatMinimum ?? 0; + Plan = plan?.PlanType; } } diff --git a/src/Core/Billing/Extensions/BillingExtensions.cs b/src/Core/Billing/Extensions/BillingExtensions.cs index 1c2c28476..21974b318 100644 --- a/src/Core/Billing/Extensions/BillingExtensions.cs +++ b/src/Core/Billing/Extensions/BillingExtensions.cs @@ -11,11 +11,10 @@ namespace Bit.Core.Billing.Extensions; public static class BillingExtensions { public static bool IsBillable(this Provider provider) => - provider is - { - Type: ProviderType.Msp or ProviderType.MultiOrganizationEnterprise, - Status: ProviderStatusType.Billable - }; + provider.SupportsConsolidatedBilling() && provider.Status == ProviderStatusType.Billable; + + public static bool SupportsConsolidatedBilling(this Provider provider) + => provider.Type is ProviderType.Msp or ProviderType.MultiOrganizationEnterprise; public static bool IsValidClient(this Organization organization) => organization is