refactor(EnvelopeController): move rejection and signing check to Main-endpoint
This commit is contained in:
@@ -75,6 +75,24 @@ public class EnvelopeController : ViewControllerBase
|
|||||||
if (er is null)
|
if (er is null)
|
||||||
return this.ViewEnvelopeNotFound();
|
return this.ViewEnvelopeNotFound();
|
||||||
|
|
||||||
|
#region rejected or signed
|
||||||
|
//check rejection
|
||||||
|
var rejRcvrs = await _historyService.ReadRejectingReceivers(er.Envelope!.Id);
|
||||||
|
if (rejRcvrs.Any())
|
||||||
|
{
|
||||||
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
ViewBag.IsExt = !rejRcvrs.Contains(er.Receiver); //external if the current user is not rejected
|
||||||
|
return View("EnvelopeRejected", er);
|
||||||
|
}
|
||||||
|
|
||||||
|
//check if it has already signed
|
||||||
|
if (await _historyService.IsSigned(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress))
|
||||||
|
{
|
||||||
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
|
return View("EnvelopeSigned");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
bool accessCodeAlreadyRequested = await _historyService.AccessCodeAlreadyRequested(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress);
|
bool accessCodeAlreadyRequested = await _historyService.AccessCodeAlreadyRequested(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress);
|
||||||
if (!accessCodeAlreadyRequested)
|
if (!accessCodeAlreadyRequested)
|
||||||
{
|
{
|
||||||
@@ -146,23 +164,7 @@ public class EnvelopeController : ViewControllerBase
|
|||||||
|
|
||||||
_logger.LogInformation("Envelope UUID: [{uuid}]\nReceiver Signature: [{signature}]", uuid, signature);
|
_logger.LogInformation("Envelope UUID: [{uuid}]\nReceiver Signature: [{signature}]", uuid, signature);
|
||||||
|
|
||||||
//check rejection
|
if (er.Envelope!.Documents?.FirstOrDefault() is DocumentDto doc && doc.ByteData is not null)
|
||||||
var rejRcvrs = await _historyService.ReadRejectingReceivers(er.Envelope!.Id);
|
|
||||||
if (rejRcvrs.Any())
|
|
||||||
{
|
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
|
||||||
ViewBag.IsExt = !rejRcvrs.Contains(er.Receiver); //external if the current user is not rejected
|
|
||||||
return View("EnvelopeRejected", er);
|
|
||||||
}
|
|
||||||
|
|
||||||
//check if it has already signed
|
|
||||||
if (await _historyService.IsSigned(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress))
|
|
||||||
{
|
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
|
||||||
return View("EnvelopeSigned");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (er.Envelope.Documents?.FirstOrDefault() is DocumentDto doc && doc.ByteData is not null)
|
|
||||||
{
|
{
|
||||||
ViewData["DocumentBytes"] = doc.ByteData;
|
ViewData["DocumentBytes"] = doc.ByteData;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user