mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
user BillingResponseModel without licensing
This commit is contained in:
parent
cf06cd76d5
commit
5c7ff94657
@ -419,11 +419,15 @@ namespace Bit.Api.Controllers
|
||||
var license = await _userService.GenerateLicenseAsync(user, billingInfo);
|
||||
return new BillingResponseModel(user, billingInfo, license);
|
||||
}
|
||||
else
|
||||
else if(!_globalSettings.SelfHosted)
|
||||
{
|
||||
var license = await _userService.GenerateLicenseAsync(user);
|
||||
return new BillingResponseModel(user, license);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new BillingResponseModel(user);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("payment")]
|
||||
|
@ -23,14 +23,18 @@ namespace Bit.Core.Models.Api
|
||||
Expiration = License.Expires;
|
||||
}
|
||||
|
||||
public BillingResponseModel(User user, UserLicense license)
|
||||
public BillingResponseModel(User user, UserLicense license = null)
|
||||
: base("billing")
|
||||
{
|
||||
StorageName = user.Storage.HasValue ? Utilities.CoreHelpers.ReadableBytesSize(user.Storage.Value) : null;
|
||||
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
|
||||
MaxStorageGb = user.MaxStorageGb;
|
||||
License = license;
|
||||
Expiration = user.PremiumExpirationDate;
|
||||
|
||||
if(license != null)
|
||||
{
|
||||
License = license;
|
||||
}
|
||||
}
|
||||
|
||||
public string StorageName { get; set; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user