1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-20 02:54:32 -05:00

Prevent organization disablement on addition to provider (#5419)

This commit is contained in:
Alex Morask 2025-02-19 09:52:17 -05:00 committed by GitHub
parent fcb9848180
commit 43be2dbc83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,13 +33,16 @@ public class SubscriptionDeletedHandler : ISubscriptionDeletedHandler
var subCanceled = subscription.Status == StripeSubscriptionStatus.Canceled;
const string providerMigrationCancellationComment = "Cancelled as part of provider migration to Consolidated Billing";
const string addedToProviderCancellationComment = "Organization was added to Provider";
if (!subCanceled)
{
return;
}
if (organizationId.HasValue && subscription is not { CancellationDetails.Comment: providerMigrationCancellationComment })
if (organizationId.HasValue &&
subscription.CancellationDetails.Comment != providerMigrationCancellationComment &&
!subscription.CancellationDetails.Comment.Contains(addedToProviderCancellationComment))
{
await _organizationService.DisableAsync(organizationId.Value, subscription.CurrentPeriodEnd);
}