mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
change payment API
This commit is contained in:
@ -19,7 +19,7 @@ namespace Bit.Core.Models.Api
|
||||
public PlanType PlanType { get; set; }
|
||||
[Required]
|
||||
public string Key { get; set; }
|
||||
public string CardToken { get; set; }
|
||||
public string PaymentToken { get; set; }
|
||||
[Range(0, double.MaxValue)]
|
||||
public short AdditionalUsers { get; set; }
|
||||
public bool Monthly { get; set; }
|
||||
@ -32,7 +32,7 @@ namespace Bit.Core.Models.Api
|
||||
OwnerKey = Key,
|
||||
Name = Name,
|
||||
Plan = PlanType,
|
||||
PaymentToken = CardToken,
|
||||
PaymentToken = PaymentToken,
|
||||
AdditionalUsers = AdditionalUsers,
|
||||
BillingEmail = BillingEmail,
|
||||
BusinessName = BusinessName,
|
||||
@ -42,9 +42,9 @@ namespace Bit.Core.Models.Api
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if(PlanType != PlanType.Free && string.IsNullOrWhiteSpace(CardToken))
|
||||
if(PlanType != PlanType.Free && string.IsNullOrWhiteSpace(PaymentToken))
|
||||
{
|
||||
yield return new ValidationResult("Card required.", new string[] { nameof(CardToken) });
|
||||
yield return new ValidationResult("Payment required.", new string[] { nameof(PaymentToken) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class OrganizationPaymentRequestModel
|
||||
{
|
||||
[Required]
|
||||
public string PaymentToken { get; set; }
|
||||
}
|
||||
}
|
@ -58,7 +58,8 @@ namespace Bit.Core.Models.Api
|
||||
switch(source.Type)
|
||||
{
|
||||
case SourceType.Card:
|
||||
Description = $"{source.Card.Brand}, *{source.Card.Last4}";
|
||||
Description = $"{source.Card.Brand}, *{source.Card.Last4}, " +
|
||||
$"{source.Card.ExpirationMonth}/{source.Card.ExpirationYear}";
|
||||
CardBrand = source.Card.Brand;
|
||||
break;
|
||||
case SourceType.BankAccount:
|
||||
|
Reference in New Issue
Block a user