Compare commits
388 Commits
feat/signF
...
refactor/f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8db72037e0 | |||
| 6b89b9bbf2 | |||
| 83ff3da795 | |||
| 5bb3341f43 | |||
| 7568274c77 | |||
| c59b179a8f | |||
| 248c5bce5a | |||
| c76a772768 | |||
| 3ba7bfd15a | |||
| e8f2c868b1 | |||
| ae669d05e7 | |||
| fbbc05814f | |||
| ec57906290 | |||
| fbfc20705d | |||
| 895eb8977e | |||
| 428f45bff1 | |||
| 9339f24bf1 | |||
| 390cbf9db5 | |||
| 570a192438 | |||
| c8a0264ed8 | |||
| 207bc8bcbd | |||
| 1ac2a476d2 | |||
|
|
41f5d9f1e4 | ||
| 2ae6dda27e | |||
| e5a25c5893 | |||
| 7d0648ede4 | |||
| bb6ca82289 | |||
| ed7068fe71 | |||
| 876c5def56 | |||
| 40697435ff | |||
| b43399ad01 | |||
| f41f26b810 | |||
| 442b7f7451 | |||
| beada59593 | |||
| b78aff102a | |||
| 67f068ef38 | |||
| 122df4bd62 | |||
| 741ebc8975 | |||
| ada76d5030 | |||
| 845d06fc4c | |||
| 59105caffc | |||
| fa8d2f5f62 | |||
| dbf42e13d9 | |||
| e48a86e21c | |||
| 1e6c9ed40e | |||
| 1d605e9da3 | |||
| 77070a8cfc | |||
| c479ea4179 | |||
| 369d101d7b | |||
| 86eb687296 | |||
| aa8f46a303 | |||
| 2c825d2fe3 | |||
| 1e1517f88a | |||
| 124523ad88 | |||
| 9c48b230b4 | |||
| 95fe1aefcf | |||
| 1b7a42fd7e | |||
| 73da768ed3 | |||
| f20243d02c | |||
| c1c30caeec | |||
| 5ccd1fee26 | |||
| 954d665ac3 | |||
| bb85437cc4 | |||
| 763f022a5e | |||
| f87f8a1d17 | |||
| fb5d2110bd | |||
| aafed0f4f4 | |||
| a433654f86 | |||
| b599ada864 | |||
| 6b00ab6a45 | |||
| 6ab85f25eb | |||
| fa46dd1fa8 | |||
| e623680c3f | |||
| f6e34c6d91 | |||
| fc443fb87f | |||
| 1c9d0a6c47 | |||
| 23ec4fe322 | |||
| 8ca0519dbc | |||
| c67bac3e16 | |||
| 6cdd1db7a9 | |||
| a87a524271 | |||
| ddb2439b29 | |||
| d48514bbad | |||
| 00077a647a | |||
| ee7eb08e75 | |||
| 6a34b65825 | |||
| 20d312a84e | |||
| 87c5e7e4de | |||
| bb93b980b4 | |||
| 950ae5a418 | |||
| 582cc1eb13 | |||
| 9434f83b3e | |||
| bbe93dad45 | |||
| 0a876fe486 | |||
| a584a548d6 | |||
| 3e3c9d4c54 | |||
| 33fa4b76f5 | |||
| 7a84726a3b | |||
| 27d97ed12a | |||
| f699e5a9aa | |||
| dc723d9f02 | |||
| 48ce0d5f32 | |||
| ef7e694c9f | |||
| c5c040fb15 | |||
| fc4187bb9e | |||
| ae4f5560fe | |||
| 09eb91b6be | |||
| 838d7e3ab8 | |||
| 542d80c439 | |||
| 145a2ebe8f | |||
| 9cf776fa98 | |||
| 68878c0fc8 | |||
| d3e5d3d791 | |||
| a7f6b94d20 | |||
| 777f20eddb | |||
| c14ffceee4 | |||
| e9202ad23e | |||
| 954eff7101 | |||
| ac501dffb1 | |||
| baf2207d03 | |||
| 6863ada4be | |||
| 8a22075abe | |||
| bcb2e79fa1 | |||
| c8dae1d8ff | |||
| cc2db8716e | |||
| b939e19334 | |||
| 16e769d916 | |||
| befbacad7c | |||
| aa1e218b37 | |||
| ab9a6cd595 | |||
| 8783cb9cd8 | |||
| e49be2b7c3 | |||
| 14a565d202 | |||
| dc42a76f31 | |||
|
|
dee58bec4b | ||
|
|
5bd045b998 | ||
|
|
fbbacb30bc | ||
|
|
0b879b2f5b | ||
|
|
a343312f97 | ||
|
|
dad43de8b1 | ||
|
|
f7c988be9b | ||
|
|
e0af5b769d | ||
|
|
b8c348afb6 | ||
| 79dc4ba599 | |||
| 3616d43f2e | |||
| d5443b223c | |||
| c456cb0301 | |||
| 1c0c23aca4 | |||
| 05d7ac7864 | |||
| 95e793b081 | |||
| dfa1667939 | |||
|
|
8a4d3ff6f9 | ||
|
|
783d91a658 | ||
|
|
ad032b2bdf | ||
|
|
f2876d8995 | ||
|
|
5468d7b2aa | ||
|
|
b005c194d3 | ||
|
|
dee6608390 | ||
|
|
8b53eae6da | ||
|
|
405b619bdc | ||
|
|
c5918b8e49 | ||
|
|
05cd8a05f4 | ||
|
|
2355a566e4 | ||
|
|
c887f857cd | ||
|
|
f114144d34 | ||
|
|
5c09601e3f | ||
|
|
18b05a3c63 | ||
|
|
ce35b0fea1 | ||
|
|
7f18cd64c5 | ||
|
|
0083c1b6c1 | ||
| 59e73dbcf0 | |||
| f34770931f | |||
| 78100ef24f | |||
| 99083a68aa | |||
| 0939e57c56 | |||
| 00bdfeb9bb | |||
| cced0e5579 | |||
| 82150290d2 | |||
| fb7fd47a2a | |||
| 20b6b328f5 | |||
| fb07d9151f | |||
| a3bc26bd08 | |||
| e1f793e571 | |||
| 86d8fcda07 | |||
| 2f8401073f | |||
| 85a855fe64 | |||
| 996b544633 | |||
| 811656c4ca | |||
| 7e90d25f0b | |||
| 20751aa708 | |||
| 51b96e2a81 | |||
| 7a011930df | |||
| a080aaec95 | |||
| d390802305 | |||
| 0b33ba0fd8 | |||
| 6778d8e3e7 | |||
| 3394a580f4 | |||
| 82a63b0dae | |||
| e61d626bf3 | |||
| bd7c1d4e36 | |||
| 30e2ac602d | |||
| 1577440b77 | |||
| 68a6a23a20 | |||
| 5e5458d87c | |||
| eae83adee4 | |||
| a29785f7c7 | |||
| cb641fd33a | |||
| 9434832261 | |||
| b7e19db0f1 | |||
| 290e87048c | |||
| c0a5b57668 | |||
| 02ef05f054 | |||
| 72134c3d3b | |||
| a4fffaa9b9 | |||
| 3a62f5317f | |||
| 59c93de8b7 | |||
| 5122a2099d | |||
| 95ec19d816 | |||
| c7b3d97b2e | |||
| 196941f73f | |||
| 415fe646b2 | |||
| f42218802d | |||
| fcf00171de | |||
| ca28c4cca4 | |||
| a48e4988d6 | |||
| ec513716ff | |||
| f39b761412 | |||
| 70d122d2ff | |||
| 5bc5fcf764 | |||
| 8db62b41ba | |||
| 0f27600c5b | |||
| 9045655262 | |||
| 5bcac264a7 | |||
| c7bf800cd5 | |||
| 5fb4d03ee7 | |||
| ac70aaa527 | |||
| e877000b14 | |||
| 305422688e | |||
| 9c6135d208 | |||
| 903e4678ed | |||
| 730a318b56 | |||
| 55c0f44954 | |||
| dbb745338c | |||
| 419f421d52 | |||
| e64ac4b5e7 | |||
| d8200993af | |||
| ee98142405 | |||
| c27337a6f5 | |||
| a09ea990ab | |||
| 05888bc57d | |||
| 39af0fe4fd | |||
| f4c61e3bc7 | |||
| 3f5a584399 | |||
| 6aec854a64 | |||
| c360bde103 | |||
| 82d4b0e740 | |||
| 12519f06f7 | |||
| a2471a0c35 | |||
| 4251a24fe9 | |||
| 63a830c8e3 | |||
| acee28ffce | |||
| 50a541c5bf | |||
| d43877db62 | |||
| 242e66cd8d | |||
| e44fa0b7bd | |||
| 4201f7820a | |||
| e095074c22 | |||
| 412f19547f | |||
| b8c00884a9 | |||
| 51d49d68ba | |||
| 4d5ee2b461 | |||
| 8a79ee4126 | |||
| cde9896c01 | |||
| c7d26a87b0 | |||
| 17ceb1f72a | |||
| b2c396c3b2 | |||
|
|
286e17a900 | ||
|
|
a21db6d6c5 | ||
|
|
fe7030b9d7 | ||
|
|
888c04b5c9 | ||
| de2cc62f95 | |||
| 0cfa732d87 | |||
|
|
b14d9169f2 | ||
| be51ca31dd | |||
| bb8d7cd208 | |||
| b6588db615 | |||
| 9a9aa2608b | |||
| 349d65d050 | |||
| 93593226e2 | |||
| 351cead423 | |||
| 07cab88e0d | |||
| faa019355a | |||
| df9bcf3221 | |||
| cda19e2b83 | |||
| 1586009a72 | |||
| 408b1e9f0d | |||
| 9158933333 | |||
| 902848958d | |||
| f5418499a7 | |||
| 47d190d9ea | |||
| 35f46d3182 | |||
| 425d21084b | |||
| 6aeba4d1e7 | |||
| 6930d7a431 | |||
| c453a1650a | |||
| b9f5ae826a | |||
| 532dc41004 | |||
| 13899cf70a | |||
| 9756303d6e | |||
| 1c51fafb69 | |||
| 94d43bce24 | |||
| f5733228bf | |||
| e3cb2ec219 | |||
|
|
260c1c174d | ||
| 1c90e693da | |||
| e4c6714677 | |||
| 812b49cfcb | |||
| f039437f4c | |||
| 6f73ba929c | |||
| fcbe956095 | |||
| e628309734 | |||
| d6cbd0597e | |||
| 9d45082bfc | |||
| 3304b01d7b | |||
| f5d33846d5 | |||
| 231140505e | |||
| 62a73e4967 | |||
| dedfb924d8 | |||
| 08601adc49 | |||
| 2a4255e5a3 | |||
| 0800e4d13e | |||
| 07381e78b4 | |||
| 5d29ad889d | |||
| 5ee9efbcd9 | |||
| 5c48afd8b0 | |||
| 2dbeae24d5 | |||
| ff1e9f27af | |||
| db05183137 | |||
| 452077e86a | |||
| f8a7239041 | |||
|
|
a1688608ab | ||
| 72fa6fb258 | |||
|
|
3c60f31050 | ||
|
|
f1920e16fa | ||
|
|
c1d46b446a | ||
|
|
a5261baec5 | ||
|
|
3eb11311a7 | ||
|
|
10b05d6301 | ||
|
|
c6fe039dd8 | ||
|
|
1f43dff9f4 | ||
|
|
dafa4f0409 | ||
|
|
3625508460 | ||
|
|
7326f03a8d | ||
|
|
35e9f6404c | ||
|
|
dd6bc55fd6 | ||
|
|
8e4266fcf6 | ||
|
|
10aa857544 | ||
|
|
4fc94fc567 | ||
|
|
b83607d916 | ||
|
|
a38c2cd956 | ||
|
|
502c607ebd | ||
|
|
39c1d3e624 | ||
|
|
39cc30f48b | ||
|
|
79204d4f6d | ||
|
|
806b990556 | ||
|
|
d34a1016c4 | ||
|
|
93dbe63fb4 | ||
|
|
55ffe40c46 | ||
|
|
be9516d852 | ||
|
|
12502bb2de | ||
|
|
26745e0c37 | ||
|
|
2ea5fd7dbb | ||
|
|
446aeb00b1 | ||
|
|
abc3bb7652 | ||
|
|
a8a768d7d6 | ||
|
|
31c4a8a20f | ||
|
|
e98abde5ff | ||
|
|
49497dafd1 | ||
|
|
08e1187124 | ||
|
|
1b923dc93b | ||
|
|
bdf2527fc1 | ||
|
|
1a69478f48 | ||
|
|
83d29bf78d | ||
|
|
bc45aadf27 | ||
|
|
7e66cd4dae | ||
|
|
cc11d70a27 | ||
|
|
02aeaea8a9 | ||
|
|
05867cc645 |
@@ -0,0 +1,33 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class AuthenticatorParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789012345678901234567890123456789'
|
||||||
|
/// </summary>
|
||||||
|
public string CharPool { get; init; } = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789012345678901234567890123456789";
|
||||||
|
|
||||||
|
//TODO: Increase the DefaultTotpSecretKeyLength (e.g. to 32) but make sure that the QR code is generated correctly and can be scanned by the authenticator.
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 20
|
||||||
|
/// </summary>
|
||||||
|
public int DefaultTotpSecretKeyLength { get; init; } = 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is
|
||||||
|
/// </summary>
|
||||||
|
public string TotpIssuer { get; init; } = "signFlow";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 0 is user email, 1 is secret key and 2 is issuer.
|
||||||
|
/// </summary>
|
||||||
|
public string TotpUrlFormat { get; init; } = "otpauth://totp/{0}?secret={1}&issuer={2}";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 20.
|
||||||
|
/// </summary>
|
||||||
|
public int TotpQRPixelsPerModule { get; init; } = 20;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DbTriggerParams : Dictionary<string, ICollection<string>>
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DispatcherParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 1
|
||||||
|
/// </summary>
|
||||||
|
public int SendingProfile { get; init; } = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defalt value is 'DDEnvelopGenerator'
|
||||||
|
/// </summary>
|
||||||
|
public string AddedWho { get; init; } = "DDEnvelopGenerator";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 202377
|
||||||
|
/// </summary>
|
||||||
|
public int ReminderTypeId { get; init; } = 202377;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is string.Empty
|
||||||
|
/// </summary>
|
||||||
|
public string? EmailAttmt1 { get; init; } = null;
|
||||||
|
}
|
||||||
@@ -1,20 +1,37 @@
|
|||||||
using DigitalData.Core.Abstractions.Client;
|
using DigitalData.Core.Client.Interface;
|
||||||
namespace EnvelopeGenerator.Application.Configurations;
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/
|
/// https://www.gtx-messaging.com/en/api-docs/sms-rest-api/
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GtxMessagingParams : IHttpClientOptions
|
public class GtxMessagingParams : IHttpClientOptions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public required string Uri { get; init; }
|
public required string Uri { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public string? Path { get; init; }
|
public string? Path { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Dictionary<string, object>? Headers { get; init; }
|
public Dictionary<string, object>? Headers { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public Dictionary<string, object?>? QueryParams { get; init; }
|
public Dictionary<string, object?>? QueryParams { get; init; }
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'to'
|
||||||
|
/// </summary>
|
||||||
public string RecipientQueryParamName { get; init; } = "to";
|
public string RecipientQueryParamName { get; init; } = "to";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'text'
|
||||||
|
/// </summary>
|
||||||
public string MessageQueryParamName { get; init; } = "text";
|
public string MessageQueryParamName { get; init; } = "text";
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class MailParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required Dictionary<string, string> Placeholders { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
using OtpNet;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class TotpSmsParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The unit is second.
|
||||||
|
/// </summary>
|
||||||
|
public int TotpStep { get; init; } = 90;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'Ihr 2FA-Passwort lautet {0}. Gültig bis {1}'
|
||||||
|
/// </summary>
|
||||||
|
public string Format { get; init; } = "Ihr 2FA-Passwort lautet {0}. Gültig bis {1}";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public ExpirationHandler Expiration { get; init; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is VerificationWindow.RfcSpecifiedNetworkDelay
|
||||||
|
/// </summary>
|
||||||
|
public VerificationWindow? TotpVerificationWindow { get; private init; } = VerificationWindow.RfcSpecifiedNetworkDelay;
|
||||||
|
|
||||||
|
private IEnumerable<int>? _tvwParams;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<int>? TotpVerificationWindowParams
|
||||||
|
{
|
||||||
|
get => _tvwParams;
|
||||||
|
init
|
||||||
|
{
|
||||||
|
_tvwParams = value;
|
||||||
|
if(_tvwParams is not null)
|
||||||
|
TotpVerificationWindow = new(previous: _tvwParams.ElementAtOrDefault(0), future: _tvwParams.ElementAtOrDefault(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class ExpirationHandler
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'e{0}_r{1}_sms_code_expiration'
|
||||||
|
/// </summary>
|
||||||
|
public string CacheKeyFormat { get; init; } = "e{0}_r{1}_sms_code_expiration";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is HH:mm:ss
|
||||||
|
/// </summary>
|
||||||
|
public string Format { get; init; } = "HH:mm:ss";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'de-DE'
|
||||||
|
/// </summary>
|
||||||
|
public string CultureName
|
||||||
|
{
|
||||||
|
get => _cultureInfo.Name;
|
||||||
|
init => _cultureInfo = new(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'de-DE'
|
||||||
|
/// </summary>
|
||||||
|
private CultureInfo _cultureInfo = new("de-DE");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'de-DE'
|
||||||
|
/// </summary>
|
||||||
|
public CultureInfo CultureInfo => _cultureInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
30
EnvelopeGenerator.Application/Common/Dto/ConfigDto.cs
Normal file
30
EnvelopeGenerator.Application/Common/Dto/ConfigDto.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object representing configuration settings.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class ConfigDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the sending profile identifier.
|
||||||
|
/// </summary>
|
||||||
|
public int SendingProfile { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the signature host URL or name.
|
||||||
|
/// </summary>
|
||||||
|
public required string SignatureHost { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the external program.
|
||||||
|
/// </summary>
|
||||||
|
public string? ExternalProgramName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the path where exports will be saved.
|
||||||
|
/// </summary>
|
||||||
|
public string? ExportPath { get; set; }
|
||||||
|
}
|
||||||
35
EnvelopeGenerator.Application/Common/Dto/DocumentDto.cs
Normal file
35
EnvelopeGenerator.Application/Common/Dto/DocumentDto.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object representing a document within an envelope, including optional binary data and form elements.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class DocumentDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier of the document.
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the envelope ID to which the document belongs.
|
||||||
|
/// </summary>
|
||||||
|
public int EnvelopeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the date and time when the document was added.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the binary data of the document, if available.
|
||||||
|
/// </summary>
|
||||||
|
public byte[]? ByteData { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the collection of elements associated with the document for receiver interactions, if any.
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<SignatureDto>? Elements { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object representing the status of a document for a specific receiver.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class DocumentStatusDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier of the document status entry.
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the associated envelope.
|
||||||
|
/// </summary>
|
||||||
|
public int EnvelopeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ID of the receiver associated with this status.
|
||||||
|
/// </summary>
|
||||||
|
public int ReceiverId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the current status code.
|
||||||
|
/// </summary>
|
||||||
|
public EnvelopeStatus Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when the status was changed.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? StatusChangedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when this record was added.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when this record was last changed.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the display value associated with the status.
|
||||||
|
/// </summary>
|
||||||
|
public string? Value { get; set; }
|
||||||
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
namespace EnvelopeGenerator.Application.Common.Dto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public record EmailTemplateDto : IUnique<int>
|
public record EmailTemplateDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
121
EnvelopeGenerator.Application/Common/Dto/EnvelopeDto.cs
Normal file
121
EnvelopeGenerator.Application/Common/Dto/EnvelopeDto.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record EnvelopeDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required EnvelopeStatus Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is string.Empty
|
||||||
|
/// </summary>
|
||||||
|
public string StatusName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is string.Empty
|
||||||
|
/// </summary>
|
||||||
|
public string Uuid { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is string.Empty
|
||||||
|
/// </summary>
|
||||||
|
[TemplatePlaceholder("[MESSAGE]")]
|
||||||
|
public string Message { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is string.Empty
|
||||||
|
/// </summary>
|
||||||
|
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int? ContractType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is 'de-DE'
|
||||||
|
/// </summary>
|
||||||
|
public string Language { get; set; } = "de-DE";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int? EnvelopeTypeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int? CertificationType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool? UseAccessCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool TFAEnabled { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public UserReadDto? User { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public EnvelopeType? EnvelopeType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? EnvelopeTypeTitle { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAlreadySent { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public byte[]? DocResult { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<DocumentDto>? Documents { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||||
|
using EnvelopeGenerator.Application.Common.Dto.Receiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record EnvelopeReceiverDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public EnvelopeDto? Envelope { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public ReceiverDto? Receiver { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int EnvelopeId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int ReceiverId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Sequence { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[TemplatePlaceholder("[NAME_RECEIVER]")]
|
||||||
|
public string? Name { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? JobTitle { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? CompanyName { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? PrivateMessage { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public bool HasPhoneNumber { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record EnvelopeReceiverSecretDto : EnvelopeReceiverDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? AccessCode { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? PhoneNumber { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiverReadOnly;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="DateValid"></param>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record EnvelopeReceiverReadOnlyCreateDto(
|
||||||
|
DateTime DateValid)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[EmailAddress]
|
||||||
|
[Required]
|
||||||
|
public required string ReceiverMail { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is null
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long? EnvelopeId { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default value is DateTime.Now
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public DateTime AddedWhen { get; } = DateTime.Now;
|
||||||
|
};
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
using EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
using EnvelopeGenerator.Application.Common.Dto.Receiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiverReadOnly;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a read-only Data Transfer Object (DTO) for an envelope receiver.
|
||||||
|
/// Contains information about the receiver, associated envelope, and audit details.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class EnvelopeReceiverReadOnlyDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the unique identifier of the envelope receiver.
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the identifier of the associated envelope.
|
||||||
|
/// </summary>
|
||||||
|
public long EnvelopeId { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the email address of the receiver.
|
||||||
|
/// </summary>
|
||||||
|
public required string ReceiverMail { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the date until which the receiver is valid.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime DateValid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the date and time when the receiver was added.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the user who added the receiver.
|
||||||
|
/// Default value is 'unknown'.
|
||||||
|
/// </summary>
|
||||||
|
public string AddedWho { get; init; } = "Unknown";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the associated envelope details.
|
||||||
|
/// </summary>
|
||||||
|
public EnvelopeDto? Envelope { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the user who last changed the receiver, if any.
|
||||||
|
/// </summary>
|
||||||
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the date and time when the receiver was last changed, if any.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or inits the associated receiver details.
|
||||||
|
/// </summary>
|
||||||
|
public ReceiverDto? Receiver { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiverReadOnly;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object for updating a read-only envelope receiver.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class EnvelopeReceiverReadOnlyUpdateDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier of the envelope receiver.
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the date when the envelope receiver becomes valid.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime DateValid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user who made the change.
|
||||||
|
/// Default value is unknown.
|
||||||
|
/// </summary>
|
||||||
|
public string ChangedWho { get; set; } = "Unknown";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the date and time when the change was made.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime ChangedWhen { get; set; } = DateTime.Now;
|
||||||
|
}
|
||||||
85
EnvelopeGenerator.Application/Common/Dto/EnvelopeTypeDto.cs
Normal file
85
EnvelopeGenerator.Application/Common/Dto/EnvelopeTypeDto.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object representing a type of envelope with its configuration settings.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class EnvelopeTypeDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier of the envelope type.
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the title of the envelope type.
|
||||||
|
/// </summary>
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the language code used in this envelope type.
|
||||||
|
/// </summary>
|
||||||
|
public string Language { get; set; } = "de-DE";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the number of days after which the envelope expires.
|
||||||
|
/// </summary>
|
||||||
|
public int? ExpiresDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the certification type identifier.
|
||||||
|
/// </summary>
|
||||||
|
public int? CertificationType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether an access code is required.
|
||||||
|
/// </summary>
|
||||||
|
public bool? UseAccessCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the final email template ID to be sent to the creator.
|
||||||
|
/// </summary>
|
||||||
|
public int? FinalEmailToCreator { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the final email template ID to be sent to the receivers.
|
||||||
|
/// </summary>
|
||||||
|
public int? FinalEmailToReceivers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when this envelope type was added.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when this envelope type was last changed.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the number of days before expiry when a warning should be sent.
|
||||||
|
/// </summary>
|
||||||
|
public int? ExpiresWarningDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether reminder emails should be sent.
|
||||||
|
/// </summary>
|
||||||
|
public bool? SendReminderEmails { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the number of days before the first reminder is sent.
|
||||||
|
/// </summary>
|
||||||
|
public int? FirstReminderDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the interval in days between reminder emails.
|
||||||
|
/// </summary>
|
||||||
|
public int? ReminderIntervalDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the contract type associated with the envelope type.
|
||||||
|
/// </summary>
|
||||||
|
public int? ContractType { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.History;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object for creating a new envelope history record.
|
||||||
|
/// </summary>
|
||||||
|
public class HistoryCreateDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier of the envelope.
|
||||||
|
/// </summary>
|
||||||
|
public int EnvelopeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user reference associated with the action.
|
||||||
|
/// </summary>
|
||||||
|
public required string UserReference { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the status of the envelope at the time of the action.
|
||||||
|
/// </summary>
|
||||||
|
public int Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the date and time when the action occurred.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ActionDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an optional comment related to the action.
|
||||||
|
/// </summary>
|
||||||
|
public string? Comment { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using DigitalData.UserManager.Application.DTOs.User;
|
||||||
|
using EnvelopeGenerator.Application.Common.Dto.Receiver;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.History;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object representing the history of an envelope, including status, sender, receiver, and related metadata.
|
||||||
|
/// </summary>
|
||||||
|
public record HistoryDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unique identifier for the envelope history entry.
|
||||||
|
/// </summary>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifier of the associated envelope.
|
||||||
|
/// </summary>
|
||||||
|
public int EnvelopeId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reference string for the user related to this history entry.
|
||||||
|
/// </summary>
|
||||||
|
public required string UserReference { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Include code of the envelope at this history point.
|
||||||
|
/// </summary>
|
||||||
|
public EnvelopeStatus Status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Type of reference for this history entry.
|
||||||
|
/// </summary>
|
||||||
|
public ReferenceType ReferenceType => ((int)Status).ToString().FirstOrDefault() switch
|
||||||
|
{
|
||||||
|
'1' => ReferenceType.Sender,
|
||||||
|
'2' => ReferenceType.Receiver,
|
||||||
|
_ => ReferenceType.System,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Human-readable name of the status.
|
||||||
|
/// </summary>
|
||||||
|
public string? StatusName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date and time when this history entry was added.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Date and time when an action was performed, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ActionDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Information about the sender associated with this history entry.
|
||||||
|
/// </summary>
|
||||||
|
public UserCreateDto? Sender { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Information about the receiver associated with this history entry.
|
||||||
|
/// </summary>
|
||||||
|
public ReceiverDto? Receiver { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional comment related to this history entry.
|
||||||
|
/// </summary>
|
||||||
|
public string? Comment { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public override int GetHashCode() => Id.GetHashCode();
|
||||||
|
};
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
using EnvelopeGenerator.Application.Common.Dto.History;
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiverReadOnly;
|
||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
using EnvelopeGenerator.Application.Common.Dto.Messaging;
|
||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
using EnvelopeGenerator.Application.Common.Dto.Receiver;
|
||||||
using EnvelopeGenerator.Application.Extensions;
|
using EnvelopeGenerator.Application.Common.Extensions;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs;
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the AutoMapper profile configuration for mapping between
|
/// Represents the AutoMapper profile configuration for mapping between
|
||||||
@@ -23,40 +23,31 @@ public class MappingProfile : Profile
|
|||||||
{
|
{
|
||||||
// Entity to DTO mappings
|
// Entity to DTO mappings
|
||||||
CreateMap<Config, ConfigDto>();
|
CreateMap<Config, ConfigDto>();
|
||||||
CreateMap<DocumentReceiverElement, DocumentReceiverElementDto>();
|
CreateMap<Signature, SignatureDto>();
|
||||||
CreateMap<DocumentStatus, DocumentStatusDto>();
|
CreateMap<DocumentStatus, DocumentStatusDto>();
|
||||||
CreateMap<EmailTemplate, EmailTemplateDto>();
|
CreateMap<EmailTemplate, EmailTemplateDto>();
|
||||||
CreateMap<Envelope, EnvelopeDto>();
|
CreateMap<Envelope, EnvelopeDto>();
|
||||||
CreateMap<EnvelopeCertificate, EnvelopeCertificateDto>();
|
CreateMap<Document, DocumentDto>();
|
||||||
CreateMap<EnvelopeDocument, EnvelopeDocumentDto>();
|
CreateMap<Domain.Entities.History, HistoryDto>();
|
||||||
CreateMap<Domain.Entities.EnvelopeHistory, EnvelopeHistoryDto>();
|
CreateMap<Domain.Entities.History, HistoryCreateDto>();
|
||||||
CreateMap<Domain.Entities.EnvelopeHistory, EnvelopeHistoryCreateDto>();
|
|
||||||
CreateMap<Domain.Entities.EnvelopeReceiver, EnvelopeReceiverDto>();
|
CreateMap<Domain.Entities.EnvelopeReceiver, EnvelopeReceiverDto>();
|
||||||
CreateMap<Domain.Entities.EnvelopeReceiver, EnvelopeReceiverSecretDto>();
|
CreateMap<Domain.Entities.EnvelopeReceiver, EnvelopeReceiverSecretDto>();
|
||||||
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
||||||
CreateMap<Domain.Entities.Receiver, ReceiverReadDto>();
|
CreateMap<Domain.Entities.Receiver, ReceiverDto>();
|
||||||
CreateMap<Domain.Entities.Receiver, ReceiverCreateDto>();
|
|
||||||
CreateMap<Domain.Entities.Receiver, ReceiverUpdateDto>();
|
|
||||||
CreateMap<UserReceiver, UserReceiverDto>();
|
|
||||||
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
CreateMap<Domain.Entities.EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
|
||||||
|
|
||||||
// DTO to Entity mappings
|
// DTO to Entity mappings
|
||||||
CreateMap<ConfigDto, Config>();
|
CreateMap<ConfigDto, Config>();
|
||||||
CreateMap<DocumentReceiverElementDto, DocumentReceiverElement>();
|
CreateMap<SignatureDto, Signature>();
|
||||||
CreateMap<DocumentStatusDto, DocumentStatus>();
|
CreateMap<DocumentStatusDto, DocumentStatus>();
|
||||||
CreateMap<EmailTemplateDto, EmailTemplate>();
|
CreateMap<EmailTemplateDto, EmailTemplate>();
|
||||||
CreateMap<EnvelopeDto, Envelope>();
|
CreateMap<EnvelopeDto, Envelope>();
|
||||||
CreateMap<EnvelopeCertificateDto, EnvelopeCertificate>();
|
CreateMap<DocumentDto, Document>();
|
||||||
CreateMap<EnvelopeDocumentDto, EnvelopeDocument>();
|
CreateMap<HistoryDto, Domain.Entities.History>();
|
||||||
CreateMap<EnvelopeHistoryDto, Domain.Entities.EnvelopeHistory>();
|
CreateMap<HistoryCreateDto, Domain.Entities.History>();
|
||||||
CreateMap<EnvelopeHistoryCreateDto, Domain.Entities.EnvelopeHistory>();
|
|
||||||
CreateMap<EnvelopeReceiverDto, Domain.Entities.EnvelopeReceiver>();
|
CreateMap<EnvelopeReceiverDto, Domain.Entities.EnvelopeReceiver>();
|
||||||
CreateMap<EnvelopeTypeDto, EnvelopeType>();
|
CreateMap<EnvelopeTypeDto, EnvelopeType>();
|
||||||
CreateMap<ReceiverReadDto, Domain.Entities.Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
CreateMap<ReceiverDto, Domain.Entities.Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
|
||||||
CreateMap<ReceiverCreateDto, Domain.Entities.Receiver>();
|
|
||||||
CreateMap<ReceiverUpdateDto, Domain.Entities.Receiver>();
|
|
||||||
CreateMap<UserReceiverDto, UserReceiver>();
|
|
||||||
CreateMap<EnvelopeReceiverBase, EnvelopeReceiverBasicDto>();
|
|
||||||
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
CreateMap<EnvelopeReceiverReadOnlyCreateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||||
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, Domain.Entities.EnvelopeReceiverReadOnly>();
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.Messaging;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class GtxMessagingResponse : Dictionary<string, object?> { }
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.Messaging;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public record SmsResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required bool Ok { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns !Ok
|
||||||
|
/// </summary>
|
||||||
|
public bool Failed => !Ok;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public dynamic? Errors { get; init; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto.Receiver;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class ReceiverDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required string EmailAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required string Signature { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public string? TotpSecretkey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public IEnumerable<EnvelopeReceiverDto>? EnvelopeReceivers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? TfaRegDeadline { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Id.GetHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
95
EnvelopeGenerator.Application/Common/Dto/SignatureDto.cs
Normal file
95
EnvelopeGenerator.Application/Common/Dto/SignatureDto.cs
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Dto;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Data Transfer Object representing a positioned element assigned to a document receiver.
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public class SignatureDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the unique identifier of the element.
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier of the associated document.
|
||||||
|
/// </summary>
|
||||||
|
public int DocumentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier of the receiver.
|
||||||
|
/// </summary>
|
||||||
|
public int ReceiverId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the type of the element.
|
||||||
|
/// </summary>
|
||||||
|
public int ElementType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the X coordinate of the element.
|
||||||
|
/// </summary>
|
||||||
|
public double X { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Y coordinate of the element.
|
||||||
|
/// </summary>
|
||||||
|
public double Y { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the width of the element.
|
||||||
|
/// </summary>
|
||||||
|
public double Width { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the height of the element.
|
||||||
|
/// </summary>
|
||||||
|
public double Height { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the page number where the element appears.
|
||||||
|
/// </summary>
|
||||||
|
public int Page { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the element is required.
|
||||||
|
/// </summary>
|
||||||
|
public bool Required { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the tooltip text for the element.
|
||||||
|
/// </summary>
|
||||||
|
public string? Tooltip { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the element is read-only.
|
||||||
|
/// </summary>
|
||||||
|
public bool ReadOnly { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the annotation index for ordering or reference.
|
||||||
|
/// </summary>
|
||||||
|
public int AnnotationIndex { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when the element was added.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime AddedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the timestamp when the element was last changed, if applicable.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? ChangedWhen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the top position of the element (in layout terms).
|
||||||
|
/// </summary>
|
||||||
|
public double Top => Y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the left position of the element (in layout terms).
|
||||||
|
/// </summary>
|
||||||
|
public double Left => X;
|
||||||
|
}
|
||||||
27
EnvelopeGenerator.Application/Common/EnvelopeFlag.cs
Normal file
27
EnvelopeGenerator.Application/Common/EnvelopeFlag.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum EnvelopeFlag
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
EnvelopeOrReceiverNonexists,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
NonDecodableEnvelopeReceiverId,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
WrongEnvelopeReceiverId,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
AccessCodeNull
|
||||||
|
}
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
using Microsoft.Extensions.Caching.Distributed;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class CacheExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task SetLongAsync(this IDistributedCache cache, string key, long value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
||||||
|
=> options is null
|
||||||
|
? cache.SetAsync(key, BitConverter.GetBytes(value), token: cToken)
|
||||||
|
: cache.SetAsync(key, BitConverter.GetBytes(value), options: options, token: cToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<long?> GetLongAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetAsync(key, cToken);
|
||||||
|
return value is null ? null : BitConverter.ToInt64(value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task SetDateTimeAsync(this IDistributedCache cache, string key, DateTime value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
||||||
|
=> cache.SetLongAsync(key: key, value: value.Ticks, options: options, cToken: cToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<DateTime?> GetDateTimeAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetAsync(key, cToken);
|
||||||
|
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task SetTimeSpanAsync(this IDistributedCache cache, string key, TimeSpan value, DistributedCacheEntryOptions? options = null, CancellationToken cToken = default)
|
||||||
|
=> cache.SetLongAsync(key: key, value: value.Ticks, options: options, cToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<TimeSpan?> GetTimeSpanAsync(this IDistributedCache cache, string key, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetAsync(key, cToken);
|
||||||
|
return value is null ? null : new(BitConverter.ToInt64(value, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: use code generator
|
||||||
|
#region GetOrSetAsync
|
||||||
|
|
||||||
|
#region string
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factory"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<string> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetStringAsync(key, cToken);
|
||||||
|
if (value is null)
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
value = factory();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetStringAsync(key, value, cToken)
|
||||||
|
: cache.SetStringAsync(key, value, options, cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factoryAsync"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<string> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<string>> factoryAsync, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
var value = await cache.GetStringAsync(key, cToken);
|
||||||
|
if(value is null)
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
value = await factoryAsync();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetStringAsync(key: key, value: value, token: cToken)
|
||||||
|
: cache.SetStringAsync(key: key, value: value, options: options, token: cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DateTime
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factory"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<DateTime> GetOrSetAsync(this IDistributedCache cache, string key, Func<DateTime> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
if (await cache.GetDateTimeAsync(key, cToken) is DateTime dateTimeValue)
|
||||||
|
return dateTimeValue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
var newValue = factory();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetDateTimeAsync(key, newValue, cToken: cToken)
|
||||||
|
: cache.SetDateTimeAsync(key, newValue, options, cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="factory"></param>
|
||||||
|
/// <param name="options"></param>
|
||||||
|
/// <param name="cacheInBackground"></param>
|
||||||
|
/// <param name="cToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<DateTime> GetOrSetAsync(this IDistributedCache cache, string key, Func<Task<DateTime>> factory, DistributedCacheEntryOptions? options = null, bool cacheInBackground = false, CancellationToken cToken = default)
|
||||||
|
{
|
||||||
|
if (await cache.GetDateTimeAsync(key, cToken) is DateTime dateTimeValue)
|
||||||
|
return dateTimeValue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create new and save
|
||||||
|
var newValue = await factory();
|
||||||
|
|
||||||
|
Task CacheAsync() => options is null
|
||||||
|
? cache.SetDateTimeAsync(key, newValue, cToken: cToken)
|
||||||
|
: cache.SetDateTimeAsync(key, newValue, options, cToken);
|
||||||
|
|
||||||
|
if (cacheInBackground)
|
||||||
|
_ = Task.Run(async () => await CacheAsync(), cToken);
|
||||||
|
else
|
||||||
|
await CacheAsync();
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class DecodingExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Validates whether a given string is a correctly formatted Base-64 encoded string.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method checks the string for proper Base-64 formatting, which includes validating
|
||||||
|
/// the length of the string (must be divisible by 4). It also checks each character to ensure
|
||||||
|
/// it belongs to the Base-64 character set (A-Z, a-z, 0-9, '+', '/', and '=' for padding).
|
||||||
|
/// The method ensures that padding characters ('=') only appear at the end of the string and
|
||||||
|
/// are in a valid configuration (either one '=' at the end if the string's length % 4 is 3,
|
||||||
|
/// or two '==' if the length % 4 is 2).
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="input">The Base-64 encoded string to validate.</param>
|
||||||
|
/// <returns>
|
||||||
|
/// <c>true</c> if the string is a valid Base-64 encoded string; otherwise, <c>false</c>.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code>
|
||||||
|
/// string testString = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk=";
|
||||||
|
/// bool isValid = IsValidBase64String(testString);
|
||||||
|
/// Console.WriteLine(isValid); // Output: true
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static bool IsBase64String(this string input)
|
||||||
|
{
|
||||||
|
// Check if the string is null or empty
|
||||||
|
if (string.IsNullOrEmpty(input))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace valid base-64 padding
|
||||||
|
input = input.Trim();
|
||||||
|
int mod4 = input.Length % 4;
|
||||||
|
if (mod4 > 0)
|
||||||
|
{
|
||||||
|
// Base-64 string lengths should be divisible by 4
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check each character to ensure it is valid base-64
|
||||||
|
foreach (char c in input)
|
||||||
|
{
|
||||||
|
if (!char.IsLetterOrDigit(c) && c != '+' && c != '/' && c != '=')
|
||||||
|
{
|
||||||
|
// Invalid character detected
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure no invalid padding scenarios exist
|
||||||
|
if (input.EndsWith("==") && input.Length % 4 == 0 ||
|
||||||
|
input.EndsWith("=") && input.Length % 4 == 3)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return input.IndexOf('=') == -1; // No padding allowed except at the end
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="encodedKey"></param>
|
||||||
|
/// <param name="decodedKeys"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool TryDecode(this string encodedKey, out string[] decodedKeys)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] bytes = Convert.FromBase64String(encodedKey);
|
||||||
|
string decodedString = Encoding.UTF8.GetString(bytes);
|
||||||
|
decodedKeys = decodedString.Split(new string[] { "::" }, StringSplitOptions.None);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(ArgumentNullException) { }
|
||||||
|
catch (FormatException) { }
|
||||||
|
catch(ArgumentException) { }
|
||||||
|
|
||||||
|
decodedKeys = Array.Empty<string>();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="decodedKeys"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static EncodeType GetEncodeType(this string[] decodedKeys) => decodedKeys.Length switch
|
||||||
|
{
|
||||||
|
2 => EncodeType.EnvelopeReceiver,
|
||||||
|
3 => long.TryParse(decodedKeys[1], out var _) ? EncodeType.EnvelopeReceiverReadOnly : EncodeType.Undefined,
|
||||||
|
_ => EncodeType.Undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="decodedKeys"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="InvalidOperationException"></exception>
|
||||||
|
public static (string? EnvelopeUuid, string? ReceiverSignature) ParseEnvelopeReceiverId(this string[] decodedKeys)
|
||||||
|
=> decodedKeys.GetEncodeType() == EncodeType.EnvelopeReceiver
|
||||||
|
? (EnvelopeUuid: decodedKeys[0], ReceiverSignature: decodedKeys[1])
|
||||||
|
: throw new InvalidOperationException("Attempted to convert a decoded other than type EnvelopeReceiver to EnvelopeReceiver.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="decodedKeys"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="InvalidOperationException"></exception>
|
||||||
|
public static long ParseReadOnlyId(this string[] decodedKeys)
|
||||||
|
=> decodedKeys.GetEncodeType() == EncodeType.EnvelopeReceiverReadOnly
|
||||||
|
? long.Parse(decodedKeys[1])
|
||||||
|
: throw new InvalidOperationException("Attempted to convert a decoded other than type EnvelopeReceiver to EnvelopeReceiver. ");
|
||||||
|
|
||||||
|
/// <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)
|
||||||
|
{
|
||||||
|
if (!envelopeReceiverId.IsBase64String())
|
||||||
|
{
|
||||||
|
return (null, null);
|
||||||
|
}
|
||||||
|
byte[] bytes = Convert.FromBase64String(envelopeReceiverId);
|
||||||
|
string decodedString = 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="envelopeReceiverReadOnlyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static long? DecodeEnvelopeReceiverReadOnlyId(this string envelopeReceiverReadOnlyId)
|
||||||
|
{
|
||||||
|
if (!envelopeReceiverReadOnlyId.IsBase64String())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
byte[] bytes = Convert.FromBase64String(envelopeReceiverReadOnlyId);
|
||||||
|
string decodedString = Encoding.UTF8.GetString(bytes);
|
||||||
|
string[] parts = decodedString.Split(new string[] { "::" }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
if (parts.Length > 2)
|
||||||
|
return long.TryParse(parts[1], out long readOnlyId) ? readOnlyId : null;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides extension methods for decoding and extracting information from an envelope receiver ID.
|
||||||
|
/// </summary>
|
||||||
|
public static class EncodingExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="readOnlyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ToEnvelopeKey(this long readOnlyId)
|
||||||
|
{
|
||||||
|
//The random number is used as a salt to increase security but it is not saved in the database.
|
||||||
|
string combinedString = $"{Random.Shared.Next()}::{readOnlyId}::{Random.Shared.Next()}";
|
||||||
|
byte[] bytes = Encoding.UTF8.GetBytes(combinedString);
|
||||||
|
string base64String = Convert.ToBase64String(bytes);
|
||||||
|
|
||||||
|
return base64String;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ToEnvelopeKey(this (string envelopeUuid, string receiverSignature) input)
|
||||||
|
{
|
||||||
|
string combinedString = $"{input.envelopeUuid}::{input.receiverSignature}";
|
||||||
|
byte[] bytes = Encoding.UTF8.GetBytes(combinedString);
|
||||||
|
string base64String = Convert.ToBase64String(bytes);
|
||||||
|
|
||||||
|
return base64String;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Extensions
|
namespace EnvelopeGenerator.Application.Common.Extensions
|
||||||
{
|
{
|
||||||
public static class LoggerExtensions
|
public static class LoggerExtensions
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using EnvelopeGenerator.Application.Common.Dto.Messaging;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides extension methods for common mapping and conversion operations.
|
||||||
|
/// </summary>
|
||||||
|
public static class MappingExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the response indicates a successful "OK" message status.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gtxMessagingResponse">The response object to evaluate.</param>
|
||||||
|
/// <returns><see langword="true"/> if the response contains a "message-status" key with a value of "ok" (case-insensitive);
|
||||||
|
/// otherwise, <see langword="false"/>.</returns>
|
||||||
|
public static bool Ok(this GtxMessagingResponse gtxMessagingResponse)
|
||||||
|
=> gtxMessagingResponse.TryGetValue("message-status", out var status)
|
||||||
|
&& status?.ToString()?.ToLower() == "ok";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts the specified byte array to its equivalent string representation encoded in base-64.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bytes">The byte array to encode.</param>
|
||||||
|
/// <returns>A base-64 encoded string representation of the input byte array.</returns>
|
||||||
|
public static string ToBase64String(this byte[] bytes)
|
||||||
|
=> Convert.ToBase64String(bytes);
|
||||||
|
}
|
||||||
@@ -1,11 +1,24 @@
|
|||||||
using Microsoft.Extensions.Caching.Memory;
|
using EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Extensions;
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public static class MemoryCacheExtensions
|
public static class MemoryCacheExtensions
|
||||||
{
|
{
|
||||||
private static readonly Guid BaseId = Guid.NewGuid();
|
private static readonly Guid BaseId = Guid.NewGuid();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEnum"></typeparam>
|
||||||
|
/// <param name="memoryCache"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="ignores"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="InvalidOperationException"></exception>
|
||||||
public static IDictionary<string, int> GetEnumAsDictionary<TEnum>(this IMemoryCache memoryCache, string key = "", params object[] ignores)
|
public static IDictionary<string, int> GetEnumAsDictionary<TEnum>(this IMemoryCache memoryCache, string key = "", params object[] ignores)
|
||||||
where TEnum : Enum
|
where TEnum : Enum
|
||||||
=> memoryCache.GetOrCreate(BaseId + typeof(TEnum).FullName + key, _ =>
|
=> memoryCache.GetOrCreate(BaseId + typeof(TEnum).FullName + key, _ =>
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
using DigitalData.Core.Exceptions;
|
||||||
|
using EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
using EnvelopeGenerator.Application.Common.Query;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
using EnvelopeGenerator.Domain.Interfaces;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class QueryExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BadRequestException"></exception>
|
||||||
|
public static IQueryable<TEntity> Where<TEntity>(this IQueryable<TEntity> root, EnvelopeQueryBase query, bool notnull = true)
|
||||||
|
where TEntity : IHasEnvelope
|
||||||
|
{
|
||||||
|
if (query.Id is not null)
|
||||||
|
root = root.Where(e => e.Envelope!.Id == query.Id);
|
||||||
|
else if (query.Uuid is not null)
|
||||||
|
root = root.Where(e => e.Envelope!.Uuid == query.Uuid);
|
||||||
|
else if (notnull)
|
||||||
|
throw new BadRequestException(
|
||||||
|
"Either Envelope Id or Envelope Uuid must be provided in the query."
|
||||||
|
);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BadRequestException"></exception>
|
||||||
|
public static IQueryable<Envelope> Where(this IQueryable<Envelope> root, EnvelopeQueryBase query, bool notnull = true)
|
||||||
|
{
|
||||||
|
if (query.Id is not null)
|
||||||
|
root = root.Where(e => e.Id == query.Id);
|
||||||
|
else if (query.Uuid is not null)
|
||||||
|
root = root.Where(e => e.Uuid == query.Uuid);
|
||||||
|
else if (notnull)
|
||||||
|
throw new BadRequestException(
|
||||||
|
"Either Envelope Id or Envelope Uuid must be provided in the query."
|
||||||
|
);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BadRequestException"></exception>
|
||||||
|
public static IQueryable<TEntity> Where<TEntity>(this IQueryable<TEntity> root, ReceiverQueryBase query, bool notnull = true)
|
||||||
|
where TEntity : IHasReceiver
|
||||||
|
{
|
||||||
|
if (query.Id is not null)
|
||||||
|
root = root.Where(e => e.Receiver!.Id == query.Id);
|
||||||
|
else if (query.EmailAddress is not null)
|
||||||
|
root = root.Where(e => e.Receiver!.EmailAddress == query.EmailAddress);
|
||||||
|
else if (query.Signature is not null)
|
||||||
|
root = root.Where(e => e.Receiver!.Signature == query.Signature);
|
||||||
|
else if (notnull)
|
||||||
|
throw new BadRequestException(
|
||||||
|
"Receiver must have at least one identifier (Id, EmailAddress, or Signature)."
|
||||||
|
);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BadRequestException"></exception>
|
||||||
|
public static IQueryable<Receiver> Where(this IQueryable<Receiver> root, ReceiverQueryBase query, bool notnull = true)
|
||||||
|
{
|
||||||
|
if (query.Id is not null)
|
||||||
|
root = root.Where(e => e.Id == query.Id);
|
||||||
|
else if (query.EmailAddress is not null)
|
||||||
|
root = root.Where(e => e.EmailAddress == query.EmailAddress);
|
||||||
|
else if (query.Signature is not null)
|
||||||
|
root = root.Where(e => e.Signature == query.Signature);
|
||||||
|
else if (notnull)
|
||||||
|
throw new BadRequestException(
|
||||||
|
"Receiver must have at least one identifier (Id, EmailAddress, or Signature)."
|
||||||
|
);
|
||||||
|
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEntity"></typeparam>
|
||||||
|
/// <typeparam name="TEnvelopeQuery"></typeparam>
|
||||||
|
/// <typeparam name="TReceiverQuery"></typeparam>
|
||||||
|
/// <param name="root"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="notnull"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IQueryable<TEntity> Where<TEntity, TEnvelopeQuery, TReceiverQuery>(this IQueryable<TEntity> root, EnvelopeReceiverQueryBase<TEnvelopeQuery, TReceiverQuery> query, bool notnull = true)
|
||||||
|
where TEntity : IHasEnvelope, IHasReceiver
|
||||||
|
where TEnvelopeQuery : EnvelopeQueryBase, new()
|
||||||
|
where TReceiverQuery : ReceiverQueryBase, new()
|
||||||
|
=> root.Where(query.Envelope, notnull).Where(query.Receiver, notnull);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using OtpNet;
|
using OtpNet;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Extensions
|
namespace EnvelopeGenerator.Application.Common.Extensions
|
||||||
{
|
{
|
||||||
public static class StringExtension
|
public static class StringExtension
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
using DigitalData.Core.Exceptions;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extension methods for tasks
|
||||||
|
/// </summary>
|
||||||
|
public static class TaskExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Awaits the specified task and ensures that the result is not <c>null</c>.
|
||||||
|
/// If the result is <c>null</c>, the exception created by factory-method is thrown.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of the result.</typeparam>
|
||||||
|
/// <typeparam name="TException">The type of the exception.</typeparam>
|
||||||
|
/// <param name="task">The task to await.</param>
|
||||||
|
/// <param name="factory">Exception provider</param>
|
||||||
|
/// <returns>The awaited result if not <c>null</c>.</returns>
|
||||||
|
/// <exception>Thrown if the result is <c>null</c>.</exception>
|
||||||
|
public static async Task<T> ThrowIfNull<T, TException>(this Task<T?> task, Func<TException> factory) where TException : Exception
|
||||||
|
{
|
||||||
|
var result = await task;
|
||||||
|
return result ?? throw factory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Awaits the specified task and ensures that the result is not <c>empty</c>.
|
||||||
|
/// If the result contains no elements, the exception created by factory-method is thrown.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The element type of the collection.</typeparam>
|
||||||
|
/// <typeparam name="TException">The type of the exception.</typeparam>
|
||||||
|
/// <param name="task">The task to await.</param>
|
||||||
|
/// <param name="factory">Exception provider</param>
|
||||||
|
/// <returns>The awaited collection if it is not <c>null</c> or empty.</returns>
|
||||||
|
/// <exception cref="NotFoundException">Thrown if the result is <c>null</c> or empty.</exception>
|
||||||
|
public static async Task<IEnumerable<T>> ThrowIfEmpty<T, TException>(this Task<IEnumerable<T>> task, Func<TException> factory) where TException : Exception
|
||||||
|
{
|
||||||
|
var result = await task;
|
||||||
|
return result?.Any() ?? false ? result : throw factory();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <typeparam name="I"></typeparam>
|
||||||
|
/// <param name="task"></param>
|
||||||
|
/// <param name="act"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<I> Then<T, I>(this Task<T> task, Func<T, I> act)
|
||||||
|
{
|
||||||
|
var res = await task;
|
||||||
|
return act(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class Exceptions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static NotFoundException NotFound() => new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static BadRequestException BadRequest() => new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static ForbiddenException Forbidden() => new();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Extensions
|
namespace EnvelopeGenerator.Application.Common.Extensions
|
||||||
{
|
{
|
||||||
public static class XSSExtensions
|
public static class XSSExtensions
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using MediatR;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.Dynamic;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Original"></param>
|
||||||
|
public record DocSignedNotification(EnvelopeReceiverDto Original) : EnvelopeReceiverDto(Original), INotification, ISendMailNotification
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public required ExpandoObject Annotations { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public EmailTemplateType TemplateType => EmailTemplateType.DocumentSigned;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string EmailAddress => Receiver?.EmailAddress
|
||||||
|
?? throw new InvalidOperationException($"Receiver is null." +
|
||||||
|
$"DocSignedNotification:\n{JsonConvert.SerializeObject(this, Format.Json.ForDiagnostics)}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class DocSignedNotificationExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Converts an <see cref="EnvelopeReceiverDto"/> to a <see cref="DocSignedNotification"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dto">The DTO to convert.</param>
|
||||||
|
/// <param name="annotations"></param>
|
||||||
|
/// <returns>A new <see cref="DocSignedNotification"/> instance.</returns>
|
||||||
|
public static DocSignedNotification ToDocSignedNotification(this EnvelopeReceiverDto dto, ExpandoObject annotations)
|
||||||
|
=> new(dto) { Annotations = annotations };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asynchronously converts a <see cref="Task{EnvelopeReceiverDto}"/> to a <see cref="DocSignedNotification"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dtoTask">The task that returns the DTO to convert.</param>
|
||||||
|
/// <param name="annotations"></param>
|
||||||
|
/// <returns>A task that represents the asynchronous conversion operation.</returns>
|
||||||
|
public static async Task<DocSignedNotification?> ToDocSignedNotification(this Task<EnvelopeReceiverDto?> dtoTask, ExpandoObject annotations)
|
||||||
|
=> await dtoTask is EnvelopeReceiverDto dto ? new(dto) { Annotations = annotations } : null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using EnvelopeGenerator.Application.Common.Notifications.DocSigned;
|
||||||
|
using EnvelopeGenerator.Application.DocStatus.Commands;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using MediatR;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class AnnotationHandler : INotificationHandler<DocSignedNotification>
|
||||||
|
{
|
||||||
|
private readonly ISender _sender;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
public AnnotationHandler(ISender sender)
|
||||||
|
{
|
||||||
|
_sender = sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task Handle(DocSignedNotification notification, CancellationToken cancel)
|
||||||
|
{
|
||||||
|
await _sender.Send(new SaveDocStatusCommand()
|
||||||
|
{
|
||||||
|
Envelope = new() { Id = notification.EnvelopeId },
|
||||||
|
Receiver = new() { Id = notification.ReceiverId},
|
||||||
|
Value = JsonConvert.SerializeObject(notification.Annotations, Format.Json.ForAnnotations)
|
||||||
|
}, cancel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using EnvelopeGenerator.Application.Common.Notifications.DocSigned;
|
||||||
|
using EnvelopeGenerator.Application.Histories.Commands;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using MediatR;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class HistoryHandler : INotificationHandler<DocSignedNotification>
|
||||||
|
{
|
||||||
|
private readonly ISender _sender;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
public HistoryHandler(ISender sender)
|
||||||
|
{
|
||||||
|
_sender = sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task Handle(DocSignedNotification notification, CancellationToken cancel)
|
||||||
|
{
|
||||||
|
if(notification.Receiver is null)
|
||||||
|
if (notification.Receiver is null)
|
||||||
|
throw new InvalidOperationException($"Receiver information is missing in the notification. DocSignedNotification:\n {JsonConvert.SerializeObject(notification, Format.Json.ForDiagnostics)}");
|
||||||
|
|
||||||
|
await _sender.Send(new CreateHistoryCommand()
|
||||||
|
{
|
||||||
|
EnvelopeId = notification.EnvelopeId,
|
||||||
|
UserReference = notification.Receiver.EmailAddress,
|
||||||
|
Status = EnvelopeStatus.DocumentSigned,
|
||||||
|
Comment = JsonConvert.SerializeObject(notification.Annotations, Format.Json.ForAnnotations)
|
||||||
|
}, cancel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Entities;
|
||||||
|
using EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class SendSignedMailHandler : SendMailHandler<DocSignedNotification>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tempRepo"></param>
|
||||||
|
/// <param name="emailOutRepo"></param>
|
||||||
|
/// <param name="mailParamsOptions"></param>
|
||||||
|
/// <param name="dispatcherParamsOptions"></param>
|
||||||
|
public SendSignedMailHandler(IRepository<EmailTemplate> tempRepo, IRepository<EmailOut> emailOutRepo, IOptions<MailParams> mailParamsOptions, IOptions<DispatcherParams> dispatcherParamsOptions) : base(tempRepo, emailOutRepo, mailParamsOptions, dispatcherParamsOptions)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification"></param>
|
||||||
|
/// <param name="emailOut"></param>
|
||||||
|
protected override void ConfigureEmailOut(DocSignedNotification notification, EmailOut emailOut)
|
||||||
|
{
|
||||||
|
emailOut.ReferenceString = notification.EmailAddress;
|
||||||
|
emailOut.ReferenceId = notification.ReceiverId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Dictionary<string, string> CreatePlaceHolders(DocSignedNotification notification)
|
||||||
|
{
|
||||||
|
var placeHolders = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "[NAME_RECEIVER]", notification.Name ?? string.Empty },
|
||||||
|
{ "[DOCUMENT_TITLE]", notification.Envelope?.Title ?? string.Empty },
|
||||||
|
};
|
||||||
|
|
||||||
|
return placeHolders;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Entities;
|
||||||
|
using EnvelopeGenerator.Application.Common.Configurations;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
using MediatR;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Notifications;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public interface ISendMailNotification : INotification
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public EmailTemplateType TemplateType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string EmailAddress { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public abstract class SendMailHandler<TNotification> : INotificationHandler<TNotification>
|
||||||
|
where TNotification : ISendMailNotification
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected readonly IRepository<EmailTemplate> TempRepo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected readonly IRepository<EmailOut> EmailOutRepo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected abstract Dictionary<string, string> CreatePlaceHolders(TNotification notification);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///{ "[MESSAGE]", notification.Message },<br/>
|
||||||
|
///{ "[DOCUMENT_ACCESS_CODE]", notification.ReceiverAccessCode },<br/>
|
||||||
|
///{ "[REASON]", pReason }<br/>
|
||||||
|
///{ "[NAME_SENDER]", notification.Envelope.User?.FullName},<br/>
|
||||||
|
///{ "[NAME_PORTAL]", DispatcherParams. },<br/>
|
||||||
|
///{ "[SIGNATURE_TYPE]", "signieren" },<br/>
|
||||||
|
///{ "[LINK_TO_DOCUMENT]", notification.SignatureLink },<br/>
|
||||||
|
///{ "[LINK_TO_DOCUMENT_TEXT]", $"{notification.SignatureLink.Truncate(40)}.." },
|
||||||
|
/// </summary>
|
||||||
|
protected readonly MailParams MailParams;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected readonly DispatcherParams DispatcherParams;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification"></param>
|
||||||
|
/// <param name="emailOut"></param>
|
||||||
|
protected abstract void ConfigureEmailOut(TNotification notification, EmailOut emailOut);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tempRepo"></param>
|
||||||
|
/// <param name="emailOutRepo"></param>
|
||||||
|
/// <param name="mailParamsOptions"></param>
|
||||||
|
/// <param name="dispatcherParamsOptions"></param>
|
||||||
|
protected SendMailHandler(IRepository<EmailTemplate> tempRepo, IRepository<EmailOut> emailOutRepo, IOptions<MailParams> mailParamsOptions, IOptions<DispatcherParams> dispatcherParamsOptions)
|
||||||
|
{
|
||||||
|
TempRepo = tempRepo;
|
||||||
|
EmailOutRepo = emailOutRepo;
|
||||||
|
MailParams = mailParamsOptions.Value;
|
||||||
|
DispatcherParams = dispatcherParamsOptions.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
|
public virtual async Task Handle(TNotification notification, CancellationToken cancel)
|
||||||
|
{
|
||||||
|
var placeHolders = CreatePlaceHolders(notification);
|
||||||
|
|
||||||
|
var temp = await TempRepo
|
||||||
|
.ReadOnly()
|
||||||
|
.SingleOrDefaultAsync(x => x.Name == notification.TemplateType.ToString(), cancel)
|
||||||
|
?? throw new InvalidOperationException($"Receiver information is missing in the notification." +
|
||||||
|
$"{typeof(TNotification)}:\n {JsonConvert.SerializeObject(notification, Format.Json.ForDiagnostics)}");
|
||||||
|
|
||||||
|
temp.Subject = ReplacePlaceHolders(temp.Subject, placeHolders, MailParams.Placeholders);
|
||||||
|
|
||||||
|
temp.Body = ReplacePlaceHolders(temp.Body, placeHolders, MailParams.Placeholders);
|
||||||
|
|
||||||
|
var emailOut = new EmailOut
|
||||||
|
{
|
||||||
|
EmailAddress = notification.EmailAddress,
|
||||||
|
EmailBody = TextToHtml(temp.Body),
|
||||||
|
EmailSubj = temp.Subject,
|
||||||
|
AddedWhen = DateTime.UtcNow,
|
||||||
|
AddedWho = DispatcherParams.AddedWho,
|
||||||
|
SendingProfile = DispatcherParams.SendingProfile,
|
||||||
|
ReminderTypeId = DispatcherParams.ReminderTypeId,
|
||||||
|
EmailAttmt1 = DispatcherParams.EmailAttmt1,
|
||||||
|
WfId = (int)EnvelopeStatus.MessageConfirmationSent,
|
||||||
|
|
||||||
|
};
|
||||||
|
ConfigureEmailOut(notification, emailOut);
|
||||||
|
await EmailOutRepo.CreateAsync(emailOut, cancel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ReplacePlaceHolders(string text, params Dictionary<string, string>[] placeHoldersList)
|
||||||
|
{
|
||||||
|
foreach (var placeHolders in placeHoldersList)
|
||||||
|
foreach (var ph in placeHolders)
|
||||||
|
text = text.Replace(ph.Key, ph.Value);
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string TextToHtml(string input)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(input)) return "";
|
||||||
|
|
||||||
|
// HTML encoding special characters
|
||||||
|
string encoded = System.Net.WebUtility.HtmlEncode(input);
|
||||||
|
|
||||||
|
// Convert tabs to (4 non-breaking spaces)
|
||||||
|
encoded = encoded.Replace("\t", " ");
|
||||||
|
|
||||||
|
// Convert line breaks to <br />
|
||||||
|
encoded = encoded.Replace("\r\n", "<br />"); // Windows
|
||||||
|
encoded = encoded.Replace("\r", "<br />"); // Mac old
|
||||||
|
encoded = encoded.Replace("\n", "<br />"); // Unix/Linux
|
||||||
|
|
||||||
|
return encoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Query;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage für Umschläge.
|
||||||
|
/// </summary>
|
||||||
|
public record EnvelopeQueryBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Die eindeutige Kennung des Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Die universell eindeutige Kennung des Umschlags.
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Uuid { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using DigitalData.Core.Exceptions;
|
||||||
|
using EnvelopeGenerator.Application.Common.Extensions;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Query;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public record EnvelopeReceiverQueryBase : EnvelopeReceiverQueryBase<EnvelopeQueryBase, ReceiverQueryBase>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TEnvelopeQuery"></typeparam>
|
||||||
|
/// <typeparam name="TReceiverQuery"></typeparam>
|
||||||
|
public record EnvelopeReceiverQueryBase<TEnvelopeQuery, TReceiverQuery>
|
||||||
|
where TEnvelopeQuery : EnvelopeQueryBase, new()
|
||||||
|
where TReceiverQuery : ReceiverQueryBase, new()
|
||||||
|
{
|
||||||
|
private string? _key;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Key
|
||||||
|
{
|
||||||
|
get => _key;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is null)
|
||||||
|
{
|
||||||
|
_key = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
(string? EnvelopeUuid, string? ReceiverSignature) = value.DecodeEnvelopeReceiverId();
|
||||||
|
if (string.IsNullOrEmpty(EnvelopeUuid) || string.IsNullOrEmpty(ReceiverSignature))
|
||||||
|
throw new BadRequestException("Der EnvelopeReceiverKey muss ein gültiger Base64-kodierter String sein, der die EnvelopeUuid und die ReceiverSignature enthält.");
|
||||||
|
|
||||||
|
Envelope = new TEnvelopeQuery()
|
||||||
|
{
|
||||||
|
Uuid = EnvelopeUuid
|
||||||
|
};
|
||||||
|
Receiver = new TReceiverQuery()
|
||||||
|
{
|
||||||
|
Signature = ReceiverSignature
|
||||||
|
};
|
||||||
|
_key = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Repräsentiert eine Abfrage für Umschläge.
|
||||||
|
/// </summary>
|
||||||
|
public virtual TEnvelopeQuery Envelope { get; set; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||||
|
/// um spezifische Informationen über einen Empfänger abzurufen.
|
||||||
|
/// </summary>
|
||||||
|
public virtual TReceiverQuery Receiver { get; set; } = new();
|
||||||
|
}
|
||||||
20
EnvelopeGenerator.Application/Common/Query/MappingProfile.cs
Normal file
20
EnvelopeGenerator.Application/Common/Query/MappingProfile.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
|
namespace EnvelopeGenerator.Application.Common.Query;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class MappingProfile : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public MappingProfile()
|
||||||
|
{
|
||||||
|
CreateMap<EnvelopeQueryBase, Envelope>();
|
||||||
|
CreateMap<ReceiverQueryBase, Receiver>();
|
||||||
|
CreateMap<EnvelopeReceiverQueryBase, EnvelopeReceiver>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace EnvelopeGenerator.Application.Common.Query;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stellt eine Abfrage dar, um die Details eines Empfängers zu lesen.
|
||||||
|
/// um spezifische Informationen über einen Empfänger abzurufen.
|
||||||
|
/// </summary>
|
||||||
|
public record ReceiverQueryBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ID des Empfängers
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// E-Mail Adresse des Empfängers
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? EmailAddress { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Eindeutige Signatur des Empfängers
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Signature { get; set; }
|
||||||
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
using Dapper;
|
using Dapper;
|
||||||
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
using EnvelopeGenerator.Application.Interfaces.SQLExecutor;
|
||||||
using EnvelopeGenerator.Application.Exceptions;
|
using DigitalData.Core.Exceptions;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.SQL;
|
namespace EnvelopeGenerator.Application.Common.SQL;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DocumentCreateReadSQL : ISQL<EnvelopeDocument>
|
public class DocumentCreateReadSQL : ISQL<Document>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base64, OUT_UID
|
/// Base64, OUT_UID
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using Dapper;
|
using Dapper;
|
||||||
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
using EnvelopeGenerator.Application.Interfaces.SQLExecutor;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.SQL;
|
namespace EnvelopeGenerator.Application.Common.SQL;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Dapper;
|
using Dapper;
|
||||||
using EnvelopeGenerator.Application.Contracts.SQLExecutor;
|
using EnvelopeGenerator.Application.Interfaces.SQLExecutor;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.SQL;
|
namespace EnvelopeGenerator.Application.Common.SQL;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.SQL;
|
namespace EnvelopeGenerator.Application.Common.SQL;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension method for converting objects to SQL parameter strings.
|
/// Extension method for converting objects to SQL parameter strings.
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
namespace EnvelopeGenerator.Application.Configurations
|
|
||||||
{
|
|
||||||
public class AuthenticatorParams
|
|
||||||
{
|
|
||||||
public string CharPool { get; init; } = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890123456789012345678901234567890123456789";
|
|
||||||
|
|
||||||
//TODO: Increase the DefaultTotpSecretKeyLength (e.g. to 32) but make sure that the QR code is generated correctly and can be scanned by the authenticator.
|
|
||||||
public int DefaultTotpSecretKeyLength { get; init; } = 20;
|
|
||||||
|
|
||||||
public string TotpIssuer { get; init; } = "signFlow";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 0 is user email, 1 is secret key and 2 is issuer.
|
|
||||||
/// </summary>
|
|
||||||
public string TotpUrlFormat { get; init; } = "otpauth://totp/{0}?secret={1}&issuer={2}";
|
|
||||||
|
|
||||||
public int TotpQRPixelsPerModule { get; init; } = 20;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
namespace EnvelopeGenerator.Application.Configurations;
|
|
||||||
|
|
||||||
public class DbTriggerParams : Dictionary<string, IEnumerable<string>>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace EnvelopeGenerator.Application.Configurations;
|
|
||||||
|
|
||||||
public class DispatcherParams
|
|
||||||
{
|
|
||||||
public int SendingProfile { get; init; } = 1;
|
|
||||||
|
|
||||||
public string AddedWho { get; init; } = "DDEnvelopGenerator";
|
|
||||||
|
|
||||||
public int ReminderTypeId { get; init; } = 202377;
|
|
||||||
|
|
||||||
public string EmailAttmt1 { get; init; } = string.Empty;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace EnvelopeGenerator.Application.Configurations;
|
|
||||||
|
|
||||||
public class MailParams
|
|
||||||
{
|
|
||||||
public required Dictionary<string, string> Placeholders { get; init; }
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
using OtpNet;
|
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Configurations
|
|
||||||
{
|
|
||||||
public class TotpSmsParams
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The unit is second.
|
|
||||||
/// </summary>
|
|
||||||
public int TotpStep { get; init; } = 90;
|
|
||||||
|
|
||||||
public string Format { get; init; } = "Ihr 2FA-Passwort lautet {0}. Gültig bis {1}";
|
|
||||||
|
|
||||||
public ExpirationHandler Expiration { get; init; } = new();
|
|
||||||
|
|
||||||
public VerificationWindow? TotpVerificationWindow { get; private init; } = VerificationWindow.RfcSpecifiedNetworkDelay;
|
|
||||||
|
|
||||||
private IEnumerable<int>? _tvwParams;
|
|
||||||
|
|
||||||
public IEnumerable<int>? TotpVerificationWindowParams
|
|
||||||
{
|
|
||||||
get => _tvwParams;
|
|
||||||
init
|
|
||||||
{
|
|
||||||
_tvwParams = value;
|
|
||||||
if(_tvwParams is not null)
|
|
||||||
TotpVerificationWindow = new(previous: _tvwParams.ElementAtOrDefault(0), future: _tvwParams.ElementAtOrDefault(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ExpirationHandler
|
|
||||||
{
|
|
||||||
public string CacheKeyFormat { get; init; } = "e{0}_r{1}_sms_code_expiration";
|
|
||||||
|
|
||||||
public string Format { get; init; } = "HH:mm:ss";
|
|
||||||
|
|
||||||
public string CultureName
|
|
||||||
{
|
|
||||||
get => _cultureInfo.Name;
|
|
||||||
init => _cultureInfo = new(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
private CultureInfo _cultureInfo = new("de-DE");
|
|
||||||
|
|
||||||
public CultureInfo CultureInfo => _cultureInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IConfigRepository : ICRUDRepository<Config, int>
|
|
||||||
{
|
|
||||||
Task<Config?> ReadFirstAsync();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IDocumentReceiverElementRepository : ICRUDRepository<DocumentReceiverElement, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IDocumentStatusRepository : ICRUDRepository<DocumentStatus, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
using static EnvelopeGenerator.Common.Constants;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEmailTemplateRepository : ICRUDRepository<EmailTemplate, int>
|
|
||||||
{
|
|
||||||
Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeCertificateRepository : ICRUDRepository<EnvelopeCertificate, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeDocumentRepository : ICRUDRepository<EnvelopeDocument, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeHistoryRepository : ICRUDRepository<EnvelopeHistory, long>
|
|
||||||
{
|
|
||||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
|
||||||
|
|
||||||
Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeReceiverReadOnlyRepository : ICRUDRepository<EnvelopeReceiverReadOnly, long>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeReceiverRepository : ICRUDRepository<EnvelopeReceiver, (int Envelope, int Receiver)>
|
|
||||||
{
|
|
||||||
Task<IEnumerable<EnvelopeReceiver>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<IEnumerable<EnvelopeReceiver>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<EnvelopeReceiver?> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<string?> ReadAccessCodeAsync(string uuid, string signature, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<int> CountAsync(string uuid, string signature);
|
|
||||||
|
|
||||||
Task<EnvelopeReceiver?> ReadByIdAsync(int envelopeId, int receiverId, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<string?> ReadAccessCodeByIdAsync(int envelopeId, int receiverId, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<IEnumerable<EnvelopeReceiver>> ReadByUsernameAsync(string username, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
|
||||||
|
|
||||||
Task<EnvelopeReceiver?> ReadLastByReceiverAsync(string? email = null, int? id = null, string? signature = null);
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeRepository : ICRUDRepository<Envelope, int>
|
|
||||||
{
|
|
||||||
Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false);
|
|
||||||
|
|
||||||
Task<Envelope?> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false);
|
|
||||||
|
|
||||||
Task<IEnumerable<Envelope>> ReadByUserAsync(int userId, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeType, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IReceiverRepository : ICRUDRepository<Receiver, int>
|
|
||||||
{
|
|
||||||
Task<Receiver?> ReadByAsync(string? emailAddress = null, string? signature = null);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Infrastructure;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Repositories;
|
|
||||||
|
|
||||||
public interface IUserReceiverRepository : ICRUDRepository<UserReceiver, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using OtpNet;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IAuthenticator
|
|
||||||
{
|
|
||||||
string GenerateCode(int length);
|
|
||||||
|
|
||||||
string GenerateTotpSecretKey(int? length = null);
|
|
||||||
|
|
||||||
byte[] GenerateTotpQrCode(string userEmail, string secretKey, string? issuer = null, string? totpUrlFormat = null, int? pixelsPerModule = null);
|
|
||||||
|
|
||||||
byte[] GenerateTotpQrCode(string userEmail, int? length = null, string? issuer = null, string? totpUrlFormat = null, int? pixelsPerModule = null);
|
|
||||||
|
|
||||||
string GenerateTotp(string secretKey, int step = 30);
|
|
||||||
|
|
||||||
bool VerifyTotp(string totpCode, string secretKey, int step = 30, VerificationWindow? window = null);
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IConfigService : IReadService<ConfigDto, Config, int>
|
|
||||||
{
|
|
||||||
Task<DataResult<ConfigDto>> ReadFirstAsync();
|
|
||||||
|
|
||||||
Task<ConfigDto> ReadDefaultAsync();
|
|
||||||
|
|
||||||
Task<string> ReadDefaultSignatureHost();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IDocumentReceiverElementService : IBasicCRUDService<DocumentReceiverElementDto, DocumentReceiverElement, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IDocumentStatusService : IBasicCRUDService<DocumentStatusDto, DocumentStatus, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
using static EnvelopeGenerator.Common.Constants;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEmailTemplateService : IBasicCRUDService<EmailTemplateDto, EmailTemplate, int>
|
|
||||||
{
|
|
||||||
Task<DataResult<EmailTemplateDto>> ReadByNameAsync(EmailTemplateType type);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeCertificateService : IBasicCRUDService<EnvelopeCertificateDto, EnvelopeCertificate, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeDocumentService : IBasicCRUDService<EnvelopeDocumentDto, EnvelopeDocument, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
using static EnvelopeGenerator.Common.Constants;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeHistoryService : ICRUDService<EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistory, long>
|
|
||||||
{
|
|
||||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
|
||||||
|
|
||||||
Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference);
|
|
||||||
|
|
||||||
Task<bool> IsSigned(int envelopeId, string userReference);
|
|
||||||
|
|
||||||
Task<bool> IsRejected(int envelopeId, string? userReference = null);
|
|
||||||
|
|
||||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadAsync(int? envelopeId = null, string? userReference = null, ReferenceType? referenceType = null, int? status = null, bool withSender = false, bool withReceiver = false);
|
|
||||||
|
|
||||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null);
|
|
||||||
|
|
||||||
Task<IEnumerable<ReceiverReadDto>> ReadRejectingReceivers(int envelopeId);
|
|
||||||
|
|
||||||
Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null);
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using DigitalData.Core.DTO;
|
|
||||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Contracts;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
|
||||||
using EnvelopeGenerator.Common;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeMailService : IEmailOutService
|
|
||||||
{
|
|
||||||
Task<DataResult<int>> SendAsync(EnvelopeReceiverDto envelopeReceiverDto, Constants.EmailTemplateType tempType, Dictionary<string, object>? optionalPlaceholders = null);
|
|
||||||
|
|
||||||
Task<DataResult<int>> SendAsync(EnvelopeReceiverReadOnlyDto dto, Dictionary<string, object>? optionalPlaceholders = null);
|
|
||||||
|
|
||||||
Task<DataResult<int>> SendAccessCodeAsync(EnvelopeReceiverDto envelopeReceiverDto);
|
|
||||||
|
|
||||||
Task<DataResult<int>> SendTFAQrCodeAsync(EnvelopeReceiverDto envelopeReceiverDto);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeReceiverReadOnlyService : ICRUDService<EnvelopeReceiverReadOnlyCreateDto, EnvelopeReceiverReadOnlyDto, EnvelopeReceiverReadOnly, long>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
using CommandDotNet;
|
|
||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
|
||||||
using EnvelopeGenerator.Application.Envelopes;
|
|
||||||
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeReceiverService : IBasicCRUDService<EnvelopeReceiverDto, EnvelopeReceiver, (int Envelope, int Receiver)>
|
|
||||||
{
|
|
||||||
|
|
||||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadByUuidAsync(string uuid, bool withEnvelope = true, bool withReceiver = false, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<DataResult<IEnumerable<string?>>> ReadAccessCodeByUuidAsync(string uuid, bool withEnvelope = false, bool withReceiver = true);
|
|
||||||
|
|
||||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadBySignatureAsync(string signature, bool withEnvelope = false, bool withReceiver = true, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<DataResult<EnvelopeReceiverDto>> ReadByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<DataResult<EnvelopeReceiverSecretDto>> ReadWithSecretByUuidSignatureAsync(string uuid, string signature, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<DataResult<EnvelopeReceiverDto>> ReadByEnvelopeReceiverIdAsync(string envelopeReceiverId, bool withEnvelope = true, bool withReceiver = true, bool readOnly = true);
|
|
||||||
|
|
||||||
Task<DataResult<string>> ReadAccessCodeByIdAsync(int envelopeId, int receiverId);
|
|
||||||
|
|
||||||
Task<DataResult<bool>> VerifyAccessCodeAsync(string uuid, string signature, string accessCode);
|
|
||||||
|
|
||||||
[Command("verify-access-code-async-by-id")]
|
|
||||||
Task<DataResult<bool>> VerifyAccessCodeAsync(string envelopeReceiverId, string accessCode);
|
|
||||||
|
|
||||||
Task<DataResult<bool>> IsExisting(string envelopeReceiverId);
|
|
||||||
|
|
||||||
Task<DataResult<IEnumerable<EnvelopeReceiverDto>>> ReadByUsernameAsync(string username, int? min_status = null, int? max_status = null, EnvelopeQuery? envelopeQuery = null, ReadReceiverQuery? receiverQuery = null, params int[] ignore_statuses);
|
|
||||||
|
|
||||||
Task<DataResult<string?>> ReadLastUsedReceiverNameByMailAsync(string? mail = null, int? id = null, string? signature = null);
|
|
||||||
|
|
||||||
Task<DataResult<SmsResponse>> SendSmsAsync(string envelopeReceiverId, string message);
|
|
||||||
Task<DataResult<IEnumerable<EnvelopeReceiverSecretDto>>> ReadWithSecretByUuidAsync(string uuid);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeService : IBasicCRUDService<EnvelopeDto, Envelope, int>
|
|
||||||
{
|
|
||||||
Task<DataResult<IEnumerable<EnvelopeDto>>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false);
|
|
||||||
|
|
||||||
Task<DataResult<EnvelopeDto>> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false);
|
|
||||||
|
|
||||||
Task<DataResult<IEnumerable<EnvelopeDto>>> ReadByUserAsync(int userId, int? min_status = null, int? max_status = null, params int[] ignore_statuses);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeType, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IReceiverService : ICRUDService<ReceiverCreateDto, ReceiverReadDto, Receiver, int>
|
|
||||||
{
|
|
||||||
Task<DataResult<ReceiverReadDto>> ReadByAsync(string? emailAddress = null, string? signature = null);
|
|
||||||
|
|
||||||
Task<Result> DeleteByAsync(string? emailAddress = null, string? signature = null);
|
|
||||||
|
|
||||||
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto) where TUpdateDto : IUnique<int>;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Messaging;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
//TODO: move to DigitalData.Core
|
|
||||||
public interface ISmsSender
|
|
||||||
{
|
|
||||||
string ServiceProvider { get; }
|
|
||||||
|
|
||||||
Task<SmsResponse> SendSmsAsync(string recipient, string message);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions.Application;
|
|
||||||
using EnvelopeGenerator.Application.DTOs;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Contracts.Services;
|
|
||||||
|
|
||||||
public interface IUserReceiverService : IBasicCRUDService<UserReceiverDto, UserReceiver, int>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record ConfigDto(
|
|
||||||
string DocumentPath,
|
|
||||||
int SendingProfile,
|
|
||||||
string SignatureHost,
|
|
||||||
string ExternalProgramName,
|
|
||||||
string ExportPath) : IUnique<int>
|
|
||||||
{
|
|
||||||
[NotMapped]
|
|
||||||
[JsonIgnore]
|
|
||||||
[Obsolete("Configuration does not have an ID; it represents a single table in the database.")]
|
|
||||||
public int Id => throw new InvalidOperationException("This configuration does not support an ID as it represents a single row in the database.");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record DocumentReceiverElementDto(
|
|
||||||
int Id,
|
|
||||||
int DocumentId,
|
|
||||||
int ReceiverId,
|
|
||||||
int ElementType,
|
|
||||||
double X,
|
|
||||||
double Y,
|
|
||||||
double Width,
|
|
||||||
double Height,
|
|
||||||
int Page,
|
|
||||||
bool Required,
|
|
||||||
string? Tooltip,
|
|
||||||
bool ReadOnly,
|
|
||||||
int AnnotationIndex,
|
|
||||||
DateTime AddedWhen,
|
|
||||||
DateTime? ChangedWhen,
|
|
||||||
double Top,
|
|
||||||
double Left
|
|
||||||
): IUnique<int>;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record DocumentStatusDto(
|
|
||||||
int Id,
|
|
||||||
int EnvelopeId,
|
|
||||||
int ReceiverId,
|
|
||||||
int Status,
|
|
||||||
DateTime? StatusChangedWhen,
|
|
||||||
DateTime AddedWhen,
|
|
||||||
DateTime? ChangedWhen) : IUnique<int>
|
|
||||||
{
|
|
||||||
public string? Value { get; set; }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeCertificateDto(
|
|
||||||
int Id,
|
|
||||||
int EnvelopeId,
|
|
||||||
string EnvelopeUuid,
|
|
||||||
string EnvelopeSubject,
|
|
||||||
int CreatorId,
|
|
||||||
string CreatorName,
|
|
||||||
string CreatorEmail,
|
|
||||||
int EnvelopeStatus) : IUnique<int>;
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeDocumentDto
|
|
||||||
(
|
|
||||||
int Id,
|
|
||||||
int EnvelopeId,
|
|
||||||
DateTime AddedWhen,
|
|
||||||
byte[]? ByteData = null,
|
|
||||||
IEnumerable<DocumentReceiverElementDto>? Elements = null
|
|
||||||
) : IUnique<int>;
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeDto() : IUnique<int>
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
public int Status { get; set; }
|
|
||||||
|
|
||||||
public string StatusName { get; set; }
|
|
||||||
|
|
||||||
public string Uuid { get; set; }
|
|
||||||
|
|
||||||
[TemplatePlaceholder("[MESSAGE]")]
|
|
||||||
public string Message { get; set; }
|
|
||||||
|
|
||||||
public DateTime AddedWhen { get; set; }
|
|
||||||
|
|
||||||
public DateTime? ChangedWhen { get; set; }
|
|
||||||
|
|
||||||
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
|
|
||||||
public string Title { get; set; }
|
|
||||||
|
|
||||||
public int? ContractType { get; set; }
|
|
||||||
|
|
||||||
public string Language { get; set; }
|
|
||||||
|
|
||||||
public int? EnvelopeTypeId { get; set; }
|
|
||||||
|
|
||||||
public int? CertificationType { get; set; }
|
|
||||||
|
|
||||||
public bool? UseAccessCode { get; set; }
|
|
||||||
|
|
||||||
public bool TFAEnabled { get; init; }
|
|
||||||
|
|
||||||
public UserReadDto? User { get; set; }
|
|
||||||
|
|
||||||
public EnvelopeType? EnvelopeType { get; set; }
|
|
||||||
|
|
||||||
public string? EnvelopeTypeTitle { get; set; }
|
|
||||||
|
|
||||||
public bool IsAlreadySent { get; set; }
|
|
||||||
|
|
||||||
public byte[]? DocResult { get; init; }
|
|
||||||
|
|
||||||
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeHistoryCreateDto(
|
|
||||||
int EnvelopeId,
|
|
||||||
string UserReference,
|
|
||||||
int Status,
|
|
||||||
DateTime? ActionDate,
|
|
||||||
string? Comment = null);
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using DigitalData.Core.DTO;
|
|
||||||
using DigitalData.UserManager.Application.DTOs.User;
|
|
||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using static EnvelopeGenerator.Common.Constants;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <param name="EnvelopeId"></param>
|
|
||||||
/// <param name="UserReference"></param>
|
|
||||||
/// <param name="Status"></param>
|
|
||||||
/// <param name="StatusName"></param>
|
|
||||||
/// <param name="AddedWhen"></param>
|
|
||||||
/// <param name="ActionDate"></param>
|
|
||||||
/// <param name="Sender"></param>
|
|
||||||
/// <param name="Receiver"></param>
|
|
||||||
/// <param name="ReferenceType"></param>
|
|
||||||
/// <param name="Comment"></param>
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeHistoryDto(
|
|
||||||
long Id,
|
|
||||||
int EnvelopeId,
|
|
||||||
string UserReference,
|
|
||||||
int Status,
|
|
||||||
string? StatusName,
|
|
||||||
DateTime AddedWhen,
|
|
||||||
DateTime? ActionDate,
|
|
||||||
UserCreateDto? Sender,
|
|
||||||
ReceiverReadDto? Receiver,
|
|
||||||
ReferenceType ReferenceType,
|
|
||||||
string? Comment = null) : BaseDTO<long>(Id), IUnique<long>;
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)>
|
|
||||||
{
|
|
||||||
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
|
||||||
|
|
||||||
public int EnvelopeId { get; init; }
|
|
||||||
|
|
||||||
public int ReceiverId { get; init; }
|
|
||||||
|
|
||||||
public int Sequence { get; init; }
|
|
||||||
|
|
||||||
[TemplatePlaceholder("[NAME_RECEIVER]")]
|
|
||||||
public string? Name { get; init; }
|
|
||||||
|
|
||||||
public string? JobTitle { get; init; }
|
|
||||||
|
|
||||||
public string? CompanyName { get; init; }
|
|
||||||
|
|
||||||
public string? PrivateMessage { get; init; }
|
|
||||||
|
|
||||||
public DateTime AddedWhen { get; init; }
|
|
||||||
|
|
||||||
public DateTime? ChangedWhen { get; init; }
|
|
||||||
|
|
||||||
public bool HasPhoneNumber { get; init; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
|
|
||||||
{
|
|
||||||
public EnvelopeDto? Envelope { get; set; }
|
|
||||||
|
|
||||||
public ReceiverReadDto? Receiver { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto()
|
|
||||||
{
|
|
||||||
public string? AccessCode { get; init; }
|
|
||||||
|
|
||||||
public string? PhoneNumber { get; init; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeReceiverReadOnlyCreateDto(
|
|
||||||
DateTime DateValid)
|
|
||||||
{
|
|
||||||
[EmailAddress]
|
|
||||||
[Required]
|
|
||||||
public required string ReceiverMail { get; init; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public long? EnvelopeId { get; set; } = null;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string? AddedWho { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeReceiverReadOnlyDto(
|
|
||||||
long Id,
|
|
||||||
long EnvelopeId,
|
|
||||||
string ReceiverMail,
|
|
||||||
DateTime DateValid,
|
|
||||||
DateTime AddedWhen,
|
|
||||||
string AddedWho,
|
|
||||||
EnvelopeDto? Envelope = null,
|
|
||||||
string? ChangedWho = null,
|
|
||||||
DateTime? ChangedWhen = null,
|
|
||||||
ReceiverReadDto? Receiver = null);
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeReceiverReadOnlyUpdateDto(
|
|
||||||
long Id,
|
|
||||||
DateTime DateValid,
|
|
||||||
string ChangedWho) : IUnique<long>
|
|
||||||
{
|
|
||||||
public DateTime ChangedWhen { get; } = DateTime.Now;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using DigitalData.Core.Abstractions;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record EnvelopeTypeDto(
|
|
||||||
int Id,
|
|
||||||
string Title,
|
|
||||||
string Language,
|
|
||||||
int? ExpiresDays,
|
|
||||||
int? CertificationType,
|
|
||||||
bool? UseAccessCode,
|
|
||||||
int? FinalEmailToCreator,
|
|
||||||
int? FinalEmailToReceivers,
|
|
||||||
DateTime AddedWhen,
|
|
||||||
DateTime? ChangedWhen,
|
|
||||||
int? ExpiresWarningDays,
|
|
||||||
bool? SendReminderEmails,
|
|
||||||
int? FirstReminderDays,
|
|
||||||
int? ReminderIntervalDays,
|
|
||||||
int? ContractType) : IUnique<int>;
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public class GtxMessagingResponse : Dictionary<string, object?> { }
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Messaging
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record SmsResponse
|
|
||||||
{
|
|
||||||
public required bool Ok { get; init; }
|
|
||||||
|
|
||||||
public bool Failed => !Ok;
|
|
||||||
|
|
||||||
public dynamic? Errors { get; init; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
|
||||||
{
|
|
||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
|
||||||
public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null)
|
|
||||||
{
|
|
||||||
public string Signature => sha256HexOfMail.Value;
|
|
||||||
|
|
||||||
private readonly Lazy<string> sha256HexOfMail = new(() =>
|
|
||||||
{
|
|
||||||
var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());
|
|
||||||
var hash_arr = SHA256.HashData(bytes_arr);
|
|
||||||
var hexa_str = BitConverter.ToString(hash_arr);
|
|
||||||
return hexa_str.Replace("-", string.Empty);
|
|
||||||
});
|
|
||||||
|
|
||||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user