mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
org signup plan details
This commit is contained in:
@ -1,16 +1,28 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Business;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class OrganizationCreateRequestModel
|
||||
public class OrganizationCreateRequestModel : IValidatableObject
|
||||
{
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public string Name { get; set; }
|
||||
[StringLength(50)]
|
||||
public string BusinessName { get; set; }
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
public string BillingEmail { get; set; }
|
||||
public PlanType PlanType { get; set; }
|
||||
[Required]
|
||||
public string Key { get; set; }
|
||||
public string CardToken { get; set; }
|
||||
[Range(0, double.MaxValue)]
|
||||
public short AdditionalUsers { get; set; }
|
||||
public bool Monthly { get; set; }
|
||||
|
||||
public virtual OrganizationSignup ToOrganizationSignup(User user)
|
||||
{
|
||||
@ -20,8 +32,20 @@ namespace Bit.Core.Models.Api
|
||||
OwnerKey = Key,
|
||||
Name = Name,
|
||||
Plan = PlanType,
|
||||
PaymentToken = CardToken
|
||||
PaymentToken = CardToken,
|
||||
AdditionalUsers = AdditionalUsers,
|
||||
BillingEmail = BillingEmail,
|
||||
BusinessName = BusinessName,
|
||||
Monthly = Monthly
|
||||
};
|
||||
}
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if(PlanType != PlanType.Free && string.IsNullOrWhiteSpace(CardToken))
|
||||
{
|
||||
yield return new ValidationResult("Card required.", new string[] { nameof(CardToken) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,13 @@ namespace Bit.Core.Models.Business
|
||||
public class OrganizationSignup
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string BusinessName { get; set; }
|
||||
public string BillingEmail { get; set; }
|
||||
public User Owner { get; set; }
|
||||
public string OwnerKey { get; set; }
|
||||
public Enums.PlanType Plan { get; set; }
|
||||
public short AdditionalUsers { get; set; }
|
||||
public string PaymentToken { get; set; }
|
||||
public bool Monthly { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,18 @@ namespace Bit.Core.Models.StaticStore
|
||||
public class Plan
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string StripeId { get; set; }
|
||||
public string StripeAnnualPlanId { get; set; }
|
||||
public string StripeAnnualUserPlanId { get; set; }
|
||||
public string StripeMonthlyPlanId { get; set; }
|
||||
public string StripeMonthlyUserPlanId { get; set; }
|
||||
public PlanType Type { get; set; }
|
||||
public short MaxUsers { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
public short BaseUsers { get; set; }
|
||||
public bool CanBuyAdditionalUsers { get; set; }
|
||||
public bool CanMonthly { get; set; }
|
||||
public decimal BaseMonthlyPrice { get; set; }
|
||||
public decimal UserMonthlyPrice { get; set; }
|
||||
public decimal BaseAnnualPrice { get; set; }
|
||||
public decimal UserAnnualPrice { get; set; }
|
||||
public TimeSpan? Trial { get; set; }
|
||||
public Func<DateTime, TimeSpan> Cycle { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
@ -9,13 +9,19 @@ namespace Bit.Core.Models.Table
|
||||
public Guid Id { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string BusinessName { get; set; }
|
||||
public string BillingEmail { get; set; }
|
||||
public string Plan { get; set; }
|
||||
public PlanType PlanType { get; set; }
|
||||
public decimal PlanPrice { get; set; }
|
||||
public decimal PlanRenewalPrice { get; set; }
|
||||
public decimal PlanBasePrice { get; set; }
|
||||
public decimal PlanUserPrice { get; set; }
|
||||
public DateTime? PlanRenewalDate { get; set; }
|
||||
public bool PlanTrial { get; set; }
|
||||
public short BaseUsers { get; set; }
|
||||
public short AdditionalUsers { get; set; }
|
||||
public short MaxUsers { get; set; }
|
||||
public string StripeCustomerId { get; set; }
|
||||
public string StripeSubscriptionId { get; set; }
|
||||
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
|
||||
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
|
||||
|
||||
|
Reference in New Issue
Block a user