public async Task HandleAsync(TransactionPreparationCommittedEvent evnt) { if (evnt.TransactionPreparation.TransactionType == TransactionType.DepositTransaction && evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { await _commandService.SendAsync(new ConfirmDepositCommand(evnt.TransactionPreparation.TransactionId) { Id = evnt.Id }); } }
public Task <AsyncTaskResult> HandleAsync(TransactionPreparationCommittedEvent evnt) { if (evnt.TransactionPreparation.TransactionType == TransactionType.DepositTransaction && evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { return(_commandService.SendAsync(new ConfirmDepositCommand(evnt.TransactionPreparation.TransactionId))); } return(Task.FromResult(AsyncTaskResult.Success)); }
public async Task HandleAsync(TransactionPreparationCommittedEvent evnt) { if (evnt.TransactionPreparation.TransactionType == TransactionType.TransferTransaction) { if (evnt.TransactionPreparation.PreparationType == PreparationType.DebitPreparation) { await _commandService.SendAsync(new ConfirmTransferOutCommand(evnt.TransactionPreparation.TransactionId) { Id = evnt.Id, Items = evnt.Items }); } else if (evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { await _commandService.SendAsync(new ConfirmTransferInCommand(evnt.TransactionPreparation.TransactionId) { Id = evnt.Id, Items = evnt.Items }); } } }
public Task <AsyncTaskResult> HandleAsync(TransactionPreparationCommittedEvent evnt) { if (evnt.TransactionPreparation.TransactionType == TransactionType.TransferTransaction) { if (evnt.TransactionPreparation.PreparationType == PreparationType.DebitPreparation) { return(_commandService.SendAsync(new ConfirmTransferOutCommand(evnt.TransactionPreparation.TransactionId) { Id = evnt.Id, Items = evnt.Items })); } else if (evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { return(_commandService.SendAsync(new ConfirmTransferInCommand(evnt.TransactionPreparation.TransactionId) { Id = evnt.Id, Items = evnt.Items })); } } return(Task.FromResult(AsyncTaskResult.Success)); }
public Task <AsyncTaskResult> HandleAsync(TransactionPreparationCommittedEvent evnt) { if (evnt.TransactionPreparation.TransactionType == TransactionType.DepositTransaction) { if (evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { Console.WriteLine("账户存款已成功,账户:{0},金额:{1},当前余额:{2}", evnt.TransactionPreparation.AccountId, evnt.TransactionPreparation.Amount, evnt.CurrentBalance); } } if (evnt.TransactionPreparation.TransactionType == TransactionType.TransferTransaction) { if (evnt.TransactionPreparation.PreparationType == PreparationType.DebitPreparation) { Console.WriteLine("账户转出已成功,交易ID:{0},账户:{1},金额:{2},当前余额:{3}", evnt.TransactionPreparation.TransactionId, evnt.TransactionPreparation.AccountId, evnt.TransactionPreparation.Amount, evnt.CurrentBalance); } if (evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { Console.WriteLine("账户转入已成功,交易ID:{0},账户:{1},金额:{2},当前余额:{3}", evnt.TransactionPreparation.TransactionId, evnt.TransactionPreparation.AccountId, evnt.TransactionPreparation.Amount, evnt.CurrentBalance); } } return(Task.FromResult(AsyncTaskResult.Success)); }
public Task HandleAsync(TransactionPreparationCommittedEvent evnt) { if (evnt.TransactionPreparation.TransactionType == TransactionType.DepositTransaction) { if (evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { _logger.InfoFormat("账户存款已成功,账户:{0},金额:{1},当前余额:{2}", evnt.TransactionPreparation.AccountId, evnt.TransactionPreparation.Amount, evnt.CurrentBalance); } } if (evnt.TransactionPreparation.TransactionType == TransactionType.TransferTransaction) { if (evnt.TransactionPreparation.PreparationType == PreparationType.DebitPreparation) { _logger.InfoFormat("账户转出已成功,交易ID:{0},账户:{1},金额:{2},当前余额:{3}", evnt.TransactionPreparation.TransactionId, evnt.TransactionPreparation.AccountId, evnt.TransactionPreparation.Amount, evnt.CurrentBalance); } if (evnt.TransactionPreparation.PreparationType == PreparationType.CreditPreparation) { _logger.InfoFormat("账户转入已成功,交易ID:{0},账户:{1},金额:{2},当前余额:{3}", evnt.TransactionPreparation.TransactionId, evnt.TransactionPreparation.AccountId, evnt.TransactionPreparation.Amount, evnt.CurrentBalance); } } return(Task.CompletedTask); }
private void Handle(TransactionPreparationCommittedEvent @event) { this.State.TransactionPreparations.Remove(@event.TransactionPreparation.TransactionId); this.State.Balance = @event.CurrentBalance; }