mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
combined tax updates with other operations
This commit is contained in:
@ -13,11 +13,17 @@ namespace Bit.Core.Models.Api
|
||||
[Range(0, 99)]
|
||||
public short? AdditionalStorageGb { get; set; }
|
||||
public IFormFile License { get; set; }
|
||||
public string Country { get; set; }
|
||||
public string PostalCode { get; set; }
|
||||
|
||||
public bool Validate(GlobalSettings globalSettings)
|
||||
{
|
||||
return (License == null && !globalSettings.SelfHosted) ||
|
||||
(License != null && globalSettings.SelfHosted);
|
||||
if (!(License == null && !globalSettings.SelfHosted) ||
|
||||
(License != null && globalSettings.SelfHosted))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return globalSettings.SelfHosted || !string.IsNullOrWhiteSpace(Country);
|
||||
}
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
||||
@ -27,6 +33,11 @@ namespace Bit.Core.Models.Api
|
||||
{
|
||||
yield return new ValidationResult("Payment token or license is required.");
|
||||
}
|
||||
if (Country == "US" && string.IsNullOrWhiteSpace(PostalCode))
|
||||
{
|
||||
yield return new ValidationResult("Zip / postal code is required.",
|
||||
new string[] { nameof(PostalCode) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using Bit.Core.Enums;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class PaymentRequestModel
|
||||
public class PaymentRequestModel : OrganizationTaxInfoUpdateRequestModel
|
||||
{
|
||||
[Required]
|
||||
public PaymentMethodType? PaymentMethodType { get; set; }
|
||||
|
Reference in New Issue
Block a user