mirror of
https://github.com/bitwarden/server.git
synced 2025-01-21 21:41:21 +01:00
[AC-2766] famlies sponsorship upcoming invoice email (#4181)
* Getting the fresh invoice if the subscription was updated when validation the families sponsorship * Getting fresh invoice after validation families sponsorship fails * Also updating invoice line items
This commit is contained in:
parent
b6940f3184
commit
5ccb4072a3
@ -77,7 +77,18 @@ public class UpcomingInvoiceHandler : IUpcomingInvoiceHandler
|
||||
{
|
||||
if (_stripeEventUtilityService.IsSponsoredSubscription(updatedSubscription))
|
||||
{
|
||||
await _validateSponsorshipCommand.ValidateSponsorshipAsync(organizationId.Value);
|
||||
var sponsorshipIsValid =
|
||||
await _validateSponsorshipCommand.ValidateSponsorshipAsync(organizationId.Value);
|
||||
if (!sponsorshipIsValid)
|
||||
{
|
||||
// If the sponsorship is invalid, then the subscription was updated to use the regular families plan
|
||||
// price. Given that this is the case, we need the new invoice amount
|
||||
subscription = await _stripeFacade.GetSubscription(subscription.Id,
|
||||
new SubscriptionGetOptions { Expand = ["latest_invoice"] });
|
||||
|
||||
invoice = subscription.LatestInvoice;
|
||||
invoiceLineItemDescriptions = invoice.Lines.Select(i => i.Description).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
var organization = await _organizationRepository.GetByIdAsync(organizationId.Value);
|
||||
|
Loading…
Reference in New Issue
Block a user