1
0
mirror of https://github.com/bitwarden/server synced 2026-01-03 09:03:44 +00:00

charge braintree customer tool

This commit is contained in:
Kyle Spearrin
2019-02-15 16:18:34 -05:00
parent 1b5652fb7c
commit fb21b19490
5 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Bit.Admin.Models
{
public class ChargeBraintreeModel : IValidatableObject
{
[Required]
[Display(Name = "Braintree Customer Id")]
public string Id { get; set; }
[Required]
[Display(Name = "Amount")]
public decimal? Amount { get; set; }
public string TransactionId { get; set; }
public string PayPalTransactionId { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if(Id != null)
{
if(Id.Length != 36 || (Id[0] != 'o' && Id[0] != 'u') ||
!Guid.TryParse(Id.Substring(1, 32), out var guid))
{
yield return new ValidationResult("Customer Id is not a valid format.");
}
}
}
}
}