mirror of
https://github.com/bitwarden/server.git
synced 2025-04-04 20:50:21 -05:00

* Remove flag from CreateProviderCommand * Remove flag from OrganizationsController * Consolidate provider extensions * Remove flag from ProvidersController * Remove flag from CreateMsp.cshtml * Remove flag from Provider Edit.cshtml Also ensured the editable Gateway fields show for Multi-organization enterprises * Remove flag from OrganizationsController * Remove flag from billing-owned provider controllers * Remove flag from OrganizationService * Remove flag from RemoveOrganizationFromProviderCommand * Remove flag from ProviderService * Remove flag * Run dotnet format * Fix failing tests
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Bit.Core.AdminConsole.Entities;
|
|
using Bit.Core.AdminConsole.Entities.Provider;
|
|
using Bit.Core.AdminConsole.Enums.Provider;
|
|
using Bit.Core.Billing.Enums;
|
|
using Bit.Core.Entities;
|
|
using Bit.Core.Enums;
|
|
using Stripe;
|
|
|
|
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
|
|
};
|
|
|
|
public static bool SupportsConsolidatedBilling(this ProviderType providerType)
|
|
=> providerType is ProviderType.Msp or ProviderType.MultiOrganizationEnterprise;
|
|
|
|
public static bool IsValidClient(this Organization organization)
|
|
=> organization is
|
|
{
|
|
Seats: not null,
|
|
Status: OrganizationStatusType.Managed,
|
|
PlanType: PlanType.TeamsMonthly or PlanType.EnterpriseMonthly or PlanType.EnterpriseAnnually
|
|
};
|
|
|
|
public static bool IsStripeEnabled(this ISubscriber subscriber)
|
|
=> subscriber is
|
|
{
|
|
GatewayCustomerId: not null and not "",
|
|
GatewaySubscriptionId: not null and not ""
|
|
};
|
|
|
|
public static bool IsUnverifiedBankAccount(this SetupIntent setupIntent) =>
|
|
setupIntent is
|
|
{
|
|
Status: "requires_action",
|
|
NextAction:
|
|
{
|
|
VerifyWithMicrodeposits: not null
|
|
},
|
|
PaymentMethod:
|
|
{
|
|
UsBankAccount: not null
|
|
}
|
|
};
|
|
|
|
public static bool SupportsConsolidatedBilling(this PlanType planType)
|
|
=> planType is PlanType.TeamsMonthly or PlanType.EnterpriseMonthly or PlanType.EnterpriseAnnually;
|
|
}
|