Skip to content

Commit

Permalink
Resolved null reference exceptions when removing a families plan spon…
Browse files Browse the repository at this point in the history
…sorship from Stripe (#4194)
  • Loading branch information
cturnbull-bitwarden authored and withinfocus committed Jul 9, 2024
1 parent c8fa267 commit 95339b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Core/Services/Implementations/StripePaymentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public class StripePaymentService : IPaymentService
bool applySponsorship)
{
var existingPlan = Utilities.StaticStore.GetPlan(org.PlanType);
var sponsoredPlan = sponsorship != null ?
var sponsoredPlan = sponsorship?.PlanSponsorshipType != null ?
Utilities.StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value) :
null;
var subscriptionUpdate = new SponsorOrganizationSubscriptionUpdate(existingPlan, sponsoredPlan, applySponsorship);
Expand All @@ -242,8 +242,11 @@ public class StripePaymentService : IPaymentService

var sub = await _stripeAdapter.SubscriptionGetAsync(org.GatewaySubscriptionId);
org.ExpirationDate = sub.CurrentPeriodEnd;
sponsorship.ValidUntil = sub.CurrentPeriodEnd;

if (sponsorship is not null)
{
sponsorship.ValidUntil = sub.CurrentPeriodEnd;
}
}

public Task SponsorOrganizationAsync(Organization org, OrganizationSponsorship sponsorship) =>
Expand Down

0 comments on commit 95339b5

Please sign in to comment.