mirror of
https://github.com/bitwarden/server
synced 2025-12-19 17:53:44 +00:00
APIs for premium. Billing helpers.
This commit is contained in:
10
src/Core/Models/Api/Request/Accounts/PremiumRequestModel.cs
Normal file
10
src/Core/Models/Api/Request/Accounts/PremiumRequestModel.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class PremiumRequestModel : PaymentRequestModel
|
||||
{
|
||||
[Range(0, 99)]
|
||||
public short? AdditionalStorageGb { get; set; }
|
||||
}
|
||||
}
|
||||
20
src/Core/Models/Api/Request/Accounts/StorageRequestModel.cs
Normal file
20
src/Core/Models/Api/Request/Accounts/StorageRequestModel.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class StorageRequestModel : IValidatableObject
|
||||
{
|
||||
[Required]
|
||||
public short? StroageGbAdjustment { get; set; }
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
{
|
||||
if(StroageGbAdjustment == 0)
|
||||
{
|
||||
yield return new ValidationResult("Storage adjustment cannot be 0.",
|
||||
new string[] { nameof(StroageGbAdjustment) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class OrganizationPaymentRequestModel
|
||||
public class PaymentRequestModel
|
||||
{
|
||||
[Required]
|
||||
public string PaymentToken { get; set; }
|
||||
Reference in New Issue
Block a user