mirror of
https://github.com/bitwarden/server.git
synced 2025-05-30 15:50:33 -05:00
[PM-26932] Improve validation tax information when subscribing to premium
This commit is contained in:
parent
ce2ecf9da0
commit
51ffe3cef8
@ -666,7 +666,11 @@ public class AccountsController : Controller
|
|||||||
new TaxInfo
|
new TaxInfo
|
||||||
{
|
{
|
||||||
BillingAddressCountry = model.Country,
|
BillingAddressCountry = model.Country,
|
||||||
BillingAddressPostalCode = model.PostalCode
|
BillingAddressPostalCode = model.PostalCode,
|
||||||
|
BillingAddressCity = model.City,
|
||||||
|
BillingAddressLine1 = model.Line1,
|
||||||
|
BillingAddressLine2 = model.Line2,
|
||||||
|
BillingAddressState = model.State,
|
||||||
});
|
});
|
||||||
|
|
||||||
var userTwoFactorEnabled = await _userService.TwoFactorIsEnabledAsync(user);
|
var userTwoFactorEnabled = await _userService.TwoFactorIsEnabledAsync(user);
|
||||||
|
@ -12,9 +12,19 @@ public class PremiumRequestModel : IValidatableObject
|
|||||||
[Range(0, 99)]
|
[Range(0, 99)]
|
||||||
public short? AdditionalStorageGb { get; set; }
|
public short? AdditionalStorageGb { get; set; }
|
||||||
public IFormFile License { get; set; }
|
public IFormFile License { get; set; }
|
||||||
public string Country { get; set; }
|
|
||||||
|
public string Line1 { get; set; }
|
||||||
|
public string Line2 { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
public string PostalCode { get; set; }
|
public string PostalCode { get; set; }
|
||||||
|
|
||||||
|
public string City { get; set; }
|
||||||
|
public string State { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Country { get; set; }
|
||||||
|
|
||||||
public bool Validate(GlobalSettings globalSettings)
|
public bool Validate(GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
if (!(License == null && !globalSettings.SelfHosted) ||
|
if (!(License == null && !globalSettings.SelfHosted) ||
|
||||||
@ -32,10 +42,5 @@ public class PremiumRequestModel : IValidatableObject
|
|||||||
{
|
{
|
||||||
yield return new ValidationResult("Payment token or license is required.");
|
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) });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user