Refaktorisierung der DecodeEnvelopeReceiverId-Methode in EnvelopeGeneratorExtensions

This commit is contained in:
Developer 02
2024-04-08 10:23:54 +02:00
parent ab713a23ac
commit 501d48961e
8 changed files with 38 additions and 53 deletions

View File

@@ -10,5 +10,7 @@ namespace EnvelopeGenerator.Application.Contracts
Task<IServiceResult<IEnumerable<EnvelopeDto>>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false, bool documentReceiverElement = false);
Task<IServiceResult<EnvelopeDto>> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false);
Task<IServiceResult<EnvelopeDto>> ReadByEnvelopeKeyAsync(string envelopeKey, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false);
}
}

View File

@@ -0,0 +1,17 @@
namespace EnvelopeGenerator.Application.Services
{
public static class EnvelopeGeneratorExtensions
{
public static (string EnvelopeUuid, string ReceiverSignature) DecodeEnvelopeReceiverId(this string envelopeReceiverId)
{
byte[] bytes = Convert.FromBase64String(envelopeReceiverId);
string decodedString = System.Text.Encoding.UTF8.GetString(bytes);
string[] parts = decodedString.Split(new string[] { "::" }, StringSplitOptions.None);
if (parts.Length > 1)
return (EnvelopeUuid: parts[0], ReceiverSignature: parts[1]);
else
return (string.Empty, string.Empty);
}
}
}