mirror of
https://github.com/bitwarden/server.git
synced 2025-06-07 11:40:31 -05:00
[PM-20485] [PM-20486] Add missing mappings to PlanAdapter (#5791)
* Add missing mappings to PlanAdapter * PM-20485: Fix SM base seats
This commit is contained in:
parent
20d3911b80
commit
dcf97a5772
@ -31,6 +31,7 @@ public record PlanAdapter : Plan
|
||||
HasScim = HasFeature("scim");
|
||||
HasResetPassword = HasFeature("resetPassword");
|
||||
UsersGetPremium = HasFeature("usersGetPremium");
|
||||
HasCustomPermissions = HasFeature("customPermissions");
|
||||
UpgradeSortOrder = plan.AdditionalData.TryGetValue("upgradeSortOrder", out var upgradeSortOrder)
|
||||
? int.Parse(upgradeSortOrder)
|
||||
: 0;
|
||||
@ -141,6 +142,7 @@ public record PlanAdapter : Plan
|
||||
var stripeSeatPlanId = GetStripeSeatPlanId(seats);
|
||||
var hasAdditionalSeatsOption = seats.IsScalable;
|
||||
var seatPrice = GetSeatPrice(seats);
|
||||
var baseSeats = GetBaseSeats(seats);
|
||||
var maxSeats = GetMaxSeats(seats);
|
||||
var allowSeatAutoscale = seats.IsScalable;
|
||||
var maxProjects = plan.AdditionalData.TryGetValue("secretsManager.maxProjects", out var value) ? short.Parse(value) : 0;
|
||||
@ -156,6 +158,7 @@ public record PlanAdapter : Plan
|
||||
StripeSeatPlanId = stripeSeatPlanId,
|
||||
HasAdditionalSeatsOption = hasAdditionalSeatsOption,
|
||||
SeatPrice = seatPrice,
|
||||
BaseSeats = baseSeats,
|
||||
MaxSeats = maxSeats,
|
||||
AllowSeatAutoscale = allowSeatAutoscale,
|
||||
MaxProjects = maxProjects
|
||||
@ -168,8 +171,16 @@ public record PlanAdapter : Plan
|
||||
private static decimal GetBasePrice(PurchasableDTO purchasable)
|
||||
=> purchasable.FromPackaged(x => x.Price);
|
||||
|
||||
private static int GetBaseSeats(FreeOrScalableDTO freeOrScalable)
|
||||
=> freeOrScalable.Match(
|
||||
free => free.Quantity,
|
||||
scalable => scalable.Provided);
|
||||
|
||||
private static int GetBaseSeats(PurchasableDTO purchasable)
|
||||
=> purchasable.FromPackaged(x => x.Quantity);
|
||||
=> purchasable.Match(
|
||||
free => free.Quantity,
|
||||
packaged => packaged.Quantity,
|
||||
scalable => scalable.Provided);
|
||||
|
||||
private static short GetBaseServiceAccount(FreeOrScalableDTO freeOrScalable)
|
||||
=> freeOrScalable.Match(
|
||||
|
Loading…
x
Reference in New Issue
Block a user