mirror of
https://github.com/bitwarden/server.git
synced 2025-07-06 02:22:49 -05:00
[PM-15179] Implement endpoints to add existing organization to CB provider (#5310)
* Implement endpoints to add existing organization to provider * Run dotnet format * Support MOE * Run dotnet format * Move ProviderClientsController under AC ownership * Move ProviderClientsControllerTests under AC ownership * Jared's feedback
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Bit.Core.AdminConsole.Entities;
|
||||
using Bit.Core.AdminConsole.Enums.Provider;
|
||||
using Bit.Core.Models.Data.Organizations;
|
||||
|
||||
#nullable enable
|
||||
@ -22,4 +23,5 @@ public interface IOrganizationRepository : IRepository<Organization, Guid>
|
||||
/// Gets the organizations that have a verified domain matching the user's email domain.
|
||||
/// </summary>
|
||||
Task<ICollection<Organization>> GetByVerifiedUserEmailDomainAsync(Guid userId);
|
||||
Task<ICollection<Organization>> GetAddableToProviderByUserIdAsync(Guid userId, ProviderType providerType);
|
||||
}
|
||||
|
30
src/Core/Billing/Constants/PlanConstants.cs
Normal file
30
src/Core/Billing/Constants/PlanConstants.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Bit.Core.Billing.Enums;
|
||||
|
||||
namespace Bit.Core.Billing.Constants;
|
||||
|
||||
public static class PlanConstants
|
||||
{
|
||||
public static List<PlanType> EnterprisePlanTypes =>
|
||||
[
|
||||
PlanType.EnterpriseAnnually2019,
|
||||
PlanType.EnterpriseAnnually2020,
|
||||
PlanType.EnterpriseAnnually2023,
|
||||
PlanType.EnterpriseAnnually,
|
||||
PlanType.EnterpriseMonthly2019,
|
||||
PlanType.EnterpriseMonthly2020,
|
||||
PlanType.EnterpriseMonthly2023,
|
||||
PlanType.EnterpriseMonthly
|
||||
];
|
||||
|
||||
public static List<PlanType> TeamsPlanTypes =>
|
||||
[
|
||||
PlanType.TeamsAnnually2019,
|
||||
PlanType.TeamsAnnually2020,
|
||||
PlanType.TeamsAnnually2023,
|
||||
PlanType.TeamsAnnually,
|
||||
PlanType.TeamsMonthly2019,
|
||||
PlanType.TeamsMonthly2020,
|
||||
PlanType.TeamsMonthly2023,
|
||||
PlanType.TeamsMonthly
|
||||
];
|
||||
}
|
@ -31,6 +31,16 @@ public static class StripeConstants
|
||||
public const string TaxIdInvalid = "tax_id_invalid";
|
||||
}
|
||||
|
||||
public static class InvoiceStatus
|
||||
{
|
||||
public const string Draft = "draft";
|
||||
}
|
||||
|
||||
public static class MetadataKeys
|
||||
{
|
||||
public const string OrganizationId = "organizationId";
|
||||
}
|
||||
|
||||
public static class PaymentBehavior
|
||||
{
|
||||
public const string DefaultIncomplete = "default_incomplete";
|
||||
|
8
src/Core/Billing/Models/AddableOrganization.cs
Normal file
8
src/Core/Billing/Models/AddableOrganization.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Billing.Models;
|
||||
|
||||
public record AddableOrganization(
|
||||
Guid Id,
|
||||
string Name,
|
||||
string Plan,
|
||||
int Seats,
|
||||
bool Disabled = false);
|
@ -2,6 +2,7 @@
|
||||
using Bit.Core.AdminConsole.Entities.Provider;
|
||||
using Bit.Core.Billing.Entities;
|
||||
using Bit.Core.Billing.Enums;
|
||||
using Bit.Core.Billing.Models;
|
||||
using Bit.Core.Billing.Services.Contracts;
|
||||
using Bit.Core.Models.Business;
|
||||
using Stripe;
|
||||
@ -10,6 +11,11 @@ namespace Bit.Core.Billing.Services;
|
||||
|
||||
public interface IProviderBillingService
|
||||
{
|
||||
Task AddExistingOrganization(
|
||||
Provider provider,
|
||||
Organization organization,
|
||||
string key);
|
||||
|
||||
/// <summary>
|
||||
/// Changes the assigned provider plan for the provider.
|
||||
/// </summary>
|
||||
@ -35,6 +41,10 @@ public interface IProviderBillingService
|
||||
Task<byte[]> GenerateClientInvoiceReport(
|
||||
string invoiceId);
|
||||
|
||||
Task<IEnumerable<AddableOrganization>> GetAddableOrganizations(
|
||||
Provider provider,
|
||||
Guid userId);
|
||||
|
||||
/// <summary>
|
||||
/// Scales the <paramref name="provider"/>'s seats for the specified <paramref name="planType"/> using the provided <paramref name="seatAdjustment"/>.
|
||||
/// This operation may autoscale the provider's Stripe <see cref="Stripe.Subscription"/> depending on the <paramref name="provider"/>'s seat minimum for the
|
||||
|
@ -172,6 +172,7 @@ public static class FeatureFlagKeys
|
||||
public const string SingleTapPasskeyAuthentication = "single-tap-passkey-authentication";
|
||||
public const string EnableRiskInsightsNotifications = "enable-risk-insights-notifications";
|
||||
public const string EnablePMAuthenticatorSync = "enable-pm-bwa-sync";
|
||||
public const string P15179_AddExistingOrgsFromProviderPortal = "PM-15179-add-existing-orgs-from-provider-portal";
|
||||
|
||||
public static List<string> GetAllKeys()
|
||||
{
|
||||
|
Reference in New Issue
Block a user