29-11-2023
This commit is contained in:
@@ -9,10 +9,10 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
private readonly EnvelopeService envelopeService;
|
||||
private readonly EmailService emailService;
|
||||
|
||||
public EnvelopeController(DatabaseService database, LoggingService logging, EnvelopeService envelope, EmailService email) : base(database, logging)
|
||||
public EnvelopeController(DatabaseService database, LoggingService logging, EnvelopeService envelope) : base(database, logging)
|
||||
{
|
||||
envelopeService = envelope;
|
||||
emailService = email;
|
||||
emailService = new(state);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -62,7 +62,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
|
||||
envelopeService.InsertHistoryEntrySigned(response);
|
||||
|
||||
SendSignedEmail(response);
|
||||
emailService.SendSignedEmail(response.Receiver.Id, response.Envelope.Id);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
@@ -71,18 +71,5 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
return ErrorResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
public bool SendSignedEmail(EnvelopeResponse response)
|
||||
{
|
||||
EmailTemplate template = new();
|
||||
EmailData emailData = new(response.Envelope, response.Receiver)
|
||||
{
|
||||
SignatureLink = "",
|
||||
};
|
||||
|
||||
template.FillDocumentSignedEmailBody(emailData);
|
||||
|
||||
return emailService.SendEmail(emailData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@ using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
public class ActionObject
|
||||
{
|
||||
public int ActionType { get; set; }
|
||||
}
|
||||
|
||||
public class HistoryController : BaseController
|
||||
{
|
||||
private readonly EnvelopeService envelopeService;
|
||||
@@ -21,7 +16,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/history/{envelopeKey}")]
|
||||
public IActionResult Get(string envelopeKey, [FromBody] ActionObject action)
|
||||
public IActionResult Get(string envelopeKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -30,12 +25,11 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
// Validate Envelope Key and load envelope
|
||||
envelopeService.EnsureValidEnvelopeKey(envelopeKey);
|
||||
EnvelopeResponse response = envelopeService.LoadEnvelope(envelopeKey);
|
||||
EnvelopeHistoryActionType actionType = (EnvelopeHistoryActionType)action.ActionType;
|
||||
|
||||
envelopeService.InsertHistoryEntry(new EnvelopeHistoryEntry()
|
||||
{
|
||||
ActionDate = DateTime.Now,
|
||||
ActionType = actionType,
|
||||
Status = EnvelopeStatus.DocumentOpened,
|
||||
EnvelopeId = response.Envelope.Id,
|
||||
UserReference = response.Receiver.Email
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user