Skip to content

Commit

Permalink
Add SendInvoiceUpcoming overload for multiple emails
Browse files Browse the repository at this point in the history
  • Loading branch information
amorask-bitwarden committed Oct 3, 2023
1 parent 81ad17c commit fdb5c4f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
12 changes: 11 additions & 1 deletion src/Core/Services/IMailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ public interface IMailService
Task SendOrganizationConfirmedEmailAsync(string organizationName, string email);
Task SendOrganizationUserRemovedForPolicyTwoStepEmailAsync(string organizationName, string email);
Task SendPasswordlessSignInAsync(string returnUrl, string token, string email);
Task SendInvoiceUpcomingAsync(string email, decimal amount, DateTime dueDate, List<string> items,
Task SendInvoiceUpcoming(
string email,
decimal amount,
DateTime dueDate,
List<string> items,
bool mentionInvoices);
Task SendInvoiceUpcoming(
IEnumerable<string> email,
decimal amount,
DateTime dueDate,
List<string> items,
bool mentionInvoices);
Task SendPaymentFailedAsync(string email, decimal amount, bool mentionInvoices);
Task SendAddedCreditAsync(string email, decimal amount);
Expand Down
19 changes: 15 additions & 4 deletions src/Core/Services/Implementations/HandlebarsMailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,21 @@ public async Task SendPasswordlessSignInAsync(string returnUrl, string token, st
await _mailDeliveryService.SendEmailAsync(message);
}

public async Task SendInvoiceUpcomingAsync(string email, decimal amount, DateTime dueDate,
List<string> items, bool mentionInvoices)
{
var message = CreateDefaultMessage("Your Subscription Will Renew Soon", email);
public async Task SendInvoiceUpcoming(
string email,
decimal amount,
DateTime dueDate,
List<string> items,
bool mentionInvoices) => await SendInvoiceUpcoming(new List<string> { email }, amount, dueDate, items, mentionInvoices);

public async Task SendInvoiceUpcoming(
IEnumerable<string> emails,
decimal amount,
DateTime dueDate,
List<string> items,
bool mentionInvoices)
{
var message = CreateDefaultMessage("Your Subscription Will Renew Soon", emails);
var model = new InvoiceUpcomingViewModel
{
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
Expand Down
18 changes: 13 additions & 5 deletions src/Core/Services/NoopImplementations/NoopMailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,19 @@ public Task SendPasswordlessSignInAsync(string returnUrl, string token, string e
return Task.FromResult(0);
}

public Task SendInvoiceUpcomingAsync(string email, decimal amount, DateTime dueDate,
List<string> items, bool mentionInvoices)
{
return Task.FromResult(0);
}
public Task SendInvoiceUpcoming(
string email,
decimal amount,
DateTime dueDate,
List<string> items,
bool mentionInvoices) => Task.FromResult(0);

public Task SendInvoiceUpcoming(
IEnumerable<string> emails,
decimal amount,
DateTime dueDate,
List<string> items,
bool mentionInvoices) => Task.FromResult(0);

public Task SendPaymentFailedAsync(string email, decimal amount, bool mentionInvoices)
{
Expand Down

0 comments on commit fdb5c4f

Please sign in to comment.