private async Task Handle(CashinEnrolledToMatchingEngineEvent evt, ICommandSender sender) { var aggregate = await _cashoutRepository.GetAsync(evt.CashoutOperationId); var matchingEngineEnrollementMoment = DateTime.UtcNow; if (aggregate.OnEnrolledToMatchingEngine(matchingEngineEnrollementMoment)) { if (!aggregate.MatchingEngineEnrollementMoment.HasValue) { throw new InvalidOperationException("ME enrollement moment should be not null here"); } sender.SendCommand ( new NotifyCrossClientCashoutCompletedCommand { OperationId = aggregate.OperationId, ClientId = aggregate.ClientId, CashinOperationId = aggregate.CashinOperationId, RecipientClientId = aggregate.RecipientClientId, AssetId = aggregate.AssetId, Amount = aggregate.Amount, StartMoment = aggregate.StartMoment, FinishMoment = aggregate.MatchingEngineEnrollementMoment.Value }, BlockchainCashoutProcessorBoundedContext.Name ); _chaosKitty.Meow(evt.CashoutOperationId); await _cashoutRepository.SaveAsync(aggregate); } }
public async Task Handle(CashinEnrolledToMatchingEngineEvent evt) { var aggregate = await _crossClientCashoutRepository.GetAsync(evt.CashoutOperationId); await _deduplicationRepository.TryRemoveAsync(aggregate.CashinOperationId); _chaosKitty.Meow(evt.CashoutOperationId); }