mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Consistency on TaxInfo use in service params
This commit is contained in:
@ -467,7 +467,8 @@ namespace Bit.Api.Controllers
|
||||
{
|
||||
license = await ApiHelpers.ReadJsonFileFromBody<UserLicense>(HttpContext, model.License);
|
||||
}
|
||||
else if (!valid && !_globalSettings.SelfHosted)
|
||||
|
||||
if (!valid && !_globalSettings.SelfHosted && string.IsNullOrWhiteSpace(model.Country))
|
||||
{
|
||||
throw new BadRequestException("Country is required.");
|
||||
}
|
||||
@ -479,7 +480,11 @@ namespace Bit.Api.Controllers
|
||||
|
||||
var result = await _userService.SignUpPremiumAsync(user, model.PaymentToken,
|
||||
model.PaymentMethodType.Value, model.AdditionalStorageGb.GetValueOrDefault(0), license,
|
||||
model.Country, model.PostalCode);
|
||||
new TaxInfo
|
||||
{
|
||||
BillingAddressCountry = model.Country,
|
||||
BillingAddressPostalCode = model.PostalCode,
|
||||
});
|
||||
var profile = new ProfileResponseModel(user, null, await _userService.TwoFactorIsEnabledAsync(user));
|
||||
return new PaymentResponseModel
|
||||
{
|
||||
@ -539,12 +544,12 @@ namespace Bit.Api.Controllers
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
await _paymentService.SaveTaxInfoAsync(user, new TaxInfo
|
||||
{
|
||||
BillingAddressCountry = model.Country,
|
||||
BillingAddressPostalCode = model.PostalCode,
|
||||
});
|
||||
await _userService.ReplacePaymentMethodAsync(user, model.PaymentToken, model.PaymentMethodType.Value);
|
||||
await _userService.ReplacePaymentMethodAsync(user, model.PaymentToken, model.PaymentMethodType.Value,
|
||||
new TaxInfo
|
||||
{
|
||||
BillingAddressCountry = model.Country,
|
||||
BillingAddressPostalCode = model.PostalCode,
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("storage")]
|
||||
|
Reference in New Issue
Block a user