23 lines
1.0 KiB
C#
23 lines
1.0 KiB
C#
using LiteCharms.Features.Notifications.Commands;
|
|
using LiteCharms.Features.Shop;
|
|
using static LiteCharms.Features.Email.Extensions.Constants;
|
|
|
|
namespace LiteCharms.Features.Email.Events.Handlers;
|
|
|
|
// TODO: Inject the INotificationService
|
|
public class SendShopEmailEnquiryEventHandler(ISender mediator) :
|
|
INotificationHandler<SendShopEmailEnquiryEvent>
|
|
{
|
|
public async ValueTask Handle(SendShopEmailEnquiryEvent notification, CancellationToken cancellationToken)
|
|
{
|
|
// TODO: Refactor this to use the NotificationService
|
|
var command = CreateNotification.Create(NotificationDirection.Outgoing, notification.SenderName!,
|
|
notification.SenderAddress!, notification.Subject!, notification.Message!, NotificationPlatforms.Email,
|
|
notification.Priority, ShopEmailFromName, ShopEmailFromAddress, Guid.CreateVersion7().ToString(),
|
|
CorrelationIdTypes.None, isInternal: true, isHtml: false);
|
|
|
|
// TODO: Remove, deprecated
|
|
await mediator.Send(command, cancellationToken);
|
|
}
|
|
}
|