1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-05 18:12:48 -05:00

APIs for premium. Billing helpers.

This commit is contained in:
Kyle Spearrin
2017-07-06 14:55:58 -04:00
parent 2afef85f85
commit d346ee5169
22 changed files with 789 additions and 313 deletions

View File

@ -4,7 +4,7 @@ using Bit.Core.Enums;
namespace Bit.Core.Models.Table
{
public class Organization : IDataObject<Guid>
public class Organization : IDataObject<Guid>, ISubscriber, IStorable, IStorableSubscriber, IRevisable
{
public Guid Id { get; set; }
public string Name { get; set; }
@ -32,6 +32,16 @@ namespace Bit.Core.Models.Table
}
}
public string BillingEmailAddress()
{
return BillingEmail;
}
public string BillingName()
{
return BusinessName;
}
public long StorageBytesRemaining()
{
if(!MaxStorageGb.HasValue)
@ -39,7 +49,12 @@ namespace Bit.Core.Models.Table
return 0;
}
var maxStorageBytes = MaxStorageGb.Value * 1073741824L;
return StorageBytesRemaining(MaxStorageGb.Value);
}
public long StorageBytesRemaining(short maxStorageGb)
{
var maxStorageBytes = maxStorageGb * 1073741824L;
if(!Storage.HasValue)
{
return maxStorageBytes;