Implemented Email and Hash Service
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
namespace PostFundManagement.Domain.Models.Email;
|
||||
|
||||
public sealed class Attachment
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public Stream? FileStream { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace PostFundManagement.Domain.Models.Email;
|
||||
|
||||
public sealed class Body : IDisposable
|
||||
{
|
||||
public string? Message { get; set; }
|
||||
|
||||
public ReadOnlyCollection<Attachment>? Attachments { get; set; }
|
||||
|
||||
public BodyProperties Properties { get; set; } = new();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Attachments is null) return;
|
||||
|
||||
foreach (var attachment in Attachments!)
|
||||
{
|
||||
if (attachment is not null)
|
||||
{
|
||||
attachment.FileStream!.Close();
|
||||
attachment.FileStream!.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PostFundManagement.Domain.Models.Email;
|
||||
|
||||
public sealed class BodyProperties
|
||||
{
|
||||
public bool IsHtml { get; set; }
|
||||
|
||||
public bool HasAttachments { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace PostFundManagement.Domain.Models.Email;
|
||||
|
||||
public sealed class Message : IDisposable
|
||||
{
|
||||
public Party? Sender { get; set; }
|
||||
|
||||
public Party? Recipient { get; set; }
|
||||
|
||||
public string? Subject { get; set; }
|
||||
|
||||
public Body? Body { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Body?.Dispose();
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace PostFundManagement.Domain.Models.Email;
|
||||
|
||||
public sealed class Party
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public string? Address { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace PostFundManagement.Domain.Models.Email;
|
||||
|
||||
public sealed class Response
|
||||
{
|
||||
public int Code { get; set; }
|
||||
|
||||
public string? Error { get; set; }
|
||||
|
||||
public EmailStatuses Status { get; set; }
|
||||
|
||||
private Response(EmailStatuses status, int code = 0, string? error = null)
|
||||
{
|
||||
Status = status;
|
||||
Code = code;
|
||||
Error = error;
|
||||
}
|
||||
|
||||
public static Response Create(EmailStatuses status, int code = 0, string? error = null) =>
|
||||
new(status, code, error);
|
||||
}
|
||||
Reference in New Issue
Block a user