mirror of
https://github.com/bitwarden/server.git
synced 2025-07-06 02:22:49 -05:00
[AC-1904] Implement endpoint to retrieve Provider subscription (#3921)
* Refactor Core.Billing prior to adding new logic * Add ProviderBillingQueries.GetSubscriptionData * Add ProviderBillingController.GetSubscriptionAsync
This commit is contained in:
22
src/Core/Billing/Models/ConfiguredProviderPlan.cs
Normal file
22
src/Core/Billing/Models/ConfiguredProviderPlan.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Bit.Core.Billing.Entities;
|
||||
using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Billing.Models;
|
||||
|
||||
public record ConfiguredProviderPlan(
|
||||
Guid Id,
|
||||
Guid ProviderId,
|
||||
PlanType PlanType,
|
||||
int SeatMinimum,
|
||||
int PurchasedSeats)
|
||||
{
|
||||
public static ConfiguredProviderPlan From(ProviderPlan providerPlan) =>
|
||||
providerPlan.Configured
|
||||
? new ConfiguredProviderPlan(
|
||||
providerPlan.Id,
|
||||
providerPlan.ProviderId,
|
||||
providerPlan.PlanType,
|
||||
providerPlan.SeatMinimum.GetValueOrDefault(0),
|
||||
providerPlan.PurchasedSeats.GetValueOrDefault(0))
|
||||
: null;
|
||||
}
|
7
src/Core/Billing/Models/ProviderSubscriptionData.cs
Normal file
7
src/Core/Billing/Models/ProviderSubscriptionData.cs
Normal file
@ -0,0 +1,7 @@
|
||||
using Stripe;
|
||||
|
||||
namespace Bit.Core.Billing.Models;
|
||||
|
||||
public record ProviderSubscriptionData(
|
||||
List<ConfiguredProviderPlan> ProviderPlans,
|
||||
Subscription Subscription);
|
Reference in New Issue
Block a user