1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00

Resolved null reference exceptions when removing a families plan sponsorship from Stripe (#4194)

This commit is contained in:
Conner Turnbull 2024-06-17 11:45:55 -04:00 committed by GitHub
parent 6af47faef1
commit 732ded52af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
@ -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) =>