1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +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) bool applySponsorship)
{ {
var existingPlan = Utilities.StaticStore.GetPlan(org.PlanType); var existingPlan = Utilities.StaticStore.GetPlan(org.PlanType);
var sponsoredPlan = sponsorship != null ? var sponsoredPlan = sponsorship?.PlanSponsorshipType != null ?
Utilities.StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value) : Utilities.StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value) :
null; null;
var subscriptionUpdate = new SponsorOrganizationSubscriptionUpdate(existingPlan, sponsoredPlan, applySponsorship); var subscriptionUpdate = new SponsorOrganizationSubscriptionUpdate(existingPlan, sponsoredPlan, applySponsorship);
@ -242,8 +242,11 @@ public class StripePaymentService : IPaymentService
var sub = await _stripeAdapter.SubscriptionGetAsync(org.GatewaySubscriptionId); var sub = await _stripeAdapter.SubscriptionGetAsync(org.GatewaySubscriptionId);
org.ExpirationDate = sub.CurrentPeriodEnd; org.ExpirationDate = sub.CurrentPeriodEnd;
sponsorship.ValidUntil = sub.CurrentPeriodEnd;
if (sponsorship is not null)
{
sponsorship.ValidUntil = sub.CurrentPeriodEnd;
}
} }
public Task SponsorOrganizationAsync(Organization org, OrganizationSponsorship sponsorship) => public Task SponsorOrganizationAsync(Organization org, OrganizationSponsorship sponsorship) =>