private async Task Handle(BlockchainOperationsExecutor.Contract.Events.OperationExecutionFailedEvent evt, ICommandSender sender) { var batch = await _cashoutsBatchRepository.TryGetAsync(evt.OperationId); if (batch == null) { return; } sender.SendCommand ( new FailBatchCommand { BatchId = batch.BatchId, ErrorCode = evt.ErrorCode, Error = evt.Error }, Self ); _chaosKitty.Meow(evt.OperationId); }
private async Task Handle(BlockchainOperationsExecutor.Contract.Events.OperationExecutionFailedEvent evt, ICommandSender sender) { var aggregate = await _cashoutRepository.TryGetAsync(evt.OperationId); if (aggregate == null) { // This is not a cashout operation return; } var operationFinishMoment = DateTime.UtcNow; if (aggregate.OnOperationFailed(evt.Error, evt.ErrorCode.MapToCashoutErrorCode(), operationFinishMoment)) { if (aggregate.ErrorCode != null) { sender.SendCommand(new NotifyCashoutFailedCommand { Amount = aggregate.Amount, AssetId = aggregate.AssetId, ClientId = aggregate.ClientId, OperationId = aggregate.OperationId, Error = aggregate.Error, ErrorCode = aggregate.ErrorCode.Value.MapToCashoutProcessErrorCode(), StartMoment = aggregate.StartMoment, FinishMoment = operationFinishMoment }, CqrsModule.Self ); } await _cashoutRepository.SaveAsync(aggregate); _chaosKitty.Meow(evt.OperationId); } }
public async Task Handle(BlockchainOperationsExecutor.Contract.Events.OperationExecutionFailedEvent evt) { await _deduplicationRepository.TryRemoveAsync(evt.OperationId); _chaosKitty.Meow(evt.OperationId); }