mirror of
https://github.com/bitwarden/server.git
synced 2025-02-27 03:41:30 +01:00
cancel subscription from payment service on delete
This commit is contained in:
parent
b2295f867b
commit
3deec076c7
@ -16,7 +16,6 @@ using U2fLib = U2F.Core.Crypto.U2F;
|
||||
using U2F.Core.Models;
|
||||
using U2F.Core.Utils;
|
||||
using Bit.Core.Exceptions;
|
||||
using Stripe;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
@ -166,12 +165,8 @@ namespace Bit.Core.Services
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(user.GatewaySubscriptionId))
|
||||
{
|
||||
var subscriptionService = new StripeSubscriptionService();
|
||||
var canceledSub = await subscriptionService.CancelAsync(user.GatewaySubscriptionId, false);
|
||||
if(!canceledSub.CanceledAt.HasValue)
|
||||
{
|
||||
throw new BadRequestException("Unable to cancel subscription.");
|
||||
}
|
||||
var paymentService = user.GetPaymentService(_globalSettings);
|
||||
await paymentService.CancelSubscriptionAsync(user, false);
|
||||
}
|
||||
|
||||
await _userRepository.DeleteAsync(user);
|
||||
|
Loading…
Reference in New Issue
Block a user