diff --git a/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs index 1d83f79e1b..c4e848b35d 100644 --- a/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs +++ b/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs @@ -112,7 +112,7 @@ public class OrganizationSubscriptionResponseModel : OrganizationResponseModel { Subscription = subscription.Subscription != null ? new BillingSubscription(subscription.Subscription) : null; UpcomingInvoice = subscription.UpcomingInvoice != null ? new BillingSubscriptionUpcomingInvoice(subscription.UpcomingInvoice) : null; - Discount = subscription.Discount != null ? new BillingCustomerDiscount(subscription.Discount) : null; + CustomerDiscount = subscription.CustomerDiscount != null ? new BillingCustomerDiscount(subscription.CustomerDiscount) : null; Expiration = DateTime.UtcNow.AddYears(1); // Not used, so just give it a value. if (hideSensitiveData) @@ -143,7 +143,7 @@ public class OrganizationSubscriptionResponseModel : OrganizationResponseModel public string StorageName { get; set; } public double? StorageGb { get; set; } - public BillingCustomerDiscount Discount { get; set; } + public BillingCustomerDiscount CustomerDiscount { get; set; } public BillingSubscription Subscription { get; set; } public BillingSubscriptionUpcomingInvoice UpcomingInvoice { get; set; } diff --git a/src/Api/Models/Response/SubscriptionResponseModel.cs b/src/Api/Models/Response/SubscriptionResponseModel.cs index 553b7dd99a..883f7ac900 100644 --- a/src/Api/Models/Response/SubscriptionResponseModel.cs +++ b/src/Api/Models/Response/SubscriptionResponseModel.cs @@ -13,7 +13,6 @@ public class SubscriptionResponseModel : ResponseModel Subscription = subscription.Subscription != null ? new BillingSubscription(subscription.Subscription) : null; UpcomingInvoice = subscription.UpcomingInvoice != null ? new BillingSubscriptionUpcomingInvoice(subscription.UpcomingInvoice) : null; - Discount = subscription.Discount != null ? new BillingCustomerDiscount(subscription.Discount) : null; StorageName = user.Storage.HasValue ? CoreHelpers.ReadableBytesSize(user.Storage.Value) : null; StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB MaxStorageGb = user.MaxStorageGb; @@ -41,7 +40,6 @@ public class SubscriptionResponseModel : ResponseModel public short? MaxStorageGb { get; set; } public BillingSubscriptionUpcomingInvoice UpcomingInvoice { get; set; } public BillingSubscription Subscription { get; set; } - public BillingCustomerDiscount Discount { get; set; } public UserLicense License { get; set; } public DateTime? Expiration { get; set; } public bool UsingInAppPurchase { get; set; } @@ -53,10 +51,12 @@ public class BillingCustomerDiscount { Id = discount.Id; Active = discount.Active; + PercentOff = discount.PercentOff; } - public string Id { get; set; } - public bool Active { get; set; } + public string Id { get; } + public bool Active { get; } + public decimal? PercentOff { get; } } public class BillingSubscription diff --git a/src/Core/Models/Business/SubscriptionInfo.cs b/src/Core/Models/Business/SubscriptionInfo.cs index f8284e0e30..8a0a6add74 100644 --- a/src/Core/Models/Business/SubscriptionInfo.cs +++ b/src/Core/Models/Business/SubscriptionInfo.cs @@ -4,7 +4,7 @@ namespace Bit.Core.Models.Business; public class SubscriptionInfo { - public BillingCustomerDiscount Discount { get; set; } + public BillingCustomerDiscount CustomerDiscount { get; set; } public BillingSubscription Subscription { get; set; } public BillingUpcomingInvoice UpcomingInvoice { get; set; } public bool UsingInAppPurchase { get; set; } @@ -17,10 +17,12 @@ public class SubscriptionInfo { Id = discount.Id; Active = discount.Start != null && discount.End == null; + PercentOff = discount.Coupon?.PercentOff; } public string Id { get; } public bool Active { get; } + public decimal? PercentOff { get; } } public class BillingSubscription diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs index dc6d4dd6f0..0f7965db77 100644 --- a/src/Core/Services/Implementations/StripePaymentService.cs +++ b/src/Core/Services/Implementations/StripePaymentService.cs @@ -1568,7 +1568,7 @@ public class StripePaymentService : IPaymentService if (customer.Discount != null) { - subscriptionInfo.Discount = new SubscriptionInfo.BillingCustomerDiscount(customer.Discount); + subscriptionInfo.CustomerDiscount = new SubscriptionInfo.BillingCustomerDiscount(customer.Discount); } if (subscriber.IsUser())