-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathOrderFlow0.cs
More file actions
27 lines (21 loc) · 1014 Bytes
/
Copy pathOrderFlow0.cs
File metadata and controls
27 lines (21 loc) · 1014 Bytes
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
namespace Cleipnir.Flows.Sample.Presentation.Solutions.A_OrderFlowRpc;
public class OrderFlow0 : Flow<Order>
{
private readonly IPaymentProviderClient _paymentProviderClient;
private readonly IEmailClient _emailClient;
private readonly ILogisticsClient _logisticsClient;
public OrderFlow0(IPaymentProviderClient paymentProviderClient, IEmailClient emailClient, ILogisticsClient logisticsClient)
{
_paymentProviderClient = paymentProviderClient;
_emailClient = emailClient;
_logisticsClient = logisticsClient;
}
public override async Task Run(Order order)
{
var transactionId = Guid.NewGuid();
await _paymentProviderClient.Reserve(order.CustomerId, transactionId, order.TotalPrice);
await _logisticsClient.ShipProducts(order.CustomerId, order.ProductIds);
await _paymentProviderClient.Capture(transactionId);
await _emailClient.SendOrderConfirmation(order.CustomerId, order.ProductIds);
}
}