mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05: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);
|
await _userRepository.DeleteAsync(user);
|
||||||
return IdentityResult.Success;
|
return IdentityResult.Success;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user