1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

cancel any subscriptions when deleting account

This commit is contained in:
Kyle Spearrin 2017-07-11 11:19:58 -04:00
parent b49c16f529
commit f0f58897a9

View File

@ -164,6 +164,16 @@ namespace Bit.Core.Services
});
}
if(!string.IsNullOrWhiteSpace(user.StripeSubscriptionId))
{
var subscriptionService = new StripeSubscriptionService();
var canceledSub = await subscriptionService.CancelAsync(user.StripeSubscriptionId, false);
if(!canceledSub.CanceledAt.HasValue)
{
throw new BadRequestException("Unable to cancel subscription.");
}
}
await _userRepository.DeleteAsync(user);
return IdentityResult.Success;
}