This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using LiteCharms.Features.Email.Configuration;
|
||||
using LiteCharms.Features.Email.Extensions;
|
||||
using LiteCharms.Features.Email.Models;
|
||||
using LiteCharms.Features.Shop;
|
||||
|
||||
namespace LiteCharms.Features.Email;
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using LiteCharms.Features.Shop;
|
||||
using LiteCharms.Features.Shop.Notifications;
|
||||
using static LiteCharms.Features.Extensions.Email;
|
||||
|
||||
namespace LiteCharms.Features.Email.Events.Handlers;
|
||||
|
||||
public class SendShopEmailEnquiryEventHandler(NotificationService notificationService) :
|
||||
INotificationHandler<SendShopEmailEnquiryEvent>
|
||||
{
|
||||
public async ValueTask Handle(SendShopEmailEnquiryEvent notification, CancellationToken cancellationToken) =>
|
||||
await notificationService.CreateNotificationAsync(new Shop.Notifications.Models.CreateNotification
|
||||
{
|
||||
CorrelationId = notification.CorrelationId,
|
||||
CorrelationIdType = CorrelationIdTypes.None,
|
||||
Direction = NotificationDirection.Outgoing,
|
||||
IsHtml = false,
|
||||
IsInternal = true,
|
||||
Message = notification.Message,
|
||||
Platform = NotificationPlatforms.Email,
|
||||
Priority = notification.Priority,
|
||||
Subject = notification.Subject!,
|
||||
Sender = notification.SenderName!,
|
||||
SenderAddress = notification.SenderAddress!,
|
||||
Recipient = ShopEmailFromName,
|
||||
RecipientAddress = ShopEmailFromAddress
|
||||
}, cancellationToken);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using LiteCharms.Features.Abstractions;
|
||||
using LiteCharms.Features.Shop;
|
||||
|
||||
namespace LiteCharms.Features.Email.Events;
|
||||
|
||||
public class SendShopEmailEnquiryEvent : EventBase, IEvent
|
||||
{
|
||||
public string Name { get; set; } = nameof(SendShopEmailEnquiryEvent);
|
||||
|
||||
public string? SenderName { get; set; }
|
||||
|
||||
public string? SenderAddress { get; set; }
|
||||
|
||||
public string? Subject { get; set; }
|
||||
|
||||
public string? Message { get; set; }
|
||||
|
||||
public Priorities Priority { get; set; }
|
||||
|
||||
public SendShopEmailEnquiryEvent() { }
|
||||
|
||||
private SendShopEmailEnquiryEvent(string senderName, string senderAddress, string subject, string message, Priorities priority = Priorities.Medium)
|
||||
{
|
||||
SenderName = senderName;
|
||||
SenderAddress = senderAddress;
|
||||
Subject = subject;
|
||||
Message = message;
|
||||
Priority = priority;
|
||||
}
|
||||
|
||||
public static SendShopEmailEnquiryEvent Create(string senderName, string senderAddress, string subject, string message, Priorities priority = Priorities.Medium)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNullOrWhiteSpace(senderName, nameof(senderName));
|
||||
ArgumentNullException.ThrowIfNullOrWhiteSpace(senderAddress, nameof(senderAddress));
|
||||
ArgumentNullException.ThrowIfNullOrWhiteSpace(subject, nameof(subject));
|
||||
ArgumentNullException.ThrowIfNullOrWhiteSpace(message, nameof(message));
|
||||
|
||||
return new(senderName, senderAddress, subject, message, priority);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using LiteCharms.Features.Shop;
|
||||
|
||||
namespace LiteCharms.Features.Email.Models;
|
||||
namespace LiteCharms.Features.Email.Models;
|
||||
|
||||
public class Response
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user