1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

Add sponsorship validation to upcoming invoice webhook

This commit is contained in:
Matt Gibson
2021-11-11 14:13:45 -05:00
committed by Justin Baur
parent be6ab1883c
commit 1d34c276e7
7 changed files with 58 additions and 50 deletions

View File

@ -195,7 +195,9 @@ namespace Bit.Core.Services
private async Task ChangeOrganizationSponsorship(Organization org, OrganizationSponsorship sponsorship, bool applySponsorship)
{
var existingPlan = Utilities.StaticStore.GetPlan(org.PlanType);
var sponsoredPlan = Utilities.StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value);
var sponsoredPlan = sponsorship != null ?
Utilities.StaticStore.GetSponsoredPlan(sponsorship.PlanSponsorshipType.Value) :
null;
var subscriptionUpdate = new SponsorOrganizationSubscriptionUpdate(existingPlan, sponsoredPlan, applySponsorship);
await FinalizeSubscriptionChangeAsync(org, subscriptionUpdate, DateTime.UtcNow);