mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
make payment method type required
This commit is contained in:
@ -7,7 +7,7 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class PremiumRequestModel : IValidatableObject
|
||||
{
|
||||
// TODO: Required in future
|
||||
[Required]
|
||||
public PaymentMethodType? PaymentMethodType { get; set; }
|
||||
public string PaymentToken { get; set; }
|
||||
[Range(0, 99)]
|
||||
|
@ -21,7 +21,6 @@ namespace Bit.Core.Models.Api
|
||||
public PlanType PlanType { get; set; }
|
||||
[Required]
|
||||
public string Key { get; set; }
|
||||
// TODO: Required in future if not free plan
|
||||
public PaymentMethodType? PaymentMethodType { get; set; }
|
||||
public string PaymentToken { get; set; }
|
||||
[Range(0, double.MaxValue)]
|
||||
@ -58,6 +57,11 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
yield return new ValidationResult("Payment required.", new string[] { nameof(PaymentToken) });
|
||||
}
|
||||
if(PlanType != PlanType.Free && !PaymentMethodType.HasValue)
|
||||
{
|
||||
yield return new ValidationResult("Payment method type required.",
|
||||
new string[] { nameof(PaymentMethodType) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class PaymentRequestModel
|
||||
{
|
||||
// TODO: Required in future
|
||||
[Required]
|
||||
public PaymentMethodType? PaymentMethodType { get; set; }
|
||||
[Required]
|
||||
public string PaymentToken { get; set; }
|
||||
|
Reference in New Issue
Block a user