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

delete organization

This commit is contained in:
Kyle Spearrin
2017-04-11 10:52:28 -04:00
parent 53a25b908a
commit 96979079ba
4 changed files with 43 additions and 3 deletions

View File

@ -570,6 +570,21 @@ namespace Bit.Core.Services
}
}
public async Task DeleteAsync(Organization organization)
{
if(!string.IsNullOrWhiteSpace(organization.StripeSubscriptionId))
{
var subscriptionService = new StripeSubscriptionService();
var canceledSub = await subscriptionService.CancelAsync(organization.StripeSubscriptionId, false);
if(!canceledSub.CanceledAt.HasValue)
{
throw new BadRequestException("Unable to cancel subscription.");
}
}
await _organizationRepository.DeleteAsync(organization);
}
public async Task UpdateAsync(Organization organization, bool updateBilling = false)
{
if(organization.Id == default(Guid))