mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -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);
|
var license = await _userService.GenerateLicenseAsync(user, billingInfo);
|
||||||
return new BillingResponseModel(user, billingInfo, license);
|
return new BillingResponseModel(user, billingInfo, license);
|
||||||
}
|
}
|
||||||
else
|
else if(!_globalSettings.SelfHosted)
|
||||||
{
|
{
|
||||||
var license = await _userService.GenerateLicenseAsync(user);
|
var license = await _userService.GenerateLicenseAsync(user);
|
||||||
return new BillingResponseModel(user, license);
|
return new BillingResponseModel(user, license);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new BillingResponseModel(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("payment")]
|
[HttpPost("payment")]
|
||||||
|
@ -23,14 +23,18 @@ namespace Bit.Core.Models.Api
|
|||||||
Expiration = License.Expires;
|
Expiration = License.Expires;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BillingResponseModel(User user, UserLicense license)
|
public BillingResponseModel(User user, UserLicense license = null)
|
||||||
: base("billing")
|
: base("billing")
|
||||||
{
|
{
|
||||||
StorageName = user.Storage.HasValue ? Utilities.CoreHelpers.ReadableBytesSize(user.Storage.Value) : null;
|
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
|
StorageGb = user.Storage.HasValue ? Math.Round(user.Storage.Value / 1073741824D, 2) : 0; // 1 GB
|
||||||
MaxStorageGb = user.MaxStorageGb;
|
MaxStorageGb = user.MaxStorageGb;
|
||||||
License = license;
|
|
||||||
Expiration = user.PremiumExpirationDate;
|
Expiration = user.PremiumExpirationDate;
|
||||||
|
|
||||||
|
if(license != null)
|
||||||
|
{
|
||||||
|
License = license;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string StorageName { get; set; }
|
public string StorageName { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user