mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 17: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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user