1
0
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:
Kyle Spearrin
2017-04-08 16:41:40 -04:00
parent 6467cafde3
commit 18d2715c71
6 changed files with 87 additions and 8 deletions

View File

@ -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) });
}
}
}

View File

@ -0,0 +1,10 @@
using System.ComponentModel.DataAnnotations;
namespace Bit.Core.Models.Api
{
public class OrganizationPaymentRequestModel
{
[Required]
public string PaymentToken { get; set; }
}
}

View File

@ -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: