Skip to content

Commit

Permalink
Send upcoming invoice to provider billing email (#4112)
Browse files Browse the repository at this point in the history
Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
  • Loading branch information
cyprain-okeke committed May 23, 2024
1 parent b269391 commit a9ab894
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Billing/Controllers/StripeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,23 @@ private async Task HandleUpcomingInvoiceEventAsync(Event parsedEvent)
await SendEmails(new List<string> { user.Email });
}
}
else if (providerId.HasValue)
{
var provider = await _providerRepository.GetByIdAsync(providerId.Value);

if (provider == null)
{
_logger.LogError(
"Received invoice.Upcoming webhook ({EventID}) for Provider ({ProviderID}) that does not exist",
parsedEvent.Id,
providerId.Value);

return;
}

await SendEmails(new List<string> { provider.BillingEmail });

}

return;

Expand Down

0 comments on commit a9ab894

Please sign in to comment.