-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSignupFlow0.cs
More file actions
36 lines (28 loc) · 1.24 KB
/
Copy pathSignupFlow0.cs
File metadata and controls
36 lines (28 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
namespace Cleipnir.Flows.Sample.Presentation.Solutions.E_CustomerSignup;
public class SignupFlow0 : Flow<string>
{
public override async Task Run(string customerEmail)
{
// Flow:
// 1. send activation mail
// 2. wait for EmailVerified event or send reminder mail after 1 day
// * send a maximum of 3 reminders before failing flow
// 3. finally send welcome mail or fail
await SendActivationMail(customerEmail);
for (var i = 0; i <= 3; i++)
{
await SendReminderMail(customerEmail);
if (i == 3)
throw new UserSignupFailedException($"User '{customerEmail}' did not activate within threshold");
}
await SendWelcomeMail(customerEmail);
}
private static Task SendActivationMail(string customerEmail) => Task.CompletedTask;
private static Task SendReminderMail(string customerEmail) => Task.CompletedTask;
private static Task SendWelcomeMail(string customerEmail) => Task.CompletedTask;
public class UserSignupFailedException : Exception
{
public UserSignupFailedException(string? message) : base(message) { }
}
public record EmailVerified(string EmailAddress);
}