1
0
mirror of https://github.com/bitwarden/server synced 2026-01-28 15:23:38 +00:00

Fix the unit test

This commit is contained in:
Cy Okeke
2026-01-19 15:41:22 +01:00
parent 5772b467b8
commit f6bae8380d
2 changed files with 8 additions and 0 deletions

View File

@@ -308,6 +308,7 @@ public class SubscriptionUpdatedHandler : ISubscriptionUpdatedHandler
previousSubscriptionItem => planIdsOfPlansWithSecretManager.Contains(previousSubscriptionItem.Plan.Id));
var currentSubscriptionHasSecretsManager =
subscription.Items is not null &&
subscription.Items.Any(
currentSubscriptionItem => planIdsOfPlansWithSecretManager.Contains(currentSubscriptionItem.Plan.Id));

View File

@@ -990,6 +990,13 @@ public class SubscriberService(
// These checks return false (no error) because they indicate "reversion not needed"
// rather than "reversion failed" - the cancellation should proceed normally.
// Check if metadata exists
if (metadata == null)
{
logger.LogDebug("Subscription {SubscriptionId} has no metadata", subscription.Id);
return false;
}
// Check if subscription has the premium upgrade metadata
if (!metadata.TryGetValue(MetadataKeys.PreviousPremiumPriceId, out var previousPremiumPriceId) ||
!metadata.TryGetValue(MetadataKeys.UpgradedOrganizationId, out var upgradedOrganizationIdStr) ||