Methoden hinzugefügt, um UUID und Signatur aus envelopeReceiverId zu extrahieren
This commit is contained in:
parent
f5dd3cf8be
commit
5e758899ab
@ -1,7 +1,15 @@
|
|||||||
namespace EnvelopeGenerator.Application.Services
|
namespace EnvelopeGenerator.Application.Services
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides extension methods for decoding and extracting information from an envelope receiver ID.
|
||||||
|
/// </summary>
|
||||||
public static class EnvelopeGeneratorExtensions
|
public static class EnvelopeGeneratorExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Decodes the envelope receiver ID and extracts the envelope UUID and receiver signature.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="envelopeReceiverId">The base64 encoded string containing the envelope UUID and receiver signature.</param>
|
||||||
|
/// <returns>A tuple containing the envelope UUID and receiver signature.</returns>
|
||||||
public static (string EnvelopeUuid, string ReceiverSignature) DecodeEnvelopeReceiverId(this string envelopeReceiverId)
|
public static (string EnvelopeUuid, string ReceiverSignature) DecodeEnvelopeReceiverId(this string envelopeReceiverId)
|
||||||
{
|
{
|
||||||
byte[] bytes = Convert.FromBase64String(envelopeReceiverId);
|
byte[] bytes = Convert.FromBase64String(envelopeReceiverId);
|
||||||
@ -13,5 +21,19 @@
|
|||||||
else
|
else
|
||||||
return (string.Empty, string.Empty);
|
return (string.Empty, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the envelope UUID from the decoded envelope receiver ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="envelopeReceiverId">The base64 encoded string to decode.</param>
|
||||||
|
/// <returns>The envelope UUID.</returns>
|
||||||
|
public static string GetEnvelopeUuid(this string envelopeReceiverId) => envelopeReceiverId.DecodeEnvelopeReceiverId().EnvelopeUuid;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the receiver signature from the decoded envelope receiver ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="envelopeReceiverId">The base64 encoded string to decode.</param>
|
||||||
|
/// <returns>The receiver signature.</returns>
|
||||||
|
public static string GetReceiverSignature(this string envelopeReceiverId) => envelopeReceiverId.DecodeEnvelopeReceiverId().ReceiverSignature;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +62,29 @@ namespace EnvelopeGenerator.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/EnvelopeKey/{envelopeReceiverId}")]
|
[HttpGet("/EnvelopeKey/{envelopeReceiverId}")]
|
||||||
public IActionResult ShowEnvelope([FromRoute] string envelopeReceiverId) => Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
public async Task<IActionResult> ShowEnvelope([FromRoute] string envelopeReceiverId)
|
||||||
|
{
|
||||||
|
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
|
||||||
|
|
||||||
|
if (response.Envelope.UseAccessCode)
|
||||||
|
{
|
||||||
|
bool accessCodeAlreadyRequested = database.Models.receiverModel.AccessCodeAlreadyRequested(response.Receiver.Email, response.Envelope.Id);
|
||||||
|
|
||||||
|
if (!accessCodeAlreadyRequested)
|
||||||
|
{
|
||||||
|
// Send email with password
|
||||||
|
bool actionResult = database.Services.actionService.RequestAccessCode(response.Envelope, response.Receiver);
|
||||||
|
bool result = database.Services.emailService.SendDocumentAccessCodeReceivedEmail(response.Envelope, response.Receiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Redirect($"/EnvelopeKey/{envelopeReceiverId}/Locked");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewData["EnvelopeKey"] = envelopeReceiverId;
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost("/EnvelopeKey/{envelopeReceiverId}/Locked")]
|
[HttpPost("/EnvelopeKey/{envelopeReceiverId}/Locked")]
|
||||||
public async Task<IActionResult> ShowEnvelope([FromRoute] string envelopeReceiverId, [FromForm] string access_code)
|
public async Task<IActionResult> ShowEnvelope([FromRoute] string envelopeReceiverId, [FromForm] string access_code)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user