mirror of
https://github.com/bitwarden/server.git
synced 2026-02-10 02:43:17 +08:00
* Billing: Add event recovery endpoints * Core: Add InternalBilling to BaseServiceUriSettings * Admin: Scaffold billing section * Admin: Scaffold ProcessStripeEvents section * Admin: Implement event processing * Run dotnet format
30 lines
846 B
C#
30 lines
846 B
C#
using System.ComponentModel;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Bit.Admin.Billing.Models.ProcessStripeEvents;
|
|
|
|
public class EventsFormModel : IValidatableObject
|
|
{
|
|
[Required]
|
|
public string EventIds { get; set; }
|
|
|
|
[Required]
|
|
[DisplayName("Inspect Only")]
|
|
public bool Inspect { get; set; }
|
|
|
|
public List<string> GetEventIds() =>
|
|
EventIds?.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries)
|
|
.Select(eventId => eventId.Trim())
|
|
.ToList() ?? [];
|
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
var eventIds = GetEventIds();
|
|
|
|
if (eventIds.Any(eventId => !eventId.StartsWith("evt_")))
|
|
{
|
|
yield return new ValidationResult("Event Ids must start with 'evt_'.");
|
|
}
|
|
}
|
|
}
|