mirror of
https://github.com/bitwarden/server.git
synced 2025-05-23 04:21:05 -05: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.Models;
|
||||||
using U2F.Core.Utils;
|
using U2F.Core.Utils;
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Stripe;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
|
|
||||||
namespace Bit.Core.Services
|
namespace Bit.Core.Services
|
||||||
@ -166,12 +165,8 @@ namespace Bit.Core.Services
|
|||||||
|
|
||||||
if(!string.IsNullOrWhiteSpace(user.GatewaySubscriptionId))
|
if(!string.IsNullOrWhiteSpace(user.GatewaySubscriptionId))
|
||||||
{
|
{
|
||||||
var subscriptionService = new StripeSubscriptionService();
|
var paymentService = user.GetPaymentService(_globalSettings);
|
||||||
var canceledSub = await subscriptionService.CancelAsync(user.GatewaySubscriptionId, false);
|
await paymentService.CancelSubscriptionAsync(user, false);
|
||||||
if(!canceledSub.CanceledAt.HasValue)
|
|
||||||
{
|
|
||||||
throw new BadRequestException("Unable to cancel subscription.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _userRepository.DeleteAsync(user);
|
await _userRepository.DeleteAsync(user);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user