1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

[AC-1843] Automate PM discount for SM Trial (#3661)

* Added appliesTo to customer discount. Added productId to subscription item

* Added IsFromSecretsManagerTrial flag to add discount for SM trials

* Fixed broken tests

---------

Co-authored-by: Alex Morask <amorask@bitwarden.com>
This commit is contained in:
Conner Turnbull
2024-01-29 11:10:27 -05:00
committed by GitHub
parent 693f0566a6
commit d7de5cbf28
8 changed files with 55 additions and 25 deletions

View File

@ -15,4 +15,5 @@ public class OrganizationUpgrade
public int? AdditionalSmSeats { get; set; }
public int? AdditionalServiceAccounts { get; set; }
public bool UseSecretsManager { get; set; }
public bool IsFromSecretsManagerTrial { get; set; }
}

View File

@ -17,11 +17,13 @@ public class SubscriptionInfo
Id = discount.Id;
Active = discount.Start != null && discount.End == null;
PercentOff = discount.Coupon?.PercentOff;
AppliesTo = discount.Coupon?.AppliesTo?.Products ?? new List<string>();
}
public string Id { get; }
public bool Active { get; }
public decimal? PercentOff { get; }
public List<string> AppliesTo { get; }
}
public class BillingSubscription
@ -59,6 +61,7 @@ public class SubscriptionInfo
{
if (item.Plan != null)
{
ProductId = item.Plan.ProductId;
Name = item.Plan.Nickname;
Amount = item.Plan.Amount.GetValueOrDefault() / 100M;
Interval = item.Plan.Interval;
@ -72,6 +75,7 @@ public class SubscriptionInfo
public bool AddonSubscriptionItem { get; set; }
public string ProductId { get; set; }
public string Name { get; set; }
public decimal Amount { get; set; }
public int Quantity { get; set; }