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:
parent
b49c16f529
commit
f0f58897a9
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user